/* Tête d'affiche · l'écran de la télé.
   ──────────────────────────────────────────────────────────────────────────
   La page que montre la télé (ou le projecteur) : la salle (le QR code, qui
   est là, la prochaine manche), la manche (le mot dans le cadre à ampoules,
   lisible du fond de la pièce) et les résultats. Toujours sombre : c'est la
   scène de l'app, celle qui se lit de loin.

   Écrite pour le navigateur d'une télé, qui n'est pas celui d'un téléphone
   (le projecteur Hisense C1 de l'appli VIDAA dessine la page en 1280 × 720),
   aux mêmes règles que l'écran de La Veillée (Veillee/static/tele.css) :
   · tout se mesure en rem, et la racine suit la taille de l'écran : une toile
     de 80 × 45 rem, quelle que soit la définition ;
   · ni `inset`, ni `aspect-ratio`, ni `:is()`, `:has()`, `color-mix()`,
     imbrication ou flou d'arrière-plan, que ces navigateurs ne connaissent
     pas tous ; aucune animation sans fin ;
   · le focus se voit de loin : ce qui l'a devient blanc (la télécommande
     n'a pas d'autre repère) ;
   · aucun style en ligne dans la page (la CSP du site) : seules la taille du
     mot et la barre du temps sont posées par le script (CSSOM).

   Deux couleurs de réponse, jamais utilisées pour autre chose : le vert de
   « Trouvé » et l'orange de « Passé ». L'or des ampoules est l'accent. */

:root {
  --nuit: #0f0d0a;
  --fond: #0f0d0a;
  --carte: #1f1b15;
  --carte-2: #2c261d;
  --encre: #fbf6e9;
  --muted: #b9ae98;
  --ligne: rgba(251, 246, 233, 0.16);
  --accent: #ffc233;
  --accent-soft: rgba(255, 194, 51, 0.14);
  --on-accent: #1c1812;
  --trouve: #62d391;
  --trouve-fort: #13703b;
  --passe: #ffa062;
  --passe-fort: #f08a24;
  --on-passe: #1c1812;
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}

/* La toile : 80 rem de large, 45 de haut. */
html { font-size: 16px; font-size: max(10px, min(1.25vw, 2.2222vh)); }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  overflow: hidden;
  background: var(--fond); color: var(--encre);
  font: 500 1rem/1.35 var(--font-text);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ico-sm { width: 1em; height: 1em; }
:focus { outline: none; }

/* Le logo de l'app (1106 × 256), en clair sur le noir. */
.t-logo {
  display: block; flex: none; width: 11.23rem; height: 2.6rem;
  background: url("brand/logo-dark.png") left center / contain no-repeat;
}
.t-logo-petit { width: 7.78rem; height: 1.8rem; }

/* ── Les boutons ──────────────────────────────────────────────────────── */
.t-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 3.2rem; padding: 0 1.6rem; border-radius: 999px;
  background: var(--carte-2); color: var(--encre); border: 0.16rem solid transparent;
  font: 600 1.15rem/1.1 var(--font-text); cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.t-btn-fort { background: var(--accent); color: var(--on-accent); }
.t-btn:focus { background: var(--encre); color: var(--nuit); transform: scale(1.05); }

