:root {
  --bg: #0a0a0a;
  --fg: #d8d4cc;
  --dim: #6e6a63;
  --whisper: #1a1917;
  --accent: #c7a97b;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Overlay 3D ASCII pour les scènes exploratoires des chambres. */
#stage3d {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease-in;
  overflow: hidden;
}
#stage3d.active {
  opacity: 1;
  pointer-events: auto;
}
#stage3d.leaving {
  opacity: 0;
  transition: opacity .9s ease-out;
}

/* Les particules d'ambiance doivent être cachées pendant les phases 3D. */
body.in-3d-scene .ambient-bg { opacity: 0 !important; transition: opacity .3s ease-out; }

/* Écran titre : gros logo ASCII + bouton COMMENCER. */
.title-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vh;
  background: transparent;
  padding: 4vh 2vw;
  transition: opacity 1.2s ease-out;
}
.title-screen.leaving { opacity: 0; pointer-events: none; }
.title-art {
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: calc(min(94vw, 1700px) / 80);
  line-height: 1.0;
  letter-spacing: 0;
  white-space: pre;
  text-align: center;
  text-shadow: 0 0 12px rgba(199, 169, 123, .5), 0 0 36px rgba(199, 169, 123, .18);
  opacity: 0;
  transform: scale(.78);
  filter: blur(14px) brightness(.25);
  animation:
    title-appear 2.8s cubic-bezier(.22, .9, .32, 1) .4s forwards,
    title-breathe 5s ease-in-out 3.3s infinite;
}
@keyframes title-appear {
  0%   { opacity: 0;   transform: scale(.78); filter: blur(14px) brightness(.25); }
  28%  { opacity: 0.6; }
  65%  { opacity: 1;   transform: scale(1.03); filter: blur(3px)  brightness(.9);  }
  100% { opacity: 1;   transform: scale(1);    filter: blur(0)    brightness(1);   }
}
@keyframes title-breathe {
  0%, 100% { opacity: .92; }
  50%      { opacity: 1;   }
}
/* Braises qui montent — spécifique à l'écran titre (motion + chars distincts de l'ambient). */
.title-embers {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.5s ease-in;
}
.title-embers.visible { opacity: .75; }
.title-embers .ember {
  position: absolute;
  top: 110vh;
  color: #ffb270;
  font-family: var(--mono);
  font-size: clamp(11px, 1.3vw, 19px);
  text-shadow: 0 0 6px rgba(255, 170, 70, .55), 0 0 18px rgba(255, 130, 40, .3);
  animation:
    ember-rise var(--d, 16s) linear var(--delay, 0s) infinite,
    ember-flicker var(--flicker, 1.8s) ease-in-out infinite;
  will-change: transform, opacity;
}
@keyframes ember-rise {
  0%   { transform: translate(0, 0) scale(.5); }
  10%  { transform: translate(var(--dx-mid, 10px), -14vh) scale(1); }
  100% { transform: translate(var(--dx, 30px), calc(-120vh - 40px)) scale(1.25); }
}
@keyframes ember-flicker {
  0%, 100% { opacity: .25; }
  50%      { opacity: 1;   }
}
.start-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--fg);
  font-family: var(--mono);
  outline: none;
  opacity: 0;
  animation: start-appear 1.2s cubic-bezier(.3, 1.2, .4, 1) 3.2s forwards;
}
@keyframes start-appear {
  0%   { opacity: 0; transform: translateY(26px) scale(.9); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}
.start-btn pre {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(13px, 1.2vw, 19px);
  line-height: 1.0;
  letter-spacing: .08em;
  color: inherit;
  text-shadow: 0 0 6px rgba(255, 196, 128, .3);
  transition: color .25s, text-shadow .25s, transform .25s;
  animation: start-breathe 2s ease-in-out infinite;
}
.start-btn:hover pre, .start-btn:focus pre {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(255, 196, 128, .7), 0 0 24px rgba(255, 196, 128, .25);
  transform: scale(1.05);
}
@keyframes start-breathe {
  0%, 100% { opacity: .85; }
  50%      { opacity: 1;   }
}

/* Boutons de choix en ASCII (pavés dessinés avec ┌─┐│└┘) */
.choice.ascii-choice {
  background: transparent;
  border: none;
  padding: 2px 0;
  min-height: auto;
  text-align: center;
  color: var(--fg);
  cursor: pointer;
  transition: color .22s, transform .22s, text-shadow .22s;
}
.choice.ascii-choice pre {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(13px, 1.1vw, 17px);
  line-height: 1.05;
  letter-spacing: 0;
  color: inherit;
  text-shadow: 0 0 4px rgba(199, 169, 123, .18);
  transition: color .22s, text-shadow .22s;
}
.choice.ascii-choice:hover,
.choice.ascii-choice:focus {
  color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}
.choice.ascii-choice:hover pre,
.choice.ascii-choice:focus pre {
  text-shadow: 0 0 8px rgba(255, 196, 128, .55), 0 0 18px rgba(255, 196, 128, .2);
}
.choice.ascii-choice:active { color: var(--accent); }
#canvas3d {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  touch-action: manipulation;
}
/* Flou "réveil" : la caméra elle-même est floue pendant l'ouverture des paupières,
   puis s'éclaircit nettement. Combiné au masque œil, l'effet "on vient d'ouvrir les yeux" devient explicite. */
