/* ==================================================================
   Hawkins Quiz — feuille de style
   Tout l'habillage est dessiné à la main : aucune image externe.
================================================================== */

:root {
  --void: #06070c;
  --ink: #0b0d15;
  --paper: #efe6d6;
  --blood: #e8112d;
  --blood-soft: #ff4b4b;
  --amber: #ffb648;
  --teal: #38d9c4;
  --violet: #8a6bff;

  --bg: #08090f;
  --bg-2: #10121d;
  --fg: #efe6d6;
  --muted: #9aa0b4;
  --accent: #e8112d;
  --accent-2: #ffb648;
  --line: rgba(239, 230, 214, .12);

  --glow: 0 0 12px rgba(232, 17, 45, .55), 0 0 42px rgba(232, 17, 45, .25);
  --radius: 14px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --tilt: 0deg;
  --hue: 0deg;
}

/* ---------- Thèmes par phase ---------- */
body.phase-1 { --bg: #0b0a10; --bg-2: #17121a; --accent: #e8112d; --accent-2: #ffb648; }
body.phase-2 { --bg: #04100d; --bg-2: #0a1c18; --accent: #2ee6a8; --accent-2: #7ef9d0; --fg: #dff7ee;
  --glow: 0 0 12px rgba(46, 230, 168, .5), 0 0 42px rgba(46, 230, 168, .2); }
body.phase-3 { --bg: #06030c; --bg-2: #0e0718; --accent: #b14cff; --accent-2: #ff3b7b; --fg: #e6dcf5;
  --glow: 0 0 14px rgba(177, 76, 255, .55), 0 0 50px rgba(177, 76, 255, .25); --tilt: -1.1deg; }

/* ---------- Mode Monde à l'Envers : tout le jeu bascule ---------- */
body.ud.phase-1 { --bg: #07030e; --bg-2: #140a26; --accent: #7a3cff; --accent-2: #ff4d8d; --fg: #e4d9f7;
  --glow: 0 0 13px rgba(122, 60, 255, .5), 0 0 44px rgba(122, 60, 255, .22); --tilt: -.55deg; }
body.ud.phase-2 { --bg: #060310; --bg-2: #11072a; --accent: #9b3cff; --accent-2: #ff3b7b; --fg: #e4dcf7;
  --glow: 0 0 14px rgba(155, 60, 255, .55), 0 0 46px rgba(155, 60, 255, .24); --tilt: -1.1deg; }
body.ud.phase-3 { --bg: #04010a; --bg-2: #0c0420; --accent: #c74cff; --accent-2: #ff2f6d; --fg: #ece2fb;
  --glow: 0 0 16px rgba(199, 76, 255, .6), 0 0 56px rgba(199, 76, 255, .3); --tilt: -1.9deg; }

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  color: var(--fg);
  background:
    radial-gradient(120% 90% at 50% -10%, var(--bg-2) 0%, var(--bg) 55%, var(--void) 100%);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background 1.1s var(--ease), color .8s var(--ease);
}

button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ---------- Calques d'ambiance ---------- */
.grain, .vignette, .spores {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
}
.grain {
  opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  background: radial-gradient(115% 85% at 50% 45%, transparent 45%, rgba(0, 0, 0, .72) 100%);
  transition: opacity .8s var(--ease);
}
body.phase-2 .vignette { background: radial-gradient(115% 85% at 50% 45%, transparent 35%, rgba(0, 12, 8, .85) 100%); }
body.phase-3 .vignette { background: radial-gradient(100% 75% at 50% 45%, transparent 22%, rgba(4, 0, 10, .94) 100%); }
body.ud .vignette { background: radial-gradient(96% 72% at 50% 45%, transparent 16%, rgba(3, 0, 8, .95) 100%); }
body.ud .vignette { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .78; } }

/* Scanlines CRT à partir du labo */
body.phase-2::after, body.phase-3::after, body.ud::after {
  content: ""; position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: .3;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .045) 0 1px, transparent 1px 3px);
}