/* Les deux réponses de la manche : la couleur de chacune, même au repos. */
.t-btn-reponse { min-height: 4rem; min-width: 13rem; padding: 0 2rem; font-size: 1.45rem; }
.t-btn-passe { border-color: var(--passe); color: var(--passe); background: transparent; }
.t-btn-trouve { border-color: var(--trouve); color: var(--trouve); background: transparent; }
.t-btn-passe:focus { background: var(--passe-fort); border-color: var(--passe-fort); color: var(--on-passe); }
.t-btn-trouve:focus { background: var(--trouve-fort); border-color: var(--trouve-fort); color: #ffffff; }

/* ── LA SALLE ─────────────────────────────────────────────────────────── */
.t-salle-ecran {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 27rem; gap: 2.4rem;
  padding: 2.2rem 2.5rem;
}
.t-gauche { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; min-height: 0; }
.t-tete { display: flex; align-items: center; gap: 1.6rem; }
.t-regle { font-size: 1.05rem; line-height: 1.35; color: var(--muted); max-width: 32rem; }
.t-titre { font: 700 2.4rem/1.08 var(--font-display); letter-spacing: -0.01em; }
.t-sur { font: 600 1.05rem/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

.t-options { display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
.t-opt { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.t-opt-titre { font: 600 1.1rem/1.2 var(--font-text); }
.t-opt-titre small { font-weight: 500; color: var(--muted); margin-left: 0.6rem; }
.t-opt-choix { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.t-opt-vide { font-size: 1.05rem; color: var(--muted); }
.t-opt-rangee { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem; }
.t-puce {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 2.5rem; padding: 0 1rem; border-radius: 999px;
  background: var(--carte); color: var(--encre); border: 0.14rem solid var(--ligne);
  font: 600 0.98rem/1.1 var(--font-text); cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.t-puce small { font-weight: 500; color: var(--muted); }
.t-puce[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.t-puce[aria-pressed="true"] .ico { color: var(--accent); }
.t-puce:focus { background: var(--encre); color: var(--nuit); border-color: var(--encre); transform: scale(1.05); }
.t-puce:focus small, .t-puce:focus .ico { color: var(--nuit); }
.t-prep-actions { display: flex; gap: 1rem; margin-top: auto; }
.t-prep-msg { min-height: 1.5rem; font-size: 1.12rem; color: var(--accent); }

/* Qui est là, et comment entrer. */
.t-salle {
  display: flex; flex-direction: column; gap: 0.75rem; min-height: 0;
  padding: 1.5rem 1.6rem; border-radius: 1.6rem; background: var(--carte); overflow: hidden;
}
.t-salle-titre { font: 700 1.75rem/1.1 var(--font-display); }
.t-entree { display: flex; align-items: center; gap: 1.2rem; }
.t-entree-texte { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.t-salle-aide { font-size: 0.95rem; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; }
.t-salle-aide strong { color: var(--encre); font-weight: 600; }
.t-qr {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 10rem; height: 10rem; padding: 0.45rem; border-radius: 0.9rem; background: #ffffff;
  text-align: center;
}
.t-qr-img { display: block; width: 100%; height: 100%; }
.t-qr-attente { color: #3a3631; font-size: 0.95rem; }
.t-code { font: 700 2rem/1 var(--font-mono); letter-spacing: 0.04em; color: var(--accent); white-space: nowrap; }
.t-salle-sous {
  align-self: stretch; margin-top: 0.2rem; padding-top: 0.8rem; border-top: 0.08rem solid var(--ligne);
  font: 600 1.1rem/1.2 var(--font-text); text-align: left;
}
.t-liste { align-self: stretch; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; min-height: 0; }
.t-liste > li { min-width: 0; }
.t-joueur {
  display: flex; gap: 0.6rem; align-items: center;
  width: 100%; min-height: 2.9rem; padding: 0.3rem 0.8rem; border-radius: 0.8rem;
  background: var(--carte-2); border: 0; text-align: left; cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.t-joueur-texte { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.t-joueur-nom { font: 600 1.1rem/1.15 var(--font-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-joueur-etat { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-joueur.is-absent .t-joueur-nom { color: var(--muted); }
.t-joueur:focus { background: var(--encre); color: var(--nuit); transform: scale(1.03); }
.t-joueur:focus .t-joueur-etat { color: var(--nuit); }
.t-liste-vide { grid-column: 1 / -1; padding: 0.8rem 0; font-size: 1.05rem; color: var(--muted); text-align: left; }
.t-salle-etat { min-height: 1.3rem; font-size: 0.95rem; color: var(--muted); }

/* La pastille d'un joueur : l'or pour qui devine, le gris pour les autres. */
.t-point { display: block; width: 1rem; height: 1rem; border-radius: 50%; background: var(--muted); flex: none; }
.t-point.is-devin { background: var(--accent); }

/* ── LA MANCHE ────────────────────────────────────────────────────────── */
.t-manche {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; gap: 0.9rem;
  padding: 1.4rem 2.5rem 1.6rem;
  background: var(--nuit);
}
.t-barre { display: flex; align-items: center; gap: 1.4rem; min-height: 3rem; flex: none; }
.t-barre-theme {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 600 1.05rem/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.t-barre-devin { font: 600 1.25rem/1.2 var(--font-text); white-space: nowrap; }
.t-chrono { min-width: 6.5rem; text-align: right; font: 700 2.8rem/1 var(--font-display); }
.t-chrono.is-urgent { color: var(--passe); }
.t-temps { flex: none; height: 0.4rem; border-radius: 999px; background: var(--ligne); overflow: hidden; }
.t-temps-plein { display: block; width: 100%; height: 100%; background: var(--accent); }
.t-manche.is-pause .t-temps-plein { background: var(--muted); }

.t-centre {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem;
}
/* Le cadre à ampoules de l'accueil (tools/soiree_images.py, 1216 × 384) :
   la case prend EXACTEMENT le rapport de son image, sinon les ampoules
   deviennent des ellipses. Le noir du cadre commence à 4,5 % de la largeur
   et à 12,5 % de la hauteur : le rembourrage y garde le mot. */
.t-affiche {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
  width: 70rem; height: 22.1rem; padding: 2.9rem 6.5rem;
  background: var(--nuit) url("img/enseigne.webp") center / 100% 100% no-repeat;
  text-align: center; overflow: hidden;
}
.t-affiche-lib {
  font: 600 1.05rem/1.3 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.t-affiche-lib:empty { display: none; }
/* La taille exacte est posée par le script (le mot le plus grand qui tienne,
   sans jamais le couper) : celle-ci n'est qu'un départ raisonnable. */
.t-affiche-mot {
  max-width: 100%;
  font: 700 7rem/1.02 var(--font-display); letter-spacing: -0.025em;
  overflow-wrap: normal; word-break: normal;
}
.t-affiche.is-decompte .t-affiche-mot { color: var(--accent); }
.t-affiche.is-pause .t-affiche-mot { color: var(--muted); }
.t-consigne { max-width: 62rem; min-height: 1.6rem; font-size: 1.3rem; line-height: 1.4; color: var(--muted); text-align: center; }
.t-consigne strong { color: var(--encre); font-weight: 600; }

.t-pied { display: flex; align-items: center; justify-content: space-between; gap: 1.6rem; min-height: 4.2rem; flex: none; }
.t-score { font: 600 1.35rem/1.2 var(--font-text); color: var(--muted); min-width: 0; }
.t-score strong { color: var(--trouve); font-weight: 700; }
.t-actions { display: flex; align-items: center; gap: 1rem; flex: none; }

/* Trouvé, passé, la fin : la scène entière change de couleur. */
.t-flash {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem;
  padding: 3rem; text-align: center;
}
.t-flash.is-trouve { background: var(--trouve-fort); color: #ffffff; }
.t-flash.is-passe { background: var(--passe-fort); color: var(--on-passe); }
.t-flash.is-fin { background: var(--accent); color: var(--on-accent); }
.t-flash-lib { font: 700 8.5rem/1 var(--font-display); letter-spacing: -0.04em; }
.t-flash-mot { max-width: 70rem; font: 600 2.4rem/1.2 var(--font-text); opacity: 0.88; overflow-wrap: anywhere; }

/* ── LES RÉSULTATS ────────────────────────────────────────────────────── */
.t-resultats {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 27rem; gap: 2.4rem;
  padding: 2.2rem 2.5rem;
}
.t-res-gauche { display: flex; flex-direction: column; gap: 1rem; min-width: 0; min-height: 0; }
.t-res-tete { display: flex; align-items: center; gap: 1.8rem; }
.t-res-score { font: 700 7rem/0.95 var(--font-display); letter-spacing: -0.05em; color: var(--accent); }
.t-res-texte { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.t-res-sous { font-size: 1.2rem; color: var(--muted); }
.t-res-aide { font-size: 1.05rem; color: var(--muted); }
.t-mots {
  flex: 1; min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 3.2rem; gap: 0.5rem;
  align-content: start;
}
.t-mots > li { min-width: 0; }
.t-mot {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; height: 100%; padding: 0 0.9rem; border-radius: 0.8rem;
  background: var(--carte); border: 0.14rem solid transparent; text-align: left; cursor: pointer;
  font: 600 1.1rem/1.15 var(--font-text);
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.t-mot-texte { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-mot.is-trouve { border-color: var(--trouve); }
.t-mot.is-trouve .ico { color: var(--trouve); }
.t-mot.is-passe { color: var(--muted); }
.t-mot.is-passe .ico { color: var(--passe); }
.t-mot:focus { background: var(--encre); color: var(--nuit); border-color: var(--encre); transform: scale(1.03); }
.t-mot:focus .ico { color: var(--nuit); }
.t-mots-vide { grid-column: 1 / -1; font-size: 1.15rem; color: var(--muted); }

.t-res-droite {
  display: flex; flex-direction: column; gap: 1rem; min-height: 0;
  padding: 1.7rem 1.6rem; border-radius: 1.6rem; background: var(--carte);
}
.t-scores { display: flex; flex-direction: column; gap: 0.45rem; min-height: 0; overflow: hidden; }
.t-ligne {
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: 0.8rem; align-items: center;
  min-height: 3rem; padding: 0.3rem 1rem 0.3rem 0.4rem; border-radius: 0.8rem; background: var(--carte-2);
}
.t-ligne.is-premier { box-shadow: 0 0 0 0.14rem var(--accent); }
.t-rang {
  display: flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--nuit); font: 700 1.05rem/1 var(--font-mono);
}
.is-premier .t-rang { background: var(--accent); color: var(--on-accent); }
.t-ligne-nom { display: flex; flex-direction: column; min-width: 0; font: 600 1.15rem/1.2 var(--font-text); }
.t-ligne-nom span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-ligne-nom small { font: 500 0.88rem/1.2 var(--font-text); color: var(--muted); }
.t-ligne-pts { font: 700 1.2rem/1 var(--font-display); }
.t-scores-vide { font-size: 1.05rem; color: var(--muted); }
.t-res-actions { display: flex; flex-direction: column; gap: 0.7rem; margin-top: auto; }
.t-res-actions .t-btn { width: 100%; }

/* ── La fenêtre (retirer un joueur, quitter pendant une pause) ─────────── */
.t-fenetre {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 7, 6, 0.8);
}
.t-fenetre-carte {
  display: flex; flex-direction: column; gap: 1rem; width: 34rem; max-width: 90%;
  padding: 2.2rem; border-radius: 1.6rem; background: var(--carte);
}
.t-fenetre-titre { font: 700 1.9rem/1.15 var(--font-display); }
.t-fenetre-texte { font-size: 1.15rem; line-height: 1.4; color: var(--muted); }
.t-fenetre-actions { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.4rem; }
.t-fenetre-actions .t-btn { justify-content: flex-start; width: 100%; }

.t-toast {
  position: fixed; left: 50%; bottom: 2rem; z-index: 20; max-width: 60rem;
  transform: translateX(-50%);
  padding: 0.8rem 1.5rem; border-radius: 999px;
  background: var(--encre); color: var(--nuit); font: 600 1.15rem/1.3 var(--font-text); text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .t-btn, .t-puce, .t-joueur, .t-mot { transition: none; }
}
