@font-face{font-family:"Jost";font-style:normal;font-weight:300;font-display:swap;src:url(assets/fonts/jost-latin-300-normal.woff2) format("woff2")}
@font-face{font-family:"Jost";font-style:normal;font-weight:400;font-display:swap;src:url(assets/fonts/jost-latin-400-normal.woff2) format("woff2")}
@font-face{font-family:"Jost";font-style:normal;font-weight:500;font-display:swap;src:url(assets/fonts/jost-latin-500-normal.woff2) format("woff2")}
@font-face{font-family:"Cormorant Garamond";font-style:normal;font-weight:500;font-display:swap;src:url(assets/fonts/cormorant-garamond-latin-500-normal.woff2) format("woff2")}
@font-face{font-family:"Cormorant Garamond";font-style:italic;font-weight:500;font-display:swap;src:url(assets/fonts/cormorant-garamond-latin-500-italic.woff2) format("woff2")}
:root {
  --noir: #000000;
  --blanc: #e9eef2;
  --gris: #7c8288;
  --rouge: #ff1a2b;
  --rouge-sombre: #5e0710;
  --trait: rgba(233, 238, 242, .16);
  --font: "Jost", "Futura", "Century Gothic", "Avenir Next", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--noir);
  color: var(--blanc);
  font-family: var(--font);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body { background: transparent; } /* le fond noir reste sur html : le décor du monde passe devant */
#app { height: 100%; position: relative; overflow: hidden; }

/* ---------- décor du monde (fond qui change à chaque étape) ---------- */
.world { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #000; }
.world-img { position: absolute; inset: -4%; background: center / cover no-repeat; opacity: 0; transition: opacity 1.8s ease;
  animation: drift 40s ease-in-out infinite alternate; }
.world-img.on { opacity: 1; }
@keyframes drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.08) translate(-1.5%, 1%); } }
.world-shade { position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 48%, rgba(0,0,0,.5) 0%, rgba(0,0,0,.25) 62%, rgba(0,0,0,.55) 100%),
              linear-gradient(to bottom, rgba(0,0,0,.3), transparent 25%, transparent 70%, rgba(0,0,0,.75)); }
@media (min-aspect-ratio: 3/4) {
  .world::before { content: ""; position: absolute; inset: -40px; background: var(--world-url) center / cover no-repeat;
    filter: blur(28px) brightness(.35); }
  .world-img { inset: 0; background-size: contain; }
}
.world.wake .world-img.on { animation: worldFlash .6s ease-out, drift 40s ease-in-out infinite alternate; }
@keyframes worldFlash { 0% { filter: brightness(2.2) saturate(1.4); } 100% { filter: none; } }
.lines p, .q, .rev p { text-shadow: 0 2px 10px #000, 0 0 2px #000; }
.place { position: fixed; left: 0; right: 0; bottom: calc(18px + var(--safe-bot)); text-align: center; color: rgba(233,238,242,.55);
  font-size: .62rem; letter-spacing: .32em; text-transform: uppercase; animation: fade 2s both; pointer-events: none; }

/* ---------- écrans ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: calc(28px + var(--safe-top)) 24px calc(24px + var(--safe-bot));
  text-align: center;
  max-width: 620px;
  margin: 0 auto;
}
.screen.active { display: flex; animation: fade .6s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- typographie ---------- */
.title, .tag, .btn, .sync-head, .game-head, .headphones {
  text-transform: uppercase;
  letter-spacing: .28em;
}
.title { font-size: clamp(1.15rem, 5vw, 1.6rem); font-weight: 400; }
.tag { font-size: clamp(.8rem, 3.7vw, 1.2rem); line-height: 1.8; letter-spacing: .22em; }
.lead { font-size: 1.2rem; line-height: 1.6; }
.muted { color: var(--gris); font-size: .95rem; line-height: 1.6; }
.red { color: var(--rouge); }

/* ---------- boutons ---------- */
.btn {
  appearance: none;
  border: 1.5px solid var(--rouge);
  background: rgba(94, 7, 16, .25);
  color: var(--blanc);
  font: inherit;
  font-size: clamp(.95rem, 4.4vw, 1.2rem);
  padding: 20px 44px;
  border-radius: 999px;
  min-width: min(100%, 320px);
  box-shadow: 0 0 18px rgba(255, 26, 43, .45), inset 0 0 12px rgba(255, 26, 43, .2);
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.97); box-shadow: 0 0 28px rgba(255, 26, 43, .7); }
.btn:disabled { opacity: .3; box-shadow: none; }
.btn.ghost { border-color: var(--trait); background: none; box-shadow: none; }
.btn:focus-visible, .key:focus-visible, .len:focus-visible { outline: 2px solid var(--blanc); outline-offset: 3px; }
.chev { color: var(--rouge); margin-left: .4em; font-size: 1.3em; line-height: 0; }

/* ---------- accueil ---------- */
.home { justify-content: flex-end; gap: 16px; }
.home-bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 9%, rgba(0,0,0,0) 56%, rgba(0,0,0,.55) 70%, rgba(0,0,0,.92) 92%),
    url("assets/accueil.webp") center 12% / cover no-repeat;
  animation: homeBreath 14s ease-in-out infinite alternate;
}
/* écrans plus larges que l'image (tablette, paysage) : l'image entière, et un flou pour remplir les côtés */
@media (min-aspect-ratio: 3/4) {
  .home-bg { background: #000; }
  .home-bg::before { content: ""; position: absolute; inset: -40px;
    background: url("assets/accueil.webp") center / cover no-repeat; filter: blur(28px) brightness(.35); }
  .home-bg::after { content: ""; position: absolute; inset: 0;
    background:
      linear-gradient(to bottom, rgba(0,0,0,0) 55%, rgba(0,0,0,.6) 72%, rgba(0,0,0,.92) 94%),
      url("assets/accueil.webp") center top / contain no-repeat; }
}
.home .home-lines p, .home .btn { text-shadow: 0 2px 12px #000, 0 0 3px #000; }
@keyframes homeBreath { from { transform: scale(1); } to { transform: scale(1.05); } }
.home .home-mark { position: absolute; top: calc(16px + var(--safe-top)); left: 50%; transform: translateX(-50%);
  width: clamp(190px, 58vw, 320px); margin: 0; filter: drop-shadow(0 2px 8px #000); }
.home .home-lines { margin-top: 0; min-height: 0; gap: 10px; font-size: clamp(.92rem, 4.2vw, 1.2rem); }
@media (max-height: 700px) { .home .home-lines { gap: 6px; font-size: .9rem; } .home .btn { padding: 15px 30px; } }
.home .headphones { display: none; }
.home-lines { transition: opacity .7s, filter .7s; }
.home-lines.swap { opacity: 0; filter: blur(4px); }
.logo { width: min(78vw, 400px); mix-blend-mode: screen; margin-top: 4vh; }
.logo.small { width: min(60vw, 280px); margin: 0; }
.home-text { display: grid; gap: 14px; margin-top: auto; }
.headphones {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--gris); font-size: .62rem; letter-spacing: .22em;
}
.headphones svg { width: 30px; fill: none; stroke: var(--blanc); stroke-width: 1.6; }

/* ---------- dialogues de THE OTHER ---------- */
.lines { display: grid; gap: 22px; max-width: 30ch; font-size: clamp(1.1rem, 5vw, 1.45rem); line-height: 1.55; }
.lines p { min-height: 1.55em; }
.hint { color: var(--gris); font-size: .8rem; letter-spacing: .12em; animation: blink 2.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.cursor::after { content: "▍"; color: var(--rouge); margin-left: 2px; animation: blink 1s steps(1) infinite; }

/* ---------- longueur ---------- */
.length-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; width: min(100%, 420px); }
.len {
  appearance: none; font: inherit; font-size: 1.6rem; color: var(--blanc);
  background: none; border: 1px solid var(--trait); border-radius: 14px;
  aspect-ratio: 1; cursor: pointer; transition: border-color .2s, color .2s, box-shadow .2s;
}
.len.on { border-color: var(--rouge); color: var(--rouge); box-shadow: 0 0 16px rgba(255, 26, 43, .4); }

/* ---------- réglage du clavier ---------- */
.sync { justify-content: space-between; }
.sync-head, .game-head {
  width: 100%; display: flex; justify-content: space-between;
  color: var(--gris); font-size: .7rem;
}
.timer { width: 100%; height: 2px; background: var(--trait); }
.timer-bar { height: 100%; width: 100%; background: var(--rouge); transform-origin: left; }
.stimulus {
  font-size: clamp(2.6rem, 14vw, 4.8rem); font-weight: 400; letter-spacing: .12em;
  min-height: 1.3em; text-shadow: 0 0 22px rgba(233, 238, 242, .25);
}
.typed {
  min-height: 2.2em; width: 100%; font-size: clamp(1.4rem, 7vw, 2rem);
  letter-spacing: .14em; border-bottom: 1px solid var(--trait); padding-bottom: 8px;
  overflow-wrap: anywhere;
}
.typed.left { text-align: left; font-size: 1.15rem; letter-spacing: .03em; min-height: 4.5em; line-height: 1.5; }

/* ---------- clavier intégré ---------- */
.kb { width: 100%; display: grid; gap: 8px; }
.kb-row { display: flex; gap: 6px; justify-content: center; }
.key {
  appearance: none; flex: 1 1 0; max-width: 56px; height: clamp(46px, 7vh, 60px);
  font: inherit; font-size: 1.15rem; font-weight: 400; color: var(--blanc);
  background: rgba(233, 238, 242, .06); border: 1px solid var(--trait); border-radius: 8px;
  cursor: pointer; transition: background .12s, color .2s, border-color .2s;
}
.key:active { background: rgba(255, 26, 43, .35); }
.kb-row.accents .key { height: clamp(38px, 5vh, 48px); font-size: 1rem; }
.key.wide { flex: 1.8 1 0; max-width: 96px; font-size: .8rem; letter-spacing: .12em; }
.key.space { flex: 5 1 0; max-width: none; }
.key.go { flex: 3 1 0; max-width: none; border-color: var(--rouge); letter-spacing: .2em; font-size: .85rem; }
.key.hit { color: var(--noir); background: var(--blanc); border-color: var(--blanc); }
.key.miss { color: var(--rouge); border-color: var(--rouge-sombre); background: none; text-decoration: line-through; }
.key:disabled { cursor: default; }

/* ---------- signal (diversion) ---------- */
.signal { display: flex; gap: 6px; align-items: center; height: 40px; }
.signal span { width: 3px; height: 100%; background: var(--rouge); animation: pulse 1s ease-in-out infinite; }
.signal span:nth-child(2) { animation-delay: .15s; }
.signal span:nth-child(3) { animation-delay: .3s; }
.signal span:nth-child(4) { animation-delay: .45s; }
.signal span:nth-child(5) { animation-delay: .6s; }
@keyframes pulse { 0%, 100% { transform: scaleY(.15); } 50% { transform: scaleY(1); } }

/* ---------- pendu ---------- */
.game { justify-content: space-between; gap: 10px; max-width: 760px; padding-top: calc(14px + var(--safe-top)); }
.game-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 0%, rgba(0,0,0,.55) 70%, #000 100%),
    linear-gradient(to bottom, #000 0%, rgba(0,0,0,.35) 18%, rgba(0,0,0,.35) 62%, #000 86%),
    url("assets/couloir.jpg") 38% 55% / cover no-repeat;
  animation: breathe 7s ease-in-out infinite;
}
@keyframes breathe { 50% { filter: brightness(.7); } }

.hud { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; }
.hud-left, .hud-right { display: grid; gap: 6px; font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; }
.hud-left { text-align: left; }
.hud-left span, .hud-right span { white-space: nowrap; }
.hud-left span + span { font-size: .6rem; letter-spacing: .18em; }
.hud-right { text-align: right; justify-items: end; }
.hud-logo { width: 96px; mix-blend-mode: screen; }
.hud-count { font-size: 1.25rem; letter-spacing: .12em; }
.hud-count b { color: var(--rouge); font-weight: 400; }
.err-bar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; width: 92px; height: 8px;
  border: 1px solid var(--trait); padding: 1px; border-radius: 2px; }
.err-bar i { background: rgba(233,238,242,.08); }
.err-bar i.on { background: var(--rouge); box-shadow: 0 0 6px var(--rouge); }

.stage { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; display: flex; justify-content: center; }
.blood { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.figure { position: relative; height: 100%; aspect-ratio: 340 / 905; max-width: 52%; margin-right: auto; margin-left: 4%; }
.rig { position: absolute; inset: 0; transform-origin: 55% 2%; animation: sway var(--sway-time, 6s) ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(calc(var(--amp, .6) * -1deg)); } to { transform: rotate(calc(var(--amp, .6) * 1deg)); } }
.figure.jerk { animation: jerk .7s cubic-bezier(.2,.9,.3,1.4); }
@keyframes jerk { 0% { transform: translateY(0); } 25% { transform: translateY(3.5%); } 55% { transform: translateY(-.8%); } 100% { transform: translateY(0); } }

.layer { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; will-change: transform, opacity; }
.layer.on { opacity: 1; }
.layer.anim-appear { animation: appear 1.6s ease-out both; }
.layer.anim-grow   { animation: grow 1.5s cubic-bezier(.3,.7,.2,1) both; }
.layer.anim-drop   { animation: drop 1s cubic-bezier(.3,1.6,.4,1) both; }
.layer.anim-spill  { animation: spill 1.8s cubic-bezier(.5,0,.3,1) both; }
@keyframes appear {
  0% { opacity: 0; filter: brightness(4) blur(6px); transform: scale(1.08); }
  12% { opacity: 1; }
  18% { opacity: .2; } 26% { opacity: 1; } 32% { opacity: .4; }
  100% { opacity: 1; filter: none; transform: none; }
}
@keyframes grow { from { opacity: 1; clip-path: inset(0 0 100% 0); filter: brightness(2.5); } to { opacity: 1; clip-path: inset(0 0 0 0); filter: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-6%); } 40% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes spill { from { opacity: 1; clip-path: inset(0 0 100% 0); transform: translateY(-2%); } to { opacity: 1; clip-path: inset(0 0 0 0); transform: none; } }

.skull { transform-origin: 55.3% 32%; transition: transform 2.5s ease; }
.eyes { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s; pointer-events: none; }
.eyes i { position: absolute; top: 26.2%; width: 4%; height: 1.6%; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--rouge) 35%, rgba(255,26,43,0) 70%);
  filter: drop-shadow(0 0 4px var(--rouge)); animation: pulseEye 1.1s ease-in-out infinite; }
