/* ---------------------------------------------------------------------------
   Motchi / Motchi — thème « feutre bleu & or », mascotte panda roux.
   Porté depuis le prototype design (Motchi/theme.css).
--------------------------------------------------------------------------- */

:root {
    --primary: #4A7EC8;
    --primary-dark: #35619F;
    --gold: #FACC15;
    --gold-dark: #D9AC06;
    --panda: #B24E2A;
    --felt-1: #33578C;
    --felt-2: #264268;
    --cream: #FBF7EE;
    --cream-2: #F3ECDC;
    --paper-border: #E2D6BB;
    --ink: #23375E;
    --ink-soft: #4A3D28;
    --cream-sub: #9C8A66;
    --light: #EAF2FF;
    --light-sub: #C7D5EC;
    --success: #16A34A;
    --danger: #EF4444;
    --warning: #FB923C;
    /* Variantes foncées pour du texte posé directement sur le papier crème :
       les teintes ci-dessus, pensées pour le feutre bleu ou pour des pastilles
       colorées, y tombent sous le ratio de contraste 4.5:1. */
    --success-dark: #147A38;
    --danger-dark: #C0392B;
    --cream-sub-dark: #756547;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
    font-family: 'Nunito', sans-serif;
    color: var(--light);
    background:
        radial-gradient(90% 60% at 50% -10%, rgba(255,255,255,.08), transparent),
        repeating-linear-gradient(45deg, rgba(0,0,0,.035) 0 2px, transparent 2px 4px),
        linear-gradient(160deg, var(--felt-1) 0%, var(--felt-2) 100%);
    background-attachment: fixed;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ── App shell ── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 26px; padding-top: calc(16px + env(safe-area-inset-top));
    position: sticky; top: 0; z-index: 40;
    backdrop-filter: blur(6px); background: rgba(38,66,104,.55);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand {
    display: flex; align-items: center; gap: 10px;
    font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 20px;
    color: #fff; text-decoration: none; white-space: nowrap;
}
.brand-badge {
    width: 36px; height: 36px; border-radius: 11px; background: var(--cream);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    box-shadow: inset 0 0 0 1.5px var(--paper-border), 0 2px 6px rgba(0,0,0,.2);
}
.brand-badge svg { width: 30px; height: 30px; }
.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topnav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topnav-user {
    color: var(--light-sub); font-size: 13px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-decoration: none; transition: color .12s;
}
a.topnav-user:hover { color: #fff; }

/* ── Menu de compte repliable (mobile) ── */
.topnav { position: relative; }
.topnav-icons { display: flex; align-items: center; gap: 8px; }
/* Sélecteur imbriqué : sans le préfixe .topnav, ce « display: none » a la même
   spécificité que .btn-outline (défini plus bas) et se ferait écraser par son
   « display: inline-block », rendant le bouton « ⋯ » visible sur desktop. */
.topnav .topnav-toggle { display: none; }
.topnav-menu { display: none; }
.topnav-menu-who { display: none; }
.topnav-menu-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px; border-radius: 11px;
    color: var(--ink); text-decoration: none;
    font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 14px;
}
.topnav-menu-item svg { flex: 0 0 17px; opacity: .8; }
.topnav-menu-item:hover, .topnav-menu-item:focus-visible { background: rgba(74,126,200,.12); outline: none; }
.topnav-menu-item.danger { color: var(--danger); }
.topnav-menu-item.danger svg { opacity: 1; }
.topnav-menu-sep { height: 1px; background: var(--paper-border); margin: 4px 6px; }
@keyframes menu-pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
    .topnav-icons { display: none; }
    .topnav .topnav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .topnav-menu:not([hidden]) {
        display: flex; flex-direction: column; gap: 2px;
        position: absolute; top: calc(100% + 10px); right: 0; z-index: 50;
        min-width: 208px; padding: 8px;
        background: linear-gradient(180deg, var(--cream), var(--cream-2));
        border: 1px solid var(--paper-border); border-radius: 16px;
        box-shadow: 0 18px 40px rgba(0,0,0,.4);
        transform-origin: top right; animation: menu-pop .16s ease;
    }
    .topnav-menu-who {
        display: block; padding: 6px 10px 10px; margin-bottom: 4px;
        border-bottom: 1px solid var(--paper-border);
        color: var(--ink); font-weight: 800; font-size: 13px;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .topnav-menu:not([hidden]) { animation: none; }
}

.stats { display: flex; align-items: center; gap: 10px; }
.manche { font-weight: 800; font-size: 14px; padding: 5px 14px; border-radius: 20px; background: rgba(255,255,255,.14); color: var(--light); white-space: nowrap; }
/* Manche pénalité : un fond terracotta plein virait au brun sale sur le feutre
   bleu et rendait le compteur difficile à lire. On garde le fond translucide
   de la pastille normale, et c'est un contour chaud plus un texte pêche clair
   (6,4:1 sur la barre) qui signalent l'état. */
.manche.penalty { color: #FFD2BC; box-shadow: inset 0 0 0 1.5px rgba(255,170,130,.55); }
.score { font-weight: 900; font-size: 15px; padding: 5px 16px; border-radius: 20px; background: var(--gold); color: #3A2E00; display: flex; gap: 6px; align-items: center; white-space: nowrap; }

.stage { flex: 1; padding: 26px; display: flex; justify-content: center; }
.wrap { width: 100%; max-width: 940px; animation: fade .2s ease; }
.wrap-narrow { max-width: 460px; }
.col-narrow { max-width: 460px; margin: 0 auto; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Mascotte + bulle ── */
.mascot-row { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.mascot-row .panda { flex-shrink: 0; filter: drop-shadow(0 6px 10px rgba(0,0,0,.2)); }
.bubble {
    background: linear-gradient(180deg, var(--cream), var(--cream-2));
    border-radius: 18px 18px 18px 5px; padding: 14px 18px; flex: 1;
    font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 16px;
    color: var(--ink-soft); line-height: 1.4;
    box-shadow: 0 8px 22px rgba(0,0,0,.2); align-self: center;
}
.bubble b, .bubble strong { color: var(--panda); }

/* ── Grille ── */
.grid2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.center { text-align: center; }

/* ── Panneaux ── */
.paper {
    background: linear-gradient(180deg, var(--cream), var(--cream-2));
    border-radius: 20px; padding: 22px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.04), 0 12px 30px rgba(0,0,0,.22);
}
/* Deux cartes empilées (ex. « Connexion » + « Jouer en invité ») ne doivent
   pas se coller : espace uniquement entre cartes consécutives. */
.paper + .paper { margin-top: 16px; }
.glass {
    background: rgba(255,255,255,.1); border-radius: 20px; padding: 20px;
    border: 1px solid rgba(255,255,255,.14);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.count { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 13px; color: #3A2E00; background: var(--gold); padding: 4px 12px; border-radius: 20px; }

/* ── Labels & hints ── */
.label { font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; margin-bottom: 10px; display: block; }
.label.on-felt { color: var(--light-sub); }
.label.on-paper { color: var(--cream-sub); }
.hint { font-size: 13px; margin-top: 10px; }
.hint.on-felt { color: var(--light-sub); }
.hint.on-paper { color: var(--cream-sub); }
.hint a { color: inherit; font-weight: 800; }
.paper-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); }
.h1 { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 26px; color: #fff; }
.muted { color: var(--light-sub); font-size: 15px; line-height: 1.55; }
/* --light-sub est un bleu très clair, illisible sur une carte crème. */
.muted.on-paper { color: var(--cream-sub-dark); }

/* ── Carte mot mystère ── */
.word-card {
    background: #fff; border-radius: 24px; padding: 28px 24px; text-align: center;
    box-shadow: 0 10px 0 #E7D9BC, 0 22px 34px rgba(0,0,0,.28);
    transform: rotate(-1.5deg); position: relative; margin: 14px 0 22px; border: 3px solid #fff;
}
.word-ribbon {
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    background: var(--gold); color: #5A4300; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 12px;
    padding: 5px 16px; border-radius: 20px; box-shadow: 0 4px 0 var(--gold-dark); white-space: nowrap;
}
.word-big { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 46px; color: var(--ink); letter-spacing: 1px; margin-top: 6px; text-transform: uppercase; }
.word-sm { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 22px; color: var(--ink); letter-spacing: 1px; background: #fff; display: inline-block; padding: 6px 20px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.18); text-transform: uppercase; }
@media (max-width: 520px) { .word-big { font-size: 38px; } }

/* ── Champs ── */
.field {
    width: 100%; border-radius: 16px; padding: 16px 18px;
    font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 22px;
    outline: none; background: #fff; border: 3px solid var(--paper-border); color: var(--ink);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.field:focus { border-color: var(--gold); box-shadow: 0 6px 18px rgba(0,0,0,.18); transform: translateY(-1px); }
.field.code { text-align: center; letter-spacing: 8px; font-size: 28px; font-weight: 700; text-transform: uppercase; }
.field.small { font-size: 17px; padding: 13px 16px; font-family: 'Nunito', sans-serif; font-weight: 700; }
.field-group { margin-bottom: 16px; }
.form-errors, ul.form-errors { list-style: none; margin: 6px 0 0; padding: 0; color: var(--danger); font-size: 13px; font-weight: 700; }

/* ── Boutons ── */
.btn {
    width: 100%; border: none; cursor: pointer; text-decoration: none; text-align: center;
    display: inline-block;
    font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 19px;
    padding: 16px; border-radius: 18px; background: var(--primary); color: #fff;
    box-shadow: 0 6px 0 var(--primary-dark);
    transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .12s, opacity .12s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 0 var(--primary-dark); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.gold { background: var(--gold); color: #3A2E00; box-shadow: 0 6px 0 var(--gold-dark); }
.btn.gold:hover:not(:disabled) { box-shadow: 0 8px 0 var(--gold-dark); }
.btn.gold:active:not(:disabled) { box-shadow: 0 2px 0 var(--gold-dark); }
.btn-outline {
    width: 100%; cursor: pointer; text-decoration: none; text-align: center; display: inline-block;
    font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 16px;
    padding: 14px; border-radius: 16px; background: transparent; color: var(--light);
    border: 2px solid rgba(255,255,255,.4); transition: background .12s;
}
.btn-outline:hover { background: rgba(255,255,255,.1); }
.btn-ghost { background: none; border: none; color: var(--light-sub); font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 14px; cursor: pointer; padding: 8px; text-decoration: none; display: inline-block; }
.btn-ghost:hover { color: #fff; }
.btn-top { width: auto; font-size: 14px; padding: 8px 16px; border-radius: 12px; box-shadow: 0 4px 0 var(--primary-dark); }
.btn-top:hover:not(:disabled) { box-shadow: 0 5px 0 var(--primary-dark); }
.btn-outline.btn-top { padding: 7px 14px; border-radius: 12px; box-shadow: none; }
.btn-icon { padding: 7px 11px; font-size: 15px; line-height: 1; }
.round-icon { width: 32px; height: 32px; flex: 0 0 32px; display: inline-grid; place-items: center; border-radius: 50%; }
.round-icon svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.action-icon { background: rgba(255,255,255,.12); color: var(--light); }
.btn-row { display: flex; gap: 12px; }
.btn-row .grow { flex: 2; }
.btn-row .shrink { flex: 1; }
/* Les boutons de la rangée s'étirent à la même hauteur : on centre leur
   libellé pour qu'un bouton court (« Connexion ») ne reste pas collé en haut
   quand le bouton voisin passe sur deux lignes. */
.btn-row .btn, .btn-row .btn-outline { display: flex; align-items: center; justify-content: center; }

/* ── Flashes ── */
.flash { border-radius: 14px; padding: 12px 16px; font-size: 14px; font-weight: 700; margin-bottom: 14px; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.flash-error, .flash-danger { background: #FEE2E2; color: #B91C1C; }
.flash-success { background: #DCFCE7; color: #15803D; }
.flash-warning, .flash-info { background: #FEF3C7; color: #92400E; }

/* ── Joueurs ── */
.players { display: flex; flex-direction: column; gap: 9px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.prow.me { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0,0,0,.06); }
.pav { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 16px; color: #fff; text-transform: uppercase; }
.pname { flex: 1; font-weight: 700; font-size: 15px; color: #2A3F66; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstatus { font-size: 13px; font-weight: 700; }
.pstatus.done { color: var(--success); }
.pstatus.wait { color: #9AA7BD; }
.prow.empty { background: transparent; border: 2px dashed rgba(255,255,255,.25); box-shadow: none; color: var(--light-sub); font-size: 14px; }
.pav.empty { background: transparent; border: 2px dashed rgba(255,255,255,.3); color: var(--light-sub); }
/* Retrait d'un joueur par l'hôte : croix discrète, mais 44 px de zone tactile
   (recommandation mobile). Les marges négatives absorbent la différence avec
   l'avatar (38 px) pour que la ligne ne grandisse pas. */
.prow-remove { flex-shrink: 0; width: 44px; height: 44px; margin: -3px -8px -3px 0; border: none; border-radius: 50%; background: none; color: #9AA7BD; font-size: 15px; line-height: 1; cursor: pointer; }
.prow-remove:hover, .prow-remove:focus-visible { background: #FEE2E2; color: var(--danger); }

/* ── Décision d'un bot, dans le récap d'une partie ── */
.bot-decision { border: 1px solid rgba(42,63,102,.14); border-left: 3px solid var(--primary, #4A7EC8); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; background: rgba(74,126,200,.05); }
.bot-decision.declined { border-left-color: #9AA7BD; background: rgba(154,167,189,.08); }
.bd-head { display: flex; align-items: center; gap: 8px; }
.bd-title { flex: 1; font-size: 14px; font-weight: 700; color: #2A3F66; min-width: 0; }
.bd-confidence { font-size: 13px; font-weight: 800; color: var(--cream-sub); white-space: nowrap; }
.bd-analysis { margin: 6px 0 0; font-size: 13px; color: var(--cream-sub); font-style: italic; }
.bd-unexplained { margin: 6px 0 0; font-size: 13px; color: #B45309; }

/* L'ajout suit immédiatement la liste. Le choix du style reste replié tant
   qu'il n'est pas utile, puis apparaît sous le déclencheur dans le sens de
   lecture naturel. */
.bot-adder { margin-top: 16px; }
.bot-add-trigger { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; }
.bot-add-trigger::-webkit-details-marker { display: none; }
.bot-add-trigger:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.bot-add-trigger small { font-weight: 600; color: var(--light-sub); }
/* Sur le tapis comme les manches de l'écran final : l'indicateur commun est
   calibré pour le papier, il s'éclaircit sur fond sombre. */
.bot-adder > summary .fold-indicator { background: rgba(255,255,255,.12); color: var(--light); }
.bot-adder[open] > summary .fold-indicator { transform: rotate(180deg); }
.add-bot { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.14); }
.bot-style-picker { margin: 0; padding: 0; border: 0; }
.bot-style-picker legend { margin-bottom: 8px; color: var(--light); font-size: 14px; font-weight: 800; }
.bot-style-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bot-style-option { position: relative; display: block; cursor: pointer; }
.bot-style-option input { position: absolute; opacity: 0; pointer-events: none; }
.bot-style-copy { display: grid; min-height: 104px; height: 100%; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 9px; padding: 10px; border: 2px solid rgba(255,255,255,.25); border-radius: 13px; background: rgba(255,255,255,.06); transition: border-color .12s, background .12s, transform .12s; }
.bot-style-copy panda-face { display: flex; align-items: center; justify-content: center; }
.bot-style-text { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.bot-style-copy strong { color: var(--light); font-size: 14px; }
.bot-style-copy small { color: var(--light-sub); font-family: 'Nunito', sans-serif; font-size: 12px; line-height: 1.3; }
.bot-style-option:hover .bot-style-copy { background: rgba(255,255,255,.1); }
.bot-style-option input:checked + .bot-style-copy { border-color: var(--gold); background: rgba(244,196,48,.13); box-shadow: 0 0 0 1px rgba(244,196,48,.2); }
.bot-style-option input:focus-visible + .bot-style-copy { outline: 3px solid rgba(255,255,255,.5); outline-offset: 2px; }
.bot-add-confirm { margin-top: 12px; }
@media (max-width: 480px) { .bot-style-options { grid-template-columns: 1fr; } .bot-style-copy { min-height: 86px; } }

.game-list { display: flex; flex-direction: column; gap: 10px; }
.game-row { text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; letter-spacing: 1px; }
.game-row:hover { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(0,0,0,.12); }
.game-row .pname { display: flex; flex-direction: column; gap: 1px; font-family: 'Space Mono', monospace; letter-spacing: 1.5px; }
.game-row-sub { font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 12px; color: #9AA7BD; letter-spacing: 0; }

/* Séparateur de mois : sans lui, une liste de codes à six caractères ne donne
   aucun repère de lecture. Volontairement léger, pour ne pas se lire comme une
   partie de plus dans la liste. */
.history-month { font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--cream-sub-dark); margin: 8px 0 -2px; }
.history-month:first-child { margin-top: 0; }
/* Le bouton est posé sur le feutre, sous le papier : il complète la liste, il
   n'en fait pas partie. */
.history-more { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.history-more-count { font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 13px; color: var(--light-sub); }

/* ── Code de partie ── */
.code-row { display: flex; gap: 10px; align-items: stretch; }
.code-display {
    flex: 1; border-radius: 16px; padding: 14px 18px; background: #fff; border: 3px solid var(--paper-border);
    font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 28px; color: var(--ink);
    text-align: center; letter-spacing: 8px; text-transform: uppercase;
}
.code-copy { width: auto; padding: 0 18px; font-size: 20px; }

/* ── Cartes indices (révision) ── */
.clue-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-radius: 12px; border: 2px solid var(--paper-border); background: #fff; margin-bottom: 8px; transition: all .15s; }
.clue-card .cw { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); overflow-wrap: anywhere; }
.clue-card .cp { font-size: 12px; color: var(--cream-sub); margin-top: 2px; }
.clue-reason { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 800; color: var(--danger); background: #FEE2E2; border: 1px solid var(--danger); border-radius: 10px; padding: 1px 8px; }
.clue-card.dup { border-color: var(--danger); background: #FEF2F2; opacity: .78; }
.clue-card.dup .cw { color: #9CA3AF; text-decoration: line-through; }
.clue-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mark-btn {
    width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--paper-border);
    background: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; color: var(--cream-sub); flex-shrink: 0; cursor: pointer;
    transition: all .15s;
}
.mark-btn:hover { border-color: var(--danger); color: var(--danger); background: #FEE2E2; }
.mark-off { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--danger); background: #FEE2E2; color: var(--danger); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; flex-shrink: 0; }
.mark-off.ok { border-color: var(--success); background: #DCFCE7; color: var(--success); }
.vote-btn { width: 38px; height: 34px; border-radius: 12px; border: 2px solid var(--paper-border); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; cursor: pointer; line-height: 1; transition: all .15s; filter: grayscale(1); opacity: .55; }
.vote-btn:hover { border-color: var(--warning); filter: none; opacity: 1; }
.vote-btn.on { border-color: var(--warning); background: #FFF7ED; filter: none; opacity: 1; }
.vote-count { font-family: 'Nunito', sans-serif; font-size: 11px; font-weight: 800; color: var(--warning); background: #FFF7ED; border: 1px solid #FED7AA; border-radius: 10px; padding: 1px 7px; white-space: nowrap; }

/* ── Palmarès de fin de partie ── */
.palmares-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.palmares-label { font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; margin: 16px 0 10px; }
.palmares-label.good { color: var(--gold-dark); }
.palmares-label.tease { color: var(--panda); }
.palmares-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.award-card { display: flex; flex-direction: column; align-items: center; text-align: center; border: 2px solid var(--paper-border); border-radius: 14px; padding: 12px 10px 10px; background: #fff; }
.award-card.good { background: linear-gradient(180deg, #FFF8DC, #fff 62%); border-color: #EFD778; }
.award-card.tease { background: linear-gradient(180deg, #FBEDE6, #fff 62%); border-color: #E7C6B4; }
.award-panda { width: 74px; height: 74px; display: flex; align-items: center; justify-content: center; }
.award-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); margin-top: 2px; }
.award-desc { font-size: 12px; color: var(--cream-sub); margin: 4px 0 10px; line-height: 1.35; }
.award-stat { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 999px; background: #F6EEDD; border: 1px solid var(--paper-border); }
.award-stat .who { color: var(--ink); }
.award-stat .val { color: var(--panda); }
.award-card.good .award-stat .val { color: var(--gold-dark); }
.award-stat .dot { color: var(--cream-sub); }

/* ── Chips & tags ── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
/* Les pastilles posées sur une ligne blanche portent toujours leur propre
   couleur : sans modificateur, elles héritent du `color` clair du `body`,
   prévu pour le tapis, et deviennent illisibles sur le papier. C'est ce qui
   rendait « bot » invisible dans le salon (#EAF2FF sur blanc, 1,13:1). Les
   teintes ci-dessous tiennent toutes le 4.5:1 de WCAG AA en 12 px. */
.chip.blue { background: #E8F0FE; color: var(--primary-dark); }
.chip.bot { background: #EEF2F8; color: #3F5680; }
.chip.gold { background: var(--gold); color: #3A2E00; }
.chip.green { background: #DCFCE7; color: var(--success); }
.chip.danger { background: #FEE2E2; color: var(--danger); }
.chip.pill-felt { background: rgba(255,255,255,.14); color: var(--light); }
.chip.pill-paper { background: rgba(0,0,0,.06); color: var(--ink-soft); }
/* Manche pénalité : la teinte mascotte, déjà utilisée par .stat-tile.tease. */
.chip.penalty { background: #FBEDE6; color: var(--panda); }
.recap-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Récap : manches dépliables ── */
.recap-round { padding: 0; overflow: hidden; }
.recap-summary { position: relative; list-style: none; cursor: pointer; padding: 11px 58px 11px 14px; display: flex; flex-direction: column; gap: 8px; -webkit-tap-highlight-color: transparent; }
.recap-summary::-webkit-details-marker { display: none; }
.recap-summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 20px; }
.recap-summary-top { display: flex; align-items: center; gap: 8px; }
.fold-indicator { margin-left: auto; background: rgba(35,55,94,.07); color: var(--cream-sub-dark); transition: transform .2s ease; }
.recap-summary .fold-indicator { position: absolute; top: 50%; right: 14px; margin-left: 0; transform: translateY(-50%); }
.recap-round[open] > summary .fold-indicator { transform: translateY(-50%) rotate(180deg); }
.recap-word { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 19px; color: var(--ink); letter-spacing: 1px; text-transform: uppercase; overflow-wrap: anywhere; }
.recap-body { padding: 4px 18px 18px; }

/* Le même détail sur l'écran final, posé sur le tapis et replié d'un cran de
   plus : l'écran est centré, les manches se lisent alignées à gauche. */
.final-rounds { padding: 0; text-align: left; }
.final-rounds > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 14px 10px 18px; font-family: 'Fredoka', sans-serif; font-weight: 700; color: var(--light); -webkit-tap-highlight-color: transparent; }
.final-rounds > summary::-webkit-details-marker { display: none; }
.final-rounds > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 20px; }
.final-rounds > summary .fold-indicator { background: rgba(255,255,255,.12); color: var(--light); }
.final-rounds[open] > summary .fold-indicator { transform: rotate(180deg); }
.final-rounds-body { padding: 0 14px 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #fff; border: 1.5px solid var(--paper-border); border-radius: 10px; padding: 7px 14px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 15px; color: var(--ink); overflow-wrap: anywhere; text-transform: uppercase; }
.tag.ghost { background: transparent; border-style: dashed; border-color: rgba(255,255,255,.3); color: var(--light-sub); font-weight: 500; text-transform: none; }
.tag.on-paper-ghost { background: transparent; border-style: dashed; border-color: var(--paper-border); color: var(--cream-sub); font-weight: 500; text-transform: none; }

/* ── Attente ── */
.waiting-note { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 700; }
.waiting-note.on-felt { color: var(--light-sub); }
.waiting-note.on-paper { color: var(--cream-sub); }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s ease-in-out infinite; flex-shrink: 0; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

/* ── Confettis ── */
.confetti-piece { position: fixed; width: 10px; height: 10px; z-index: 90; pointer-events: none; will-change: transform, opacity; }

/* ── Mode Blitz ── */
.mode-picker { border: 0; margin: 0 0 18px; min-width: 0; }
.mode-intro { color: var(--ink-soft); font-size: 14px; line-height: 1.45; margin-bottom: 12px; }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-option { position: relative; cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option span {
    min-height: 76px; display: flex; flex-direction: column; justify-content: center; gap: 3px;
    padding: 12px 14px; border: 2px solid var(--paper-border); border-radius: 14px;
    background: #fff; color: var(--ink); transition: border-color .15s, background .15s, transform .15s;
}
.mode-option b { font-family: 'Fredoka', sans-serif; font-size: 17px; }
.mode-option small { color: var(--cream-sub); font-size: 12px; font-weight: 700; }
.mode-option input:checked + span { border-color: var(--gold-dark); background: #FFF8D1; box-shadow: 0 3px 0 var(--gold-dark); transform: translateY(-2px); }
.mode-option input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.mode-summary { min-height: 38px; margin-top: 12px; padding: 9px 11px; border-radius: 10px; background: rgba(35,55,94,.07); color: var(--ink-soft); font-size: 13px; font-weight: 800; line-height: 1.35; }

.blitz-rules { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: 16px; background: #FFF8D1; border: 2px solid var(--gold-dark); color: var(--ink-soft); box-shadow: 0 5px 0 rgba(217,172,6,.65); }
.blitz-rules strong { color: #5A4300; font-family: 'Fredoka', sans-serif; font-size: 17px; }
.blitz-rules span { font-size: 13px; font-weight: 800; }

.blitz-phase { padding: 13px 16px; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); box-shadow: 0 8px 18px rgba(0,0,0,.13); }
.blitz-phase-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.blitz-phase-label { color: var(--light); font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.blitz-clock { color: var(--gold); font-family: 'Space Mono', monospace; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.blitz-progress { height: 7px; margin-top: 10px; overflow: hidden; border-radius: 6px; background: rgba(255,255,255,.14); }
.blitz-progress > span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--gold); transition: width .2s linear, background-color .2s; }
.blitz-phase-note { margin-top: 7px; color: var(--light-sub); font-size: 12px; font-weight: 800; }
.blitz-phase.urgent .blitz-clock { color: var(--warning); }
.blitz-phase.urgent .blitz-progress > span { background: var(--warning); }
.blitz-phase.critical .blitz-clock { color: #FCA5A5; }
.blitz-phase.critical .blitz-progress > span { background: var(--danger); }
.blitz-phase.review { background: rgba(250,204,21,.12); border-color: rgba(250,204,21,.35); }
.blitz-phase.review .blitz-clock { color: var(--light); font-size: 13px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

/* ── Résultat de manche ── */
.result-card { border-radius: 22px; padding: 26px 22px; text-align: center; }
.result-card.win { background: #DCFCE7; border: 2px solid #86EFAC; }
.result-card.lose { background: #FEE2E2; border: 2px solid #FCA5A5; }
.result-card.skip { background: #FEF3C7; border: 2px solid #FCD34D; }
.result-card .r-title { display: inline-block; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 28px; border: 3px solid currentColor; border-radius: 14px; padding: 4px 26px; margin-bottom: 8px; background: rgba(255,255,255,.5); transform: rotate(-3deg); }
.result-card .r-title.win-t { color: var(--success); }
.result-card .r-title.lose-t { color: var(--danger); }
.result-card .r-title.skip-t { color: var(--warning); }
.result-card .r-sub { font-size: 15px; color: #6B7280; margin: 4px 0 14px; }
/* Manche passée d'office après une défaite. Sans teinte propre elle portait le
   jaune du passage volontaire, alors que les deux n'ont rien à voir : on
   reprend le terracotta de la mascotte, distinct du vert, du rouge et du
   jaune déjà pris. */
.result-card.penalty { background: #FFF1EC; border: 2px solid #F0BFA9; }
.result-card .r-title.penalty-t { color: var(--panda); }
.result-card .r-head { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.result-card .r-head .r-title { margin-bottom: 0; }

/* Annonce de la pénalité sur l'écran de défaite. L'ancienne note grise en bas
   de carte avait la forme d'une mention légale et passait inaperçue : bloc
   plein, aligné à gauche, avec la pastille ↻ commune aux autres écrans. */
.penalty-note { display: flex; align-items: center; gap: 12px; text-align: left; margin-top: 18px; padding: 12px 14px; background: #fff; border: 2px solid #FCA5A5; border-radius: 14px; }
.penalty-note .pn-mark { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #FEE2E2; color: var(--danger); display: grid; place-items: center; font-size: 19px; font-weight: 700; line-height: 1; }
.penalty-note .pn-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.penalty-note .pn-txt b { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 15px; color: #B91C1C; }
.penalty-note .pn-txt span { font-size: 12.5px; color: #6B7280; line-height: 1.35; }
.guess-bubble { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 18px; }
.guess-bubble .gb-label { font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: #C08A90; }
.guess-bubble .gb-word { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 15px; color: #B4474D; background: #fff; padding: 5px 18px; border-radius: 12px; box-shadow: 0 3px 10px rgba(180,71,77,.18); text-transform: uppercase; letter-spacing: .5px; }

/* ── Score final ── */
.bigscore { display: inline-flex; align-items: baseline; gap: 6px; background: #fff; border: 3px solid var(--paper-border); border-radius: 20px; padding: 16px 40px; box-shadow: 0 10px 0 #E7D9BC; }
.bigscore .n { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 68px; color: var(--ink); line-height: 1; }
.bigscore .d { font-size: 26px; color: var(--cream-sub); }
.progress { height: 12px; border-radius: 6px; background: rgba(255,255,255,.16); overflow: hidden; }
.progress > div { height: 100%; border-radius: 6px; background: var(--gold); transition: width .6s; }
.score-split { display: flex; gap: 24px; justify-content: center; font-size: 15px; }
.score-breakdown-values { margin: 12px 0; }
.score-breakdown-penalty { margin: 0; }
/* Le bilan s'affiche sur une carte crème : on prend les variantes foncées,
   sinon le vert clair et le rose se noient dans le fond. */
.score-split .ok { color: var(--success-dark); font-weight: 700; }
.score-split .ko { color: var(--danger-dark); font-weight: 700; }

/* ── Stats joueur ── */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 520px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.stat-tile { background: #fff; border: 2px solid var(--paper-border); border-radius: 14px; padding: 14px 10px; text-align: center; }
.stat-tile .num { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 30px; line-height: 1; color: var(--ink); }
.stat-tile .lbl { display: block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--cream-sub); }
.stat-tile .sub { display: block; margin-top: 3px; font-size: 11px; font-weight: 700; color: var(--panda); }
.stat-tile.good { background: linear-gradient(180deg, #FFF8DC, #fff 62%); border-color: #EFD778; }
.stat-tile.good .num { color: var(--gold-dark); }
.stat-tile.tease { background: linear-gradient(180deg, #FBEDE6, #fff 62%); border-color: #E7C6B4; }
.stat-tile.tease .num { color: var(--panda); }

/* ── Tuiles « système de points » (côté devineur) ── */
.pt-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pt-tile { background: #fff; border: 2px solid var(--paper-border); border-radius: 14px; padding: 14px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pt-tile.win { background: linear-gradient(180deg, #F0FDF4, #fff 62%); border-color: #A7E9BE; }
.pt-tile.skip { background: linear-gradient(180deg, #FEFCE8, #fff 62%); border-color: #F2E08C; }
.pt-tile.auto { background: linear-gradient(180deg, #FEF2F2, #fff 62%); border-color: #F6C2C2; }
.pt-badge { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 22px; line-height: 1; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.pt-tile.win .pt-badge { background: #DCFCE7; color: var(--success); }
.pt-tile.skip .pt-badge { background: #FEF3C7; color: var(--gold-dark); }
.pt-tile.auto .pt-badge { background: #FEE2E2; color: var(--danger); font-size: 20px; }
.pt-name { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 13px; color: var(--ink); }
.pt-txt { font-size: 11.5px; color: var(--cream-sub); line-height: 1.35; }
@media (max-width: 560px) { .pt-tiles { grid-template-columns: 1fr; } }

/* ── Mémo « mots interdits » (écran de révision) ── */
.rules-memo { border: 1px dashed var(--paper-border); border-radius: 13px; margin-top: 14px; background: rgba(255, 255, 255, .35); }
.rules-memo > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14.5px; color: var(--ink); padding: 12px 14px;
}
.rules-memo > summary::-webkit-details-marker { display: none; }
.rules-memo[open] > summary .fold-indicator { transform: rotate(180deg); }
.rules-inner { padding: 2px 10px 13px; }
.rule-tiles { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.rule-tile {
    background: #fff; border: 1.5px solid var(--paper-border); border-radius: 12px; padding: 9px 5px 8px;
    text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px;
    flex: 1 1 95px; min-width: 90px; max-width: 118px;
}
.rule-tile .panda { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .14)); }
.rt-name { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 11.5px; color: var(--ink); line-height: 1.12; }
.rt-ex { font-size: 9.5px; color: var(--cream-sub); line-height: 1.25; }
.rt-ex i { font-style: italic; color: var(--panda); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .fold-indicator { transition: none; } }

/* ── Accueil : lien vers les règles (secondaire, sous l'accueil) ── */
.top-actions { display: flex; justify-content: flex-end; margin: -8px 0 16px; }
.rules-link {
    display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
    font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14px; color: var(--light-sub);
    padding: 8px 14px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .28);
    transition: background .12s, color .12s, border-color .12s;
}
.rules-link:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .5); }
.rules-link svg { flex-shrink: 0; }

/* ── Page /regles : titre (h1) ── */
.rules-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 24px; color: #fff; margin-bottom: 16px; letter-spacing: .3px; text-wrap: balance; }
@media (max-width: 520px) { .rules-title { font-size: 21px; } }

/* ── Page /regles : parcours d'une manche (chemin vertical) ── */
.rules-path { display: flex; flex-direction: column; gap: 2px; }
.rstep { display: flex; gap: 13px; align-items: center; position: relative; padding: 6px 0; }
.rstep .rmark {
    width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; background: #fff;
    display: grid; place-items: center; border: 3px solid var(--gold);
    box-shadow: 0 4px 0 var(--gold-dark); z-index: 2;
}
.rstep:not(:last-child) .rmark::after {
    content: ""; position: absolute; left: 22px; top: 50px; width: 3px; height: calc(100% - 34px);
    background-image: linear-gradient(var(--gold-dark) 55%, transparent 0);
    background-size: 3px 11px; z-index: 1;
}
.rstep .rbody { background: #fff; border: 2px solid var(--paper-border); border-radius: 14px; padding: 10px 14px; flex: 1; }
.rstep.hl .rbody { border-color: var(--gold-dark); background: linear-gradient(180deg, #FFFBEA, #fff 70%); }
.rstep .rbody .t { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 15px; color: var(--ink); }
.rstep .rbody .d { font-size: 12.5px; color: var(--cream-sub); line-height: 1.35; margin-top: 2px; }
.rstep .rbody .d i { color: var(--panda); font-style: normal; font-weight: 800; }

/* ── Page /regles : les points (3 tuiles compactes côte à côte) ── */
.score3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.s3 { border: 2px solid var(--paper-border); border-radius: 14px; background: #fff; padding: 12px 6px 11px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.s3 .b { width: 36px; height: 36px; border-radius: 50%; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 17px; display: grid; place-items: center; }
.s3.win { background: linear-gradient(180deg, #F0FDF4, #fff 62%); border-color: #A7E9BE; }
.s3.win .b { background: #DCFCE7; color: var(--success); }
.s3.skip { background: linear-gradient(180deg, #FEFCE8, #fff 62%); border-color: #F2E08C; }
.s3.skip .b { background: #FEF3C7; color: var(--gold-dark); }
.s3.auto { background: linear-gradient(180deg, #FEF2F2, #fff 62%); border-color: #F6C2C2; }
.s3.auto .b { background: #FEE2E2; color: var(--danger); font-size: 15px; }
.s3 .n { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 12px; color: var(--ink); line-height: 1.1; }
.s3 .x { font-size: 10px; color: var(--cream-sub); line-height: 1.25; }

/* ── Page /regles : mots interdits (lignes enrichies) ── */
.forb { display: flex; flex-direction: column; gap: 7px; }
.frow { display: flex; align-items: center; gap: 11px; background: #fff; border: 2px solid var(--paper-border); border-radius: 12px; padding: 8px 11px; }
.frow .fp { flex-shrink: 0; }
.frow .ftxt { flex: 1; min-width: 0; }
.frow .nm { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 13.5px; color: var(--ink); line-height: 1.1; }
.frow .fdesc { font-size: 11px; color: var(--cream-sub); line-height: 1.25; margin-top: 1px; }
.frow .fex {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 800; color: var(--danger); background: #FEE2E2;
    border: 1px solid #F6C2C2; border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.frow .fex .x { font-weight: 900; }
.frow .fex i { font-style: italic; }

/* ── Variante 2×2 des tuiles règles (mémo du lobby, 4 tuiles) ── */
.rule-tiles.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.rule-tiles.grid2 .rule-tile { max-width: none; min-width: 0; }

/* ── Page /regles : liste « bon à savoir » ── */
.rule-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rule-notes li {
    position: relative; padding-left: 26px; font-size: 14px; line-height: 1.4; color: var(--ink-soft);
}
.rule-notes li::before {
    content: "🐾"; position: absolute; left: 0; top: 0; font-size: 13px;
}
.rule-notes b { color: var(--ink); font-weight: 800; }

/* ── Modal de confirmation ── */
.modal-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 22px; background: rgba(20,34,58,.72); backdrop-filter: blur(3px); animation: modal-fade .16s ease; }
.modal-overlay[hidden] { display: none; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card { width: 100%; max-width: 340px; background: linear-gradient(180deg, var(--cream), var(--cream-2)); border-radius: 22px; padding: 24px 22px; box-shadow: 0 24px 60px rgba(0,0,0,.45); text-align: center; animation: modal-pop .18s cubic-bezier(.34,1.56,.64,1); }
@keyframes modal-pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-mascot { display: flex; justify-content: center; margin-bottom: 8px; }
.modal-mascot .panda { filter: drop-shadow(0 4px 8px rgba(0,0,0,.15)); }
.modal-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 21px; color: var(--ink); margin-bottom: 6px; text-wrap: balance; }
.modal-detail { font-size: 13.5px; color: var(--cream-sub); margin-bottom: 18px; line-height: 1.45; }
.modal-detail[hidden] { display: none; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions > * { flex: 1; }
.modal-actions .btn { padding: 13px; font-size: 16px; }
.btn-cancel { padding: 13px; border: 2px solid var(--paper-border); background: #fff; color: var(--ink-soft); border-radius: 16px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 16px; cursor: pointer; transition: background .12s; }
.btn-cancel:hover { background: #F6EEDD; }
body.modal-open { overflow: hidden; }

/* ── Divers ── */
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }

@media (max-width: 520px) {
    /* Barre plus compacte : brand + pills + bouton « ⋯ » doivent tenir sur 360 px
       (et rester lisibles avec des nombres larges type « Manche 12/13 · ★ 10 »)
       sans jamais rogner le bouton menu. */
    .topbar { padding: 14px 14px; padding-top: calc(14px + env(safe-area-inset-top)); gap: 8px; }
    .topbar-right { gap: 8px; min-width: 0; }
    .brand { font-size: 17px; gap: 8px; flex-shrink: 0; }
    .brand-badge { width: 30px; height: 30px; }
    .brand-badge svg { width: 26px; height: 26px; }
    .stats { gap: 6px; min-width: 0; }
    .manche, .score { font-size: 12px; padding: 4px 10px; }
    .topnav-toggle { flex-shrink: 0; }
    .stage { padding: 18px; }
    .mascot-row .panda { width: 64px; height: 64px; }
    .bubble { font-size: 15px; }
    .topnav-user { display: none; }
    .mode-options { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .blitz-progress > span { transition: none; }
    .pulse-dot { animation: none; }
    .modal-overlay, .modal-card { animation: none; }
}

/* ── Pied de page ── */
.sitefoot {
    padding: 22px 26px calc(22px + env(safe-area-inset-bottom));
    display: flex; justify-content: center;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sitefoot-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; }
.sitefoot-nav a {
    color: var(--light-sub); font-size: 13px; font-weight: 700;
    text-decoration: none; transition: color .12s;
}
.sitefoot-nav a:hover { color: #fff; }

/* ── Pages légales ── */
.legal { line-height: 1.6; }
.legal-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 24px; color: var(--ink); margin: 4px 0 4px; }
.legal-updated { color: var(--cream-sub); font-size: 13px; margin-bottom: 18px; }
.legal h2 { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); margin: 22px 0 8px; }
.legal p, .legal li { color: var(--ink-soft); font-size: 15px; }
.legal ul { margin: 8px 0 8px 20px; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--primary-dark); font-weight: 700; }
.legal-links { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--paper-border); font-size: 14px; }
.legal .todo {
    background: #FFF3C4; color: #7A5B00; border-radius: 5px;
    padding: 1px 6px; font-weight: 700; font-size: 13px;
}
