/* quiz.charbon.studio — sombre seulement : on vote dans une salle de cinéma, l'écran du téléphone ne doit pas éclairer la salle. */
@font-face {
  font-family: "Josefin Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(fonts/josefin-sans-latin.woff2) format("woff2");
}

:root {
  --fond: #000;
  --surface: #0d0d10;
  --surface-2: #15151a;
  --bord: #26262e;
  --texte: #ededf2;
  --doux: #a2a2b0;
  --faible: #6a6a78;
  --tuile: #f1f1ee;
  --encre: #0b0b0b;
  --magenta: #ff3ddc;
  --cyan: #38e4ff;
  --juste: #62f08a;
  --faux: #ff6b6b;
  --c-35mm: #ffb83d;
  --c-xenon: #7fe7ff;
  --c-laser_phosphore: #c6ff3d;
  --c-laser_rgb: #ff4fe0;
  --titre: "Josefin Sans", "Futura", "Avenir Next", "Century Gothic", system-ui, sans-serif;
  --corps: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rayon: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.45 var(--corps);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* grain de pellicule, fixe (pas d'animation : la batterie) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
}
/* halo de couleur, comme les photogrammes de l'affiche */
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(40% 30% at 0% 10%, rgba(255, 61, 220, .16), transparent 70%),
    radial-gradient(40% 30% at 100% 30%, rgba(56, 228, 255, .13), transparent 70%),
    radial-gradient(45% 30% at 10% 100%, rgba(98, 240, 138, .10), transparent 70%),
    radial-gradient(40% 25% at 100% 95%, rgba(255, 184, 61, .10), transparent 70%);
}

button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}
.app.admin { max-width: 1120px; }

.ecran { animation: entree .35s ease-out both; }
.ecran.sans-anim { animation: none; }
@keyframes entree { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ecran, .point { animation: none !important; } }

.sur-titre {
  margin: 0 0 18px;
  text-align: center;
  font: 600 13px/1 var(--titre);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--doux);
}
.question {
  margin: 0 0 6px;
  text-align: center;
  font: 700 clamp(28px, 8.4vw, 40px)/1.05 var(--titre);
  letter-spacing: .01em;
}
.texte { color: var(--doux); text-align: center; margin: 10px auto 0; max-width: 34em; }

/* ---------- titre en tuiles, comme l'affiche */
.tuiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin: 6px 0 22px;
}
.tuiles .mot { display: inline-flex; gap: 3px; }
.tuiles b {
  display: inline-block;
  min-width: 1.02em;
  padding: .2em .08em 0;
  background: var(--tuile);
  color: var(--encre);
  font: 700 clamp(21px, 6.4vw, 38px)/1 var(--titre);
  text-transform: uppercase;
  text-align: center;
  box-shadow: -2px 0 0 var(--magenta), 2px 0 0 var(--cyan);
}
.tuiles.petites b { font-size: 19px; box-shadow: -1.5px 0 0 var(--magenta), 1.5px 0 0 var(--cyan); }

/* ---------- les quatre projecteurs */
.choix { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.carte {
  --c: var(--doux);
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 78px;
  padding: 12px 16px;
  border: 1.5px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, opacity .15s, transform .08s, box-shadow .15s;
}
.carte:active { transform: scale(.985); }
.carte:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.carte .icone { color: var(--c); width: 64px; height: 30px; }
.carte .icone svg { width: 100%; height: 100%; display: block; overflow: visible; }
.carte .nom { display: block; font: 700 21px/1.1 var(--titre); padding-top: 3px; }
.carte .sous { display: block; color: var(--faible); font-size: 13.5px; margin-top: 2px; }
.carte .coche {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--bord);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: var(--encre);
}
.choix.vote-fait .carte:not(.choisie) { opacity: .45; }
.carte.choisie {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 11%, var(--surface));
  box-shadow: 0 0 0 1px var(--c), 0 0 26px -6px var(--c);
}
.carte.choisie .coche { background: var(--c); border-color: var(--c); }
.carte.choisie .coche::after { content: "✓"; }
.carte.envoi .coche { animation: pulse 0.9s ease-in-out infinite; }
.choix.legende .carte { cursor: default; min-height: 62px; opacity: .8; }
.choix.legende .carte .coche { display: none; }
.choix.legende .carte:active { transform: none; }