.eyes i:first-child { left: 49%; }
.eyes i:last-child { left: 57.6%; }
@keyframes pulseEye { 50% { opacity: .35; } }
.rig.stare .skull { transform: rotate(-5deg) translateY(.4%); }
.rig.stare .eyes, .rig.dead .eyes { opacity: 1; }

.callout {
  position: absolute; right: 0; top: 24%; width: 44%; z-index: 3;
  border: 1px solid rgba(255,26,43,.6); background: rgba(20,0,2,.55);
  padding: 14px 16px; border-radius: 4px;
  font-size: .7rem; letter-spacing: .22em; line-height: 1.9; text-transform: uppercase; text-align: center;
  box-shadow: 0 0 14px rgba(255,26,43,.25);
}
.callout::before { content: ""; position: absolute; right: 100%; top: 16px; width: 18px; border-top: 1px solid rgba(255,26,43,.6); }
.callout .red { color: var(--rouge); }
.callout.glitch { animation: glitch .5s steps(2) 2; }
@keyframes glitch { 0% { transform: translate(2px,-1px); filter: hue-rotate(20deg); } 50% { transform: translate(-3px,1px); opacity: .6; } 100% { transform: none; } }

.slots { display: flex; gap: clamp(6px, 2.2vw, 14px); justify-content: center; width: 100%; }
.slot {
  flex: 0 1 40px; height: 48px; border-bottom: 2px solid var(--blanc);
  font-size: clamp(1.3rem, 6vw, 2rem); font-weight: 400; display: flex; align-items: flex-end; justify-content: center;
}
.slot.reveal { color: var(--rouge); }
.game .key { height: clamp(44px, 6.2vh, 60px); background: rgba(10,10,10,.8); }
.game .key.hit { background: rgba(233,238,242,.28); color: rgba(233,238,242,.55); border-color: transparent; }
.game .key.miss { color: var(--rouge); border-color: var(--rouge); background: rgba(40,0,4,.8); box-shadow: 0 0 10px rgba(255,26,43,.35); text-decoration: none; }