#canvas3d.waking {
  animation: canvas-wake 7.5s cubic-bezier(.3,.2,.4,1) forwards;
}
@keyframes canvas-wake {
  0%,  12%  { filter: blur(14px) brightness(.35); }
  22%       { filter: blur(6px)  brightness(.55); }   /* entrouvert : flou puis moins */
  32%       { filter: blur(10px) brightness(.4);  }   /* re-ferme : plus flou */
  58%       { filter: blur(12px) brightness(.35); }   /* tient fermé */
  100%      { filter: blur(0)    brightness(1);   }   /* pleine conscience */
}
@media (prefers-reduced-motion: reduce) {
  #canvas3d.waking { animation: none; filter: none; }
}
#hud3d {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* Sous-titre narratif en bas du cadre. */
#hud3d .subtitle {
  position: absolute;
  bottom: 10vh;
  left: 50%;
  transform: translateX(-50%);
  color: #f0e8d6;
  font-family: var(--mono);
  font-size: clamp(14px, 1.35vw, 20px);
  text-align: center;
  max-width: 76vw;
  padding: .3em .9em;
  letter-spacing: .02em;
  opacity: 0;
  transition: opacity .9s ease;
  text-shadow: 0 0 6px rgba(0,0,0,.95), 0 0 16px rgba(0,0,0,.7), 0 1px 0 rgba(0,0,0,.95);
  line-height: 1.5;
  will-change: opacity;
}
#hud3d .subtitle.visible { opacity: 1; }

/* Paupières façon vraie forme d'œil : masque radial (ellipse) qui s'ouvre, se
   referme, puis s'ouvre en grand. Les variables --eye-w et --eye-h sont animées
   par le JS en appliquant une classe ".eye-blink" sur le masque. */