.c-35mm { --c: var(--c-35mm); }
.c-xenon { --c: var(--c-xenon); }
.c-laser_phosphore { --c: var(--c-laser_phosphore); }
.c-laser_rgb { --c: var(--c-laser_rgb); }

/* ---------- progression des séquences */
.progression { display: flex; justify-content: center; gap: 6px; margin: 0 0 14px; }
.progression i { width: 22px; height: 4px; border-radius: 2px; background: var(--bord); }
.progression i.fait { background: var(--doux); }
.progression i.courant { background: var(--texte); box-shadow: 0 0 10px rgba(255, 255, 255, .6); }
.numero {
  text-align: center;
  font: 600 14px/1 var(--titre);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--doux);
  margin: 0 0 10px;
}

.statut {
  min-height: 3em;
  margin: 18px 4px 0;
  text-align: center;
  color: var(--doux);
  font-size: 15px;
}
.statut.ok { color: var(--texte); }
.statut.alerte { color: var(--faux); }

.attente-point { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; color: var(--doux); font-size: 15px; text-align: left; }
.point { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--juste); box-shadow: 0 0 12px var(--juste); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.reseau {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 7px 14px;
  border-radius: 999px;
  background: #2a1414;
  border: 1px solid #5a2525;
  color: #ffb3b3;
  font-size: 13.5px;
  white-space: nowrap;
}

/* ---------- résultats du spectateur */
.score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 6px;
  font-family: var(--titre);
}
.score .n {
  font-weight: 700;
  font-size: clamp(88px, 30vw, 132px);
  line-height: .9;
  text-shadow: -3px 0 0 var(--magenta), 3px 0 0 var(--cyan);
}
.score .sur { font-weight: 600; font-size: 26px; color: var(--doux); }
.verdict { text-align: center; font: 700 24px/1.2 var(--titre); margin: 6px 0 4px; }
.salle { text-align: center; color: var(--doux); margin: 0 0 22px; font-size: 15px; }