.game-foot { display: grid; justify-items: center; gap: 8px; font-size: .62rem; letter-spacing: .28em; text-transform: uppercase; color: var(--blanc); }
.foot-line { width: 60%; height: 1px; background: linear-gradient(90deg, transparent, var(--rouge), transparent); position: relative; }
.foot-line::after { content: ""; position: absolute; left: 50%; top: -4px; width: 8px; height: 8px; margin-left: -4px;
  border: 1.5px solid var(--rouge); border-radius: 50%; background: #000; }

.flash { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0;
  background: url("assets/pendu/flash.jpg") center / cover no-repeat; }
.flash.go { animation: flash .38s steps(1) both; }
@keyframes flash {
  0% { opacity: 0; }
  8% { opacity: 1; clip-path: inset(0 0 55% 0); transform: translateX(-3%) scale(1.05); }
  16% { opacity: 1; clip-path: inset(30% 0 0 0); transform: translateX(4%) scale(1.1); }
  24% { opacity: .85; clip-path: none; transform: scale(1.18); filter: invert(1) hue-rotate(180deg); }
  34% { opacity: 0; }
  100% { opacity: 0; }
}
.flash.red { background: rgba(255,0,20,.55); }
.stage.shake { animation: shakeScreen .45s; }
@keyframes shakeScreen { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }
.game.dark .figure { transition: filter 3s; filter: brightness(.25); }

/* ---------- pourquoi ---------- */
.why { justify-content: space-between; }
.big-word { font-size: clamp(1.8rem, 9vw, 3rem); letter-spacing: .2em; color: var(--rouge); font-weight: 400; margin-top: 2vh; }
.why-input { width: 100%; display: grid; gap: 16px; }

/* ---------- son ---------- */
.pause-btn { right: 52px !important; }
/* ---------- « Partir » : extinction façon télé cathodique ---------- */
body.crt-off #app, body.crt-off .world { animation: crtOff .65s cubic-bezier(.7,0,.8,.4) forwards; transform-origin: 50% 50%; }
body.crt-on #app, body.crt-on .world { animation: crtOn .8s cubic-bezier(.2,.6,.3,1) both; transform-origin: 50% 50%; }
@keyframes crtOff {
  0%   { transform: scale(1, 1); filter: brightness(1); }
  45%  { transform: scale(1, .006); filter: brightness(4) contrast(2); }
  75%  { transform: scale(.25, .004); filter: brightness(6); }
  100% { transform: scale(0, 0); filter: brightness(8); opacity: 0; }
}
@keyframes crtOn {
  0%   { transform: scale(0, .004); filter: brightness(8); opacity: 1; }
  35%  { transform: scale(1, .006); filter: brightness(5) contrast(2); }
  70%  { transform: scale(1, 1.04); filter: brightness(1.6); }
  100% { transform: scale(1, 1); filter: none; }
}
.tv-off { position: fixed; inset: 0; z-index: 60; background: #000; display: none; }
.tv-off.on { display: block; }
.tv-line { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 18px 6px rgba(255,255,255,.8); animation: tvDot 1.4s ease-out forwards; }
@keyframes tvDot { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.2); } }
.tv-led { position: absolute; left: 50%; bottom: calc(26px + var(--safe-bot)); width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%;
  background: #ff1a2b; box-shadow: 0 0 8px 2px rgba(255,26,43,.8); opacity: 0; animation: tvLed 1.6s steps(1) 1.2s infinite; }
@keyframes tvLed { 0% { opacity: 1; } 50% { opacity: .08; } }
body.crt-off .sound { display: none; }

/* ---------- âge et conditions ---------- */
.age-badge { width: 28px; height: 28px; flex: 0 0 28px; }
.age-badge.big { width: 72px; height: 72px; }
.age-title { font-size: clamp(1.1rem, 5.5vw, 1.6rem); letter-spacing: .08em; }
.legal { display: flex; align-items: center; justify-content: center; gap: 6px 10px; flex-wrap: wrap; font-size: .66rem; padding: 0 46px;
  letter-spacing: .08em; color: rgba(233,238,242,.7); margin-top: -4px; }
.legal a { color: rgba(233,238,242,.85); text-decoration: underline; text-underline-offset: 3px; }
.touch-age { display: flex; align-items: center; gap: 8px; color: var(--gris); font-size: .72rem; letter-spacing: .08em; }
/* place réservée en bas pour les boutons pause et son : rien ne passe dessous */
.l13, .scene, .game, .lvl { padding-bottom: calc(54px + var(--safe-bot)) !important; }
.pause-btn svg { fill: var(--gris) !important; stroke: none !important; }
.pause-screen { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; background: rgba(0,0,0,.86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); text-align: center; }
.pause-screen[hidden] { display: none; }
.pause-title { font-size: clamp(2rem, 10vw, 3rem); letter-spacing: .3em; text-transform: uppercase; color: var(--rouge);
  text-shadow: 0 0 20px rgba(255,26,43,.6); }
.pause-text { color: var(--blanc); font-size: 1.1rem; margin-bottom: 10px; }
.pause-note { color: var(--gris); font-size: .8rem; max-width: 30ch; line-height: 1.5; }
@keyframes shrinkBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes growBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* en pause, toutes les animations s'arrêtent (barres de temps, sablier, pendu…) */
body.paused *, body.paused *::before, body.paused *::after { animation-play-state: paused !important; }
body.paused .pause-screen, body.paused .pause-screen * { animation-play-state: running !important; }
.sound {
  position: fixed; bottom: calc(10px + var(--safe-bot)); right: 10px; z-index: 5;
  width: 40px; height: 40px; border: none; background: none; cursor: pointer;
}
.sound svg { width: 22px; fill: none; stroke: var(--gris); stroke-width: 1.6; stroke-linejoin: round; }
.sound.off .wave { opacity: 0; }

/* ---------- tablette ---------- */

/* ---------- prénom + numérologie + mort ---------- */
.name { justify-content: space-between; }
.name .lines { margin-top: auto; }
.name .kb { margin-top: auto; }
.calc { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 64px; }
.calc .cell { display: grid; justify-items: center; gap: 4px; animation: fade .3s both; }
.calc .cell b { font-size: 1.6rem; font-weight: 400; }
.calc .cell i { font-style: normal; color: var(--rouge); font-size: 1rem; }
.calc .sum { width: 100%; text-align: center; color: var(--gris); letter-spacing: .14em; margin-top: 6px; }
.numero-n { font-size: clamp(5rem, 30vw, 9rem); color: var(--rouge); line-height: 1; min-height: 1em;
  text-shadow: 0 0 30px rgba(255,26,43,.6); }
.numero-n:empty { display: none; }
.dead-title { font-size: clamp(2.4rem, 12vw, 4rem); color: var(--rouge); letter-spacing: .12em; text-transform: uppercase;
  text-shadow: 0 0 26px rgba(255,26,43,.7); animation: fade 2s both; }
.dead-timer { width: min(100%, 360px); }
.dead-timer .timer-bar { transform: scaleX(0); transition: transform linear; }

/* ---------- mort au niveau 1 : image plein écran ---------- */
.dead.mort1-on { max-width: none; padding: 0; }
.dead.mort1-on > .dead-title, .dead.mort1-on > #dead-lines, .dead.mort1-on > .dead-timer, .dead.mort1-on > #dead-count { display: none; }
.mort1 { position: fixed; inset: 0; z-index: 1; overflow: hidden; background: #000; }
.mort1[hidden] { display: none; }
/* fond flou pour les tablettes : l'image entière reste visible au centre */
.mort1-bg { position: absolute; inset: -40px; background: url("assets/mort-niveau1.webp") center / cover no-repeat;
  filter: blur(28px) brightness(.3); }
/* cadre au ratio de l'image : rogne un peu les côtés sur téléphone, entière sur tablette */
.mort1-frame { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(calc(100dvh * 941 / 1672), 128vw); aspect-ratio: 941 / 1672; container-type: inline-size; }
.mort1-frame img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none;
  -webkit-user-drag: none; }
.mort1.go .mort1-frame img { animation: mortIn 7s cubic-bezier(.2,.7,.2,1) both; }
@keyframes mortIn {
  0%   { opacity: 0; transform: scale(1.12); filter: brightness(3) saturate(0) blur(4px); }
  4%   { opacity: 1; filter: brightness(2.2) saturate(.4) blur(1px); }
  12%  { filter: brightness(.35) saturate(1); }
  100% { opacity: 1; transform: scale(1); filter: brightness(1) saturate(1); }
}
/* phrases dites par la voix : sur le sol, au-dessus de « NIVEAU 01 — ÉCHEC » */
.mort1-lines { position: absolute; left: 50%; transform: translateX(-50%); width: min(84%, calc(100vw - 36px)); top: 71.5%; height: 13.5%; display: flex; flex-direction: column;
  justify-content: flex-end; gap: .35em; text-align: center; font-size: clamp(.82rem, 4.1cqw, 1.1rem); line-height: 1.35;
  color: #f1e6e6; text-shadow: 0 1px 3px #000, 0 0 14px #000, 0 0 26px rgba(0,0,0,.9); pointer-events: none; }
.mort1-lines p { margin: 0; animation: fade .5s both; }
.mort1-lines p.muted { color: #c9b4b4; font-size: .92em; }
/* le bouton « Recommencer » (même place et même style que sur l'affiche) */
.mort1-btn { position: absolute; left: 31.6%; width: 36.9%; top: 88.9%; height: 4.4%; padding: 0; margin: 0;
  border: 1.5px solid rgba(215,40,48,.95); border-radius: .6cqw; background: rgba(8,2,3,.72); cursor: pointer; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 0 18px rgba(255,26,43,.18); -webkit-tap-highlight-color: transparent; }
.mort1-label { position: relative; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500;
  font-size: clamp(.8rem, 3.6cqw, 1.3rem); letter-spacing: .16em; text-transform: uppercase; color: #ff2a3a;
  text-shadow: 0 0 10px rgba(255,26,43,.45); }
/* tant qu'on respire, le bouton est éteint et se remplit de rouge */
.mort1-btn:disabled { cursor: default; }
.mort1-btn:disabled .mort1-label { color: rgba(255,60,70,.45); text-shadow: none; }
.mort1-fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0);
  transition: transform 1s linear; background: linear-gradient(90deg, rgba(255,26,43,.06), rgba(255,26,43,.26));
  box-shadow: inset -2px 0 0 rgba(255,60,70,.9); }
.mort1-btn.ready { animation: mortReady 1.6s ease-in-out infinite; }
.mort1-btn.ready .mort1-fill { opacity: 0; transition: opacity .6s; }
@keyframes mortReady {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,26,43,.35), 0 0 14px rgba(255,26,43,.25); }
  50%      { box-shadow: 0 0 0 1px rgba(255,26,43,.9), 0 0 30px rgba(255,26,43,.7), inset 0 0 18px rgba(255,26,43,.35); }
}
.mort1-btn.ready:active { transform: scale(.97); }
.mort1-count { position: absolute; left: 0; right: 0; top: 94.2%; margin: 0; text-align: center;
  font-size: clamp(.7rem, 3.2cqw, .9rem); letter-spacing: .3em; color: rgba(233,238,242,.6);
  text-shadow: 0 0 8px #000; pointer-events: none; }
.mort1-count:empty { display: none; }
.mort1.out .mort1-frame img { transition: filter 1.2s, opacity 1.2s; filter: brightness(0); opacity: 0; }

/* ---------- niveaux 2 à 12 ---------- */
.sealed { display: grid; justify-items: center; gap: 6px; padding: 16px 26px; border: 1px dashed rgba(255,26,43,.6);
  border-radius: 6px; background: rgba(20,0,2,.6); font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; }
.sealed span { color: var(--gris); }
.sealed b { font-weight: 400; }
.sealed.open { border-style: solid; box-shadow: 0 0 24px rgba(255,26,43,.45); animation: fade .6s; }
.sealed .num { font-size: 4rem; letter-spacing: .05em; color: var(--rouge); text-shadow: 0 0 18px rgba(255,26,43,.6); }
.lvl { justify-content: flex-start; gap: 14px; max-width: 760px; padding-top: calc(14px + var(--safe-top)); }
.lvl-bg { display: none; }
.lvl-bg-old {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0,0,0,.35) 0%, rgba(0,0,0,.8) 65%, #000 100%),
    url("assets/couloir.jpg") 40% 50% / cover no-repeat;
  filter: brightness(.45);
}
.lvl-body {
  flex: 1 1 auto; min-height: 0; width: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 12px 0 8px;
}
.lvl-body > :first-child { margin-top: auto; }
.lvl-body > :last-child { margin-bottom: auto; }
.lvl-body > .place:first-child + * { margin-top: auto; } /* sécurité : la légende ne compte pas dans le centrage */
.lvl-body .kb { margin-top: 8px; }
.q { font-size: clamp(1.05rem, 4.8vw, 1.35rem); line-height: 1.5; max-width: 30ch; }
.opts { display: grid; gap: 12px; width: min(100%, 460px); }
.opt {
  appearance: none; font: inherit; font-size: 1.05rem; color: var(--blanc); text-align: left;
  background: rgba(10,10,10,.75); border: 1px solid var(--trait); border-radius: 10px; padding: 16px 18px; cursor: pointer;
  transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.opt:active, .opt.picked { border-color: var(--rouge); box-shadow: 0 0 14px rgba(255,26,43,.35); }
.opt:disabled:not(.picked) { opacity: .35; }
.two { display: grid; gap: 14px; width: min(100%, 360px); justify-items: center; }
.two .btn { letter-spacing: .16em; font-size: .95rem; padding: 18px 22px; width: 100%; }
.home-actions { display: grid; gap: 14px; justify-items: center; }
.link { appearance: none; background: none; border: none; color: var(--gris); font: inherit; font-size: .85rem;
  letter-spacing: .14em; text-decoration: underline; text-underline-offset: 4px; padding: 10px; cursor: pointer; }
.link-box { width: 100%; padding: 12px; border: 1px dashed var(--trait); border-radius: 8px; font-size: .85rem;
  overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
a.btn { text-decoration: none; display: inline-block; }
.alert { border: 1px solid var(--rouge); color: var(--rouge); padding: 10px 16px; border-radius: 6px;
  font-size: .75rem; letter-spacing: .24em; text-transform: uppercase; box-shadow: 0 0 14px rgba(255,26,43,.3); }

.ring { position: relative; width: 150px; display: grid; justify-items: center; gap: 6px; }
.ring svg { width: 110px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--trait); }
.ring .val { stroke: var(--rouge); stroke-linecap: round; transition: stroke-dashoffset 2s ease; filter: drop-shadow(0 0 4px var(--rouge)); }
.ring b { position: absolute; top: 38px; font-size: 1.3rem; font-weight: 400; }
.ring span { color: var(--gris); font-size: .8rem; }

.memory { width: min(100%, 520px); aspect-ratio: 941 / 590; background: center / cover no-repeat; border-radius: 6px;
  box-shadow: 0 0 30px rgba(255,26,43,.25); transition: opacity .8s, filter .8s; }
.memory.gone { opacity: 0; filter: blur(8px); }
.memory.mirrored { transform: scaleX(-1); filter: brightness(.8) contrast(1.15); }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(100%, 480px); }
.card { appearance: none; font: inherit; color: var(--blanc); text-align: left; cursor: pointer; min-height: 92px;
  background: rgba(10,10,10,.8); border: 1px solid var(--trait); border-radius: 8px; padding: 12px;
  display: grid; align-content: space-between; gap: 8px; transition: border-color .3s, transform .4s; }
