/* Ma main, en bas de l'écran (Components/Table/HandDock.razor, boutons de Components/Table/HandCardActions.razor). */

.hand-card {
    display: inline-flex;
    flex-direction: column;
    gap: 0.35rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    margin: 0.25rem;
    background: white;
    min-width: 160px;
    vertical-align: top;
    border-top-width: 6px;
    border-top-style: solid;
}

/* Habillage visuel des cartes par catégorie (règles : chaque famille a sa propre couleur dans le
   jeu physique). Simple bande de couleur en haut de la carte plutôt qu'une illustration réelle. */
.hand-card span {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hand-card[class*="cat-"] { border-top-color: var(--cat-color); }

.hand-count {
    font-weight: 400;
    opacity: 0.7;
}

/* ---------- Main du joueur : fanée en bas de l'écran, façon jeu de cartes ---------- */
.hand-dock {
    flex: 0 0 auto;
    background: rgba(0, 0, 0, 0.4);
    border-top: 2px solid var(--gold);
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.hand-dock-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.8;
    padding: 0.1rem 0.2rem 0.3rem;
}

.hand-strip {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.2rem;
    scroll-snap-type: x proximity;
}

.game-shell .hand-card {
    scroll-snap-align: start;
    background: linear-gradient(160deg, #fffdf6 0%, #f1eee0 100%);
    color: #222;
    border-radius: var(--card-radius);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top-style: solid;
    border-top-width: 8px;
    /* Ne JAMAIS fixer border-top-color ici, ni via le raccourci border/border-top : les
       règle .hand-card[class*="cat-"] plus haut dans ce fichier fixe la couleur par catégorie,
       et un raccourci ici (même "border: none") la réinitialiserait à currentColor (bandes
       toutes noires) car il touche implicitement les 4 côtés y compris border-top-color. */
    --hand-card-w: 148px;
    min-width: var(--hand-card-w);
    max-width: var(--hand-card-w);
    height: var(--hand-card-h, auto);
    flex: 0 0 auto;
    transition: transform 0.12s ease;
    gap: 0.25rem;
    cursor: pointer;
}

.game-shell .hand-card:active {
    transform: translateY(-4px);
}

.hand-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.15rem;
}

.hand-card-actions .btn {
    font-size: 0.8rem;
}

/* Cartes en main : catégorie en français + effet court (texte complet au survol). */
.hand-card-category {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
}

.game-shell .hand-card .hand-card-effect,
.hand-card-effect {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.74rem;
    line-height: 1.2;
    color: #4a4a4a;
    font-style: italic;
    cursor: help;
}

.hand-card-smiles {
    float: right;
    text-transform: none;
    letter-spacing: normal;
    opacity: 1;
    font-weight: 700;
    color: #b8860b;
}

.game-shell .hand-card .hand-card-warning,
.hand-card-warning {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.72rem;
    font-weight: 700;
    color: #b03a2e;
}

.hand-deficit {
    color: #ffb4a8;
    cursor: help;
    font-weight: 600;
}

.hand-note {
    font-weight: 500;
    font-size: 0.85em;
    color: #f0c36b;
}

/* Main : titre en haut, catégorie et sourires, illustration au milieu, effet dessous. */
.game-shell .hand-card .hand-card-art {
    display: block;
    align-self: center;
    font-size: 44px;
    margin: 0.05rem 0 0.1rem;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
}

.game-shell .hand-card .hand-card-art .card-art-badge {
    font-size: 20px;
}

.game-shell .hand-card .hand-card-title {
    line-height: 1.15;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* ---------- Main compacte sur téléphone (demande : « l'affichage mobile est horrible », captures
   d'un iPhone 17 Pro Max en portrait et en paysage) ----------
   Grand écran : inchangé (actions sur chaque carte, barre d'actions masquée).
   Téléphone : des cartes compactes (nom, grande émoticône, sourires) qui défilent ; toucher une
   carte la sélectionne et ouvre, au-dessus de la main, une barre avec son effet, son avertissement
   et ses boutons. La main n'occupe plus que le bas de l'écran : le plateau redevient visible. */
.hand-action-bar,
.hand-card-smiles-compact {
    display: none;
}

.hand-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.game-shell .hand-card.selected {
    outline: 3px solid var(--gold);
    outline-offset: 1px;
}

/* Barre d'actions de la main (téléphone) : même couleur de catégorie que la carte. */
.hand-action-bar[class*="cat-"] { border-top-color: var(--cat-color); }

@media (min-width: 900px) {
    /* Écran large (tablette/desktop) : la main garde une taille confortable
   et n'a plus besoin d'un défilement aussi serré. */
    .game-shell .hand-card {
        --hand-card-w: 170px;
    }
}

@media (max-width: 600px), (orientation: landscape) and (max-height: 500px) {
    .game-shell .hand-card .hand-card-category,
    .game-shell .hand-card .hand-card-info,
    .game-shell .hand-card .hand-card-actions {
        display: none;
    }

    .game-shell .hand-card .hand-card-smiles-compact {
        display: block;
        position: absolute;
        right: 0.3rem;
        bottom: 0.2rem;
        font-size: 0.66rem;
        font-weight: 800;
        color: #6a5200;
    }

    /* Carte qui ne peut pas être posée telle quelle (salaire sans métier…) : pastille ⚠. */
    .game-shell .hand-card.warn::after {
        content: "⚠";
        position: absolute;
        left: 0.3rem;
        bottom: 0.15rem;
        font-size: 0.72rem;
        color: #c0392b;
    }

    .game-shell .hand-card.selected {
        transform: translateY(-5px);
        outline-width: 3px;
    }

    .hand-strip {
        gap: 0.4rem;
        padding: 0.4rem 0.1rem 0.15rem;
    }

    .hand-dock {
        padding-top: 0.2rem;
        position: relative;
    }

    .hand-action-bar {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        padding: 0.45rem 0.55rem;
        border-radius: 12px;
        background: linear-gradient(160deg, #fffdf6 0%, #f1eee0 100%);
        color: #222;
        border-top: 5px solid #999;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
        position: absolute;
        left: 0.4rem;
        right: 0.4rem;
        bottom: calc(100% + 0.3rem);
        z-index: 40;
        margin: 0;
    }

    .hab-head {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .hab-art {
        font-size: 34px;
        line-height: 1;
        position: relative;
    }

    .hab-art .card-art-badge {
        font-size: 14px;
        position: absolute;
        right: -6px;
        bottom: -4px;
    }

    .hab-text {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        min-width: 0;
        font-size: 0.8rem;
    }

    .hab-text strong {
        font-size: 0.92rem;
    }

    .hab-cat {
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #777;
    }

    .hab-close {
        border: none;
        background: rgba(0, 0, 0, 0.08);
        border-radius: 999px;
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .hab-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .hab-actions > * {
        flex: 1 1 auto;
    }

    .hab-actions .btn {
        margin: 0;
        padding: 0.45rem 0.7rem;
        font-size: 0.85rem;
        min-height: 40px;
    }

    /* « Désenchantement » tient sur une ligne dans une carte de 148 px. */
    .game-shell .hand-card .hand-card-title {
        font-size: 0.7rem;
        line-height: 1.12;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        overflow-wrap: break-word;
    }

    .game-shell .hand-card {
        --hand-card-w: 84px;
        --hand-card-h: 118px;
        padding: 0.3rem 0.35rem 0.25rem;
        border-top-width: 6px;
        gap: 0.1rem;
        position: relative;
        overflow: hidden;
    }

    .hand-dock-header {
        font-size: 0.68rem;
        padding: 0 0.2rem 0.1rem;
    }

    .game-shell .hand-card .hand-card-art {
        font-size: 36px;
        margin: auto 0 0.9rem;
    }

    .game-shell .hand-card .hand-card-art .card-art-badge {
        font-size: 15px;
    }

    .hab-text .hand-card-effect {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    /* Main : un peu plus basse sur les très petits écrans. */
    .game-shell .hand-card {
        --hand-card-w: 78px;
        --hand-card-h: 104px;
    }

    .game-shell .hand-card .hand-card-art {
        font-size: 32px;
        margin: auto 0 0.8rem;
    }
}

@media (max-width: 360px) and (orientation: portrait) {
    .game-shell .hand-card {
        --hand-card-w: 70px;
        --hand-card-h: 96px;
    }

    .game-shell .hand-card .hand-card-title {
        font-size: 0.64rem;
    }

    .game-shell .hand-card .hand-card-art {
        font-size: 28px;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    /* Paysage sur téléphone : très peu de hauteur, la main se fait encore plus basse. */
    .game-shell .hand-card {
        --hand-card-w: 76px;
        --hand-card-h: 86px;
    }

    .game-shell .hand-card .hand-card-title {
        -webkit-line-clamp: 1;
        font-size: 0.66rem;
    }

    .game-shell .hand-card .hand-card-art {
        font-size: 28px;
        margin: auto 0 0.6rem;
    }

    .hand-action-bar {
        flex-direction: row;
        align-items: center;
        padding: 0.3rem 0.5rem;
    }

    .hab-head {
        flex: 1 1 45%;
        min-width: 0;
    }

    .hab-actions {
        flex: 1 1 55%;
    }

    .hand-dock-header {
        font-size: 0.62rem;
    }
}

@media (orientation: landscape) and (max-height: 340px) {
    .game-shell .hand-card {
        --hand-card-w: 64px;
        --hand-card-h: 70px;
        padding: 0.2rem 0.3rem;
    }

    .game-shell .hand-card .hand-card-title {
        font-size: 0.58rem;
    }

    .game-shell .hand-card .hand-card-art {
        font-size: 22px;
        margin: auto 0 0.5rem;
    }

    .game-shell .hand-card .hand-card-smiles-compact {
        font-size: 0.56rem;
    }

    .hand-strip {
        padding-top: 0.3rem;
    }

    .hand-dock-header {
        padding: 0 0.2rem;
        display: none;
    }

    .hand-action-bar {
        padding: 0.2rem 0.45rem;
        gap: 0.3rem;
    }

    .hab-art {
        font-size: 24px;
    }

    .hab-text {
        font-size: 0.7rem;
    }

    .hab-text strong {
        font-size: 0.78rem;
    }

    .hab-cat {
        display: none;
    }

    .hab-actions .btn {
        min-height: 32px;
        padding: 0.25rem 0.55rem;
        font-size: 0.75rem;
    }

    .hab-close {
        width: 26px;
        height: 26px;
    }
}
