/* Lifebound — styles communs : page, couleurs du tapis (variables), boutons, cartes (faces,
   bandes de couleur par catégorie, illustrations).

   Les fichiers de css/ sont chargés dans cet ordre (voir App.razor) : base, home, table, topbar,
   board, piles, panels, hand, chat, banners. L'ordre compte quand deux règles de même poids visent
   le même élément : ne pas le changer sans vérifier (tools/ui-tests/ui_styles.py).

   Tailles d'écran utilisées (@media) :
   - bureau : pas de @media ; grand écran (min-width: 900px / 1000px) ;
   - téléphone : (max-width: 600px), (orientation: landscape) and (max-height: 500px) ;
   - téléphone portrait : (max-width: 600px) and (orientation: portrait), puis 480, 400 et 360 px ;
   - téléphone paysage bas : (orientation: landscape) and (max-height: 500px), puis 340 px. */

h1:focus {
    outline: none;
}

body {
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 1rem 1.5rem 3rem;
    color: #222;
    background: #fafafa;
}

.card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    background: white;
}

.btn {
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #333;
    background: #222;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn.secondary {
    background: white;
    color: #222;
}

.btn.danger {
    background: #b32121;
    color: white;
    border-color: #7a1616;
}

.error {
    color: #b32121;
    font-weight: 600;
}

body:has(.game-shell) {
    padding: 0;
    margin: 0;
}

:root {
    --felt: #0b6b40;
    --felt-dark: #052c1c;
    --gold: #e0b400;
    --ink: #f4f2ea;
    --card-radius: 12px;
}

/* Face de carte (défausse) : même papier crème et bande de couleur que les cartes en main. */
.card-face {
    --band: #999;
    position: absolute;
    inset: 0;
    border-radius: var(--card-radius);
    background: linear-gradient(160deg, #fffdf6 0%, #f1eee0 100%);
    border-top: 12px solid var(--band);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.4);
    transform: rotate(var(--tilt, 0deg));
    color: #222;
}

.card-face.under {
    transform: rotate(calc(var(--tilt, 0deg) * 3)) translate(4px, 2px);
    filter: brightness(0.9);
}

.card-face.top {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: flex-start;
    gap: 0.12rem;
    padding: 0.3rem 0.4rem 1.1rem;
}