.card.open { border-color: rgba(255,26,43,.55); transform: rotateY(360deg); }
.card-label { color: var(--gris); font-size: .68rem; letter-spacing: .24em; text-transform: uppercase; }
.card-value { font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.card-value em { display: block; margin-top: 6px; font-style: normal; font-size: .65rem; letter-spacing: .12em;
  color: var(--rouge); text-transform: uppercase; }

.rows { width: min(100%, 480px); display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; align-items: center; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--trait); font-size: .95rem; overflow-wrap: anywhere; }
.row:not(:has(span:nth-child(3))) { grid-template-columns: 1.3fr 1fr; }
.row span:first-child { color: var(--gris); font-size: .85rem; }
.row.head { border: none; color: var(--gris); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; padding-bottom: 0; }
.row.diff span:nth-child(3) { color: var(--rouge); }

.identity { width: min(100%, 480px); display: grid; grid-template-columns: 110px 1fr; gap: 16px; text-align: left;
  border: 1px solid rgba(255,26,43,.45); border-radius: 8px; padding: 14px; background: rgba(10,0,2,.7); }
.portrait { position: relative; aspect-ratio: 5 / 6; background: url("assets/pendu/flash.jpg") center / cover; filter: grayscale(.4); border-radius: 4px; }
.portrait .bar { position: absolute; left: -4%; right: -4%; top: 38%; height: 12%; background: var(--rouge); box-shadow: 0 0 12px var(--rouge); }
.identity dl { display: grid; gap: 4px; font-size: .9rem; }
.identity dt { color: var(--gris); font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; margin-top: 6px; }

.rev { display: grid; gap: 14px; justify-items: center; max-width: 32ch; }
.rev-num { font-size: 4.5rem; font-weight: 400; color: var(--rouge); line-height: 1; text-shadow: 0 0 20px rgba(255,26,43,.5); }
.rev-title { color: var(--gris); font-size: .75rem; letter-spacing: .3em; text-transform: uppercase; }
.rev p { font-size: 1.15rem; line-height: 1.55; }

.blackout { position: fixed; inset: 0; z-index: 30; background: #000; display: grid; place-items: center; padding: 30px;
  opacity: 0; pointer-events: none; transition: opacity .6s; text-align: center; }
.blackout.on { opacity: 1; pointer-events: auto; }
.blackout p { font-size: clamp(1.3rem, 6vw, 2rem); letter-spacing: .12em; max-width: 22ch; line-height: 1.5; }