@property --eye-w { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
@property --eye-h { syntax: "<percentage>"; inherits: true; initial-value: 0%; }

#hud3d .eye-mask {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #000;
  pointer-events: none;
  --eye-w: 0%;
  --eye-h: 0%;
  -webkit-mask-image: radial-gradient(
      ellipse var(--eye-w) var(--eye-h) at center,
      transparent 68%,
      rgba(0,0,0,.6) 86%,
      #000 100%);
  mask-image: radial-gradient(
      ellipse var(--eye-w) var(--eye-h) at center,
      transparent 68%,
      rgba(0,0,0,.6) 86%,
      #000 100%);
}
#hud3d .eye-mask.blink {
  animation: eye-blink 7.5s cubic-bezier(.4, 0, .5, 1) forwards;
}
@keyframes eye-blink {
  0%    { --eye-w:  0%; --eye-h:  0%; }   /* fermé */
  18%   { --eye-w: 42%; --eye-h: 11%; }   /* entrouvert (fente) */
  32%   { --eye-w: 12%; --eye-h:  3%; }   /* se referme */
  40%   { --eye-w:  6%; --eye-h:  1.5%; } /* fermé */
  60%   { --eye-w:  6%; --eye-h:  1.5%; } /* tient fermé — "qqch se penche" */
  100%  { --eye-w: 95%; --eye-h: 75%; }   /* grand ouvert */
}
@media (prefers-reduced-motion: reduce) {
  #hud3d .eye-mask.blink { animation: eye-blink .9s linear forwards; }
}

/* Rappel des touches — toujours visible, bas gauche. */
#hud3d .fps-ctrls {
  position: absolute;
  bottom: 2.5vh;
  left: 2.5vw;
  color: color-mix(in srgb, var(--fg) 65%, transparent);
  font-family: var(--mono);
  font-size: clamp(11px, 0.95vw, 14px);
  letter-spacing: .04em;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: .3em;
  text-shadow: 0 0 6px rgba(0,0,0,.9), 0 0 16px rgba(0,0,0,.6);
  transition: opacity 1s ease;
  line-height: 1.4;
}
#hud3d .fps-ctrls b {
  color: var(--accent);
  font-weight: normal;
  letter-spacing: .1em;
  padding: 0 .3em;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 2px;
  margin-right: .2em;
}
#hud3d .fps-ctrls.fade { opacity: 0; }

/* Choix FPS (3 boutons ASCII centrés en bas) */
#hud3d .fps-choice {
  position: absolute;
  bottom: 12vh;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  flex-direction: column;
  gap: .4em;
  opacity: 0;
  transition: opacity .9s ease, transform .9s cubic-bezier(.3, 1.2, .4, 1);
  pointer-events: none;
}
#hud3d .fps-choice.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
#hud3d .fps-choice-btn {
  background: transparent;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  color: var(--fg);
  transition: color .22s, transform .22s, text-shadow .22s;
  outline: none;
}
#hud3d .fps-choice-btn pre {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(13px, 1.1vw, 17px);
  line-height: 1.05;
  color: inherit;
  text-shadow: 0 0 6px rgba(0,0,0,.9), 0 0 14px rgba(0,0,0,.55);
  transition: color .22s, text-shadow .22s;
}
#hud3d .fps-choice-btn:hover,
#hud3d .fps-choice-btn:focus {
  color: var(--accent);
  transform: translateY(-1px);
}
#hud3d .fps-choice-btn:hover pre,
#hud3d .fps-choice-btn:focus pre {
  text-shadow: 0 0 8px rgba(255, 196, 128, .7), 0 0 20px rgba(255, 196, 128, .3);
}

/* Flash discret quand un tap est validé pendant un passage. */
#stage3d.tap-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse 50% 40% at center, rgba(255, 200, 130, .18), transparent 70%);
  animation: tap-flash-pulse .22s ease-out forwards;
}
@keyframes tap-flash-pulse {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2vh;
  padding: 4vh 0 6vh;
  position: relative;
  z-index: 1;
}

/* Centre vertical du contenu quand on est sur la citation + saisie du prénom. */
body.centered-quote #stage {
  min-height: 100vh;
  min-height: 100dvh;
  justify-content: center;
  padding: 2vh 0;
  transition: justify-content .9s ease, padding .9s ease, min-height .9s ease;
}

/* Fond ASCII animé en arrière-plan — particules CSS fluides (GPU). */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  margin: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1s ease-in;
  user-select: none;
}
.ambient-bg.visible { opacity: .34; }
.ambient-bg .particle {
  position: absolute;
  top: 100vh;
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(10px, 1vw, 15px);
  text-shadow: 0 0 4px rgba(199, 169, 123, .35);
  animation: particle-drift var(--d, 18s) linear var(--delay, 0s) infinite;
  will-change: transform, opacity;
}
@keyframes particle-drift {
  0%   { transform: translate(0, 0) scale(.9);                          opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translate(var(--dx, 0), calc(-100vh - 40px)) scale(1.1); opacity: 0; }
}