.card-face-name {
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-face-cat {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

.card-face-smiles {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #b8860b;
}

/* Couleur de chaque famille de cartes (bande en haut des cartes : main, piles, « Ma vie »,
   accueil, catalogue). Une seule palette : --cat-color, lue par chaque sorte de carte. */
.cat-Study { --cat-color: #4a90d9; }
.cat-Job { --cat-color: #5a5a5a; }
.cat-Salary { --cat-color: #2fa84f; }
.cat-Flirt { --cat-color: #e0559b; }
.cat-Wedding { --cat-color: #d94ed9; }
.cat-Adultery { --cat-color: #8b2fa8; }
.cat-Child { --cat-color: #f2b53d; }
.cat-Pet { --cat-color: #a0703d; }
.cat-House { --cat-color: #3d9e9e; }
.cat-Trip { --cat-color: #3d7ff2; }
.cat-MedalOfHonor { --cat-color: #d9a300; }
.cat-PrizeOfExcellence { --cat-color: #d9a300; }
.cat-Penalty { --cat-color: #c0392b; }
.cat-Special { --cat-color: #7a4ed9; }
.cat-Drug { --cat-color: #6b8e23; }
.cat-Object { --cat-color: #17a2b8; }
.cat-Character { --cat-color: #d4a017; }
.cat-Ephemeris { --cat-color: #3346a8; }
.cat-Hex { --cat-color: #5b1f6e; }
.cat-MagicObject { --cat-color: #1fa38a; }
.cat-Potion { --cat-color: #e0559b; }

.card-face[class*="cat-"] { --band: var(--cat-color); }

.card-slot-empty {
    position: absolute;
    inset: 0;
    border-radius: var(--card-radius);
    border: 2px dashed rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.btn.small {
    padding: 0.25rem 0.55rem;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.mini-stack {
    display: flex;
}

.mini-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ---------- Boutons, thème "table de jeu" doré/vert ---------- */
.game-shell .btn,
.lobby-shell .btn {
    background: linear-gradient(180deg, #1f9a5c, #0b6b40);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.game-shell .btn.secondary,
.lobby-shell .btn.secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #133;
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: none;
}

.game-shell .btn.danger,
.lobby-shell .btn.danger {
    background: linear-gradient(180deg, #d33 0%, #8f1d1d 100%);
    color: #fff;
    border-color: rgba(0, 0, 0, 0.25);
}

.game-shell .btn.gold {
    background: linear-gradient(180deg, #ffd34d 0%, #d9a300 100%);
    color: #2a1e00;
    border: 1px solid #a07800;
    font-weight: 800;
}

/* ---------- Illustrations des cartes (demande : « pour les visuels de carte tu peux utiliser des
   émoticônes », puis « le visuel emojis est trop petit, ça serait bien d'ajouter les visuels dans
   la main également ») : une émoticône par carte (Services/CardArt.cs), en GRAND au milieu de la
   carte — main, « Ma vie », défausse, rivière, éphéméride, choix de cartes — et en petit sur les
   plateaux compacts des adversaires et dans les listes. Police couleur du système uniquement. ---------- */
.card-art {
    position: relative;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
    font-style: normal;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    color: #222;
    opacity: 1;
    white-space: nowrap;
    user-select: none;
}

/* Petit badge dans le coin : distingue les potions (toutes 🧪) et les maléfices (tous 💀). */
.card-art .card-art-badge {
    position: absolute;
    right: -0.3em;
    bottom: -0.1em;
    font-size: 0.46em;
    line-height: 1;
    padding: 0.1em;
    border-radius: 50%;
    background: #fffdf6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Faces de cartes (défausse, rivière, éphéméride, choix) : nom et catégorie en haut, illustration
   centrée dans la place restante (≈ 30 % de la hauteur de la carte), sourires en bas à droite. */
.card-face.top .card-face-name {
    -webkit-line-clamp: 2;
    font-size: 0.78rem;
    /* Sans max-width, un mot plus long que la carte (« Contraception », « Aveuglement ») la
       débordait des deux côtés au lieu d'être coupé. */
    max-width: 100%;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.card-face.top .card-art {
    display: block;
    margin: auto 0;
    font-size: calc(var(--pile-h, 134px) * 0.3);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
}

.card-face.top .card-art .card-art-badge {
    font-size: 0.42em;
}

/* Listes (défausse complète, sélecteur de la défausse, voyance) : illustration en petit devant le nom. */
.card-art.inline {
    display: inline-block;
    margin-right: 0.3em;
    font-size: 1.15em;
    vertical-align: -0.12em;
}

.card-art.inline .card-art-badge {
    font-size: 0.55em;
}

/* =====================================================================================
   TÉLÉPHONE — mise en page dédiée (demande : « fais en sorte que le rendu téléphone, même pour
   des plus petits que l'iPhone 17, soit correct et jouable »). Vérifiée de 320 × 480 (iPhone SE,
   barres de Safari comprises) à 430 × 800 en portrait, et de 568 × 250 à 932 × 380 en paysage.
   ===================================================================================== */
/* Safari iOS grossit tout seul le texte en paysage : on garde la taille prévue. */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (max-width: 480px) {
    .btn.small {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        margin-top: 0.2rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .card-face-name {
        font-size: 0.62rem;
    }
}

@media (max-width: 480px) {
    .card-face-name {
        font-size: 0.66rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .card-face-cat {
        display: none;
    }
}

@media (max-width: 480px) {
    .card-face-cat {
        display: none;
    }
}

/* Petit drapeau de langue (🇬🇧 / 🇫🇷) : coin de l'accueil et de la salle d'attente, barre du haut en partie. */
.lang-flag {
    text-decoration: none;
    line-height: 1;
}

.lang-flag-corner {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 12px;
    z-index: 60;
    padding: 0.25rem 0.45rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
    font-size: 1.35rem;
}

.lang-flag-bar {
    font-size: 1.1rem;
    padding: 0 0.15rem;
}