/* Spores du Monde à l'Envers */
.spores { opacity: 0; transition: opacity 1.4s var(--ease); z-index: 1; }
body.phase-3 .spores, body.ud .spores { opacity: 1; }
.spore {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, rgba(200, 170, 255, .55) 45%, transparent 70%);
  filter: blur(.4px);
  animation: drift linear infinite;
}
@keyframes drift {
  from { transform: translate3d(0, 110svh, 0) scale(.7); opacity: 0; }
  10%  { opacity: .85; }
  90%  { opacity: .6; }
  to   { transform: translate3d(30px, -12svh, 0) scale(1.15); opacity: 0; }
}

/* ---------- Structure ---------- */
#app {
  position: relative; z-index: 4;
  width: min(760px, 100% - 2rem);
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0 1rem;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  transform: rotate(var(--tilt));
  transition: transform 1.2s var(--ease);
}

.screen { display: none; animation: fadeUp .55s var(--ease) both; }
.screen.is-active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Titre ---------- */
.brand { text-align: center; margin-bottom: 1.4rem; }
.brand__kicker {
  margin: 0 0 .4rem; font-size: .72rem; letter-spacing: .42em; text-transform: uppercase;
  color: var(--muted);
}
.brand__title {
  margin: 0; font-family: "Rozha One", Georgia, serif; font-weight: 400;
  line-height: .85; letter-spacing: .01em;
  display: flex; flex-direction: column; align-items: center; gap: .1em;
}
.brand__word {
  font-size: clamp(3rem, 12vw, 6rem);
  color: #16060a;
  -webkit-text-stroke: 2px var(--accent);
  text-shadow: var(--glow);
  animation: flicker 7s steps(1) infinite;
}
.brand__word--sub {
  font-size: clamp(1.6rem, 5.5vw, 2.6rem);
  letter-spacing: .48em; text-indent: .48em;
  -webkit-text-stroke: 1.2px var(--accent);
  animation-delay: 1.3s;
}
.brand__title { cursor: pointer; -webkit-user-select: none; user-select: none; }
@keyframes flicker {
  0%, 42%, 46%, 58%, 100% { opacity: 1; }
  43%, 57% { opacity: .72; }
  44% { opacity: .35; }
}
.brand__tag {
  margin: 1rem auto 0; max-width: 46ch; color: var(--muted);
  font-size: .95rem; line-height: 1.6;
}

/* ---------- Mur d'alphabet ---------- */
.wall {
  --bulb: 13px;
  position: relative;
  margin: 1.6rem auto .6rem;
  padding: 1.1rem clamp(.6rem, 3vw, 1.6rem) .9rem;
  max-width: 620px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(92, 58, 24, .10) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(255, 240, 210, .16) 0 22px, transparent 22px 44px),
    linear-gradient(165deg, #e2d2b6, #c9b394 60%, #bda587);
  box-shadow: inset 0 0 70px rgba(70, 38, 12, .5), inset 0 2px 0 rgba(255, 250, 235, .35), 0 22px 45px -28px #000;
}
body.phase-3 .wall { filter: saturate(.35) brightness(.55) hue-rotate(230deg); }
/* En mode Monde à l'Envers, le mur de l'intro reste assez clair pour rester jouable. */
body.ud #wall { filter: saturate(.5) brightness(.6) hue-rotate(208deg) contrast(1.3); }
/* Le mur du verdict reste lisible : c'est le moment de récompense. */
body.phase-3 #wallResult, body.ud #wallResult { filter: saturate(.8) brightness(.85) hue-rotate(195deg); }
/* Le mur de jeu sert à répondre : il ne doit jamais devenir illisible. */
body.phase-3 #wallQuiz, body.ud #wallQuiz { filter: saturate(.9) brightness(.95) hue-rotate(196deg); }

.wall__row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  justify-items: center;
  margin-bottom: .45rem;
}
.wall__row:last-child { margin-bottom: 0; }

/* Le fil électrique qui zigzague derrière les ampoules.
   `2px` compense le padding haut des cellules, pour que le fil traverse
   exactement le centre des ampoules. */
