/* =========================================================
   nuit.css — Minuit au Village (page unique)
   ========================================================= */

@font-face { font-family: "Press Start 2P"; src: url("/assets/fonts/press-start-2p.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --noir: #07070d;
  --pale: #d8d2c2;
  --gris: #8b8476;
  --sang: #8a0b0b;
  --sang-vif: #c4141c;
  --lueur: #f2c14e;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --texte: "Manrope", system-ui, sans-serif;
  --plume: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--noir); color: var(--pale);
  font-family: var(--texte); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
svg { display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
p { margin: 0 0 1rem; text-wrap: pretty; }
:focus-visible { outline: 2px dashed var(--lueur); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 48px; padding: 0.9em 1.5em;
  font-family: var(--pixel); font-size: 0.72rem; letter-spacing: 0.04em; line-height: 1.5;
  text-decoration: none; border-radius: 4px; border: 2px solid currentColor;
  transition: background-color 160ms, color 160ms, translate 160ms;
}
.btn:active { translate: 0 2px; }
.btn--sang { background: var(--sang); color: #f3e9dc; border-color: #2a0204; box-shadow: 0 0 0 1px var(--sang-vif), 0 6px 30px rgb(196 20 28 / 0.25); }
.btn--sang:hover { background: var(--sang-vif); }
.btn--discret { background: transparent; color: var(--gris); border-color: #2c2a30; }
.btn--discret:hover { color: var(--pale); border-color: var(--gris); }
.btn--petit { min-height: 40px; padding: 0.7em 1.1em; font-size: 0.62rem; }

/* ---------- HUD ---------- */
.hud {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: 0.7rem 1rem;
  background: linear-gradient(#07070d 30%, transparent);
  font-family: var(--pixel); font-size: 0.62rem; letter-spacing: 0.04em;
  pointer-events: none;
}
.hud > * { margin: 0; pointer-events: auto; }
.hud__titre { color: var(--sang-vif); text-shadow: 0 0 12px rgb(196 20 28 / 0.6); }
.hud__pages { display: inline-flex; align-items: center; gap: 0.5em; color: var(--pale); }
.hud__pages.is-bump { animation: bump 600ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bump { 40% { scale: 1.4; color: var(--lueur); } }
.hud__heure { color: var(--gris); }
.hud__heure.is-minuit { color: var(--sang-vif); animation: pouls 1.4s ease-in-out infinite; }
@keyframes pouls { 50% { opacity: 0.4; } }
.hud__btns { margin-left: auto !important; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.hud__btn {
  min-height: 36px; padding: 0.55em 0.9em; border-radius: 4px;
  background: rgb(10 10 16 / 0.8); border: 1px solid #2c2a30; color: var(--gris);
  font-family: var(--pixel); font-size: 0.56rem;
}
.hud__btn:hover { color: var(--pale); border-color: var(--gris); }
.hud__btn--lumiere { color: var(--lueur); border-color: #5a4a1e; }
.hud__volume { display: inline-flex; align-items: center; gap: 0.5em; color: var(--gris); font-size: 0.56rem; }
.hud__volume input { width: 6.5rem; accent-color: var(--sang-vif); }

/* ---------- Écran titre ---------- */
.titre {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 1.5rem; overflow: auto;
  background: radial-gradient(ellipse at 50% 120%, #2a0a0e 0, #0b080d 45%, #030305 100%);
  text-align: center;
}
.titre__brume {
  position: fixed; inset: -20%; pointer-events: none; opacity: 0.5;
  background:
    radial-gradient(40% 25% at 20% 70%, rgb(140 150 160 / 0.12), transparent),
    radial-gradient(35% 20% at 75% 80%, rgb(140 150 160 / 0.1), transparent),
    radial-gradient(50% 30% at 50% 100%, rgb(140 150 160 / 0.14), transparent);
  animation: derive 26s ease-in-out infinite alternate;
}
@keyframes derive { to { translate: 6% -3%; } }
.titre__inner { position: relative; max-width: 40rem; display: grid; justify-items: center; gap: 0.4rem; }
.titre__heure { font-family: var(--pixel); font-size: 0.8rem; color: var(--sang-vif); letter-spacing: 0.2em; animation: pouls 2s ease-in-out infinite; }
.titre__h1 {
  margin: 0 0 1rem;
  font-family: var(--pixel); font-weight: 400; line-height: 1.25;
  font-size: clamp(1.9rem, 1rem + 5vw, 4.4rem);
  color: #efe6d6;
  text-shadow: 3px 0 0 rgb(196 20 28 / 0.7), -2px 0 0 rgb(0 160 170 / 0.25), 0 0 40px rgb(196 20 28 / 0.35);
  animation: titre-vacille 7s infinite;
}
@keyframes titre-vacille { 0%, 91%, 95%, 100% { opacity: 1; } 92% { opacity: 0.3; } 94% { opacity: 0.85; } }
.titre__pitch { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem); max-width: 32ch; color: var(--pale); }
.titre__alerte {
  max-width: 36ch; font-size: 0.88rem; color: #c9b6a6;
  border: 1px solid #3a1418; background: rgb(60 8 12 / 0.35); padding: 0.8rem 1rem; border-radius: 4px;
}
.titre__alerte strong { color: var(--sang-vif); }
.titre__btns { display: flex; gap: 0.8rem; flex-wrap: wrap; justify-content: center; margin: 0.6rem 0 1.2rem; }
.titre__aide { font-size: 0.8rem; color: var(--gris); }
.titre__ecoute { margin: 1.4rem 0 0.6rem; font-family: var(--pixel); font-size: 0.7rem; line-height: 2.2; color: #c9b6a6; animation: pouls 2.2s ease-in-out infinite; }
.titre { cursor: pointer; }
.titre__btns:not([hidden]) { animation: apparait 1.4s ease-out both; }
.titre .titre__alerte { font-size: 0.78rem; margin-top: 0.6rem; }
.titre__passer { display: none; font-size: 0.8rem; color: var(--gris); animation: pouls 2s ease-in-out infinite; }
.titre.is-intro { cursor: pointer; }
.titre.is-intro .titre__btns, .titre.is-intro .titre__alerte, .titre.is-intro .titre__aide { display: none; }
.titre.is-intro .titre__passer { display: block; }

/* ---------- La carte ---------- */
.carte { position: fixed; inset: 0; visibility: hidden; }
.carte.is-on { visibility: visible; }
.carte__vue { position: absolute; inset: 0; overflow: hidden; outline: none; touch-action: none; cursor: crosshair; background: #000; }
.carte__monde, .carte__lueurs { position: absolute; left: 0; top: 0; will-change: transform; }
.carte__decor, .carte__lueurs svg { max-width: none; }
.carte__lueurs { pointer-events: none; z-index: 3; }

.zone {
  position: absolute; padding: 0; border: 0; background: none;
  left: calc(var(--x) * 1px - var(--w) / 2); top: calc(var(--y) * 1px - var(--h));
  width: var(--w); height: var(--h); z-index: var(--y);
}
.zone svg { max-width: none; width: 100%; height: 100%; }
.zone:hover svg, .zone:focus-visible svg { filter: brightness(1.35); }

.avatar { position: absolute; left: 0; top: 0; pointer-events: none; }
.avatar__sprite { translate: -24px -62px; }
.avatar.is-left svg { scale: -1 1; }

.avatar.is-walking .avatar__sprite { animation: pas 360ms steps(2) infinite; }
@keyframes pas { 50% { translate: -24px -65px; } }

/* L'obscurité : un seul halo, celui de la lanterne */
.nuit {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  --lx: 50%; --ly: 50%; --lr: 170px;
  background: radial-gradient(circle at var(--lx) var(--ly),
    rgb(255 196 110 / 0.10) 0,
    rgb(255 180 90 / 0.03) calc(var(--lr) * 0.4),
    rgb(4 4 9 / 0.5) calc(var(--lr) * 0.75),
    rgb(3 3 8 / 0.86) calc(var(--lr) * 1.05),
    rgb(2 2 6 / 0.92) calc(var(--lr) * 1.6));
}
.nuit::after { content: ""; position: absolute; inset: 0; background: #000; opacity: 0; }
html.is-vacille .nuit::after { animation: vacille 1.2s linear; }
@keyframes vacille { 0% { opacity: 0; } 15% { opacity: 0.9; } 30% { opacity: 0.2; } 55% { opacity: 0.85; } 100% { opacity: 0; } }
html.is-lumiere .nuit { opacity: 0.45; }

.lueur { animation: fenetre 11s infinite; animation-delay: var(--d); }
@keyframes fenetre { 0%, 70%, 100% { opacity: 1; } 72%, 79% { opacity: 0; } 74% { opacity: 0.6; } }
.lueur--crypte { opacity: 0; animation: none; transition: opacity 3s; }
.lueur--crypte.is-ouverte { opacity: 1; animation: pouls 3s ease-in-out infinite; }
.lueur-nom { font-family: var(--pixel); font-size: 11px; fill: #8a847a; letter-spacing: 1px; }
.silhouette-lieu { opacity: 0.12; filter: grayscale(1) brightness(2.4); pointer-events: none; }
.lueur--guide { animation: guide 2.8s ease-in-out infinite; }
@keyframes guide { 50% { opacity: 0.7; } }
.lueur.is-eteinte { opacity: 0; animation: eteinte 1.4s steps(1) both; }
@keyframes eteinte { 0% { opacity: 1; } 20% { opacity: 0.2; } 30% { opacity: 0.9; } 45% { opacity: 0.1; } 60% { opacity: 0.6; } 100% { opacity: 0; } }

/* Clic sur la carte : un repère immédiat */
.repere { position: absolute; left: 0; top: 0; width: 34px; height: 14px; margin: -7px 0 0 -17px; border: 2px solid rgb(242 193 78 / 0.8); border-radius: 50%; pointer-events: none; animation: repere 800ms ease-out both; }
@keyframes repere { from { scale: 0.3; opacity: 1; } to { scale: 1.4; opacity: 0; } }

/* Les habitants de la nuit : ils errent, apparaissent, disparaissent */
.habitant { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; opacity: 0; animation: habitant 1.6s ease-out forwards; filter: brightness(0.75) drop-shadow(0 0 8px rgb(150 190 150 / 0.25)); }
.habitant svg { display: block; max-width: none; translate: -50% -100%; }
@keyframes habitant { to { opacity: 0.8; } }
.habitant--zombie svg { animation: tituber 1.8s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes tituber { 0%, 100% { rotate: -5deg; } 50% { rotate: 6deg; } }
.habitant--chien svg { animation: courir 260ms steps(2) infinite; }
.habitant--clown svg { animation: balance-clown 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes balance-clown { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }
@keyframes courir { 50% { translate: -50% -104%; } }
.habitant.is-gauche svg { scale: -1 1; }
.habitant.is-part { opacity: 0; transition: opacity 700ms; animation: none; }
.habitant.is-fuite { opacity: 0; transition: opacity 80ms; animation: none; }
.habitant.is-fonce { animation: fonce 500ms ease-in forwards; }
@keyframes fonce { 0% { opacity: 0.8; } 100% { opacity: 1; scale: 3.2; filter: brightness(1.2); } }

/* Un passage familier a changé */
.arbre-tombe { position: absolute; left: 0; top: 0; pointer-events: none; }
.arbre-tombe svg { max-width: none; }

.brume {
  position: absolute; inset: -30%; z-index: 4; pointer-events: none; opacity: 0.6;
  background:
    radial-gradient(30% 14% at 30% 40%, rgb(150 160 170 / 0.07), transparent),
    radial-gradient(26% 12% at 70% 65%, rgb(150 160 170 / 0.06), transparent),
    radial-gradient(40% 16% at 50% 85%, rgb(150 160 170 / 0.07), transparent);
  animation: derive 40s ease-in-out infinite alternate;
}

/* Des yeux dans le noir (arbres, rôdeur) */
.yeux-arbre, .rodeur-yeux { position: absolute; left: 0; top: 0; display: flex; gap: 9px; translate: 0 0; }
.yeux-arbre span, .rodeur-yeux span {
  width: 7px; height: 4px; border-radius: 50%;
  background: #ffe36a; box-shadow: 0 0 8px 2px rgb(255 210 80 / 0.7);
  animation: ouvre 260ms ease-out both;
}
.rodeur-yeux { margin-left: -10px; gap: 7px; }
.rodeur-yeux span { width: 5px; height: 3px; background: #ff2a1a; box-shadow: 0 0 10px 3px rgb(255 30 20 / 0.6); animation-duration: 900ms; }
@keyframes ouvre { from { scale: 1 0; } }
.yeux-arbre.is-ferme span { scale: 1 0; transition: scale 200ms; }
.rodeur { position: absolute; left: 0; top: 0; pointer-events: none; animation: apparait 900ms ease-out both; }
.rodeur svg { translate: -20px -118px; max-width: none; }
@keyframes apparait { from { opacity: 0; } }
.rodeur.is-part, .rodeur-yeux.is-part { opacity: 0; transition: opacity 600ms; }
.rodeur.is-fuite, .rodeur-yeux.is-fuite { opacity: 0; transition: opacity 60ms; }

.carte__aide {
  position: fixed; left: 50%; bottom: 1.2rem; translate: -50% 0; z-index: 20; margin: 0;
  width: max-content; max-width: calc(100vw - 2rem); text-align: center;
  font-size: 0.85rem; color: #b8afa0; background: rgb(5 5 9 / 0.8); padding: 0.6rem 1rem; border-radius: 4px;
  transition: opacity 600ms;
}
.carte__aide.is-hidden { opacity: 0; }
.carte__invite {
  position: fixed; left: 50%; bottom: 4.6rem; translate: -50% 0; z-index: 21;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: center;
  padding: 0.8rem 1rem; border: 1px solid #3a1418; border-radius: 4px; background: rgb(8 6 10 / 0.92);
  max-width: calc(100vw - 2rem);
}
.carte__invite p { margin: 0; font-size: 0.92rem; }

/* ---------- Les scènes (explorées à la lampe) ---------- */
.scene {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center; padding: 4.2rem 1rem 1rem;
  background: rgb(0 0 0 / 0.94);
  animation: apparait 400ms ease-out;
}
.scene__boite { width: min(100%, 980px); display: grid; gap: 0.8rem; justify-items: center; }
.scene__titre { margin: 0; font-family: var(--pixel); font-weight: 400; font-size: 0.85rem; color: var(--sang-vif); letter-spacing: 0.06em; }
.scene__cadre {
  position: relative; overflow: hidden; width: min(100%, calc((100vh - 17.5rem) * 4 / 3)); aspect-ratio: 4 / 3;
  border: 1px solid #1d1b20; cursor: none; touch-action: none;
  --sx: 50%; --sy: 55%;
}
.scene__art { width: 100%; height: 100%; max-width: none; }
.scene__noir {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--sx) var(--sy), rgb(255 220 150 / 0.06) 0, transparent 9%, rgb(0 0 0 / 0.75) 17%, rgb(0 0 0 / 0.975) 27%);
}
html.is-lumiere .scene__noir { opacity: 0.35; }
.spot { position: absolute; z-index: 1; padding: 0; border: 0; background: none; cursor: none; }
.spot:focus-visible { outline: 1px dashed rgb(242 193 78 / 0.6); }
.scene__texte {
  min-height: 4.8em; width: min(100%, 46rem); margin: 0; text-align: center; color: #c9c0b0;
}
.scene__texte.is-new { animation: apparait 600ms ease-out; }
.scene__texte .carnet { display: block; margin-top: 0.5rem; font-family: var(--plume); font-style: italic; font-size: 1.08rem; color: #eadfc6; }

/* États des scènes */
.sc-silhouette { opacity: 0; transition: opacity 120ms; }
.is-silhouette .sc-silhouette { opacity: 1; }
.sc-larmes { opacity: 0; stroke-dasharray: 40; stroke-dashoffset: 40; }
.is-larmes .sc-larmes { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s ease-in; }
.sc-flamme { transform-box: fill-box; transform-origin: 50% 100%; animation: flamme 900ms ease-in-out infinite alternate; }
@keyframes flamme { to { scale: 0.85 1.1; } }
.is-eteint .sc-flamme, .sc-flamme.is-off { opacity: 0; }
.sc-tete2 { display: none; }
.is-tournee .sc-tete { display: none; }
.is-tournee .sc-tete2 { display: inline; }
.sc-visage { opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; translate: 0 20px; scale: 0.6; }
.is-monte .sc-visage { opacity: 1; translate: 0 0; scale: 1; transition: opacity 1.2s, translate 1.4s, scale 1.4s; }
.sc-balancoire { transform-box: fill-box; transform-origin: 50% 0; }
.is-tire .sc-corde { animation: tire 2.6s ease-in-out; }
@keyframes tire { 8% { translate: 0 7px; } 18% { translate: 0 2px; } 34% { translate: 0 11px; } 55% { translate: 0 4px; } 75% { translate: 0 8px; } 100% { translate: 0 0; } }
.is-balance .sc-balancoire { animation: balance 3.2s ease-in-out; }
@keyframes balance { 15% { rotate: 22deg; } 40% { rotate: -18deg; } 62% { rotate: 12deg; } 82% { rotate: -6deg; } }

/* ---------- Fin ---------- */
.fin {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 2rem;
  background: radial-gradient(ellipse at 50% 50%, #1a0507, #000 70%); text-align: center;
  animation: apparait 2s ease-out;
}
.fin__inner { max-width: 34rem; display: grid; justify-items: center; }
.fin__heure { font-family: var(--pixel); color: var(--sang-vif); animation: pouls 1.4s infinite; }
.fin__titre { font-family: var(--pixel); font-weight: 400; font-size: clamp(1.1rem, 0.8rem + 2vw, 1.8rem); line-height: 1.4; color: #efe6d6; margin: 0 0 1.4rem; }
.fin__signe { font-family: var(--plume); font-style: italic; font-size: 1.3rem; color: var(--sang-vif); margin-top: 0.6rem; }

/* ---------- Les frayeurs ---------- */
.frayeur { position: fixed; inset: 0; z-index: 1000; pointer-events: none; display: none; background: #000; overflow: hidden; }
.frayeur.is-on { display: grid; place-items: center; animation: tremble 70ms steps(2) infinite; }
.frayeur::after { content: ""; position: absolute; inset: 0; z-index: 3; background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgb(0 0 0 / 0.85) 85%); }
.frayeur__bete { display: grid; place-items: center; width: 100%; height: 100%; }
.frayeur__bete > svg {
  height: 118vh; width: auto; max-width: none;
  filter: drop-shadow(7px 0 0 rgb(255 0 0 / 0.45)) drop-shadow(-5px 0 0 rgb(0 255 255 / 0.2)) contrast(1.15);
  animation: surgit 110ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.frayeur__bete > .frayeur__photo {
  height: 108vh; width: auto; max-width: none;
  mask-image: radial-gradient(ellipse 60% 62% at 50% 50%, #000 55%, transparent 100%);
  filter: contrast(1.25) brightness(1.1);
  animation: surgit 110ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
@keyframes surgit { from { scale: 0.12; opacity: 0.4; } }
@keyframes tremble { 0% { translate: -8px 4px; } 50% { translate: 7px -5px; } 100% { translate: -3px 6px; } }
.frayeur__flash { position: absolute; inset: 0; z-index: 1; background: #b00000; opacity: 0; animation: flash 260ms ease-out; mix-blend-mode: multiply; }
.frayeur.is-on .frayeur__flash { animation: flash 260ms ease-out; }
@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
.frayeur__grain {
  position: absolute; inset: -50%; z-index: 2; opacity: 0.22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 120ms steps(3) infinite;
}
@keyframes grain { 33% { translate: 3% -2%; } 66% { translate: -2% 3%; } }
.frayeur[data-bete="mains"] .frayeur__bete { position: relative; }
.frayeur__main { position: absolute; bottom: -12vh; height: 105vh; }
.frayeur__main svg { height: 100%; width: auto; max-width: none; }
.frayeur__main--g { left: -4vw; rotate: 16deg; animation: main-g 140ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.frayeur__main--d { right: -4vw; rotate: -16deg; scale: -1 1; animation: main-d 140ms 60ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes main-g { from { translate: -70vw 30vh; } }
@keyframes main-d { from { translate: 70vw 30vh; } }

.empreintes { position: fixed; inset: 0; z-index: 990; pointer-events: none; }
.empreinte { position: absolute; width: 24vmin; opacity: 0; animation: empreinte 5s ease-in both; }
.empreinte svg { width: 100%; height: auto; }
@keyframes empreinte { 0% { opacity: 0.6; } 60% { opacity: 0.45; } 100% { opacity: 0; } }

/* Le visage, quand on ne bouge plus */
.visage-noir { position: fixed; inset: 0; z-index: 45; pointer-events: none; display: grid; place-items: center; opacity: 0; transition: opacity 90ms; mix-blend-mode: screen; }
.visage-noir svg { height: 92vh; width: auto; }
.visage-noir.is-on { opacity: 0.12; transition: opacity 8s ease-in; }

/* Coupure de courant */
.coupure { position: fixed; inset: 0; z-index: 950; pointer-events: none; background: #000; opacity: 0; transition: opacity 60ms; }
.coupure.is-on { opacity: 1; }
.coupure.is-ombre { opacity: 1; background: transparent; }
.coupure__ombre { position: absolute; bottom: 0; height: 62vh; opacity: 0; }
.coupure__ombre svg { height: 100%; width: auto; }
.coupure.is-ombre .coupure__ombre { opacity: 0.92; }

/* La silhouette au bord de l'écran */
.guetteur { position: fixed; z-index: 900; height: 30vh; width: 25vh; opacity: 0; pointer-events: none; transition: translate 150ms ease-in, opacity 150ms; }
.guetteur svg { width: 100%; height: 100%; }
.guetteur.is-on { opacity: 1; pointer-events: auto; cursor: pointer; transition: translate 1.6s ease-out, opacity 1s; }
.guetteur[data-cote="g"] { left: 0; top: var(--pos); translate: -100% 0; rotate: 90deg; }
.guetteur[data-cote="g"].is-on { translate: -30% 0; }
.guetteur[data-cote="d"] { right: 0; top: var(--pos); translate: 100% 0; rotate: -90deg; }
.guetteur[data-cote="d"].is-on { translate: 30% 0; }
.guetteur[data-cote="b"] { bottom: 0; left: var(--pos); translate: 0 100%; }
.guetteur[data-cote="b"].is-on { translate: 0 45%; }

/* 404 */
.perdu { overflow: auto; }

/* Page du carnet trouvée */
.trouvaille {
  position: fixed; left: 50%; top: 38%; translate: -50% -50%; z-index: 930; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 0.8rem;
  font-family: var(--pixel); font-size: clamp(1.4rem, 1rem + 2.5vw, 2.8rem); color: #f1e6cf;
  text-shadow: 0 0 24px rgb(242 193 78 / 0.7), 0 3px 0 #000;
  animation: trouvaille 3.2s ease-out both;
}
@keyframes trouvaille { 0% { opacity: 0; scale: 0.6; } 12% { opacity: 1; scale: 1.08; } 20% { scale: 1; } 75% { opacity: 1; } 100% { opacity: 0; translate: -50% -70%; } }

/* ---------- La voix ---------- */
.voix {
  position: fixed; left: 50%; top: 3.6rem; translate: -50% 0; z-index: 960; margin: 0;
  width: max-content; max-width: min(42rem, 90vw); text-align: center; pointer-events: none;
  font-family: var(--plume); font-style: italic; font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.4rem); line-height: 1.45;
  color: #eadbc8; text-shadow: 0 0 14px rgb(160 10 14 / 0.9), 0 2px 2px #000;
  background: radial-gradient(ellipse at center, rgb(0 0 0 / 0.85) 40%, transparent 75%); padding: 0.6rem 2.2rem;
  opacity: 0;
}
body:has(#scene:not([hidden])) .voix { bottom: auto; top: 6.8rem; }
body:has(#titre:not([hidden])) .voix { top: auto; bottom: 0.6rem; font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.15rem); }
.voix.is-on { opacity: 1; transition: opacity 400ms; animation: voix-tremble 2.6s steps(3) infinite; }
.voix.is-out { opacity: 0; transition: opacity 1.2s; }
@keyframes voix-tremble { 0%, 100% { translate: -50% 0; } 33% { translate: calc(-50% + 1px) -1px; } 66% { translate: calc(-50% - 1px) 0; } }

/* Écran d'entrée (le clic qui autorise le son) */
.porte { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: 2rem; background: #000; text-align: center; padding: 1.5rem; }
.porte__texte { margin: 0; font-family: var(--pixel); font-size: 0.75rem; line-height: 2.4; color: var(--gris); animation: titre-vacille 5s infinite; }
.titre.is-ferme .titre__inner { visibility: hidden; }

/* Les épreuves : la voix demande de cliquer */
.appat {
  position: fixed; z-index: 940; width: 34px; height: 34px; translate: -50% -50%; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle, #fff6d8 0, #ffcf6a 30%, rgb(255 160 40 / 0.35) 55%, transparent 72%);
  box-shadow: 0 0 40px 12px rgb(255 190 90 / 0.3);
  animation: appat 1.6s ease-in-out infinite;
}
@keyframes appat { 50% { scale: 1.3; opacity: 0.65; } }
.compte {
  position: fixed; left: 50%; top: 42%; translate: -50% -50%; z-index: 945; margin: 0; pointer-events: none; opacity: 0;
  font-family: var(--pixel); font-size: clamp(2rem, 1rem + 5vw, 5rem); color: var(--sang-vif); text-shadow: 0 0 30px rgb(196 20 28 / 0.7);
}
.compte.is-on { animation: compte 900ms ease-out; }
@keyframes compte { 0% { opacity: 0; scale: 1.6; } 20% { opacity: 1; scale: 1; } 100% { opacity: 0; } }
.noir-total { position: fixed; inset: 0; z-index: 945; background: #000; opacity: 0; transition: opacity 1.5s; cursor: none; }
.noir-total.is-on { opacity: 1; }
.lueur-nom.is-indice { fill: #ff2a1a; filter: drop-shadow(0 0 6px #f00); animation: pouls 1s ease-in-out infinite; }

/* ---------- Les mots qui font peur ---------- */
.mot { display: inline-block; animation-duration: 1.4s; animation-fill-mode: both; animation-timing-function: ease-out; }
.mot--ombre { animation-name: mot-ombre; }
@keyframes mot-ombre { 0% { color: inherit; } 30% { color: #000; text-shadow: 0 0 18px #000, 0 0 2px #fff; letter-spacing: 0.2em; } 100% { color: #9a8f80; text-shadow: 0 0 10px #000; } }
.mot--sang { position: relative; animation-name: mot-sang; }
@keyframes mot-sang { 0% { color: inherit; } 25%, 100% { color: #e01b24; text-shadow: 0 0 12px rgb(200 0 0 / 0.9); } }
.mot--sang::after { content: ""; position: absolute; left: 40%; top: 85%; width: 3px; height: 0; background: #b00; border-radius: 0 0 3px 3px; animation: goutte-mot 2.4s ease-in both; animation-delay: inherit; }
@keyframes goutte-mot { 20% { height: 0; } 100% { height: 1.4em; opacity: 0.2; } }
.mot--tremble { animation-name: mot-tremble; animation-duration: 90ms; animation-iteration-count: 14; animation-timing-function: steps(2); color: #f1d9c0; }
@keyframes mot-tremble { 0% { translate: -2px 1px; } 50% { translate: 2px -1px; } 100% { translate: -1px 2px; } }
.mot--noir { animation-name: mot-noir; animation-duration: 1.8s; }
@keyframes mot-noir { 0% { opacity: 1; } 30% { opacity: 0.05; } 45% { opacity: 0.7; } 60% { opacity: 0.1; } 100% { opacity: 1; } }
.mot--yeux { animation-name: mot-yeux; }
@keyframes mot-yeux { 0% { color: inherit; letter-spacing: 0; } 40%, 100% { color: #ff3a2a; letter-spacing: 0.25em; text-shadow: 0 0 14px #f00; } }
.mot--froid { animation-name: mot-froid; animation-duration: 2s; }
@keyframes mot-froid { 0% { color: inherit; filter: none; } 40%, 100% { color: #cfe3f0; text-shadow: 0 0 14px rgb(120 170 220 / 0.9); filter: blur(0.4px); } }
.mot--toi { animation-name: mot-toi; animation-duration: 1.2s; }
@keyframes mot-toi { 0% { scale: 1; } 30% { scale: 1.7; color: #ff2a1a; } 100% { scale: 1.15; color: #ff5a4a; } }

/* Ce que l'écran fait sur ces mots */
.fx { position: fixed; inset: 0; z-index: 955; pointer-events: none; }
.fx--ombre svg { position: absolute; top: 8vh; height: 90vh; width: auto; opacity: 0; filter: blur(6px); animation: fx-ombre 1.5s ease-in-out both; }
@keyframes fx-ombre { 0% { left: -40vw; opacity: 0; } 30% { opacity: 0.55; } 70% { opacity: 0.55; } 100% { left: 110vw; opacity: 0; } }
.fx--sang { background: radial-gradient(ellipse at center, transparent 55%, rgb(120 0 0 / 0.55) 100%); animation: fx-sang 2.6s ease-out both; }
.fx--sang i { position: absolute; top: 0; width: 6px; height: 0; background: linear-gradient(#5a0000, #a00000); border-radius: 0 0 4px 4px; animation: fx-goutte 2.6s ease-in both; }
@keyframes fx-sang { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fx-goutte { 0% { height: 0; } 70% { opacity: 1; } 100% { height: 28vh; opacity: 0; } }
.fx--yeux { display: flex; gap: 22px; position: fixed; inset: auto; width: max-content; height: auto; }
.fx--yeux span { width: 16px; height: 7px; border-radius: 50%; background: #ff2a1a; box-shadow: 0 0 18px 6px rgb(255 30 20 / 0.6); animation: fx-yeux 1.3s ease-in-out both; }
@keyframes fx-yeux { 0%, 100% { scale: 1 0; } 15%, 75% { scale: 1 1; } 45% { scale: 1 0.1; } 55% { scale: 1 1; } }
.fx--froid { background: radial-gradient(ellipse at center, transparent 40%, rgb(150 190 220 / 0.25) 100%); backdrop-filter: grayscale(0.8) brightness(0.8); animation: fx-sang 2.4s ease-out both; }
html.is-tremble body { animation: tremble 70ms steps(2) 8; }

/* ---------- Le joueur est la cible ---------- */
.titre__maire { margin: -0.4rem 0 0.6rem; font-family: var(--pixel); font-size: 0.75rem; color: var(--sang-vif); letter-spacing: 0.15em; text-shadow: 0 0 12px rgb(196 20 28 / 0.6); animation: titre-vacille 6s infinite; }
.titre__prenom { display: grid; gap: 0.4rem; width: 100%; justify-items: center; margin-bottom: 0.4rem; font-size: 0.8rem; color: var(--gris); }
.titre__prenom input {
  width: min(16rem, 80vw); padding: 0.6rem 0.8rem; text-align: center;
  font-family: var(--plume); font-style: italic; font-size: 1.1rem; color: #eadfc6;
  background: rgb(10 6 8 / 0.8); border: 1px solid #3a1418; border-radius: 4px;
}
.titre__prenom input:focus { outline: 2px dashed var(--sang-vif); outline-offset: 2px; }
.titre__btns { flex-wrap: wrap; }
.nom-sang {
  position: fixed; left: 50%; top: 45%; translate: -50% -50%; z-index: 958; pointer-events: none;
  font-family: var(--plume); font-style: italic; font-size: clamp(3rem, 2rem + 8vw, 9rem); color: #9a0a0a;
  text-shadow: 0 0 30px rgb(160 0 0 / 0.8), 0 4px 0 #300; filter: blur(0.6px);
  animation: nom-sang 2.8s ease-out both;
}
@keyframes nom-sang { 0% { opacity: 0; scale: 1.3; filter: blur(8px); } 12% { opacity: 1; scale: 1; filter: blur(0.6px); } 30% { opacity: 0.2; } 38% { opacity: 1; } 100% { opacity: 0; scale: 0.96; } }

/* ---------- Dans les pièces : la lampe meurt, quelqu'un est là ---------- */
.scene__cadre.is-lampe-morte .scene__noir { background: #000; }
.intrus { position: absolute; height: 34%; translate: -50% -100%; pointer-events: none; }
.intrus svg { height: 100%; width: auto; max-width: none; }
.intrus.is-fuite { opacity: 0; transition: opacity 120ms; }
.main-intrus { position: absolute; pointer-events: none; transition: translate 400ms ease-in; }
.main-intrus svg { width: clamp(40px, 7vw, 70px); height: auto; max-width: none; }
.main-intrus--g { left: 0; translate: -30% -50%; rotate: 90deg; }
.main-intrus--d { right: 0; translate: 30% -50%; rotate: -90deg; }
.main-intrus--b { bottom: 0; translate: -50% 35%; }
.main-intrus--g.is-retire { translate: -140% -50%; }
.main-intrus--d.is-retire { translate: 140% -50%; }
.main-intrus--b.is-retire { translate: -50% 140%; }

/* ---------- Mouvement réduit : fondus seulement ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .frayeur.is-on { animation: none; }
  .frayeur__bete > svg, .frayeur__bete > .frayeur__photo, .frayeur__main--g, .frayeur__main--d { animation: none; }
  .frayeur__flash, .frayeur__grain { display: none; }
  .frayeur.is-on .frayeur__bete { animation: fondu 400ms ease-out both !important; animation-duration: 400ms !important; }
  @keyframes fondu { from { opacity: 0; } }
  .visage-noir.is-on { transition-duration: 4s !important; }
  .fx--ombre, .fx--sang i, html.is-tremble body { animation: none !important; display: none; }
}
