:root {
  --fond: #10131c;
  --texte: #ffffff;
  --accent: #ffd23f;
  --doux: #9fb0c8;
  --police: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font-family: var(--police); }

#stage {
  position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px;
  background: var(--fond); color: var(--texte); overflow: hidden;
}

#noir { position: absolute; inset: 0; background: #000; z-index: 20; }

/* ---------- Diapo ---------- */
.diapo {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 18px;
  padding: 28px 60px 32px; text-align: center;
}
.d-titre { margin: 0; font-size: 84px; line-height: 1.05; font-weight: 800; letter-spacing: .5px; }
.devinette .d-titre { color: var(--accent); }
.d-visuel { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.d-legende { font-size: 56px; line-height: 1.15; font-weight: 700; }
.d-legende:empty { display: none; }
.d-sous { font-size: 40px; color: var(--accent); font-weight: 600; margin-top: 6px; }
.message { font-size: 52px; color: var(--doux); max-width: 1200px; }

svg.cadre {
  height: 100%; width: auto; max-width: 100%; aspect-ratio: 16 / 9;
  border: 8px solid #fff; border-radius: 6px; background: #fff; display: block;
}
svg.schema { border-radius: 20px; display: block; }

.duo { height: 100%; width: 100%; display: flex; gap: 36px; align-items: center; justify-content: center; }
.duo > .cadre { height: auto; width: 60%; }
.duo > .cadre:only-child { height: 100%; width: auto; }
.duo > .schema { width: 34%; height: auto; }
.duo > .schema:only-child, .duo.deux > .schema { width: 44%; }

.accueil .d-titre { font-size: 110px; color: var(--accent); }
.d-code { font-size: 34px; color: var(--doux); font-weight: 400; }
.d-code b { color: #fff; letter-spacing: 6px; }

/* Récapitulatif */
.grille { display: grid; gap: 18px 24px; width: 100%; align-content: center; }
.grille.g10 { grid-template-columns: repeat(5, 1fr); }
.grille.g6 { grid-template-columns: repeat(3, 1fr); padding: 0 120px; }
.grille.g3 { grid-template-columns: repeat(3, 1fr); }
.grille figure { margin: 0; }
.grille svg.cadre { width: 100%; height: auto; border-width: 5px; }
.grille figcaption { font-size: 30px; font-weight: 700; margin-top: 6px; }

/* Activité vignettes */
.pellicule { display: flex; gap: 28px; padding: 40px 34px; background: #222; border-radius: 16px;
  border-top: 22px dashed #444; border-bottom: 22px dashed #444; }
.case { width: 250px; aspect-ratio: 16 / 9; border: 6px dashed #fff; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 90px; font-weight: 800; color: var(--accent); }

/* Quiz */
.cartes { display: flex; gap: 70px; }
.carte { width: 300px; height: 300px; border-radius: 36px; display: flex; align-items: center; justify-content: center; }
.quiz { display: flex; gap: 40px; height: 100%; width: 100%; align-items: center; justify-content: center; }
.quiz > svg.cadre { height: auto; width: 60%; }
.options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 26px; width: 36%; }
.options li {
  display: flex; align-items: center; gap: 22px; background: var(--c); border-radius: 22px;
  padding: 20px 26px; font-size: 46px; font-weight: 800; text-align: left; transition: all .3s;
}
.options li.fausse { opacity: .22; }
.options li.bonne { outline: 8px solid #fff; transform: scale(1.06); }

/* Vidéo */
.video { padding: 0; background: #000; }
.video iframe, .video video { width: 100%; height: 100%; border: 0; background: #000; }

/* Film des vignettes */
#film { position: absolute; inset: 0; background: #000; z-index: 10; }
.film-image { width: 100%; height: 100%; display: block; }
.film-badge { position: absolute; top: 24px; right: 30px; display: flex; align-items: center; gap: 14px;
  background: rgba(0, 0, 0, .5); padding: 8px 18px; border-radius: 16px; color: #fff; font-size: 40px; font-weight: 800; }
.film-decompte { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 320px; font-weight: 800; color: #fff; }
.verdict { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(16, 19, 28, .88); text-align: center; }
.verdict h1 { font-size: 104px; margin: 0 0 20px; }
.verdict p { font-size: 54px; margin: 0; color: #fff; }
.verdict.ok h1 { color: #7ee08a; }
.verdict.ko h1 { color: #ffb347; }

/* ---------- Outils (visibles quand la souris bouge) ---------- */
#outils { position: fixed; top: 12px; right: 12px; display: flex; gap: 8px; opacity: 0; transition: opacity .3s; z-index: 30; }
body.souris #outils { opacity: 1; }
#outils button { font-size: 26px; width: 52px; height: 52px; border-radius: 12px; border: 0; background: rgba(255,255,255,.15); color: #fff; cursor: pointer; }
#statut { position: fixed; bottom: 8px; right: 12px; font: 14px var(--police); color: #fff; opacity: .45; z-index: 30; }
#statut.ok::before, #statut.attente::before, #statut.hors::before { content: "●"; margin-right: 6px; }
#statut.ok::before { color: #4cd964; }
#statut.attente::before { color: #ffb000; }
#statut.hors::before { color: #ff5a5a; }

/* ---------- Paramètres ---------- */
dialog { width: min(640px, 94vw); max-height: 92vh; border: 0; border-radius: 18px; padding: 24px 28px; font: 17px/1.4 var(--police); color: #1b1f2a; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin: 0 0 14px; }
dialog label { display: block; margin: 10px 0; font-weight: 600; }
dialog label.ligne { font-weight: 400; }
dialog select, dialog input[type=url], dialog input[type=file] { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 6px; }
dialog fieldset { border: 1px solid #d5d9e2; border-radius: 12px; margin: 14px 0; }
dialog legend { font-weight: 700; padding: 0 6px; }
dialog button { font: inherit; padding: 8px 16px; border-radius: 10px; border: 1px solid #b8bfcc; background: #f3f5f9; cursor: pointer; }
dialog button.principal { background: #1b1f2a; color: #fff; border: 0; }
.aide { color: #5b6476; font-size: 15px; margin: 6px 0; }
.code-grand { font-size: 44px; font-weight: 800; letter-spacing: 10px; margin: 4px 0 10px; }
.version { color: #5b6476; font-size: 14px; }

/* QR code (accueil et paramètres) */
.qr { background: #fff; border-radius: 20px; padding: 18px 18px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 300px; flex: none; }
.qr svg { width: 264px; height: 264px; display: block; }
.qr span { color: #1b1f2a; font-size: 26px; font-weight: 800; }
.accueil .duo > .cadre { width: auto; height: 100%; max-width: calc(100% - 340px); }
.qr-reglages svg { width: 180px; height: 180px; }

/* 8 vignettes */
.pellicule.n8 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 28px; }
.pellicule.n8 .case { width: 230px; font-size: 72px; }

.film-decompte { flex-direction: column; }
.film-decompte small { font-size: 90px; color: var(--accent); }

/* Tableau des groupes */
.recap-groupes { position: absolute; inset: 0; background: var(--fond); padding: 40px 80px; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.recap-groupes h1 { font-size: 84px; margin: 0 0 20px; color: var(--accent); }
.recap-groupes table { border-collapse: collapse; font-size: 46px; font-weight: 700; }
.recap-groupes th { text-align: left; padding: 6px 30px 6px 0; white-space: nowrap; }
.recap-groupes td { padding: 6px 16px; }
.recap-groupes td svg { margin: 0 3px; vertical-align: middle; }
.recap-groupes tr.ok td:last-child { color: #7ee08a; }
.recap-groupes tr.ko td:last-child { color: #ffb347; }
.recap-groupes p { font-size: 44px; font-weight: 700; margin-top: 24px; }

/* Mouvements : schéma de côté + vue de dessus empilés */
.duo > .pile { width: 34%; display: flex; flex-direction: column; gap: 18px; }
.duo > .pile > svg.schema { width: 100%; height: auto; }
.duo > .cadre:has(+ .pile) { width: 60%; height: auto; }