/* Le screen laisse ses enfants décider leur largeur
   (narration : colonne 72ch, ASCII : pleine fenêtre). */
#screen {
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: clamp(15px, 1.2vw, 20px);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1em;
}

/* Lignes de narration : colonne confortable, centrée. */
.line {
  opacity: 0;
  animation: fade .9s ease-out forwards;
  width: 100%;
  max-width: 72ch;
  padding: 0 4vw;
}
@keyframes fade { to { opacity: 1; } }

.narration { color: var(--fg); }
.prompt    { color: var(--accent); margin-top: 1.2em; }
.sys       { color: var(--dim); font-style: italic; }
.echo      { color: var(--dim); }

/* ASCII mono — hors contexte intro (fallback). */
.ascii-block {
  display: block;
  white-space: pre;
  color: var(--accent);
  margin: 2vh auto;
  font-size: clamp(6px, 1.0vw, 10px);
  line-height: 1.0;
  letter-spacing: 0;
  overflow: hidden;
  text-shadow:
    0 0 1px rgba(199, 169, 123, .55),
    0 0 6px rgba(199, 169, 123, .18),
    0 0 14px rgba(199, 169, 123, .08);
  filter: contrast(1.05) saturate(1.1);
  animation: ascii-breathe 6s ease-in-out infinite;
}
@keyframes ascii-breathe {
  0%, 100% { opacity: .92; }
  50%      { opacity: 1;    }
}

/* ASCII coloré image→ASCII — cadré type "tableau au musée". */
.ascii-color {
  display: block;
  color: var(--accent);   /* teinte du cadre ASCII (les spans internes gardent leur couleur) */
  margin: 0 auto;
  font-size: calc(min(70vw, 1100px) / 128);
  line-height: 1.0;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 0 1px rgba(0, 0, 0, .55), 0 0 4px rgba(0, 0, 0, .25);
  filter: contrast(1.1);
  max-width: 100vw;
  overflow: hidden;
}
.ascii-color span { font-size: inherit; }

/* Cadre musée : tableau centré verticalement + cartel sous l'œuvre. */
.painting-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  gap: 2.6vh;
  width: 100%;
}

.museum-label {
  text-align: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: clamp(12px, 0.95vw, 15px);
  letter-spacing: .14em;
  line-height: 1.6;
  opacity: 0;
  animation: label-in 1.4s 3.4s ease-out forwards;
}
.museum-label .artist { color: var(--fg); }
.museum-label .work   { color: var(--dim); font-style: italic; margin-top: .25em; display: block; }
.museum-label .sep    { display: inline-block; margin: 0 .6em; opacity: .55; }
@keyframes label-in {
  0%   { opacity: 0; transform: translateY(4px); letter-spacing: .3em; }
  100% { opacity: 1; transform: translateY(0);   letter-spacing: .14em; }
}
@media (prefers-reduced-motion: reduce) {
  .museum-label { animation: none; opacity: 1; transform: none; letter-spacing: .14em; }
}

/* Révélation cinématique de l'intro : dezoom doux + long temps de contemplation + fade. */
.intro-reveal {
  transform-origin: center center;
  will-change: transform, filter, opacity;
  animation:
    intro-zoom-in 3.0s cubic-bezier(.19, 1, .22, 1) forwards,
    intro-fade-out 1.8s 10.2s ease-in forwards;
}
@keyframes intro-zoom-in {
  0%   { transform: scale(1.35); filter: blur(8px) brightness(.55); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: scale(1);    filter: blur(0)   brightness(1);   opacity: 1; }
}
@keyframes intro-fade-out {
  0%   { opacity: 1; filter: blur(0)   brightness(1); }
  100% { opacity: 0; filter: blur(6px) brightness(.4); }
}
@media (prefers-reduced-motion: reduce) {
  .intro-reveal, .ascii-block, .line { animation: none; opacity: 1; transform: none; }
}

/* Détails cachés (Metteur en Scène, portes de service). */
.whisper {
  color: var(--whisper);
  cursor: default;
  user-select: none;
}
.whisper:hover { color: var(--whisper); }
.whisper.found { color: var(--accent); }