.wall__row::before {
  content: ""; position: absolute; left: 1%; right: 1%;
  top: calc(2px + var(--bulb) / 2 - 1.5px); height: 3px; border-radius: 2px;
  background: linear-gradient(#3a4a2c, #1e2616);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .1);
  z-index: 0;
}
.wall__row:nth-child(1)::after, .wall__row:nth-child(2)::after {
  content: ""; position: absolute; width: 3px; border-radius: 2px;
  top: calc(2px + var(--bulb) / 2); height: calc(100% + .45rem);
  background: linear-gradient(#33412a, #1e2616);
  z-index: 0;
}
.wall__row:nth-child(1)::after { right: 1%; }
.wall__row:nth-child(2)::after { left: 1%; }

.wall__cell {
  position: relative; z-index: 1; text-align: center;
  display: block; width: 100%; min-height: 44px;
  padding: 2px 0 4px; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit;
  -webkit-user-select: none; user-select: none;
  border-radius: 8px;
  transition: background .18s;
}
.wall__cell:active { background: rgba(255, 255, 255, .18); }
.wall__cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wall--static .wall__cell { cursor: default; min-height: 0; }
/* La première rangée (A-H) n'a que 8 lettres : on la cale à droite pour que
   H tombe sous I, et que le fil descende bien dans la continuité. */
.wall__row:nth-child(1) .wall__cell:first-child { grid-column: 2; }
.wall__bulb {
  width: var(--bulb); height: var(--bulb); margin: 0 auto 4px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #5a4c3d, #2e251c 70%);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .35);
  transition: background .16s linear, box-shadow .16s linear;
}
.wall__cell.on .wall__bulb {
  background: radial-gradient(circle at 34% 30%, #fff, var(--c) 55%);
  box-shadow: 0 0 9px var(--c), 0 0 26px var(--c), 0 0 48px rgba(255, 255, 255, .18);
}
.wall__cell.on .wall__letter { color: #2a1a10; text-shadow: 0 0 12px var(--c); }
.wall__letter {
  font-family: "Rozha One", Georgia, serif;
  font-size: clamp(.78rem, 2.4vw, 1.1rem);
  color: rgba(48, 30, 16, .6);
  transition: color .16s linear, text-shadow .16s linear;
}
.wall__caption {
  text-align: center; color: var(--muted); font-size: .82rem;
  letter-spacing: .18em; text-transform: uppercase; min-height: 1.2em; margin: 0 0 1rem;
  transition: color .3s;
}
.wall__caption.is-composing { color: var(--accent-2); letter-spacing: .5em; }

/* ---------- Bascule Monde à l'Envers ---------- */
.ud-toggle {
  display: flex; align-items: center; gap: .6rem; margin: 0 auto 1rem;
  font: inherit; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  padding: .6rem 1.1rem; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--line); background: rgba(255, 255, 255, .02); color: var(--muted);
  transition: color .25s, border-color .25s, box-shadow .25s;
}
.ud-toggle__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3a3f52; transition: background .25s, box-shadow .25s;
}
.ud-toggle[aria-pressed="true"] {
  color: var(--fg); border-style: solid; border-color: var(--accent); box-shadow: var(--glow);
}
.ud-toggle[aria-pressed="true"] .ud-toggle__dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ---------- Compteur de secrets ---------- */
.secrets {
  text-align: center; margin: 0 auto 1.4rem; font-size: .68rem;
  letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.secrets i { font-style: normal; opacity: .28; margin-left: .18em; }
.secrets i.on { opacity: 1; }

/* ---------- Boutons ---------- */
.btn {
  font: inherit; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  font-size: .78rem; padding: .95rem 1.6rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--fg);
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .25s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.btn--primary { background: var(--accent); color: #12060a; border-color: var(--accent); }
body.phase-2 .btn--primary, body.phase-3 .btn--primary { color: #05100d; }
body.ud .btn--primary { color: #0a0316; }
.btn--ghost { border-color: var(--line); color: var(--muted); }
.btn--ghost:hover { color: var(--fg); border-color: var(--accent); }
.btn--next { display: block; margin: 1.4rem auto 0; }

/* Pas d'état survol sur les écrans tactiles : il resterait collé après le tap. */
@media (hover: none) {
  .btn:hover, .choice:hover:not(:disabled) { transform: none; box-shadow: none; background: rgba(255, 255, 255, .03); }
  .btn--primary:hover { background: var(--accent); }
  .only-keys { display: none; }
}

.intro__actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

.rules {
  margin: 2.2rem auto 0; padding: 1.1rem 1.4rem 1.1rem 2.4rem; max-width: 560px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
  color: var(--muted); font-size: .88rem; line-height: 1.9;
}
.rules b { color: var(--fg); }
.rules__hint { color: rgba(154, 160, 180, .62); font-style: italic; }
.only-ud { display: none; }
body.ud .only-ud { display: list-item; }
body.ud .only-normal { display: none; }
kbd {
  font: inherit; font-size: .75rem; padding: .1em .45em; border-radius: 5px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--fg);
}

/* ---------- HUD ---------- */
.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  margin-bottom: .9rem;
}
.hud__phase { display: flex; align-items: center; gap: .55rem; color: var(--fg); }
.dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent); animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; transform: scale(.78); } }
.hud__score {
  display: flex; align-items: center; gap: .4rem; color: var(--fg);
  font: inherit; font-size: .95rem; letter-spacing: 0;
  border: 0; background: none; padding: .3rem .2rem; cursor: pointer; border-radius: 8px;
}
.hud__score:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eggo { font-size: 1.1rem; filter: saturate(1.2); transition: transform .2s var(--ease); }
.hud__score:active .eggo { transform: scale(1.35) rotate(-12deg); }

/* ---------- Timer ---------- */
/* ---------- La chasse : le Démogorgon avance ---------- */
.hunt { position: relative; margin-bottom: 2rem; }
.hunt__track {
  position: relative; height: 44px; border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 60%),
    linear-gradient(90deg, #000 0%, rgba(0, 0, 0, .55) 100%);
  border: 1px solid var(--line);
}
.hunt__fill {
  position: absolute; inset: 0; border-radius: 9px; transform-origin: right center;
  background: linear-gradient(90deg, transparent, rgba(255, 214, 120, .11));
}
/* La proie : une lampe torche braquée vers l'obscurité. */
.hunt__prey { position: absolute; right: 9px; bottom: 8px; z-index: 2; }
.hunt__body {
  position: absolute; right: 0; bottom: 0; width: 5px; height: 18px; border-radius: 3px;
  background: linear-gradient(var(--fg), rgba(255, 255, 255, .2));
}
.hunt__beam {
  position: absolute; right: 5px; bottom: 5px;
  width: 0; height: 0;
  border-top: 9px solid transparent; border-bottom: 9px solid transparent;
  border-right: 34px solid rgba(255, 214, 120, .3);
  filter: blur(2px);
}
/* Le monstre : `--p` va de 0 (loin) à 1 (sur vous). */
.demo {
  position: absolute; bottom: 1px; left: calc(var(--p, 0) * 100%);
  margin-left: calc(var(--p, 0) * -42px);
  width: 38px; height: 52px; z-index: 1;
  transition: filter .4s var(--ease);
  animation: stalk 1.4s ease-in-out infinite;
}
@keyframes stalk { 50% { transform: translateY(-2px) rotate(1.5deg); } }
.demo__svg { width: 100%; height: 100%; display: block; }
.demo__torso { fill: #04030a; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.demo__limbs path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.demo .petal {
  fill: #06040c; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round;
  transform: rotate(var(--a)); transform-box: view-box; transform-origin: 28px 25px;
  transition: transform .5s var(--ease);
}
.hunt.is-close .demo .petal { transform: rotate(var(--o)); }
.hunt.is-close .demo {
  filter: drop-shadow(0 0 10px var(--accent));
  animation: lurch .3s steps(2) infinite;
}
@keyframes lurch { 50% { transform: translateY(-3px) rotate(-4deg) scale(1.06); } }
.hunt.is-caught .demo { animation: pounce .55s var(--ease) forwards; }
@keyframes pounce { to { transform: scale(3) translate(12px, 6px); opacity: 0; } }

.hunt__val {
  position: absolute; right: 2px; top: 48px;
  font-size: .68rem; letter-spacing: .16em; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hunt__val::after { content: " s"; }
.hunt.is-close .hunt__val { color: var(--accent); }

/* Flash rouge quand le chrono vous rattrape */
.strike {
  position: fixed; inset: 0; z-index: 8; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 40, 40, .5), transparent 65%);
}
.strike.is-on { animation: strike .55s var(--ease); }
@keyframes strike { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Sélecteur de mode ---------- */
.modes {
  display: grid; grid-template-columns: 1fr 1fr; gap: .6rem;
  max-width: 520px; margin: 0 auto 1rem;
}
.mode {
  font: inherit; text-align: left; cursor: pointer;
  padding: .8rem 1rem; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .02); color: var(--muted);
  transition: border-color .2s, color .2s, background .2s, box-shadow .25s;
}
.mode b {
  display: block; font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--fg); margin-bottom: .2rem;
}
.mode span { font-size: .74rem; line-height: 1.4; display: block; }
.mode.is-on { border-color: var(--accent); background: rgba(255, 255, 255, .05); box-shadow: var(--glow); }
.mode.is-on b { color: var(--accent); }
.mode:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.record {
  text-align: center; margin: 0 auto 1.4rem; font-size: .7rem;
  letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.record b { color: var(--accent-2); }

.only-survie { display: none; }
body.mode-survie .only-survie { display: list-item; }
body.mode-survie .only-enquete { display: none; }
.only-defi { display: none; }
body.mode-defi .only-defi { display: list-item; }
body.mode-defi .only-enquete, body.mode-defi .only-survie { display: none; }
body.mode-defi .seasons { opacity: .35; pointer-events: none; }
.modes { grid-template-areas: "a b" "c c"; }
.mode--wide { grid-area: c; }
.mode--done { border-style: dashed; }
.mode--done b { color: var(--accent-2) !important; }

/* ---------- Filtre par saison ---------- */
.seasons {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  flex-wrap: wrap; margin: 0 auto 1.4rem;
}
.seasons__label {
  font-size: .64rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted); margin-right: .3rem;
}
.season {
  font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  min-width: 44px; min-height: 34px; padding: .4rem .7rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .02); color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.season.is-on { color: var(--fg); border-color: var(--accent); background: rgba(255, 255, 255, .06); }
