/* Quiz entre amis.
   Mêmes jetons de couleur que le compteur de points : les deux applis vivent
   sous le même toit et doivent se ressembler. Ce qui change ici, c'est la
   taille des cibles — on joue une main occupée, souvent debout, parfois avec un
   verre dans l'autre. */

:root {
  --bg: #0f1116;
  --surface: #171a22;
  --surface-2: #1e222c;
  --border: #2a2f3c;
  --text: #e9ebf2;
  --muted: #99a1b3;
  --accent: #6366f1;
  --accent-soft: #6366f133;
  --gold: #f5c518;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --pad: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

/* --- Barre du haut ------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 10px var(--pad);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  margin: 0;
  font-size: 17px; font-weight: 600;
  text-align: center;
  /* Un nom long ne doit pas faire grandir la barre : il se réduit. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--muted);
  font-size: 20px; cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
/* Masqué, le bouton retour doit garder sa colonne : sans ça il sort de la
   grille, le titre glisse dans la colonne de 44 px et se casse en trois
   lignes. */
.icon-btn[hidden] { visibility: hidden; display: grid !important; }

/* --- Structure ----------------------------------------------------------- */

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--pad);
  padding-bottom: calc(120px + var(--safe-b));
}

.screen-title { margin: 4px 0 8px; font-size: 22px; }
.section-title {
  margin: 26px 0 10px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.stack { display: grid; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.centre { text-align: center; }

/* --- Boutons et champs --------------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 16px;
  font: inherit; font-weight: 600;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; }
/* Deux boutons pleine largeur qui se suivent se touchaient : sur un téléphone
   tenu d'une main, le pouce vise entre les deux et part dans une partie solo
   au lieu d'en créer une. Ces deux-là ne mènent pas au même endroit — l'écart
   doit se voir, pas seulement exister. */
.btn-block + .btn-block { margin-top: 12px; }
.btn-lg { padding: 16px; font-size: 17px; }

.field { display: grid; gap: 6px; margin: 14px 0; }
.field label { font-size: 13px; color: var(--muted); }
.field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  margin-top: 22px;
  padding: 12px 0 calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 68%, transparent);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  font: inherit; font-size: 14px;
  cursor: pointer;
}
.chip.est-actif { background: var(--accent-soft); border-color: var(--accent); }
/* La part déjà jouée d'un thème. Discrète : c'est une indication pour choisir,
   pas un score à battre. */
