/* Mode télé : tout se mesure avec une unité --u (le plus petit de 1 % de la
   largeur et 1,78 % de la hauteur, soit 1vw sur une télé 16:9), pour rester
   lisible à 3 mètres et tenir dans la fenêtre quel que soit le format :
   4:3, 16:10, navigateur de télé avec barres, zoom, écran vertical.
   Une marge de sécurité (« overscan ») entoure la page. Si une question ou
   des réponses très longues ne tiennent pas, js/ecran.js réduit seulement
   la scène (--reduction) jusqu'à ce que tout rentre. */

body.tele {
  --u0: min(1vw, 1.7778vh);
  --u: var(--u0);
  --reduction: 1;
  font-size: calc(2.2 * var(--u));
  overflow: hidden;
}
body.tele main {
  max-width: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 4vh 4vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.tele .logo { font-size: calc(3.4 * var(--u)); margin: 0; text-align: left; white-space: nowrap; }
body.tele h1, body.tele p { overflow-wrap: anywhere; }
/* Pas de carte penchée : la rotation ferait dépasser les coins de la scène. */
body.tele .carte, body.tele .carte:nth-of-type(even) { transform: none; }

.tele-bandeau { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: calc(1 * var(--u)) calc(2 * var(--u)); flex: none; }
.tele-compteur { font: 700 calc(2.6 * var(--u))/1 var(--titre); }
.tele-rejoindre { display: flex; align-items: center; gap: calc(1 * var(--u)); background: #fff; border-radius: calc(1 * var(--u)); padding: calc(.6 * var(--u)) calc(1 * var(--u)); box-shadow: calc(.25 * var(--u)) calc(.35 * var(--u)) 0 rgba(0, 120, 191, .7); }
.tele-rejoindre img { width: calc(8 * var(--u)); height: calc(8 * var(--u)); image-rendering: pixelated; }
.tele-rejoindre .petit { font-size: calc(1.2 * var(--u)); }
.tele-code { font: 700 calc(2.8 * var(--u))/1 var(--titre); letter-spacing: .2em; }

/* La scène (tout sauf le bandeau et l'aide) est la seule partie réduite. */
.tele-scene, main > .tele-centre {
  --u: calc(var(--u0) * var(--reduction));
  font-size: calc(2.2 * var(--u));
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: calc(1.35 * var(--u)); min-height: 0; min-width: 0; overflow: hidden;
}
.tele-centre { flex: 1; min-width: 0; max-width: 100%; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(1.125 * var(--u)); text-align: center; }
.tele-centre h1 { font-size: calc(5 * var(--u)); }
.tele-centre .logo { font-size: calc(5 * var(--u)); text-align: center; }
.tele-centre .classement { width: min(calc(70 * var(--u)), 100%); }
.tele-formulaire { display: flex; gap: calc(2 * var(--u)); width: min(calc(70 * var(--u)), 100%); }
.tele-formulaire .champ-code { font-size: calc(4 * var(--u)); }
.tele-formulaire .bouton { width: auto; font-size: calc(2.6 * var(--u)); padding: 0 calc(3 * var(--u)); }
body.tele .erreur { font-size: calc(2 * var(--u)); }

/* Au tour de… */
.tele-choixNiveau { flex-direction: row; align-items: center; gap: calc(5 * var(--u)); }
.tele-tour { flex: 1; display: flex; flex-direction: column; align-items: center; gap: calc(0.844 * var(--u)); text-align: center; font-size: calc(2.6 * var(--u)); }
.tele-tour h1 { font-size: calc(7 * var(--u)); }
.tele-tour .avatar.grand { width: calc(10.125 * var(--u)); height: calc(10.125 * var(--u)); font-size: calc(5.625 * var(--u)); }
.tele-tour .avatar.grand .accessoire { font-size: calc(3.938 * var(--u)); top: calc(-2.25 * var(--u)); right: calc(-1.688 * var(--u)); }
.tele-discret { opacity: .7; }
.tele-cote { flex: 1; }

/* Classement, podium */
body.tele .ligne { padding: calc(0.675 * var(--u)) calc(1.2 * var(--u)); border-radius: calc(1 * var(--u)) calc(.4 * var(--u)) calc(1.2 * var(--u)) calc(.5 * var(--u)); }
body.tele .ligne .rang, body.tele .ligne .nom, body.tele .ligne .score { font-size: calc(2.6 * var(--u)); }
body.tele .ligne .rang { width: calc(3 * var(--u)); }
body.tele .ligne .avatar { width: calc(4.5 * var(--u)); height: calc(4.5 * var(--u)); font-size: calc(2.3 * var(--u)); }
body.tele .ligne .avatar .accessoire { font-size: calc(1.8 * var(--u)); top: calc(-1 * var(--u)); right: calc(-.9 * var(--u)); }
body.tele .podium { width: min(calc(80 * var(--u)), 100%); gap: calc(2 * var(--u)); margin: calc(1.125 * var(--u)) 0 0; }
body.tele .marche { max-width: none; }
body.tele .marche .nom { font-size: calc(3 * var(--u)); }
body.tele .marche .score { font-size: calc(2 * var(--u)); }
body.tele .marche .socle { font-size: calc(5 * var(--u)); }
body.tele .marche .avatar.grand { width: calc(6.75 * var(--u)); height: calc(6.75 * var(--u)); font-size: calc(3.375 * var(--u)); }
body.tele .marche .avatar.grand .accessoire { font-size: calc(2.812 * var(--u)); top: calc(-1.688 * var(--u)); right: calc(-1.125 * var(--u)); }

/* Question */
.tele-joueur { display: flex; align-items: center; gap: calc(1.2 * var(--u)); }
.tele-joueur .nom { font: 700 calc(3 * var(--u))/1 var(--titre); }
.tele-joueur .avatar { width: calc(5.5 * var(--u)); height: calc(5.5 * var(--u)); font-size: calc(3 * var(--u)); }
.tele-joueur .avatar .accessoire { font-size: calc(2.4 * var(--u)); top: calc(-1.2 * var(--u)); right: calc(-1 * var(--u)); }
.tele-niveau { font: 700 calc(1.8 * var(--u))/1 var(--titre); padding: calc(0.45 * var(--u)) calc(1 * var(--u)) calc(0.281 * var(--u)); border-radius: calc(.8 * var(--u)) calc(.3 * var(--u)) calc(.9 * var(--u)) calc(.4 * var(--u)); color: var(--encre); }
body.tele .chrono .piste { height: calc(1.35 * var(--u)); border-radius: calc(1.125 * var(--u)); }
body.tele .chrono .secondes { font-size: calc(3.4 * var(--u)); min-width: calc(7 * var(--u)); }
.tele-enonce { font: 700 calc(3.6 * var(--u))/1.15 var(--titre); padding: calc(1.688 * var(--u)) calc(2.5 * var(--u)); }
.tele-propositions { display: grid; grid-template-columns: 1fr 1fr; gap: calc(1.125 * var(--u)) calc(2 * var(--u)); }
body.tele .proposition { min-height: calc(6.188 * var(--u)); font-size: calc(2.6 * var(--u)); padding: calc(0.844 * var(--u)) calc(1.5 * var(--u)); gap: calc(1.5 * var(--u)); cursor: default; }
body.tele .proposition .lettre { width: calc(4.4 * var(--u)); height: calc(4.4 * var(--u)); font-size: calc(2.4 * var(--u)); }
.tele-verdict { display: flex; align-items: center; justify-content: center; gap: calc(2 * var(--u)); }
body.tele .verdict { font-size: calc(3.4 * var(--u)); }
body.tele .bulle { font-size: calc(2 * var(--u)); max-width: calc(45 * var(--u)); }
.tele-decision { text-align: center; }
.tele-decision h1 { font-size: calc(7 * var(--u)); color: var(--faux); }
.tele-decision p { font-size: calc(3 * var(--u)); }
.tele-appel { font: 700 calc(2.4 * var(--u))/1.2 var(--titre); text-align: center; }

/* On se connaît */
.tele-secrets { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(26 * var(--u)), 1fr)); gap: calc(0.9 * var(--u)) calc(2 * var(--u)); width: min(calc(86 * var(--u)), 100%); }
body.tele .tele-secrets .ligne.fini { background: #E3F6EC; }
.tele-enonce-long { font-size: calc(3 * var(--u)); white-space: pre-line; }
.tele-vises { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: calc(1.5 * var(--u)); font: 700 calc(3 * var(--u))/1.1 var(--titre); }
.tele-vise { display: inline-flex; align-items: center; gap: calc(1 * var(--u)); background: var(--juste); color: #fff; padding: calc(0.562 * var(--u)) calc(1.5 * var(--u)); border-radius: calc(1 * var(--u)) calc(.4 * var(--u)) calc(1.2 * var(--u)) calc(.5 * var(--u)); }
.tele-vise .avatar { width: calc(5 * var(--u)); height: calc(5 * var(--u)); font-size: calc(2.6 * var(--u)); }
.tele-scores .classement { grid-template-columns: repeat(auto-fit, minmax(calc(22 * var(--u)), 1fr)); }
body.tele .tele-scores .ligne .rang, body.tele .tele-scores .ligne .nom, body.tele .tele-scores .ligne .score { font-size: calc(2 * var(--u)); }

/* Écran en hauteur (téléphone recopié, écran d'ordinateur vertical) : une
   seule colonne, avec une unité tirée de la largeur. */
@media (max-aspect-ratio: 1/1) {
  body.tele { --u0: min(1.9vw, 1.2vh); }
  .tele-choixNiveau { flex-direction: column; gap: calc(2 * var(--u)); }
  .tele-propositions { grid-template-columns: 1fr; }
  .tele-bandeau .tele-compteur { order: 3; flex: 1 0 100%; text-align: center; }
  body.tele .podium { width: 100%; }
}
.tele-suivi { font: 700 calc(1.5 * var(--u))/1.1 var(--titre); }
/* Une ligne d'explication, lisible à 3 mètres. */
.tele-aide { font: 700 calc(1.9 * var(--u))/1.25 var(--texte); text-align: center; background: #fff; border-radius: calc(1 * var(--u)) calc(.4 * var(--u)) calc(1.2 * var(--u)) calc(.5 * var(--u)); padding: calc(0.562 * var(--u)) calc(1.5 * var(--u)); margin-top: calc(0.844 * var(--u)); box-shadow: calc(.25 * var(--u)) calc(.35 * var(--u)) 0 rgba(255, 72, 176, .7); }

/* Cartes (protocole 4) : la carte jouée, le nombre de cartes de chacun. */
.tele-carte { font: 700 calc(2.4 * var(--u))/1.2 var(--titre); text-align: center; margin: 0; }
body.tele .ligne .nombre-cartes { font-size: calc(2 * var(--u)); }