.season:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- Questions à épeler ---------- */
.spell__slots {
  display: flex; justify-content: center; align-items: flex-end;
  gap: clamp(.25rem, 1vw, .4rem); flex-wrap: nowrap; margin-bottom: 1rem;
}
.spell__slot {
  flex: 0 0 auto;
  width: clamp(26px, 8vw, 38px); height: clamp(36px, 10vw, 48px);
  display: grid; place-items: center;
  border-bottom: 3px solid var(--line); border-radius: 4px;
  font-family: "Rozha One", Georgia, serif; font-size: clamp(1.05rem, 4vw, 1.6rem); color: var(--fg);
  background: rgba(255, 255, 255, .03);
}
.spell__slot.is-next { border-bottom-color: var(--accent); animation: blink 1s steps(2) infinite; }
.spell__slot.is-ok { border-bottom-color: #2ee6a8; color: #2ee6a8; }
.spell__slot.is-ko { border-bottom-color: var(--blood); color: var(--blood-soft); }
.wall--mini { --bulb: 9px; margin: 0 auto .8rem; max-width: 480px; padding: .7rem .5rem .5rem; }
.wall--mini .wall__cell { min-height: 38px; }
.wall--mini .wall__letter { font-size: clamp(.62rem, 2.2vw, .85rem); }
.spell__hint {
  margin: 0; text-align: center; font-size: .76rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap;
}
.spell__back {
  font: inherit; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  padding: .35rem .8rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--muted);
}
.spell__back:hover { color: var(--fg); border-color: var(--accent); }