.details { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.detail {
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  padding: 13px 14px 12px;
}
.detail .tete { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.detail .marque {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: var(--encre);
}
.detail .marque.juste { background: var(--juste); }
.detail .marque.faux { background: var(--faux); }
.detail .marque.vide { background: var(--bord); color: var(--doux); }
.detail .titre { font: 700 17px/1.15 var(--titre); padding-top: 2px; }
.detail .titre small { display: block; font: 13.5px/1.3 var(--corps); color: var(--doux); }

/* barres */
.barres { display: grid; gap: 5px; }
.barre {
  display: grid;
  grid-template-columns: minmax(96px, 9.5em) 1fr 3.4em;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--doux);
}
.barre .lib { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre .piste { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.barre .rempli { height: 100%; width: 0; border-radius: 4px; background: var(--faible); transition: width .5s ease-out; }
.barre .val { text-align: right; font-variant-numeric: tabular-nums; }
.barre.bonne { color: var(--texte); }
.barre.bonne .rempli { background: var(--c); box-shadow: 0 0 10px -2px var(--c); }
.barre.bonne .lib::after { content: " ✓"; color: var(--c); }
.barre.mien .lib { text-decoration: underline; text-decoration-color: var(--doux); text-underline-offset: 3px; }

.pied { margin-top: 28px; text-align: center; color: var(--faible); font-size: 13px; }
.pied a { color: var(--doux); }

/* ---------- admin */
.admin .barre-haut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 18px;
}
.admin .barre-haut .tuiles { margin: 0; justify-content: flex-start; }
.admin .barre-haut .espace { flex: 1; }
.pastille {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--bord);
  background: var(--surface);
  color: var(--doux);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.pastille strong { color: var(--texte); }
.pastille .point { width: 8px; height: 8px; }

.grille { display: grid; gap: 16px; }
@media (min-width: 900px) { .grille { grid-template-columns: 1.25fr 1fr; align-items: start; } }
.bloc {
  border: 1px solid var(--bord);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 18px;
}
.bloc h2 {
  margin: 0 0 14px;
  font: 600 13px/1 var(--titre);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--doux);
}
.phase { font: 700 clamp(26px, 4vw, 38px)/1.1 var(--titre); margin: 0 0 4px; }
.phase-sous { color: var(--doux); margin: 0 0 16px; }
.admin .barre { grid-template-columns: minmax(96px, 9.5em) 1fr 6.2em; }
.admin .barres.grandes { gap: 10px; margin: 6px 0 4px; }
.admin .barres.grandes .barre { grid-template-columns: minmax(120px, 11em) 1fr 6.5em; font-size: 17px; }
.admin .barres.grandes .piste { height: 16px; border-radius: 8px; }
.admin .barres.grandes .rempli { border-radius: 8px; }
.admin .barre .rempli { background: var(--c); opacity: .55; }
.admin .barre.bonne .rempli { opacity: 1; }
.admin .masque .barre.bonne .rempli { opacity: .55; box-shadow: none; }
.admin .masque .barre.bonne .lib::after { content: ""; }
.admin .masque .barre.bonne { color: var(--doux); }

.boutons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn {
  appearance: none;
  border: 1.5px solid var(--bord);
  background: var(--surface-2);
  color: var(--texte);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--doux); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.principal {
  background: var(--tuile);
  border-color: var(--tuile);
  color: var(--encre);
  font: 700 19px/1 var(--titre);
  padding: 16px 22px 13px;
  box-shadow: -3px 0 0 var(--magenta), 3px 0 0 var(--cyan);
}
.btn.principal:hover { background: #fff; }
.btn.danger { border-color: #5a2525; color: #ffb3b3; background: #1a0c0c; }
.btn.danger:hover { border-color: var(--faux); }
.btn.discret { background: transparent; color: var(--doux); }

.tableau { width: 100%; border-collapse: collapse; font-size: 15px; }
.tableau th { text-align: left; color: var(--faible); font-weight: 500; font-size: 13px; padding: 0 8px 8px 0; }
.tableau td { padding: 9px 8px 9px 0; border-top: 1px solid var(--bord); vertical-align: middle; font-variant-numeric: tabular-nums; }
.tableau tr.courante td { background: rgba(255, 255, 255, .035); }
.tableau td.num { width: 2.2em; color: var(--doux); }
.puce {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 2px;
  border-radius: 999px;
  border: 1px solid var(--c);
  color: var(--c);
  font: 600 13px/1.3 var(--titre);
  white-space: nowrap;
}
.puce.vide { --c: var(--faible); }
.empile { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); min-width: 90px; }
.empile span { height: 100%; background: var(--c); opacity: .8; }

.prep { display: grid; gap: 8px; }
.prep-ligne { display: grid; grid-template-columns: 2.6em 1fr; align-items: center; gap: 8px; }
.prep-ligne .n { color: var(--doux); font-variant-numeric: tabular-nums; }
.segments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.segments button {
  appearance: none;
  border: 1.5px solid var(--bord);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 4px 6px;
  font: 600 13.5px/1.15 var(--titre);
  color: var(--doux);
  cursor: pointer;
}
.segments button.on { border-color: var(--c); color: var(--encre); background: var(--c); }
details.repli > summary { cursor: pointer; list-style: none; }
details.repli > summary::-webkit-details-marker { display: none; }
details.repli > summary h2 { display: inline; }
details.repli > summary::after { content: " ▸"; color: var(--faible); }
details.repli[open] > summary::after { content: " ▾"; }
details.repli[open] > summary { margin-bottom: 14px; }
.note { color: var(--faible); font-size: 13.5px; margin: 10px 0 0; }
.interrupteur { display: inline-flex; align-items: center; gap: 8px; color: var(--doux); font-size: 14px; cursor: pointer; user-select: none; }
.interrupteur input { accent-color: var(--cyan); width: 18px; height: 18px; }

.qr-plein {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vh;
  padding: 4vh 16px;
  cursor: zoom-out;
}
.qr-plein img { width: min(62vh, 82vw); height: auto; aspect-ratio: 1; image-rendering: pixelated; background: #fff; border-radius: 1.2vh; }
.qr-plein .adresse { font: 700 clamp(28px, 6vh, 72px)/1 var(--titre); letter-spacing: .02em; }
.qr-plein .consigne { color: var(--doux); font-size: clamp(16px, 2.6vh, 28px); }
.erreur-admin { text-align: center; margin-top: 18vh; }
@media (max-width: 600px) {
  .admin .barres.grandes .barre { grid-template-columns: 7.6em 1fr 5.4em; font-size: 15px; }
  .admin .barre { grid-template-columns: 7.6em 1fr 5.4em; }
  .admin .barre-haut { gap: 8px 10px; }
}