.chip-part { margin-left: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Un bouton d'appoint, pour les actions qu'on ne fait qu'une fois par an. */
.btn-petit { padding: 8px 12px; font-size: 13px; color: var(--muted); }

/* --- Accueil ------------------------------------------------------------- */

.hero {
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(160deg, #3a2a5e 0%, #1f1d33 55%, var(--surface) 100%);
  border: 1px solid var(--border);
}
.hero-kicker {
  margin: 0 0 6px;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold);
}
.hero-title { margin: 0 0 6px; font-size: 24px; line-height: 1.25; }
.hero-sub { margin: 0; color: var(--muted); font-size: 14px; }

.join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.code-input {
  min-width: 0;
  padding: 13px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 700 22px/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.35em;
  text-align: center;
  text-transform: uppercase;
}

.reglage-avance { margin-top: 26px; }
.reglage-avance summary { color: var(--muted); font-size: 13px; cursor: pointer; }

.voix-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 10px 0; }
.voix-etat {
  grid-column: 1 / -1;
  margin: 0;
  padding: 11px 14px;
  border-left: 3px solid var(--ok);
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  font-size: 14px;
}
.voix-row select {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.carte-pack {
  display: grid; gap: 4px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.carte-pack.est-installe { border-color: var(--ok); }

/* L'offre groupée. Elle est posée au-dessus des packs et doit se distinguer
   d'eux au premier coup d'œil, sinon elle se lit comme un pack de plus — et
   une offre d'entrée qu'on ne remarque pas ne sert à rien. */
.carte-offre {
  border-color: var(--accent);
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
}
.carte-offre .pack-etat {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--accent);
}
.pack-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pack-nom { font-weight: 600; }
.pack-etat {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.pack-etat.est-acquis { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.pack-resume { margin: 0; }
.carte-pack .btn { margin-top: 8px; }

.carte-persona {
  display: grid; gap: 2px;
  text-align: left;
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.carte-persona.est-actif { border-color: var(--accent); background: var(--accent-soft); }
.persona-nom { font-weight: 600; }
.persona-desc { font-size: 13px; color: var(--muted); }

/* --- Lobby --------------------------------------------------------------- */

.code-affiche {
  margin: 6px 0 4px;
  text-align: center;
  font: 800 clamp(48px, 18vw, 76px)/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.18em;
  color: var(--gold);
}

.lien-partage { display: grid; gap: 8px; justify-items: center; margin-top: 16px; }
.lien-texte {
  margin: 0;
  font-size: 12px; color: var(--muted);
  word-break: break-all; text-align: center;
}

.ligne-joueur {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.pastille-nom { font-weight: 600; }

/* --- La manche ----------------------------------------------------------- */

.jeu-entete { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pastille {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-size: 12px; font-weight: 600;
}
.pastille-douce { background: var(--surface-2); border-color: var(--border); color: var(--muted); }

.chrono {
  position: relative;
  height: 8px;
  margin: 26px 0 16px;
  border-radius: 999px;
  background: var(--surface-2);
}
.chrono-jauge {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width 0.12s linear;
}
.chrono-jauge.est-urgent { background: var(--danger); }
/* Le décompte de la fenêtre de jokers, sous la jauge. La marge lui réserve sa
   place : le chiffre est en position absolue et ne pousse rien tout seul. */
.chrono[data-compte] { margin-bottom: 116px; }
.chrono[data-compte]::after {
  content: attr(data-compte);
  position: absolute;
  inset-inline: 0;
  top: 22px;
  text-align: center;
  font: 800 clamp(56px, 20vw, 88px)/1 system-ui, sans-serif;
  color: var(--gold);
}

.annonce { margin: 26px 0 6px; color: var(--muted); font-size: 14px; font-style: italic; }
.question { margin: 0 0 18px; font-size: clamp(21px, 5.2vw, 28px); line-height: 1.28; }

.reponses { display: grid; gap: 10px; }
.reponse {
  display: grid;
  grid-template-columns: 34px 1fr 22px;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 11px 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 17px;
  cursor: pointer;
}
.reponse:disabled { cursor: default; }
.reponse-lettre {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  font-weight: 800; font-size: 15px;
  color: var(--muted);
}
.reponse-marque { text-align: right; font-weight: 800; }
.reponse.est-choisi { border-color: var(--accent); background: var(--accent-soft); }
.reponse.est-choisi .reponse-lettre { background: var(--accent); color: #fff; }
.reponse.est-juste { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.reponse.est-juste .reponse-marque { color: var(--ok); }
.reponse.est-faux { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.reponse.est-faux .reponse-marque { color: var(--danger); }
/* Une réponse fausse non choisie s'efface : seul compte ce qu'on regarde. */
.reponse:disabled:not(.est-juste):not(.est-faux):not(.est-choisi) { opacity: 0.5; }

/* Retirée par le 50/50 : barrée et presque effacée, mais toujours à sa place —
   les réponses ne doivent pas se réorganiser sous le doigt en pleine manche. */
.reponse.est-retiree { opacity: 0.22; }
.reponse.est-retiree .reponse-texte { text-decoration: line-through; }

.consigne { margin: -8px 0 16px; color: var(--gold); font-size: 14px; font-weight: 600; }

/* --- Estimation ---------------------------------------------------------- */

.estimation { display: grid; gap: 12px; }
.estimation-ligne { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.estimation-champ {
  width: 100%;
  max-width: 260px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 800 34px/1.1 ui-monospace, "SF Mono", Menlo, monospace;
  text-align: center;
}
.estimation-champ:disabled { opacity: 0.7; }
.estimation-unite { color: var(--muted); font-size: 15px; white-space: nowrap; }
.estimation-resultat { display: grid; gap: 4px; }
.estimation-solution {
  display: flex; align-items: baseline; gap: 10px; justify-content: center;
  margin: 0; font-size: 26px;
}
.estimation-solution strong { color: var(--ok); }

/* --- Le mix -------------------------------------------------------------- */

.mix { display: grid; gap: 12px; }
.mix-champ {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 600 19px/1.3 inherit;
}
.mix-champ:disabled { opacity: 0.7; }
.mix-resultat { display: grid; gap: 8px; }
/* La liste peut faire vingt titres : on la borne et on la fait défiler, sinon
   elle pousse le classement et les jokers hors de l'écran à chaque révélation. */
.mix-liste {
  margin: 0; padding: 0 0 0 2px; list-style: none;
  display: grid; gap: 6px;
  max-height: 42vh; overflow-y: auto;
  font-size: 15px; line-height: 1.35;
}
.mix-liste li { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.mix-liste li:last-child { border-bottom: 0; }
.mix-titre { font-weight: 700; }
.mix-artiste { color: var(--muted); }

/* --- Le blind test du DJ -------------------------------------------------- */

.dj-saisie { display: grid; gap: 12px; }
.dj-resultat { display: grid; gap: 8px; }
.dj-solution { margin: 0; font-size: 18px; }
.dj-solution strong { color: var(--ok); }

/* Le pupitre du DJ : il se lit d'un coup d'œil entre deux morceaux, téléphone
   dans une main et télécommande de l'enceinte dans l'autre. */
.dj { display: grid; gap: 12px; margin-bottom: 16px; }
.dj-consigne { margin: 0; font-weight: 600; }
.dj-morceau { display: grid; gap: 8px; }
.dj-top { font-size: 20px; }
.dj-verdicts { display: grid; gap: 10px; }
.dj-ligne {
  display: grid; gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit; text-align: left;
  cursor: pointer;
}
.dj-ligne.est-juste { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.dj-ligne.est-partiel { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.dj-propose { font-size: 16px; overflow-wrap: anywhere; }
/* L'état, en bout de ligne et en gras : c'est lui qu'on regarde en tapant. */
.dj-etat { justify-self: end; font-weight: 700; font-size: 15px; }
.dj-ligne.est-juste .dj-etat { color: var(--ok); }
.dj-ligne.est-partiel .dj-etat { color: var(--gold); }
.dj-note summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
.dj-note[open] summary { margin-bottom: 8px; }

/* --- Tu te mets combien ? ------------------------------------------------ */

.pari { display: grid; gap: 10px; margin: 4px 0 14px; }
/* Le thème de la carte, seule information sur laquelle on puisse miser. Il
   passe devant « tu te mets combien ? », qui ne dit rien qu'on ne sache déjà
   après la première manche du genre. */
.pari-theme {
  margin: 0 0 2px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--gold);
}
.pari-titre { margin: 0; font-size: 19px; font-weight: 800; }
/* Dix crans sur une largeur de téléphone : cinq par ligne, assez gros pour le
   pouce. Une seule ligne de dix donnerait des cibles de 30 px. */
.pari-grille { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pari-cran {
  padding: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 800 20px/1 inherit;
  cursor: pointer;
}
.pari-cran.est-actif { border-color: var(--accent); background: var(--accent); color: #fff; }
.pari-cran:disabled { opacity: 0.45; cursor: default; }
.pari-cran.est-actif:disabled { opacity: 1; }
.ttmc { display: grid; gap: 14px; }
.ttmc-enonce { margin: 0; font-size: 21px; line-height: 1.25; }
.ttmc-correction:empty { display: none; }

/* --- Dans l'ordre -------------------------------------------------------- */

.ordre { display: grid; gap: 10px; }
.elements { display: grid; gap: 8px; }
.element {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center; gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 16px;
  cursor: pointer;
}
.element:disabled { cursor: default; }
.element-rang {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}
.element.est-place { border-color: var(--accent); background: var(--accent-soft); }
.element.est-place .element-rang { background: var(--accent); color: #fff; }
.element.est-juste { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.element.est-juste .element-rang { background: var(--ok); color: #10221c; }
.element.est-faux { border-color: var(--danger); }
.element.est-faux .element-rang { background: var(--danger); color: #2a1414; }

/* --- Rafale -------------------------------------------------------------- */

.rafale { display: grid; gap: 8px; }
.affirmation {
  display: grid; gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.affirmation-texte { margin: 0; font-size: 15px; line-height: 1.35; }
.vf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vf {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit; font-weight: 700;
  cursor: pointer;
}
.vf:disabled { cursor: default; }
.vf.est-choisi { background: var(--accent); border-color: transparent; color: #fff; }
.vf.est-juste { border-color: var(--ok); color: var(--ok); }
.vf.est-choisi.est-juste { background: var(--ok); color: #10221c; }
.vf.est-faux { border-color: var(--danger); color: var(--danger); }

/* --- Le fil rouge -------------------------------------------------------- */

.fil-rouge { margin-top: 18px; }
.fil-boite {
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
  padding: 11px 14px;
  background: color-mix(in srgb, var(--gold) 7%, transparent);
}
.fil-boite summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.fil-boite p { margin: 8px 0 0; }
/* L'indice est ce qu'on relit à chaque tentative : il ressort du mode d'emploi
   qui l'entoure, lequel ne se lit qu'une fois. */
.fil-indice {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}
.fil-ligne { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.fil-champ {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.fil-trouve {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  font-size: 14px;
}

.jeu-etat { display: grid; gap: 8px; margin-top: 18px; }
.atteinte { margin: 0; font-weight: 600; color: var(--ok); }
.gain { margin: 0; font-size: 30px; font-weight: 800; }
.gain-plus { color: var(--ok); }
.gain-moins { color: var(--danger); }
.gain-zero { color: var(--muted); }
.note {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  font-size: 14px;
}
.evenement { margin: 0; font-weight: 600; color: var(--gold); }

/* --- Jokers -------------------------------------------------------------- */

/* En ligne souple plutôt qu'en grille fixe : une partie peut n'ouvrir que deux
   jokers, et deux boutons calés à gauche d'une grille de cinq font accident. */
.jokers { display: flex; flex-wrap: wrap; gap: 6px; }
.joker {
  flex: 1 1 0; min-width: 62px;
  display: grid; gap: 3px; justify-items: center;
  padding: 10px 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.joker-emoji { font-size: 20px; }
.joker-nom { font-size: 10px; line-height: 1.15; text-align: center; color: var(--muted); }
.joker.est-arme { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.joker.est-arme .joker-nom { color: var(--text); }
.joker.est-use { opacity: 0.3; }
.joker:disabled { cursor: default; }

/* Le choix de la cible, juste sous la rangée : on vient d'armer le joker, la
   question suivante est « sur qui ? » et la réponse doit être à portée de
   pouce. */
.joker-cible { margin-top: 10px; display: grid; gap: 6px; }
.joker-cible p { margin: 0; }
.cible-rangee { display: flex; flex-wrap: wrap; gap: 8px; }

/* Le fil rouge au podium : c'est la chute de la soirée, elle mérite mieux
   qu'une ligne perdue sous le classement. */
.fin-fil {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  display: grid;
  gap: 6px;
}
.fin-fil p { margin: 0; }
.fil-mot { font-size: 18px; font-weight: 700; }

/* La légende : ce que fait chaque joker, le temps de la fenêtre. Assez petite
   pour ne pas repousser la rangée hors de l'écran, assez lisible pour qu'on la
   parcoure en dix secondes. */
.joker-legende {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
  font-size: 12.5px;
  line-height: 1.3;
}
.joker-legende li { display: grid; grid-template-columns: 20px 1fr; gap: 6px; align-items: start; }
.joker-legende-emoji { font-size: 13px; }
.joker-legende b { font-weight: 600; }

/* --- Le compte ------------------------------------------------------------ */

/* Quatre chiffres qu'on lit d'un coup d'œil : c'est tout ce qu'une page de
   statistiques doit donner avant qu'on ait décidé de s'y intéresser. */
.stats-grille {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 10px 0 14px;
}
.stat {
  display: grid; gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
}
.stat-valeur { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-libelle { font-size: 12.5px; color: var(--muted); }

/* --- Ce que la table a répondu -------------------------------------------- */

/* Le bloc de la révélation où l'on découvre les réponses des autres. Il vient
   avant le classement : les points, on les regarde après avoir ri. */
.dits { display: grid; gap: 5px; margin: 12px 0 4px; }
.dit {
  display: grid;
  grid-template-columns: minmax(60px, auto) 1fr auto;
  align-items: baseline; gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 14.5px;
}
.dit.est-moi { outline: 1px solid var(--accent); }
.dit.est-juste { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); }
.dit.est-partiel { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
.dit-nom { color: var(--muted); font-weight: 600; }
/* Une estimation à cinq chiffres et un titre tapé à la va-vite tiennent sur la
   même ligne : on coupe plutôt que de pousser la pastille hors de l'écran. */
.dit-texte { font-weight: 600; overflow-wrap: anywhere; }
.dit-marque { font-variant-numeric: tabular-nums; font-size: 13px; }
/* Sur toute la largeur, en dessous : « a saboté Bob » est une phrase, pas une
   pastille, et la ligne du dessus est déjà pleine. */
.dit-joker {
  grid-column: 1 / -1;
  font-size: 13px; font-weight: 600;
  color: var(--gold);
}
/* Un joker dépensé pour rien se lit, mais ne se pavane pas. */
.dit-joker.est-rate { color: var(--muted); font-weight: 500; }

/* --- Classement et podium ------------------------------------------------ */

.classement { display: grid; gap: 6px; margin-top: 8px; }
.rang {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 15px;
}
.rang.est-moi { background: var(--accent-soft); }
.rang-place { color: var(--muted); font-weight: 700; }
.rang-score { font-weight: 700; font-variant-numeric: tabular-nums; }

.podium-ligne {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center; gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 17px;
}
.podium-ligne.est-moi { border-color: var(--accent); }
.podium-medaille { font-size: 26px; text-align: center; }
.podium-nom { font-weight: 600; }
.podium-score { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); }

/* Message de dernier recours si le câblage n'a pas pu se faire. */
.panne {
  margin: 0;
  padding: 14px var(--pad);
  background: var(--danger);
  color: #1a1a1a;
  font-weight: 600;
}

/* --- Toast et dialogue --------------------------------------------------- */

#toast {
  position: fixed;
  left: 50%; bottom: calc(22px + var(--safe-b));
  transform: translate(-50%, 20px);
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 40;
}
#toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
#toast[data-kind="warn"] { border-color: var(--warn); }

.dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  max-width: min(92vw, 420px);
  padding: 20px;
}
.dialog::backdrop { background: #0008; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.btn-danger { background: var(--danger); border-color: transparent; color: #1a1a1a; }

/* --- Écrans larges ------------------------------------------------------- */

/* Sur une tablette posée au milieu de la table, les réponses passent sur deux
   colonnes : c'est le premier pas vers l'écran commun. */
@media (min-width: 640px) {
  .reponses { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .chrono-jauge { transition: none; }
  .btn:active { transform: none; }
}

/* --- Le vote de la table -------------------------------------------------- */

/* Le mix juge sur une liste, qui ne connaît pas toute la musique du monde.
   Ce bloc est le rattrapage : ce que la machine refuse, la salle tranche. */
.vote { margin: 18px 0; display: grid; gap: 10px; }
.vote-titre { margin: 0; font-weight: 600; }
.vote-ligne {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.vote-quoi { min-width: 0; }
.vote-quoi strong { display: block; overflow-wrap: anywhere; }
.vote-boutons { display: flex; gap: 8px; flex: none; }
/* Assez large pour le pouce : on vote vite, et souvent de travers sinon. */
.vote-boutons .btn { padding: 10px 14px; }
.vote-oui.est-actif { background: color-mix(in srgb, var(--ok) 30%, transparent); border-color: var(--ok); }
.vote-non.est-actif { background: color-mix(in srgb, var(--danger) 30%, transparent); border-color: var(--danger); }

/* Le lien vers l'écran commun, sous le partage du lobby. */
.lien-tv { color: var(--accent); }

/* --- L'écran commun ------------------------------------------------------- */

/* Une télé se regarde à trois mètres, pas à trente centimètres : tout est
   dimensionné en `vmin` pour que la page suive l'écran qu'on lui donne, du
   vidéoprojecteur au portable posé sur la cheminée. */
.tv-body {
  height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.tv { width: 100%; height: 100%; padding: 4vmin; display: grid; }
.tv-ecran { align-self: center; justify-self: center; width: 100%; max-width: 1600px; }

.tv-kicker {
  margin: 0 0 1vmin;
  font-size: 2vmin; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold);
}
.tv-titre { margin: 0 0 3vmin; font-size: 6vmin; }
.tv-note { color: var(--muted); font-size: 2.2vmin; margin: 3vmin 0 0; }

/* Le choix de ce que la télé montre pendant la manche. Posé sur l'écran du
   code, avant la partie : c'est le seul moment où quelqu'un est debout près de
   l'écran, télécommande ou souris en main. */
.tv-sous-titre { margin: 5vmin 0 2vmin; font-size: 3vmin; color: var(--muted); font-weight: 600; }
.tv-modes { display: flex; flex-wrap: wrap; gap: 1.5vmin; }
.tv-mode {
  padding: 1.6vmin 2.4vmin;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 2.4vmin; font-weight: 600; cursor: pointer;
}
.tv-mode.est-actif { border-color: var(--gold); color: var(--gold); }
.tv-modes + .tv-note { margin-top: 2vmin; }

/* La même bascule pendant la partie, mais effacée : le bon réglage ne se
   trouve qu'une fois la première manche passée, et personne ne rouvrira la
   page pour ça. Elle ne doit pour autant rien voler à la question. */
.tv-mode-bascule {
  position: fixed; right: 2vmin; bottom: 2vmin;
  padding: 1vmin 1.6vmin;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: transparent; color: var(--muted);
  font-size: 1.8vmin; cursor: pointer;
  opacity: 0.35; transition: opacity 0.2s;
}
.tv-mode-bascule:hover, .tv-mode-bascule:focus-visible { opacity: 1; }

.tv-form { display: flex; gap: 2vmin; align-items: center; }
.tv-champ {
  flex: 1; min-width: 0;
  padding: 2vmin;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: 700 6vmin/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.3em; text-align: center; text-transform: uppercase;
}

/* Le code du salon : c'est ce qu'on lit du fond de la pièce pour rejoindre. */
/* Le lobby se lit du fond de la pièce : tout y est centré, sans quoi le code
   flotte au milieu pendant que les mots restent collés à gauche. */
.tv-ecran[data-tv="lobby"], .tv-ecran[data-tv="code"] { text-align: center; }
.tv-ecran[data-tv="code"] .tv-form { text-align: left; }

.tv-code {
  margin: 0 0 4vmin;
  font: 800 22vmin/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.12em; text-align: center;
  color: var(--gold);
}
.tv-joueurs { display: flex; flex-wrap: wrap; gap: 1.5vmin; justify-content: center; }
.tv-joueur {
  padding: 1.2vmin 2.4vmin;
  border-radius: 999px; background: var(--surface-2);
  font-size: 2.6vmin; font-weight: 600;
}

.tv-entete { display: flex; gap: 1.5vmin; margin-bottom: 2vmin; }
.tv-pastille {
  padding: 0.9vmin 2vmin; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 2vmin; font-weight: 700;
}
.tv-pastille-douce { background: transparent; border: 1px solid var(--border); }

.tv-chrono {
  position: relative;
  height: 1.2vmin; margin-bottom: 3vmin;
  border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.tv-jauge { height: 100%; background: var(--accent); transition: width 0.2s linear; }
.tv-jauge.est-urgent { background: var(--danger); }
/* Le décompte d'avant-question, en très grand : c'est le signal que la table
   doit lâcher son verre. */
.tv-chrono[data-compte]::after {
  content: attr(data-compte);
  position: absolute; inset: 0; top: 2vmin;
  display: grid; place-items: center;
  font: 800 12vmin/1 system-ui, sans-serif; color: var(--muted);
}
.tv-chrono[data-compte] { margin-bottom: 16vmin; }

.tv-annonce { margin: 0 0 1.5vmin; color: var(--muted); font-size: 2.6vmin; font-style: italic; }
.tv-question { margin: 0 0 3vmin; font-size: 5.5vmin; line-height: 1.2; }
.tv-explication { margin: 2vmin 0 0; color: var(--muted); font-size: 2.4vmin; line-height: 1.4; }

.tv-reponses { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6vmin; }
.tv-reponse {
  padding: 2vmin 2.4vmin;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  font-size: 3vmin; font-weight: 600;
}
.tv-reponse.est-juste {
  background: color-mix(in srgb, var(--ok) 22%, transparent);
  border-color: var(--ok);
}
.tv-titre-accepte {
  padding: 1.2vmin 2vmin;
  border-radius: var(--radius); background: var(--surface);
  font-size: 2.4vmin;
}

/* Le classement ne quitte jamais l'écran : sur un téléphone il faut défiler
   pour le voir, et personne ne défile pendant une manche. */
/* Les réponses de la table, à la révélation.
   En pastilles qui s'enroulent, comme les scores juste en dessous : à trois
   joueurs on lit une ligne, à huit on en lit trois — là où une pastille par
   ligne aurait poussé le classement hors de l'écran dès la cinquième personne.
   Une réponse longue — quatre éléments classés, un titre tapé au clavier —
   prend sa propre ligne sans rien déranger. */
.tv-dits {
  display: flex; flex-wrap: wrap; gap: 1.2vmin;
  margin-top: 2vmin;
}
.tv-dit {
  display: flex; align-items: baseline; gap: 2vmin;
  padding: 1vmin 2.4vmin;
  border-radius: 999px; background: var(--surface);
  font-size: 2.6vmin;
}
.tv-dit.est-juste { background: color-mix(in srgb, var(--ok) 20%, var(--surface)); }
.tv-dit.est-partiel { background: color-mix(in srgb, var(--gold) 16%, var(--surface)); }
.tv-dit-nom { color: var(--muted); font-weight: 600; }
.tv-dit-texte { font-weight: 700; }
/* Le coup de joker, dans la pastille : c'est la ligne que toute la table
   cherche à la révélation — qui m'a fait ça. */
.tv-dit-joker { color: var(--gold); font-weight: 700; }
.tv-dit-joker.est-rate { color: var(--muted); font-weight: 600; }

.tv-scores {
  display: flex; flex-wrap: wrap; gap: 1.2vmin;
  margin-top: 3vmin; padding-top: 2vmin;
  border-top: 1px solid var(--border);
}
.tv-score {
  display: flex; align-items: baseline; gap: 1.2vmin;
  padding: 1vmin 2vmin;
  border-radius: 999px; background: var(--surface);
  font-size: 2.4vmin;
}
.tv-score.est-tete { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.tv-score-nom { font-weight: 600; }
.tv-score-total { font-weight: 800; }
.tv-score-gain { font-size: 2vmin; font-weight: 700; }
.tv-score-gain.est-plus { color: var(--ok); }
.tv-score-gain.est-moins { color: var(--danger); }

/* Le classement seul : plus rien ne se dispute l'écran, alors il s'étale. Une
   ligne par joueur plutôt qu'une file de pastilles — c'est la seule chose que
   ce mode donne à lire, elle doit se lire du fond de la pièce. */
.tv[data-mode="classement"] .tv-scores {
  display: grid; gap: 1.6vmin;
  margin-top: 4vmin; padding-top: 3vmin;
}
.tv[data-mode="classement"] .tv-score {
  justify-content: space-between;
  border-radius: var(--radius);
  padding: 2vmin 3vmin;
  font-size: 4vmin;
}
.tv[data-mode="classement"] .tv-score-gain { font-size: 3vmin; }

.tv-podium { display: grid; gap: 2vmin; }
.tv-podium-ligne {
  display: flex; align-items: center; gap: 3vmin;
  padding: 2.4vmin 3vmin;
  border-radius: var(--radius); background: var(--surface);
}
.tv-medaille { font-size: 5vmin; }
.tv-podium-nom { flex: 1; font-size: 4vmin; font-weight: 700; }
.tv-podium-score { font-size: 3vmin; color: var(--muted); }

.tv-alerte {
  position: fixed; left: 50%; bottom: 3vmin; transform: translateX(-50%);
  margin: 0; padding: 1.4vmin 3vmin;
  border-radius: 999px; background: var(--surface-2); color: var(--warn);
  font-size: 2.2vmin;
}

/* Les deux actions du bas de l'écran « Mon compte ». Pas de barre collante :
   elle recouvrait le classement entre amis, et ni la déconnexion ni la
   suppression n'ont à rester sous le pouce pendant qu'on lit ses statistiques. */
.actions-compte { margin: 30px 0 calc(24px + var(--safe-b)); }