/* ---------- Saisie des initiales, façon borne d'arcade ---------- */
.initials {
  margin: 0 auto 1.6rem; max-width: 420px; text-align: center;
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 1.1rem 1rem; background: rgba(255, 255, 255, .03);
  box-shadow: var(--glow);
}
.initials__title {
  margin: 0 0 .8rem; font-size: .68rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--accent);
}
.initials__slots { display: flex; justify-content: center; gap: .7rem; margin-bottom: .7rem; }
.initials__slot {
  width: 46px; height: 58px; display: grid; place-items: center;
  border-bottom: 3px solid var(--line); border-radius: 4px;
  font-family: "Rozha One", Georgia, serif; font-size: 2rem; color: var(--fg);
  background: rgba(255, 255, 255, .03);
}
.initials__slot.is-next { border-bottom-color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { border-bottom-color: transparent; } }
.initials__hint { margin: 0 0 1rem; font-size: .78rem; color: var(--muted); }
.initials__actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.initials__actions .btn { padding: .7rem 1.2rem; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:disabled:hover { transform: none; box-shadow: none; }

/* ---------- Tableau d'honneur ---------- */
.board {
  margin: 1.6rem auto 0; max-width: 460px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, .02); padding: 1rem 1.1rem;
}
.board__title {
  margin: 0 0 .7rem; font-size: .66rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--muted); text-align: center;
}
.board__row {
  display: grid; grid-template-columns: 2ch 1fr auto auto; gap: .8rem; align-items: baseline;
  padding: .35rem 0; font-size: .84rem; color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, .05);
}
.board__row:first-of-type { border-top: 0; }
.board__row b {
  font-family: "Rozha One", Georgia, serif; font-size: 1.1rem;
  letter-spacing: .12em; color: var(--fg); font-weight: 400;
}
.board__row i { font-style: normal; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; }
.board__row span { font-variant-numeric: tabular-nums; color: var(--fg); }
.board__row.is-new { color: var(--accent-2); }
.board__row.is-new b, .board__row.is-new span { color: var(--accent-2); text-shadow: 0 0 12px var(--accent); }