/* Zone d'entrée */
#input-zone {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2vh;
  width: 100%;
  max-width: 72ch;
  padding: 0 4vw;
}

.choice {
  font-family: var(--mono);
  font-size: clamp(14px, 1.1vw, 18px);
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--dim);
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
  min-height: 48px;
  transition: border-color .2s ease, color .2s ease;
}
.choice:hover,
.choice:focus { border-color: var(--fg); outline: none; }
.choice:active { color: var(--accent); }

.text-input-form {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--dim);
  padding-bottom: 4px;
}
.text-input-caret { color: var(--accent); font-size: 1.2em; }
.text-input {
  flex: 1;
  font-family: var(--mono);
  font-size: clamp(14px, 1.1vw, 18px);
  color: var(--fg);
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 0;
  min-height: 40px;
}

/* Cartel de chapitre entre les chambres (Roman + titre). */
.chapter-title {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5vh;
  background: var(--bg);
  opacity: 0;
  animation: chapter-in 1.2s cubic-bezier(.3,.9,.4,1) forwards;
  pointer-events: none;
  padding: 4vh 4vw;
  text-align: center;
}
.chapter-title.leaving {
  animation: chapter-out 1s ease-in forwards;
}
.chapter-roman {
  color: var(--dim);
  font-family: var(--mono);
  font-size: clamp(36px, 5vw, 72px);
  letter-spacing: .35em;
  padding-left: .35em;
  text-shadow: 0 0 12px rgba(0, 0, 0, .7);
  line-height: 1;
}
.chapter-name {
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(22px, 3vw, 44px);
  letter-spacing: .08em;
  text-shadow: 0 0 12px rgba(0, 0, 0, .75), 0 0 28px color-mix(in srgb, var(--accent) 40%, transparent);
  line-height: 1.15;
  max-width: 94vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-sub {
  color: color-mix(in srgb, var(--fg) 55%, transparent);
  font-family: var(--mono);
  font-size: clamp(11px, 1vw, 15px);
  letter-spacing: .25em;
  margin-top: 1em;
  opacity: .9;
  max-width: 94vw;
  white-space: nowrap;
  overflow: hidden;
}
@media (max-width: 640px) {
  .chapter-name { letter-spacing: .04em; font-size: clamp(18px, 6vw, 28px); }
  .chapter-sub  { letter-spacing: .18em; font-size: clamp(10px, 2.6vw, 13px); }
}
@keyframes chapter-in {
  0%   { opacity: 0; transform: scale(.92); filter: blur(10px); }
  100% { opacity: 1; transform: scale(1);   filter: blur(0); }
}
@keyframes chapter-out {
  0%   { opacity: 1; filter: blur(0); }
  100% { opacity: 0; filter: blur(6px); }
}

/* Indicateur mute du soundManager (toujours visible, discret en bas-droit). */
.mute-indicator {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 300;
  color: var(--dim);
  font-family: var(--mono);
  font-size: clamp(10px, 0.82vw, 13px);
  letter-spacing: .12em;
  user-select: none;
  pointer-events: none;
  opacity: .55;
  text-shadow: 0 0 4px rgba(0,0,0,.95), 0 0 10px rgba(0,0,0,.6);
  transition: color .3s, opacity .3s;
}
.mute-indicator.muted { color: var(--accent); opacity: .85; }

/* --- Console dev (ouverte avec ²) --- */
#dev-console {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 400;
  background: rgba(0, 0, 0, .92);
  color: #a0e0a0;
  font-family: var(--mono);
  font-size: clamp(12px, 1vw, 14px);
  padding: 10px 14px;
  border-bottom: 1px solid #335033;
  transform: translateY(-100%);
  transition: transform .25s ease-out;
  box-shadow: 0 6px 20px rgba(0,0,0,.6);
}
#dev-console.open { transform: translateY(0); }
#dev-console .log {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: #90c090;
}
#dev-console .prompt-line {
  display: flex;
  gap: 8px;
  align-items: center;
}
#dev-console .caret { color: #c0ffc0; }
#dev-console input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e0ffe0;
  font-family: var(--mono);
  font-size: inherit;
  caret-color: #a0ffa0;
}
#dev-console .hint {
  color: #5e8060;
  font-size: .9em;
  letter-spacing: .05em;
}