/* ---------- toucher pour entrer + accueil parlé ---------- */
.touch { cursor: pointer; }
.touch::before { content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,.88)), url("assets/accueil.webp") center top / cover no-repeat; filter: blur(3px); }
.pulse { animation: pulseLogo 2.8s ease-in-out infinite; }
@keyframes pulseLogo { 50% { opacity: .45; transform: scale(.97); } }
.touch-text { color: var(--gris); font-size: .8rem; letter-spacing: .3em; text-transform: uppercase; animation: blink 2.4s ease-in-out infinite; }
.home-lines { min-height: 9em; margin-top: auto; font-size: clamp(1rem, 4.6vw, 1.3rem); }
.home-lines p { text-shadow: 0 2px 12px #000; }
.home-actions.wait { opacity: 0; pointer-events: none; }
.home-actions { transition: opacity 1.2s; }
.leave { font-size: .75rem; color: rgba(124,130,136,.7); }

/* ---------- niveau 13 : l'heure ---------- */
.l13 { justify-content: flex-start; gap: 12px; max-width: min(760px, 49vh); overflow-y: auto; padding-top: calc(12px + var(--safe-top)); }
/* la largeur suit la hauteur de l'écran : tout tient sans défiler, du petit téléphone à la tablette */
.scene { max-width: min(760px, 62vh) !important; }
.l13-bg { position: fixed; inset: 0; z-index: -1; background: linear-gradient(to bottom, rgba(0,0,0,.2), #000 85%), url("assets/l13/fond.jpg") center top / cover no-repeat; }
.l13-head { width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: .72rem; letter-spacing: .32em; text-transform: uppercase; border-bottom: 1px solid var(--trait); padding-bottom: 10px; }
.l13-logo { width: 34px; mix-blend-mode: screen; }
.l13-top { width: 100%; display: grid; grid-template-columns: 1fr 23%; gap: 10px; align-items: start; }

.window { position: relative; aspect-ratio: 550 / 425; overflow: hidden; border-radius: 4px;
  box-shadow: 0 0 0 2px #1a1a1a, 0 10px 30px rgba(0,0,0,.8); transition: filter 1.5s; }
.window > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.w-base { object-fit: cover; }
.w-friend, .w-hand { object-fit: cover; transform-origin: 38% 90%; }
.w-friend { animation: breath 4.2s ease-in-out infinite; }
@keyframes breath { 50% { transform: translateY(-.6%) scale(1.015); } }
.w-hand { transform-origin: 16% 70%; animation: tremble .18s steps(2) infinite; }
@keyframes tremble { 50% { transform: translate(.25%, -.2%); } }
.w-water-cv { pointer-events: none; }
.w-water-old { top: auto; bottom: 0; height: 0%; transition: height 1s linear;
  background: linear-gradient(to bottom, rgba(120,150,160,.35) 0, rgba(40,60,70,.6) 6%, rgba(8,18,24,.88) 100%);
  box-shadow: 0 -2px 10px rgba(180,210,220,.25); mix-blend-mode: normal; }
.w-rain { background:
    repeating-linear-gradient(100deg, rgba(255,255,255,0) 0 18px, rgba(255,255,255,.07) 18px 19px, rgba(255,255,255,0) 19px 42px);
  background-size: 200% 200%; animation: rain .6s linear infinite; mix-blend-mode: screen; }
@keyframes rain { to { background-position: -40px 120px; } }
.w-flash { opacity: 0; background: #fff; pointer-events: none; }
.w-flash.red { background: #ff1a2b; }
.w-flash.go { animation: wflash .5s ease-out; }
@keyframes wflash { 0% { opacity: .9; } 30% { opacity: .1; } 45% { opacity: .6; } 100% { opacity: 0; } }
.w-sub { inset: auto 0 0 0; height: auto; margin: 0; padding: 8px 6%; background: linear-gradient(transparent, rgba(0,0,0,.75) 35%);
  text-align: center; color: #fff; font-size: clamp(.72rem, 3.2vw, .95rem);
  letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 0 6px #ff1a2b, 0 2px 4px #000; opacity: 0; }
.w-sub.show { animation: sub 4.5s ease-out both; }
@keyframes sub { 0% { opacity: 0; transform: translateX(-3px); } 6% { opacity: 1; transform: translateX(3px); } 10% { transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
.window.lunge .w-friend { animation: lunge .7s cubic-bezier(.2,1.4,.4,1); }
@keyframes lunge { 0% { transform: none; } 35% { transform: translateY(-4%) scale(1.16); filter: brightness(1.4); } 100% { transform: none; } }
.window.lunge .w-hand { animation: slap .7s cubic-bezier(.2,1.4,.4,1); }
@keyframes slap { 0% { transform: none; } 30% { transform: translate(-3%, -3%) scale(1.12); } 45% { transform: scale(1.02); } 100% { transform: none; } }
.window.shake { animation: shakeScreen .45s; }
.window.flicker { animation: flicker 7s steps(1) infinite; }
@keyframes flicker { 0%, 100% { filter: brightness(1); } 41% { filter: brightness(.35); } 42% { filter: brightness(1); } 43% { filter: brightness(.5); } 44% { filter: brightness(1); } 77% { filter: brightness(.6); } 78% { filter: brightness(1); } }
.window.dark { filter: brightness(0); }
.window.dead { filter: brightness(.05) saturate(0); animation: none; }
.window.saved .w-friend, .window.saved .w-hand { transition: opacity 2.5s, transform 2.5s; opacity: 0; transform: translateY(4%) scale(.95); }

.clock { display: grid; gap: 6px; }
.digits { background: #050505; border: 1px solid #2a2a2a; border-radius: 3px; text-align: center; padding: 4px 2px;
  font-size: clamp(1.1rem, 5.4vw, 1.9rem); letter-spacing: .08em; color: #ff2436; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255,26,43,.9); }
.digits.urgent { animation: blink .8s steps(1) infinite; }
.digits.hit { animation: hitClock .6s; }
@keyframes hitClock { 30% { transform: scale(1.15); color: #fff; } }
.glass-sand { position: relative; }
.glass-sand img { width: 100%; display: block; border-radius: 3px; }
.sand-stream { position: absolute; left: 50%; top: 38%; width: 2px; height: 26%; margin-left: -1px;
  background: linear-gradient(#ff1a2b, rgba(255,26,43,.2)); animation: stream .35s linear infinite; }
@keyframes stream { 50% { opacity: .5; transform: scaleX(.6); } }

.plaque { width: 100%; padding: 14px; border: 1px solid #333; border-radius: 3px;
  background: linear-gradient(#141414, #070707); box-shadow: inset 0 0 12px #000;
  font-size: clamp(.72rem, 3.3vw, .9rem); letter-spacing: .28em; text-transform: uppercase; line-height: 1.9; }
.plaque.glitch { animation: glitch .5s steps(2) 1; }

.lock-guide { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); margin-bottom: -4px; }
.lock-guide span:first-child { text-align: right; }
.lock-guide span:last-child { text-align: left; }
.lock-guide b { color: #ff3b48; font-weight: 400; font-size: 1.2rem; letter-spacing: .3em; text-shadow: 0 0 8px rgba(255,26,43,.8); }
.lock { width: 100%; display: grid; gap: 8px; padding: 12px 8px; border-radius: 10px;
  background: linear-gradient(#1b1b1b, #0a0a0a); box-shadow: inset 0 0 18px #000, 0 0 0 1px #262626; }
.lock.deny { animation: shakeScreen .45s; }
.lock.open .tile.on { border-color: #fff; box-shadow: 0 0 24px #fff; }
.reel { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 4px; }
.reel-btn { appearance: none; background: none; border: none; color: var(--gris); font-size: 1.8rem; height: 52px; cursor: pointer; }
.reel-view { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; perspective: 400px; touch-action: pan-y; }
.tile { height: clamp(46px, 7vh, 60px); display: grid; place-items: center; border-radius: 4px;
  background: linear-gradient(#2c2c2c, #111); border: 1px solid #3a3a3a;
  transform: rotateY(calc(var(--off) * -18deg)) scale(calc(1 - (var(--off) * var(--off)) * .06)); opacity: calc(1 - (var(--off) * var(--off)) * .15); cursor: pointer; }
.tile svg { width: 60%; fill: none; stroke: #c9ced2; stroke-width: 1.4; stroke-linejoin: round; }
.tile.on { border: 1.5px solid var(--rouge); box-shadow: 0 0 14px rgba(255,26,43,.55), inset 0 0 10px rgba(255,26,43,.25); }
.tile.on svg { stroke: #fff; }

.l13-actions { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; }
.l13-actions .btn { min-width: 0; flex: 1; padding: 16px 10px; font-size: .85rem; letter-spacing: .2em; }
.round { appearance: none; width: 54px; height: 54px; flex: 0 0 54px; border-radius: 50%; border: 1px solid rgba(233,238,242,.5);
  background: rgba(0,0,0,.5); cursor: pointer; display: grid; place-items: center; }
.round svg { width: 24px; fill: none; stroke: var(--blanc); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.round:disabled { opacity: .3; }
.round.glow { border-color: var(--rouge); box-shadow: 0 0 16px var(--rouge); animation: blink 1.2s ease-in-out infinite; }


/* ---------- niveau 11 : le dossier qui bascule ---------- */
.dossier11 { width: min(100%, 480px); display: grid; grid-template-columns: 42% 1fr; gap: 14px; align-items: end;
  padding: 14px; background: rgba(8,8,8,.82); border: 1px solid rgba(255,26,43,.45); border-radius: 6px; text-align: left;
  box-shadow: 0 12px 34px rgba(0,0,0,.8); animation: fade .8s both; }
.d-photo { position: relative; }
.d-photo img { display: block; width: 100%; border-radius: 3px; filter: contrast(1.05); }
.d-stamp { position: absolute; left: 6%; bottom: 8%; padding: 3px 10px; border: 2px solid var(--rouge); color: var(--rouge);
  font-size: .75rem; letter-spacing: .24em; text-transform: uppercase; transform: rotate(-8deg); background: rgba(0,0,0,.55);
  animation: stamp .5s .4s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes stamp { from { opacity: 0; transform: rotate(-8deg) scale(2.2); } to { opacity: 1; transform: rotate(-8deg) scale(1); } }
.d-id { display: grid; gap: 4px; font-size: .95rem; }
.d-label { color: var(--gris); font-size: .6rem; letter-spacing: .24em; text-transform: uppercase; margin-top: 8px; }
.d-name { font-weight: 400; font-size: 1.25rem; letter-spacing: .06em; color: var(--rouge); min-height: 1.4em; }
.d-name.glitch, #d-link.glitch { animation: glitch .4s steps(2) 2; }
.d-facts { width: min(100%, 480px); display: grid; gap: 10px; text-align: left; }
.d-facts p { padding: 8px 12px; border-left: 2px solid #444; font-size: 1.02rem; line-height: 1.45; background: rgba(0,0,0,.45);
  animation: fade .5s both; transition: border-color .4s, color .4s; }
.d-facts p.flip { animation: glitch .35s steps(2) 1; }
.d-facts p.tu { border-left-color: var(--rouge); color: #fff; }

/* ---------- l'Ombre ---------- */
.thinking { display: flex; gap: 6px; justify-content: center; padding: 10px; }
.thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--rouge); animation: blink 1s ease-in-out infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; } .thinking span:nth-child(3) { animation-delay: .4s; }
.safety { max-width: 34ch; display: grid; gap: 16px; font-size: 1.1rem; line-height: 1.6; color: #f2f2f2;
  background: #111; border: 1px solid #333; border-radius: 10px; padding: 22px; text-align: left; }

/* ---------- niveaux 14 à 20 ---------- */
.scene { justify-content: flex-start; gap: 10px; max-width: 760px; overflow-y: auto; padding-top: calc(12px + var(--safe-top)); }
.scene-bg { position: fixed; inset: -30px; z-index: -1; background: center / cover no-repeat; filter: blur(18px) brightness(.28); }
.sc-clock { margin-left: auto; color: #ff2436; font-variant-numeric: tabular-nums; letter-spacing: .1em; font-size: 1rem; text-shadow: 0 0 8px rgba(255,26,43,.8); }
.hero { position: relative; width: 100%; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px #1d1d1d, 0 12px 30px rgba(0,0,0,.8); flex-shrink: 0; transition: filter 1s; }
.hero-img { display: block; width: 100%; height: auto; max-height: 46vh; object-fit: cover; }
.scene.compact .hero-img { max-height: 30vh; }
.scene.compact .plaque { padding: 8px; }
.hero > .w-flash, .hero > .hero-over { position: absolute; inset: 0; }
.hero > .w-sub { position: absolute; pointer-events: none; }
.hero.shake { animation: shakeScreen .45s; }
.hero.dim { filter: brightness(.06); }
.hero.dim-1 { filter: brightness(.8); } .hero.dim-2 { filter: brightness(.64); } .hero.dim-3 { filter: brightness(.5); }
.hero.dim-4 { filter: brightness(.36); } .hero.dim-5 { filter: brightness(.22); } .hero.dim-6 { filter: brightness(.05); }
.sc-panel { width: 100%; display: grid; gap: 10px; justify-items: center; }

/* bandes (14) */
.tape { width: 100%; display: grid; grid-template-columns: 40px 1fr 44px; gap: 8px; align-items: center;
  background: #0b0b0b; border: 1px solid #262626; border-radius: 6px; padding: 8px; }
.tape b { font-weight: 400; border: 1px solid #555; border-radius: 3px; text-align: center; padding: 4px 0; }
.tape canvas { width: 100%; height: 44px; display: block; }
.tape .play { appearance: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rouge); background: none; color: var(--blanc); cursor: pointer; }
.tape-text { grid-column: 1 / -1; min-height: 1.3em; font-size: .85rem; color: var(--gris); letter-spacing: .06em; }
.words { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.word { appearance: none; font: inherit; color: var(--blanc); background: linear-gradient(#222, #0d0d0d); border: 1px solid #3a3a3a;
  border-radius: 4px; padding: 12px 4px; letter-spacing: .2em; text-transform: uppercase; cursor: pointer; }
.word.on { border-color: var(--rouge); box-shadow: 0 0 12px rgba(255,26,43,.5); }

/* preuves (15) */
.proofs { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.proof { appearance: none; position: relative; padding: 5px 5px 8px; background: #d9d2c3; border: none; border-radius: 3px; cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,.7); color: #111; font: inherit; font-size: .72rem; letter-spacing: .06em; transform: rotate(var(--r, 0deg)); }
.proof img { display: block; width: 100%; aspect-ratio: 5 / 4; object-fit: cover; margin-bottom: 5px; }
.proof .badge { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; background: var(--rouge);
  color: #fff; display: none; place-items: center; font-size: .95rem; box-shadow: 0 0 10px var(--rouge); }
.proof.set .badge { display: grid; }
.doc { width: 100%; padding: 14px; background: #d9d2c3; color: #111; border-radius: 3px; font-family: "Courier New", monospace; font-size: .85rem;
  line-height: 1.6; box-shadow: 0 8px 18px rgba(0,0,0,.7); animation: fade .8s both; }
.doc .stamp { display: inline-block; border: 2px solid #b0101c; color: #b0101c; padding: 2px 8px; transform: rotate(-4deg); font-weight: bold; margin-top: 6px; }

/* chambre noire (16) */
.slots3 { display: flex; gap: 10px; align-items: center; }
.slot3 { appearance: none; width: 64px; height: 64px; border: 1px solid #555; border-radius: 4px; background: rgba(0,0,0,.6); cursor: pointer; display: grid; place-items: center; color: var(--gris); font: inherit; }
.slot3.sel { border-color: var(--rouge); box-shadow: 0 0 12px rgba(255,26,43,.5); }
.slot3 svg, .palette .frag svg { width: 70%; fill: none; stroke: #ff3b48; stroke-width: 1.6; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(255,26,43,.8)); }
.palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: 100%; }
.palette .frag { appearance: none; aspect-ratio: 1; border: 1px solid #333; border-radius: 4px; background: #0c0c0c; cursor: pointer; display: grid; place-items: center; }
.reveal-spot { position: absolute; width: 40%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(circle, rgba(255,40,50,.0) 0%, rgba(255,40,50,.0) 60%); }
.hero-img.dark-img { filter: brightness(.045); transition: filter 1.2s; }
.hero .lit { position: absolute; inset: 0; background: center / cover; opacity: 0; pointer-events: none; z-index: 1;
  filter: brightness(1.5) saturate(1.3); }
.hero .lit.on { animation: lit 1.2s ease-out; }
@keyframes lit { 0% { opacity: 0; } 8% { opacity: 1; } 55% { opacity: .9; } 100% { opacity: 0; } }

/* témoin (17) */
.leds { display: flex; gap: 12px; }
.leds i { width: 12px; height: 12px; border-radius: 50%; background: #ff1a2b; box-shadow: 0 0 10px #ff1a2b; transition: all .6s; }
.leds i.off { background: #2a0a0c; box-shadow: none; }
.tags { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tag17 { background: #d9d2c3; color: #1a1a1a; border-radius: 3px; padding: 8px 10px; font-size: .8rem; display: flex; gap: 8px; align-items: center; }
.tag17 svg { width: 18px; flex: 0 0 18px; fill: none; stroke: #1a1a1a; stroke-width: 1.8; }
.scene .slots { margin-top: 4px; }

/* mensonge (18) */
.cams { position: absolute; inset: 0; pointer-events: none; }
.cam { position: absolute; overflow: hidden; }
.cam.f { background: #000; }
.cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 38% 30%;
  filter: grayscale(1) contrast(1.3) brightness(.85); }
.cam.f::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0 1px, transparent 1px 3px); animation: rain .4s linear infinite; }
.cam-label { position: absolute; top: 4%; right: 4%; color: #ff2436; font-size: clamp(.5rem, 2.2vw, .75rem); letter-spacing: .08em;
  background: rgba(0,0,0,.6); padding: 1px 4px; font-variant-numeric: tabular-nums; }
.versions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.version { background: #d9d2c3; color: #111; border-radius: 3px; padding: 8px; font-family: "Courier New", monospace; font-size: .68rem; line-height: 1.45; }
.version h4 { font-family: var(--font); font-weight: 500; letter-spacing: .2em; font-size: .7rem; margin-bottom: 4px; }
.version p { display: grid; grid-template-columns: 52px 1fr; gap: 4px; }
.version .hot { background: #b0101c; color: #fff; padding: 0 3px; }
.chip { font-size: .72rem; color: var(--gris); border: 1px dashed #444; border-radius: 20px; padding: 5px 12px; }

/* échange (19) */
.hotspot { position: absolute; appearance: none; border: none; background: none; cursor: pointer; border-radius: 10px; }
.hotspot.floor { border-radius: 50%; }
.hotspot.floor::after { content: ""; position: absolute; inset: 20%; border-radius: 50%; box-shadow: 0 0 0 0 rgba(255,255,255,.0); animation: glint 6s ease-in-out infinite; }
.hotspot.floor.more::after { animation-duration: 2.2s; }
@keyframes glint { 0%, 88%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } 92% { box-shadow: 0 0 24px 6px rgba(255,255,255,.35); } }
.two-doors { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two-doors .btn { min-width: 0; padding: 16px 6px; letter-spacing: .18em; font-size: .85rem; }

/* reflet (20) */
.mirror-mark { position: absolute; width: 18%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px solid #ff1a2b; border-radius: 50%;
  box-shadow: 0 0 20px #ff1a2b, inset 0 0 20px rgba(255,26,43,.5); animation: fade .8s both; }
.clues { display: flex; gap: 10px; }
.clue { min-width: 84px; height: 64px; padding: 0 8px; border: 1px solid rgba(255,26,43,.6); border-radius: 4px; display: grid; place-items: center;
  font-size: .9rem; letter-spacing: .12em; background: rgba(10,0,2,.7); }
.clue.empty { color: var(--gris); border-color: #444; }
.clue svg { width: 30px; fill: none; stroke: var(--blanc); stroke-width: 1.6; color: var(--blanc); }

@media (min-width: 700px) {
  .screen { gap: 36px; }
  .key { max-width: 64px; }
  .figure { max-width: 50%; margin: 0 auto; }
  .callout { font-size: .8rem; max-width: 34%; }
}

/* ---------- écrans très bas (téléphone en paysage) ---------- */
@media (max-height: 520px) {
  .hud-logo { width: 60px; }
  .logo { width: 180px; margin-top: 0; }
  .screen { gap: 12px; }
  .key { height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .flash { display: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- petits écrans (hauteur réduite) : niveau 13 et scènes plus compacts ---------- */
@media (max-height: 740px), (orientation: landscape) and (max-height: 900px) {
  .l13, .scene { gap: 6px; }
  .l13-head { padding-bottom: 6px; }
  .l13-top { width: 86%; margin: 0 auto; }
  .plaque { padding: 8px 10px; line-height: 1.6; }
  .lock-guide { font-size: .55rem; }
  .lock { gap: 4px; padding: 6px; }
  .tile { height: 38px; }
  .reel-btn { height: 38px; font-size: 1.4rem; }
  .l13-actions { padding-bottom: 0; }
  .l13-actions .btn { padding: 12px 8px; }
  .round { width: 44px; height: 44px; flex-basis: 44px; }
  .hero-img { max-height: 36vh; }
}

/* ---------- niveau 12 → 13 : le Docteur lit ton profil ---------- */
.screen.prof { max-width: none; padding: 0; }
.prof-plate { position: fixed; inset: 0; z-index: 1; overflow: hidden; background: #000; }
.prof-bg { position: absolute; inset: -40px; background: url("assets/docteur.webp") center / cover no-repeat;
  filter: blur(28px) brightness(.28); }
/* même cadre que l'écran de mort : un peu rogné sur téléphone, entier sur tablette */
.prof-frame { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(calc(100dvh * 941 / 1672), 128vw); aspect-ratio: 941 / 1672; container-type: inline-size; }
.prof-frame .prof-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none;
  -webkit-user-drag: none; opacity: 0; }
.prof-plate.go .prof-frame .prof-art { animation: profIn 6s cubic-bezier(.3,.6,.2,1) forwards; }
@keyframes profIn {
  0%   { opacity: 0; transform: scale(1.06); filter: brightness(0); }
  10%  { opacity: 1; filter: brightness(.15); }
  14%  { filter: brightness(.9); }
  16%  { filter: brightness(.1); }
  22%  { filter: brightness(.6); }
  100% { opacity: 1; transform: scale(1); filter: brightness(1); }
}
/* le voyant rouge derrière la vitre clignote */
.prof-lamp { position: absolute; left: 11.5%; top: 15.25%; width: 9%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(circle, rgba(255,40,50,.9), rgba(255,20,30,.25) 40%, transparent 70%);
  mix-blend-mode: screen; opacity: 0; pointer-events: none; }
.prof-plate.go .prof-lamp { animation: profLamp 2.7s steps(1) 2s infinite; }
@keyframes profLamp { 0% { opacity: .9; } 8% { opacity: .1; } 12% { opacity: .95; } 55% { opacity: .2; } 70% { opacity: .85; } }
/* l'écran du téléphone s'allume quand il lit ton dossier */
.prof-phone { position: absolute; left: 15.6%; top: 30.6%; width: 14.6%; height: 17.8%; border-radius: 8% / 5%;
  transform: rotate(-3deg); pointer-events: none; mix-blend-mode: screen; opacity: 0; transition: opacity .6s;
  background: linear-gradient(to bottom, transparent 0 46%, rgba(255,40,50,.55) 50%, transparent 54% 100%) 0 0 / 100% 220%,
    radial-gradient(ellipse at 50% 50%, rgba(255,30,40,.28), transparent 70%); }
.prof-plate.scan .prof-phone { opacity: 1; animation: profScan 1.6s linear infinite; }
@keyframes profScan { from { background-position: 0 100%, 0 0; } to { background-position: 0 -120%, 0 0; } }
/* la boîte de dialogue : posée exactement sur celle de l'image, puis elle grandit vers le bas si besoin */
.prof-box { position: absolute; left: 16.05%; width: 67.8%; top: 68.72%; min-height: 9.7%; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .5cqw;
  padding: 2.6cqw 4.6cqw 2.8cqw; text-align: center; background: rgb(6,4,4);
  border: 1px solid rgba(200,42,40,.9); box-shadow: 0 0 0 3px rgb(6,4,4), 0 0 0 4px rgba(200,42,40,.35), 0 10px 40px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .5s; pointer-events: none; }
.prof-box::before, .prof-box::after { content: ""; position: absolute; left: 50%; width: 1.1cqw; height: 1.1cqw;
  background: rgb(200,42,40); transform: translate(-50%, -50%) rotate(45deg); }
.prof-box::before { top: 0; }
.prof-box::after { top: 100%; }
.prof-plate.talk .prof-box { opacity: 1; }
.prof-theme { margin: 0; font-family: "Jost", sans-serif; font-weight: 500; font-size: clamp(.56rem, 2.3cqw, .75rem);
  letter-spacing: .34em; text-transform: uppercase; color: #ff2a3a; min-height: 1.2em; transition: opacity .4s; }
.prof-theme:empty { display: none; }
.prof-text { margin: 0; font-family: "Cormorant Garamond", "Garamond", "Georgia", serif; font-weight: 500;
  font-size: clamp(1rem, 4.7cqw, 1.5rem); line-height: 1.22; color: #f3ecec; transition: opacity .35s; }
.prof-text.red, .prof-text span.red { color: #ff2a3a; }
.prof-text.wait { color: #b9a7a7; font-style: italic; animation: profWait 1.4s ease-in-out infinite; }
@keyframes profWait { 50% { opacity: .35; } }
.prof-box.swap .prof-text, .prof-box.swap .prof-theme { opacity: 0; }
/* le rire : on avance vers le masque, la lumière tremble */
.prof-red { position: absolute; inset: 0; background: rgba(255,0,20,.0); mix-blend-mode: multiply; pointer-events: none; }
.prof-plate.laugh .prof-frame .prof-art { animation: profZoom 5s cubic-bezier(.5,0,.3,1) forwards; transform-origin: 41.4% 25%; }
.prof-plate.laugh .prof-red { animation: profFlick 5s steps(1) forwards; }
@keyframes profZoom {
  0%   { opacity: 1; transform: scale(1); filter: brightness(1); }
  100% { opacity: 1; transform: scale(1.9); filter: brightness(.55) contrast(1.3) saturate(1.3); }
}
@keyframes profFlick {
  0% { background: rgba(255,0,20,0); } 12% { background: rgba(255,0,20,.45); } 16% { background: rgba(255,0,20,0); }
  38% { background: rgba(255,0,20,.35); } 41% { background: rgba(255,0,20,0); } 70% { background: rgba(255,0,20,.55); }
  74% { background: rgba(255,0,20,.1); } 90% { background: rgba(120,0,10,.7); } 100% { background: rgba(0,0,0,1); }
}
.prof-plate.laugh .prof-box { opacity: 0; transition: opacity 1.2s 1s; }
.prof-plate.laugh .prof-lamp { animation: profLamp .5s steps(1) infinite; }
.prof-plate.out { transition: opacity 1.4s; opacity: 0; }

/* textes posés sur les images (les images sont livrées sans texte) */
.mort1-title { position: absolute; left: 4%; right: 4%; top: 6.4%; margin: 0; text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: 9.6cqw; line-height: .98;
  letter-spacing: .05em; text-transform: uppercase;
  background: linear-gradient(180deg, #f6e4e1 0%, #d9aaa4 55%, #a8635c 100%); -webkit-background-clip: text; background-clip: text;
  color: transparent; filter: drop-shadow(0 2px 6px rgba(0,0,0,.9)); opacity: 0; }
.mort1.go .mort1-title { animation: fade 1.6s .9s both; }
.orn { position: absolute; left: 26%; right: 26%; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(200,50,50,.8) 30%, rgba(200,50,50,.8) 46%, transparent 48% 52%, rgba(200,50,50,.8) 54%, rgba(200,50,50,.8) 70%, transparent); }
.orn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1px; height: 2.6cqw; transform: translate(-50%, -50%);
  background: linear-gradient(transparent, rgba(220,60,60,.9), transparent); }
.mort1-orn { top: 18.6%; opacity: 0; }
.mort1.go .mort1-orn { animation: fade 1.2s 1.6s both; }
.mort1-orn2 { top: 84.2%; left: 30%; right: 30%; }
.mort1-level { position: absolute; left: 0; right: 0; top: 85.6%; margin: 0; text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: clamp(.72rem, 3.3cqw, 1.1rem);
  letter-spacing: .2em; text-transform: uppercase; color: rgba(236,226,226,.82); text-shadow: 0 0 8px #000; }
.mort1-lines { top: 69% !important; height: 14% !important; }

.prof-logo { position: absolute; left: 50%; top: 2.2%; width: 32%; height: auto; transform: translateX(-50%);
  mix-blend-mode: screen; opacity: 0; pointer-events: none; }
.prof-plate.go .prof-logo { animation: fade 2s 1.8s forwards; }
.prof-phone-title { position: absolute; left: 16.8%; top: 31.25%; width: 12.8%; margin: 0; text-align: center;
  font-family: "Jost", sans-serif; font-weight: 500; font-size: 1.55cqw; letter-spacing: .06em; text-transform: uppercase;
  color: rgba(255,255,255,.9); transform: rotate(-2deg); pointer-events: none; opacity: 0; }
.prof-plate.go .prof-phone-title { animation: fade 1s 2.4s forwards; }
.prof-foot { position: absolute; left: 0; right: 0; top: 95.1%; margin: 0; display: flex; align-items: center; justify-content: center;
  gap: 2.4cqw; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: clamp(.72rem, 3.1cqw, 1.05rem);
  letter-spacing: .28em; text-transform: uppercase; color: rgba(236,230,230,.85); pointer-events: none; opacity: 0; }
.prof-foot::before, .prof-foot::after { content: ""; width: 18%; height: 1px; background: rgba(236,230,230,.35); }
.prof-foot b { font-weight: 500; color: #ff2a3a; }
.prof-foot .arrow { letter-spacing: 0; }
.prof-plate.go .prof-foot { animation: fade 1.5s 2s forwards; }
.prof-plate.laugh .prof-logo, .prof-plate.laugh .prof-foot, .prof-plate.laugh .prof-phone-title { opacity: 0; transition: opacity 1s; animation: none; }

/* ---------- prénom → la présence (le chiffre n'est plus montré) ---------- */
.numero.presence .calc, .numero.presence .numero-n { display: none; }
.numero.presence .lines { gap: 14px; }
.numero.presence .lines p { font-size: clamp(1.05rem, 4.6vw, 1.35rem); line-height: 1.45; }
.numero.presence .presence-line { font-size: clamp(1.35rem, 6.4vw, 1.9rem) !important; color: #fff;
  text-shadow: 0 0 22px rgba(255,26,43,.45); letter-spacing: .02em; margin-bottom: 6px; }
.numero.presence::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,.35), rgba(0,0,0,.92) 70%); animation: fade 3s both; }
.numero.fade-out { transition: opacity 1.3s, filter 1.3s; opacity: 0; filter: blur(3px); }

/* ---------- boutons son / pause : ne recouvrent plus jamais les boutons du jeu ---------- */
/* une bande réservée en bas de chaque écran, sous les boutons du jeu */
.screen { padding-bottom: calc(66px + var(--safe-bot)) !important; }
.sound { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.pause-btn { right: 60px !important; }
/* écrans en image plein écran (mort au niveau 1, le Docteur) : les boutons passent en haut à droite */
body:has(.dead.mort1-on.active) .sound, body:has(.prof.active) .sound {
  bottom: auto; top: calc(10px + var(--safe-top)); }
.sound[hidden] { display: none !important; }

/* ---------- le Docteur animé (vidéo Kling, si assets/docteur-anim.mp4 existe) ---------- */
.prof-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s; pointer-events: none; }
.prof-plate.has-video .prof-video { opacity: 1; }
.prof-plate.has-video.laugh .prof-video { animation: profZoom 5s cubic-bezier(.5,0,.3,1) forwards; transform-origin: 41.4% 25%; }

/* ---------- l'écran « bugge » quand le joueur se moque ---------- */
body.bug #app { animation: bugShake .11s steps(2) infinite; }
body.bug .world { animation: bugHue .23s steps(3) infinite; }
@keyframes bugShake {
  0%   { transform: translate(0, 0) skewX(0); filter: none; }
  25%  { transform: translate(-9px, 3px) skewX(4deg); filter: drop-shadow(6px 0 0 rgba(255,0,40,.9)) drop-shadow(-6px 0 0 rgba(0,220,255,.7)); }
  50%  { transform: translate(7px, -5px) skewX(-6deg) scaleY(1.04); filter: invert(1) hue-rotate(90deg); }
  75%  { transform: translate(-3px, 8px) skewX(2deg); filter: contrast(3) saturate(0); }
  100% { transform: translate(5px, -2px); filter: drop-shadow(-8px 0 0 rgba(255,0,40,.9)); }
}
@keyframes bugHue { 0% { filter: hue-rotate(0); } 50% { filter: hue-rotate(160deg) contrast(2); } 100% { filter: invert(1); } }
.bug-bars { position: fixed; inset: 0; z-index: 55; pointer-events: none; display: none; }
body.bug .bug-bars { display: block; }
.bug-bars i { position: absolute; left: 0; right: 0; mix-blend-mode: difference; }
/* intro : la vidéo montre un autre plan (couloir) → pas de titre sur le téléphone */
.prof-plate.intro .prof-phone-title, .prof-plate.intro .prof-phone { display: none; }
/* la vidéo du bureau n'a pas le même cadrage que l'image : on retire les calques posés sur le téléphone */
.prof-plate.has-video .prof-phone-title, .prof-plate.has-video .prof-phone { display: none; }
/* intro en vidéo : pas d'image fixe derrière, on part du noir */
.prof-plate.intro .prof-art, .prof-plate.intro .prof-bg { display: none; }
.prof-plate.intro .prof-video { transition: none; }

/* ---------- mort au niveau 1 : la vidéo du Bourreau d'abord, les textes ensuite ---------- */
.mort1-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.mort1.vid .mort1-video { opacity: 1; }
.mort1.playing .mort1-title, .mort1.playing .mort1-orn, .mort1.playing .mort1-orn2, .mort1.playing .mort1-level,
.mort1.playing .mort1-btn, .mort1.playing .mort1-count, .mort1.playing .mort1-lines { opacity: 0 !important; animation: none !important; }
.mort1.playing .mort1-frame img { animation: none !important; opacity: 0; }
.mort1.after .mort1-title { animation: fade 1.6s .2s both; }
.mort1.after .mort1-orn { animation: fade 1.2s .8s both; }
.mort1.after .mort1-level, .mort1.after .mort1-btn, .mort1.after .mort1-orn2 { animation: fade 1s both; }
/* montage de mort : une image par coup, avec un flash blanc */
.mort1-shot { position: absolute; inset: 0; background: center / cover no-repeat; z-index: 1; }
.mort1-shot.cut { animation: mortCut 1s ease-out both; }
@keyframes mortCut {
  0%   { filter: brightness(3.5) contrast(1.4); transform: scale(1.14); }
  25%  { filter: brightness(.9) contrast(1.2); }
  100% { filter: brightness(.7) contrast(1.15); transform: scale(1); }
}

/* « Touche l'écran » : bien visible, qui respire */
.hint-touch { display: inline-flex; align-items: center; gap: 12px; margin: 8px 0 0; padding: 14px 22px; border: 1.5px solid var(--rouge);
  border-radius: 999px; background: rgba(20,0,3,.65); color: #fff; font-size: .95rem; letter-spacing: .06em;
  box-shadow: 0 0 22px rgba(255,26,43,.45); animation: touchPulse 1.8s ease-in-out infinite; }
.hint-touch[hidden] { display: none; }
.hint-touch .finger { position: relative; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; background: var(--rouge); }
.hint-touch .finger::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--rouge); animation: touchRing 1.8s ease-out infinite; }
@keyframes touchPulse { 50% { box-shadow: 0 0 34px rgba(255,26,43,.75); transform: scale(1.03); } }
@keyframes touchRing { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
/* intro avant le prénom : pas de texte sur la vidéo, seulement la voix */
.prof-plate.intro .prof-box { display: none !important; }

/* niveau 8 : le Docteur s'est levé, il parle collé à l'écran ; la vidéo reste sur sa dernière image, assombrie */
.prof-plate.intro.conteur.talk .prof-box { display: block !important; opacity: 1; }
.prof-plate.conteur .prof-video { transition: filter 1.6s ease; }
.prof-plate.conteur.talk .prof-video { filter: brightness(.42) contrast(1.15) saturate(.8); }
.prof-plate.conteur:not(.has-video).talk .prof-box { opacity: 1; }

/* niveau 8 : l'enveloppe et ses lignes cachées */
.sealed.card { gap: 10px; max-width: 92%; padding: 18px 20px 20px; }
.sealed .num s { color: var(--gris); font-size: .5em; vertical-align: middle; margin-right: .2em; }
.seal-l { display: block; font-style: normal; font-size: .78rem; letter-spacing: .14em; color: #3a0a0e; background: #1a0306; padding: 2px 6px; text-align: center; line-height: 1.5; }
.seal-l.on { color: var(--rouge); background: transparent; text-shadow: 0 0 10px rgba(255,26,43,.55); }
.lines .big { font-size: 3.6rem; line-height: 1; letter-spacing: .04em; text-align: center; }
/* on compte les lettres jusqu'à son nombre */
.count-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 10px 0 4px; max-width: 100%; }
.count-row span { min-width: 1.35em; padding: 4px 2px; text-align: center; font-size: 1.15rem; letter-spacing: 0; color: var(--gris); border-bottom: 1px solid rgba(255,255,255,.12); transition: color .08s, background .08s; }
.count-row span.on { color: #fff; background: rgba(255,26,43,.35); }
.count-row span.hit { color: #fff; background: var(--rouge); box-shadow: 0 0 22px rgba(255,26,43,.8); transform: scale(1.25); }
.count-n { text-align: center; font-size: 1.6rem; color: var(--rouge); min-height: 1.4em; font-variant-numeric: tabular-nums; }
/* le clavier à chiffres */
.kb.numpad { max-width: 300px; margin: 0 auto; }
.kb.numpad .key { flex: 1 1 0; max-width: none; height: clamp(46px, 7vh, 58px); font-size: 1.3rem; }
.kb.numpad .key.go, .kb.numpad .key.wide { flex: 1 1 0; font-size: .9rem; }
.typed.num-typed { font-size: 3rem; letter-spacing: .12em; min-height: 1.2em; text-align: center; color: var(--rouge); }

/* il frappe le bureau : l'écran tremble, flash rouge */
.prof-plate.slam { animation: profSlam .55s cubic-bezier(.2,.8,.3,1); }
.prof-plate.slam::after { content: ""; position: absolute; inset: 0; background: #ff0018; mix-blend-mode: multiply; pointer-events: none; animation: profSlamRed .7s ease-out forwards; }
@keyframes profSlam { 0% { transform: translate(0,0) scale(1.04); } 15% { transform: translate(-9px,6px) scale(1.04); } 30% { transform: translate(8px,-7px) scale(1.03); } 45% { transform: translate(-6px,4px) scale(1.02); } 60% { transform: translate(4px,-2px) scale(1.01); } 100% { transform: none; } }
@keyframes profSlamRed { 0% { opacity: .75; } 100% { opacity: 0; } }

/* compte à rebours vers le niveau 13 */
.cd { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 50%, #1a0005 0%, #000 70%); }
.cd[hidden] { display: none; }
.cd-tunnel { position: absolute; left: 50%; top: 50%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255,26,43,.0) 0deg 5deg, rgba(255,26,43,.55) 5deg 6deg, rgba(255,255,255,.0) 6deg 11deg, rgba(255,255,255,.35) 11deg 11.6deg);
  -webkit-mask: radial-gradient(circle, transparent 6%, #000 40%); mask: radial-gradient(circle, transparent 6%, #000 40%); }
.cd-ring { position: absolute; width: min(78vw, 46vh); height: min(78vw, 46vh); transform: rotate(-90deg); }
.cd-ring circle { fill: none; stroke-width: 1.4; }
.cd-ring-bg { stroke: rgba(255,255,255,.08); }
.cd-ring-fill { stroke: var(--rouge); stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(255,26,43,.8)); }
.cd-num { position: relative; font-family: "Cormorant Garamond", Georgia, serif; font-size: min(46vw, 30vh); line-height: 1; color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(255,26,43,.55); will-change: transform, opacity, filter; }
.cd.hot .cd-num { color: var(--rouge); text-shadow: 0 0 40px rgba(255,26,43,.9), 0 0 4px #fff; }
.cd-label { position: absolute; top: 14%; left: 0; right: 0; margin: 0; text-align: center; font-size: .8rem; letter-spacing: .42em; text-transform: uppercase; color: var(--gris); }
.cd.hot .cd-label { color: var(--rouge); }
.cd-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; mix-blend-mode: screen; }
.cd.hot .cd-flash { background: #ff1a2b; }

/* niveau 8 : les planches d'encre */
.ink-wrap { position: relative; display: grid; justify-items: center; gap: 2px; width: 100%; }
.ink-box { width: min(70vw, 27vh, 300px); aspect-ratio: 1; display: grid; place-items: center; }
.ink-card { width: 100%; height: auto; border-radius: 3px; background: #ece6d8;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 18px 40px rgba(0,0,0,.7); will-change: transform, clip-path; }
.ink-cap { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gris); margin: 0; }
.ink-turn { background: none; border: 0; color: var(--gris); font: inherit; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; cursor: pointer; }
.ink-turn:disabled { opacity: .3; }
[data-screen="lvl"] .ink-wrap ~ .q { margin: 2px 0; }
[data-screen="lvl"] .ink-wrap ~ .opts { gap: 7px; }
[data-screen="lvl"] .ink-wrap ~ .opts .opt { padding-top: 8px; padding-bottom: 8px; font-size: .92rem; }

/* accès : inscription, code, paiement */
.screen.acces { gap: 18px; text-align: center; }
.acces .logo.small { width: min(62vw, 256px); margin-bottom: 0; }
.acces-step { display: grid; gap: 14px; justify-items: center; width: min(100%, 380px); }
.acces-form { display: grid; gap: 12px; width: 100%; }
.acces-input { width: 100%; padding: 14px 14px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.18); color: #fff;
  font: inherit; font-size: 1.05rem; text-align: center; border-radius: 2px; outline: none; -webkit-appearance: none; }
.acces-input:focus { border-color: var(--rouge); box-shadow: 0 0 0 3px rgba(255,26,43,.18); }
.acces-input.code { font-family: Georgia, serif; font-size: 1.8rem; letter-spacing: .45em; text-transform: uppercase; padding-left: .45em; }
.acces-check { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: .85rem; line-height: 1.45; color: var(--gris); cursor: pointer; }
.acces-check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: #ff1a2b; }
.acces-check a { color: #fff; }
.acces-err { min-height: 1.2em; margin: 0; color: var(--rouge); font-size: .9rem; }
.acces-links { display: grid; gap: 4px; }
.pay-level { margin: 0; font-size: .75rem; letter-spacing: .4em; text-transform: uppercase; color: var(--rouge); }
.pay-price { margin: 4px 0; font-family: Georgia, serif; font-size: 3.4rem; line-height: 1; color: #fff; text-shadow: 0 0 24px rgba(255,26,43,.55); }
.pay-note { margin: 0; font-size: .72rem; line-height: 1.5; color: var(--gris); max-width: 34ch; }
.screen.acces [hidden] { display: none !important; }

.code-wrap { display: flex; align-items: stretch; width: 100%; }
.code-pre { display: flex; align-items: center; padding: 0 2px 0 12px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.18); border-right: 0;
  font-family: "Courier New", monospace; font-size: 1rem; color: var(--gris); letter-spacing: .02em; }
.code-wrap .acces-input.code { flex: 1; min-width: 0; text-align: left; border-left: 0; padding-left: 2px; font-family: "Courier New", monospace; font-size: 1.15rem; letter-spacing: .06em; }

.acces-small { margin: 0; font-size: .74rem; line-height: 1.5; color: var(--gris); }
.acces-small a { color: #fff; }
/* écrans d'accès : toujours sur fond noir, même par-dessus le décor d'un niveau */
.screen.acces::before { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 35%, #160306 0%, #000 72%); }