/* ---------- Carte question ---------- */
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
  padding: clamp(1.2rem, 3.5vw, 2rem);
  box-shadow: 0 30px 60px -40px #000;
}
.card__level {
  margin: 0 0 .7rem; font-size: .68rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--accent);
}
.card__q {
  margin: 0 0 1.4rem; font-family: "Rozha One", Georgia, serif; font-weight: 400;
  font-size: clamp(1.35rem, 4.2vw, 1.95rem); line-height: 1.25;
}
/* En mode Monde à l'Envers, la question arrive à l'envers puis se redresse. */
body.ud .card__q { animation: unmirror .6s var(--ease) both; transform-origin: center; }
@keyframes unmirror {
  from { transform: scaleX(-1) skewX(6deg); opacity: .25; filter: blur(2px); }
  to { transform: none; opacity: 1; filter: none; }
}

.choices { display: grid; gap: .6rem; }
.choice {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left;
  font: inherit; color: var(--fg); cursor: pointer;
  min-height: 52px; padding: .85rem 1rem; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03);
  -webkit-user-select: none; user-select: none;
  transition: border-color .2s, background .2s, transform .12s var(--ease);
}
.choice:hover:not(:disabled) { border-color: var(--accent); transform: translateX(4px); background: rgba(255, 255, 255, .06); }
.choice:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.choice:disabled { cursor: default; }
.choice__key {
  flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 6px; font-size: .72rem; font-weight: 700;
  background: rgba(255, 255, 255, .07); color: var(--muted);
}
.choice.is-correct { border-color: #2ee6a8; background: rgba(46, 230, 168, .14); }
.choice.is-correct .choice__key { background: #2ee6a8; color: #04120d; }
.choice.is-wrong { border-color: var(--blood); background: rgba(232, 17, 45, .13); }
.choice.is-wrong .choice__key { background: var(--blood); color: #fff; }
.choice.is-faded { opacity: .4; }

.reveal {
  margin-top: 1.1rem; padding-left: .9rem; border-left: 2px solid var(--accent);
  color: var(--muted); font-size: .9rem; line-height: 1.65; display: none;
}
.reveal.is-on { display: block; animation: fadeUp .4s var(--ease) both; }
.reveal b { color: var(--fg); }

/* ---------- Série / saignement de nez ---------- */
.streak {
  position: fixed; left: 50%; top: 12%; transform: translateX(-50%);
  z-index: 6; pointer-events: none; text-align: center;
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent-2);
  opacity: 0;
}
.streak.is-on { animation: streakPop 1.9s var(--ease) both; }
@keyframes streakPop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.9); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}
.drop {
  position: fixed; top: -20px; z-index: 6; pointer-events: none;
  width: 7px; height: 11px; border-radius: 50% 50% 50% 50% / 68% 68% 32% 32%;
  background: linear-gradient(#ff3b3b, #8e0512); box-shadow: 0 0 8px rgba(232, 17, 45, .7);
  animation: fall 1.5s cubic-bezier(.5, 0, .9, .6) forwards;
}
@keyframes fall { to { transform: translateY(112svh) scale(1.25); opacity: .1; } }

/* ---------- Résultat ---------- */
.result__kicker, .result__line { text-align: center; }
.result__kicker {
  margin: 0; font-size: .72rem; letter-spacing: .42em; text-transform: uppercase; color: var(--muted);
}
.result__rank {
  margin: .2rem 0 .6rem; text-align: center;
  font-family: "Rozha One", Georgia, serif; font-weight: 400;
  font-size: clamp(2rem, 8vw, 3.4rem); line-height: 1;
  color: #16060a; -webkit-text-stroke: 1.6px var(--accent); text-shadow: var(--glow);
}
.result__line { margin: 0 auto 1.2rem; max-width: 48ch; color: var(--muted); line-height: 1.7; }
.badge {
  display: block; width: fit-content; margin: 0 auto 1.2rem;
  padding: .5rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--fg);
  font-size: .68rem; letter-spacing: .22em; text-transform: uppercase;
  box-shadow: var(--glow);
}
.marks {
  text-align: center; margin: 0 auto 1.8rem; font-size: 1.15rem; letter-spacing: .1em;
  line-height: 1.8;
}
.marks .sep { opacity: .3; margin: 0 .35rem; }
.result__actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.8rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.stat {
  border: 1px solid var(--line); border-radius: 10px; padding: .9rem;
  background: rgba(255, 255, 255, .03); text-align: center;
}
.stat b { display: block; font-size: 1.5rem; font-family: "Rozha One", Georgia, serif; font-weight: 400; color: var(--accent-2); }
.stat span { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* ---------- Pied de page ---------- */
.foot {
  position: relative; z-index: 4;
  width: min(760px, 100% - 2rem); margin: 2rem auto 1.5rem;
  color: #666d80; font-size: .72rem; line-height: 1.7; text-align: center;
}
.foot p { margin: .3rem 0; }
.foot a { color: var(--muted); }

/* ---------- Easter egg : tout à l'envers ---------- */
body.flipped #app { transform: rotate(180deg); }

/* ---------- Accessibilité ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  body.phase-3 { --tilt: 0deg; }
}

@media (max-width: 520px) {
  #app { width: min(760px, 100% - 1.2rem); }
  .wall { --bulb: 9px; padding: .85rem .45rem .7rem; }
  .wall__letter { font-size: clamp(.62rem, 2.9vw, .9rem); }
  .wall__cell { min-height: 40px; }
  .rules { padding-left: 2rem; }
  .hud { font-size: .66rem; letter-spacing: .12em; }
  .hud__phase span:last-child { max-width: 11ch; }
  .marks { font-size: .95rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand__tag { font-size: .88rem; }
  .intro__actions .btn { width: 100%; }
  .modes { grid-template-columns: 1fr; }
  .mode { display: flex; align-items: baseline; gap: .7rem; }
  .mode b { margin: 0; }
  .initials__slot { width: 40px; height: 52px; font-size: 1.7rem; }
}

/* Paysage sur téléphone : on récupère de la hauteur partout. */
@media (max-height: 500px) and (orientation: landscape) {
  #app { justify-content: flex-start; padding-top: .6rem; }
  .brand__kicker { margin-bottom: .1rem; }
  .brand__word { font-size: clamp(2rem, 7vw, 3rem); }
  .brand__word--sub { font-size: clamp(1rem, 3vw, 1.4rem); }
  .brand__tag, .rules, .secrets, .foot { display: none; }
  .wall { --bulb: 8px; margin: .8rem auto .4rem; padding: .5rem .5rem .4rem; max-width: 460px; }
  .wall__cell { min-height: 30px; }
  .wall__row { margin-bottom: .2rem; }
  .wall__caption { margin-bottom: .6rem; }
  .ud-toggle { margin-bottom: .6rem; }
  .card { padding: 1rem 1.2rem; }
  .card__q { font-size: 1.15rem; margin-bottom: .9rem; }
  .choice { min-height: 42px; padding: .55rem .9rem; }
  .choices { grid-template-columns: 1fr 1fr; }
  .hunt { margin-bottom: 1rem; }
  .hunt__track { height: 34px; }
  .demo { width: 26px; height: 32px; margin-left: calc(var(--p, 0) * -30px); }
  .hunt__val { top: 38px; }
  .modes { margin-bottom: .6rem; }
  .mode span { display: none; }
  .result__rank { font-size: 2rem; }
  .marks { margin-bottom: 1rem; }
  .board { display: none; }
}