/* Indicateur [DEV] toujours visible quand le mode est actif. */
#dev-badge {
  position: fixed;
  right: 14px;
  bottom: 34px;
  z-index: 300;
  color: #ff8080;
  font-family: var(--mono);
  font-size: clamp(10px, 0.82vw, 13px);
  letter-spacing: .2em;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 0 6px rgba(255, 60, 60, .4);
  transition: opacity .3s;
}
body.dev-mode #dev-badge { opacity: .9; }

/* Menu de saut rapide par chapitre (dev mode) */
#dev-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  background: rgba(10, 12, 10, .96);
  border: 1px solid #335033;
  border-radius: 2px;
  padding: 24px 28px;
  color: #c0e0c0;
  font-family: var(--mono);
  min-width: 340px;
  max-width: 90vw;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.8);
  display: none;
}
#dev-menu.open { display: block; }
#dev-menu h3 {
  margin: 0 0 14px;
  color: #a0ffa0;
  font-size: 15px;
  letter-spacing: .25em;
  font-weight: normal;
}
#dev-menu .group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
#dev-menu .group-label {
  color: #70a070;
  font-size: 11px;
  letter-spacing: .3em;
  margin-top: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #253525;
}
#dev-menu button {
  background: transparent;
  border: 1px solid #335033;
  color: #c0e0c0;
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
#dev-menu button:hover {
  background: rgba(96, 192, 96, .12);
  border-color: #70a070;
  color: #e0ffe0;
}
#dev-menu .close-x {
  position: absolute;
  top: 12px;
  right: 14px;
  color: #a0c0a0;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
}
#dev-menu .hint {
  color: #5e8060;
  font-size: 11px;
  letter-spacing: .1em;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #253525;
  line-height: 1.6;
}

/* Bouton « valider & sortir » pendant les reactions FPS en dev mode */
#hud3d .dev-fps-exit {
  position: absolute;
  top: 3vh;
  right: 2vw;
  background: rgba(0, 0, 0, .75);
  border: 1px solid #70a070;
  color: #c0ffc0;
  font-family: var(--mono);
  font-size: 13px;
  padding: 6px 12px;
  cursor: pointer;
  letter-spacing: .1em;
  z-index: 50;
  display: none;
}
body.dev-mode #hud3d .dev-fps-exit { display: block; }
#hud3d .dev-fps-exit:hover { background: rgba(0, 32, 0, .9); color: #e0ffe0; }

/* Prompt "Espace pour avancer" affiché pendant les pauses manuelles. */
#dev-prompt {
  position: fixed;
  left: 50%;
  bottom: 3.5vh;
  transform: translateX(-50%);
  z-index: 290;
  color: #c0ffc0;
  font-family: var(--mono);
  font-size: clamp(12px, 1vw, 15px);
  letter-spacing: .14em;
  padding: 6px 14px;
  border: 1px solid rgba(160, 255, 160, .4);
  border-radius: 2px;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  animation: dev-prompt-pulse 1.4s ease-in-out infinite;
}
#dev-prompt.visible { opacity: .9; }
@keyframes dev-prompt-pulse {
  0%, 100% { text-shadow: 0 0 2px rgba(160, 255, 160, .3); }
  50%      { text-shadow: 0 0 12px rgba(160, 255, 160, .8); }
}

/* Scrollbar discrète (si jamais un navigateur en affiche une) */
::-webkit-scrollbar { width: 6px; height: 0; }
::-webkit-scrollbar-thumb { background: var(--whisper); }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 600px) {
  .line, #input-zone { padding: 0 5vw; }
  #screen { font-size: clamp(14px, 3.6vw, 18px); }
  .choice, .text-input { font-size: clamp(14px, 3.6vw, 17px); }
  .ascii-color { font-size: calc(98vw / 128); }
}
