/* =========================================================================
   STYLE.CSS — MAISON CAMÉLÉON VISUAL NOVEL
   Responsive : mobile (< 480px) · tablette (480–768px) · desktop (768px+)
========================================================================= */

/* ── VARIABLES ── */
:root {
  --blue:        #00d4ff;
  --red:         #ff2a2a;
  --orange:      #ff6a00;
  --slime-green: #00ffcc;
  --dark:        #020a14;

  /* Tailles fluides */
  --title-size:    clamp(28px, 5vw, 60px);
  --subtitle-size: clamp(11px, 1.5vw, 14px);
  --input-size:    clamp(24px, 4vw, 38px);
  --dialogue-size: clamp(14px, 2vw, 18px);
  --speaker-size:  clamp(16px, 2.5vw, 24px);
  --boot-size:     clamp(12px, 1.8vw, 16px);
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--dark);
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden;
  height: 100vh; height: 100dvh; /* dvh pour mobile (barre nav incluse) */
  width: 100vw;
  color: white;
  -webkit-tap-highlight-color: transparent; /* supprime le flash bleu au tap */
  touch-action: manipulation;
}

/* =========================================================================
   ÉCRAN DE DÉMARRAGE
========================================================================= */
#start-screen {
  position: fixed; inset: 0; background: #000; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--blue);
  font-size: clamp(16px, 3vw, 24px);
  text-align: center; padding: 20px;
}

/* =========================================================================
   EFFETS GLOBAUX
========================================================================= */
#static-noise {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
  opacity: 0.08; animation: noiseJitter 0.2s infinite;
}
@keyframes noiseJitter { 0% { background-position: 0 0; } 100% { background-position: 100% 100%; } }

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.15) 2px, rgba(0,0,0,0.15) 4px);
}

#bg {
  position: fixed; inset: 0; background-color: var(--dark); z-index: 0;
  transition: background 0.4s ease;
}

/* =========================================================================
   HUD
========================================================================= */
.hud-element {
  position: fixed; z-index: 50;
  font-size: clamp(8px, 1.2vw, 10px);
  color: rgba(255,255,255,0.3); letter-spacing: 2px; pointer-events: none;
  line-height: 1.6;
}
#hud-top-left  { top: 12px; left: 12px; }
#hud-top-right { top: 12px; right: 12px; text-align: right; }
#hud-bottom    { bottom: 12px; left: 50%; transform: translateX(-50%); color: rgba(0,212,255,0.2); white-space: nowrap; }

/* Sur mobile on masque le HUD top-right pour gagner de la place */
@media (max-width: 480px) {
  #hud-top-right { display: none; }
  #hud-top-left  { font-size: 7px; }
  #hud-bottom    { font-size: 7px; }
}

.blink { animation: cursorBlink 1s infinite; }
@keyframes cursorBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.glitch-anim { animation: glitch 0.2s infinite; }
@keyframes glitch {
  0%   { transform: translate(0); }
  20%  { transform: translate(-2px,  2px); }
  40%  { transform: translate(-2px, -2px); }
  60%  { transform: translate( 2px,  2px); }
  80%  { transform: translate( 2px, -2px); }
  100% { transform: translate(0); }
}

/* =========================================================================
   GESTION DES PHASES
========================================================================= */
.phase-container {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.8s ease-in-out, visibility 0.8s;
  padding: 20px;
  overflow-y: auto; /* scroll si contenu dépasse sur petit écran */
}
.phase-container.active { opacity: 1; visibility: visible; pointer-events: auto; }

/* =========================================================================
   BOOT SEQUENCE
========================================================================= */
#boot-sequence {
  justify-content: flex-start; align-items: flex-start;
  padding: clamp(5%, 10%, 80px) clamp(5%, 10%, 80px);
}
.boot-line {
  font-size: var(--boot-size);
  color: rgba(0,212,255,0.8); text-shadow: 0 0 5px var(--blue);
  margin-bottom: 10px; min-height: 18px;
}
.progress-wrapper { width: 100%; max-width: 500px; margin-top: 20px; display: none; }
.progress-label   { font-size: 11px; color: #aaa; margin-bottom: 5px; letter-spacing: 2px; display: flex; justify-content: space-between; }
.progress-track   { width: 100%; height: 4px; background: rgba(255,255,255,0.1); overflow: hidden; }
.progress-fill    { width: 0%; height: 100%; background: var(--blue); box-shadow: 0 0 10px var(--blue); transition: width 0.1s linear; }

/* =========================================================================
   TITRES & SOUS-TITRES
========================================================================= */
.sys-title {
  font-family: 'Black Han Sans', sans-serif;
  font-size: var(--title-size);
  text-shadow: 0 0 20px rgba(0,212,255,0.5);
  text-align: center; letter-spacing: 2px; line-height: 1.1; margin-bottom: 10px;
}
.sys-subtitle {
  color: var(--blue); letter-spacing: clamp(3px, 1vw, 8px);
  margin-bottom: 10px; text-align: center;
  font-size: var(--subtitle-size);
}

/* =========================================================================
   INPUT CODE
========================================================================= */
.code-input {
  background: rgba(0,212,255,0.05); border: none;
  border-bottom: 2px solid var(--blue);
  color: var(--blue); font-family: 'Share Tech Mono', monospace;
  font-size: var(--input-size);
  letter-spacing: clamp(8px, 2vw, 15px);
  text-align: center;
  width: clamp(160px, 50vw, 220px);
  padding: 10px; outline: none; margin-bottom: 20px; transition: 0.3s;
}
.code-input:focus { box-shadow: 0 10px 30px rgba(0,212,255,0.2); border-bottom-color: white; }

/* Clavier virtuel mobile — évite le zoom auto sur iOS */
@media (max-width: 768px) {
  .code-input { font-size: max(16px, var(--input-size)); } /* iOS ne zoome pas en dessous de 16px */
}

.btn-submit {
  background: transparent; border: 1px solid var(--blue); color: var(--blue);
  padding: clamp(10px, 2vw, 15px) clamp(20px, 4vw, 40px);
  cursor: pointer; font-family: 'Share Tech Mono', monospace;
  letter-spacing: 4px; font-size: clamp(11px, 1.5vw, 14px); transition: 0.3s;
}
.btn-submit:hover, .btn-submit:active { background: rgba(0,212,255,0.2); color: white; }
.error-msg { color: var(--red); height: 20px; font-size: 13px; margin-bottom: 10px; }

/* =========================================================================
   MÉDIAS PLACEHOLDER
========================================================================= */
.media-placeholder {
  width: clamp(200px, 60%, 600px);
  height: clamp(120px, 25vh, 300px);
  border: 2px dashed rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.05);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; margin-bottom: 20px;
  text-align: center; padding: 15px;
}

.fullscreen-bg {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%; opacity: 0.4;
}

/* Split layout : côte à côte sur desktop, empilé sur mobile */
.split-layout {
  display: flex; flex-direction: row;
  width: min(80%, 900px); gap: 30px; align-items: center;
}
@media (max-width: 600px) {
  .split-layout {
    flex-direction: column;
    width: 90%; gap: 15px;
  }
  .split-layout .media-placeholder { width: 100%; }
  .split-layout > div:last-child { width: 100% !important; text-align: center !important; }
  .split-layout .sys-title { font-size: clamp(28px, 8vw, 45px); text-align: center !important; }
  .split-layout .sys-subtitle { text-align: center !important; }
  .split-layout .code-input { text-align: center; width: 100% !important; }
}

/* =========================================================================
   MOTEUR DE DIALOGUE — VISUAL NOVEL
========================================================================= */
#narrative-screen {
  background: rgba(0,0,0,0.85); z-index: 100;
  display: none; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding-bottom: clamp(5%, 8%, 60px);
  cursor: pointer; position: absolute; inset: 0;
}

.dialogue-box {
  width: clamp(280px, 85%, 800px);
  border: 1px solid rgba(255,255,255,0.6);
  background: rgba(0,20,40,0.92);
  padding: clamp(16px, 3vw, 30px);
  position: relative;
  box-shadow: 0 0 30px rgba(0,212,255,0.1);
}

#speaker-name {
  font-family: 'Black Han Sans', sans-serif;
  font-size: var(--speaker-size);
  letter-spacing: 3px; margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 5px;
}

#dialogue-text {
  font-size: var(--dialogue-size);
  line-height: 1.65; min-height: 50px; color: #ddd;
  word-wrap: break-word; overflow-wrap: break-word;
}

.continue-hint {
  font-size: 11px; color: #888; text-align: right;
  margin-top: 15px; animation: pulseHint 1.5s infinite;
}

/* =========================================================================
   SPRITES (PORTRAITS VISUAL NOVEL)
========================================================================= */
.sprite {
  position: absolute; bottom: 0;
  width: clamp(120px, 25vw, 350px);
  height: auto; max-height: 80vh; object-fit: contain;
  transition: all 0.3s ease;
  opacity: 0.4; filter: brightness(0.5) grayscale(30%); z-index: 90;
}
.sprite-left  { left: 1%;  transform: translateX(-15px); }
.sprite-right { right: 1%; transform: translateX(15px); }
.sprite.active {
  opacity: 1; filter: brightness(1) grayscale(0%);
  transform: translateX(0) scale(1.03); z-index: 95;
}
.is-talking { animation: talkBounce 0.15s infinite alternate; }
@keyframes talkBounce {
  0%   { transform: translateY(0)   scale(1.03); }
  100% { transform: translateY(-4px) scale(1.03); }
}

/* Sur mobile les portraits sont plus petits et moins envahissants */
@media (max-width: 480px) {
  .sprite { width: clamp(80px, 18vw, 130px); max-height: 45vh; }
  .sprite-left  { left: 0; }
  .sprite-right { right: 0; }
}

/* =========================================================================
   ÉCRAN MATRIX (DÉCRYPTAGE)
========================================================================= */
#decryption-screen {
  background: #02050a; z-index: 90; color: #00d4ff;
  display: none; flex-direction: column;
  align-items: flex-start; justify-content: flex-end;
  padding: clamp(20px, 5vw, 50px);
  position: absolute; inset: 0;
}
.matrix-line {
  font-size: clamp(10px, 1.5vw, 12px);
  margin-bottom: 4px; opacity: 0.8; text-shadow: 0 0 5px #00d4ff;
}

/* =========================================================================
   FX OVERLAY
========================================================================= */
#fx-overlay { position: fixed; inset: 0; z-index: 150; pointer-events: none; display: none; }
.fx-wind {
  background: repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(0,255,255,0.1) 80px, rgba(0,255,255,0.1) 85px);
  animation: windBlow 0.2s linear infinite;
}
@keyframes windBlow { 0% { background-position: 0 0; } 100% { background-position: 500px 0; } }
.text-tremble { animation: textShake 0.1s infinite alternate; }
@keyframes textShake {
  0%   { transform: translate(0, 0) skewX(0); }
  100% { transform: translate(-4px, 2px) skewX(-5deg); }
}
.fx-blood {
  background: radial-gradient(circle, transparent 20%, rgba(150,0,0,0.8) 100%);
  animation: heartbeat 1s infinite; box-shadow: inset 0 0 100px red;
}
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.05); filter: brightness(1.5); } }
.fx-lightning { background: #000; animation: stormFlash 2s infinite; }
@keyframes stormFlash {
  0%, 90%, 100% { background-color: rgba(0,0,0,0.8); }
  92%, 96%      { background-color: white; box-shadow: inset 0 0 200px #4169e1; }
}

/* =========================================================================
   SÉQUENCE GLITCH / SCAN
========================================================================= */
.glitch-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; opacity: 0; }
.glitch-anim-heavy { animation: heavyGlitch 0.4s infinite; }
@keyframes heavyGlitch {
  0%   { transform: translate(0)          scale(1);    filter: hue-rotate(0deg)   contrast(1);   opacity: 1; }
  20%  { transform: translate(-10px,10px) scale(1.05); filter: hue-rotate(90deg)  contrast(1.5); opacity: 0.8; }
  40%  { transform: translate(10px,-10px) scale(1.05); filter: hue-rotate(-90deg) invert(0.2);   opacity: 1; }
  60%  { transform: translate(-5px,-5px)  scale(1);    filter: invert(1);                         opacity: 0.9; }
  80%  { transform: translate(5px,5px)    scale(1.02); filter: hue-rotate(45deg);                 opacity: 1; }
  100% { transform: translate(0)          scale(1);    filter: hue-rotate(0deg);                  opacity: 1; }
}
.scanner-line {
  position: absolute; top: 0; left: 0; width: 100%; height: 6px;
  background: rgba(0,212,255,0.9); box-shadow: 0 0 30px var(--blue), 0 0 10px white;
  animation: scanDown 2s infinite linear; z-index: 5;
}
@keyframes scanDown {
  0%   { top: -10px; opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%;  opacity: 0; }
}
.loading-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.7); z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* =========================================================================
   FLASH AUTO-SUBMIT
========================================================================= */
.flash-success {
  position: absolute; inset: 0; z-index: 9999; pointer-events: none;
  animation: flashWhite 0.3s ease-out forwards;
}
@keyframes flashWhite {
  0%   { background-color: rgba(255,255,255,0.9); box-shadow: inset 0 0 100px #00d4ff; }
  100% { background-color: transparent; box-shadow: none; }
}

/* =========================================================================
   ÉCRAN FAUX APPEL ANDROID
========================================================================= */
#phase-call { background: #050505; }
.swipe-container {
  display: flex; justify-content: space-between; align-items: center;
  width: clamp(220px, 60vw, 280px); height: 70px; margin-top: 50px; position: relative;
}
.swipe-track {
  position: absolute; width: 100%; height: 100%; border-radius: 35px;
  background: rgba(255,255,255,0.05); display: flex; align-items: center;
  padding: 0 10px; justify-content: center;
}
.swipe-hint {
  color: rgba(255,255,255,0.3); font-size: 11px; letter-spacing: 2px;
  animation: pulseHint 2s infinite; pointer-events: none;
}
.call-btn {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: grab;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; position: absolute; z-index: 2;
}
.btn-accept { background: #28a745; color: white; left: 5px; box-shadow: 0 0 15px rgba(40,167,69,0.5); }
.btn-decline { background: #dc3545; color: white; right: 5px; cursor: pointer; }

/* =========================================================================
   MENU DEBUG
========================================================================= */
#debug-menu {
  display: none; position: fixed; top: 50px; left: 10px;
  background: rgba(0,0,0,0.95); border: 1px solid var(--red);
  padding: 12px; z-index: 9999;
  font-family: 'Share Tech Mono', monospace;
  max-height: 85vh; overflow-y: auto;
  width: clamp(180px, 40vw, 260px);
}
.debug-btn {
  display: block; width: 100%; background: transparent;
  border: 1px solid var(--blue); color: var(--blue);
  margin-bottom: 5px; padding: 6px 8px; cursor: pointer;
  text-align: left; font-family: 'Share Tech Mono', monospace;
  font-size: clamp(10px, 1.5vw, 12px);
}
.debug-btn:hover, .debug-btn:active { background: var(--blue); color: black; }

/* =========================================================================
   HOLOGRAMME
========================================================================= */
.hologram-glow { animation: pulseHologram 2s infinite alternate; }
@keyframes pulseHologram {
  0%   { filter: drop-shadow(0 0 5px var(--blue))  brightness(0.2); }
  100% { filter: drop-shadow(0 0 15px var(--blue)) drop-shadow(0 0 30px var(--blue)) brightness(0.4); }
}

/* =========================================================================
   TEXTE ENRICHI (lore.js balises)
========================================================================= */
@keyframes pulseDanger {
  0%, 100% { text-shadow: 0 0 6px #ff2a2a; opacity: 1; }
  50%       { text-shadow: 0 0 18px #ff2a2a, 0 0 35px #ff000066; opacity: 0.85; }
}
@keyframes richGlitch {
  0%   { transform: translate(0);          filter: none; }
  20%  { transform: translate(-3px, 1px);  filter: hue-rotate(90deg); }
  40%  { transform: translate(3px, -1px);  filter: hue-rotate(-90deg) brightness(1.4); }
  60%  { transform: translate(-2px, 2px);  filter: invert(0.3); }
  80%  { transform: translate(2px, -2px);  filter: brightness(1.2); }
  100% { transform: translate(0);          filter: none; }
}
@keyframes richShake {
  0%   { transform: translate(0, 0)     rotate(0deg); }
  100% { transform: translate(-2px, 1px) rotate(-1deg); }
}

/* =========================================================================
   CINÉMATIQUE AINZ
========================================================================= */
@keyframes ainzFogPulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}
@keyframes ainzScanDown {
  0%   { top: -8px;  opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100vh; opacity: 0; }
}
@keyframes ainzTrembleLight {
  0%, 100% { transform: translate(0, 0); }
  25%       { transform: translate(-1px, 1px); }
  75%       { transform: translate(1px, -1px); }
}
.ainz-tremble-light { animation: ainzTrembleLight 0.15s infinite; }

@keyframes ainzTrembleHeavy {
  0%, 100% { transform: translate(0, 0)       rotate(0deg); }
  20%       { transform: translate(-4px, 2px)  rotate(-0.3deg); }
  40%       { transform: translate(4px, -2px)  rotate(0.3deg); }
  60%       { transform: translate(-3px,-3px)  rotate(-0.2deg); }
  80%       { transform: translate(3px, 3px)   rotate(0.2deg); }
}
.ainz-tremble-heavy { animation: ainzTrembleHeavy 0.1s infinite; }

@keyframes ainzHeavyGlitch {
  0%   { transform: translate(0)         skew(0deg);  filter: none; }
  15%  { transform: translate(-8px, 3px) skew(-3deg); filter: hue-rotate(90deg)  brightness(2); }
  30%  { transform: translate(8px, -3px) skew(3deg);  filter: hue-rotate(-90deg) invert(0.3); }
  45%  { transform: translate(-4px,-4px) skew(-1deg); filter: brightness(3)      saturate(0); }
  60%  { transform: translate(4px, 4px)  skew(1deg);  filter: hue-rotate(180deg); }
  75%  { transform: translate(-6px, 2px) skew(-2deg); filter: invert(0.5); }
  100% { transform: translate(0)         skew(0deg);  filter: none; }
}
.ainz-glitch-heavy { animation: ainzHeavyGlitch 0.12s infinite !important; }

/* =========================================================================
   UTILITAIRES
========================================================================= */
@keyframes pulseHint { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.8; } }


/* =========================================================================
   TV / OVERSCAN — sécurité pour les bords coupés sur smart TV
========================================================================= */
@media (min-width: 1280px) {
  body {
    padding: env(safe-area-inset-top, 0px)
             env(safe-area-inset-right, 0px)
             env(safe-area-inset-bottom, 0px)
             env(safe-area-inset-left, 0px);
  }
}

/* =========================================================================

/* =========================================================================
   CINÉMATIQUES VELDRA / FATE / RANGA / MYNOGHRA — v2
========================================================================= */

/* ── VELDRA — éclairs cyan ── */
.cin-lightning-anim    { animation: cyanLightning 0.5s infinite; }
.cin-lightning-intense { animation: cyanLightning 0.18s infinite; }
@keyframes cyanLightning {
    0%, 85%, 100% { background: transparent; box-shadow: none; }
    87% { background: #00d4ff22; box-shadow: inset 0 0 150px #00d4ff88; }
    90% { background: transparent; }
    93% { background: #00d4ff11; box-shadow: inset 0 0 80px #00d4ff44; }
}

/* ── RANGA — éclairs violets ── */
.cin-lightning-purple { animation: purpleLightning 0.5s infinite; }
@keyframes purpleLightning {
    0%, 85%, 100% { background: transparent; box-shadow: none; }
    87% { background: #7b2fff33; box-shadow: inset 0 0 150px #7b2fff88; }
    90% { background: transparent; }
    93% { background: #7b2fff11; }
}

/* ── FATE — pulse rouge ── */
.fate-pulse-anim {
    background: radial-gradient(ellipse at center, #88000055 0%, transparent 65%);
    animation: fatePulse 1.2s ease-in-out infinite;
}
@keyframes fatePulse {
    0%, 100% { transform: scale(1);    opacity: 0.5; }
    50%       { transform: scale(1.2); opacity: 1;   }
}

/* ── FATE — œil SVG paupières qui s'ouvrent ── */
.fate-eye-open .eyelid-top {
    transform-origin: 100px 0px;
    animation: eyelidTopOpen 1.3s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes eyelidTopOpen {
    0%   { transform: scaleY(1);   }
    100% { transform: scaleY(0);   }
}
.fate-eye-open .eyelid-bottom {
    transform-origin: 100px 100px;
    animation: eyelidBottomOpen 1.3s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes eyelidBottomOpen {
    0%   { transform: scaleY(1);   }
    100% { transform: scaleY(0);   }
}
.fate-eye-open .eye-iris {
    animation: eyeIrisGlow 2s ease-in forwards;
}
@keyframes eyeIrisGlow {
    0%   { filter: brightness(0.3); }
    100% { filter: brightness(1) drop-shadow(0 0 8px #ff0000); }
}

/* ── RANGA — brume ── */
@keyframes ranFogPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.04); }
}


/* ── MYNOGHRA — interface corrompue ── */
.myn-ui-corrupt {
    animation: mynUiCorrupt 0.3s steps(1) infinite;
}
@keyframes mynUiCorrupt {
    0%   { filter: none; transform: translate(0); }
    20%  { filter: hue-rotate(180deg) saturate(3) brightness(0.5); transform: translate(-3px, 0); }
    40%  { filter: none; transform: translate(2px, 1px); }
    60%  { filter: invert(0.15) hue-rotate(90deg); transform: translate(0); }
    80%  { filter: brightness(2) saturate(0); transform: translate(-1px, -1px); }
    100% { filter: none; transform: translate(0); }
}

/* ── MYNOGHRA — glitch overlay ── */
.myn-glitch-overlay {
    background: repeating-linear-gradient(
        0deg,
        transparent 0px, transparent 4px,
        rgba(80,0,20,0.08) 4px, rgba(80,0,20,0.08) 5px
    );
    animation: mynGlitchLines 0.15s steps(1) infinite;
}
@keyframes mynGlitchLines {
    0%   { background-position: 0 0;   opacity: 0.6; }
    33%  { background-position: 0 3px; opacity: 0.9; }
    66%  { background-position: 0 1px; opacity: 0.4; }
    100% { background-position: 0 0;   opacity: 0.7; }
}

/* ── MYNOGHRA — tentacules ── */
.tentacle {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: tentacleGrow 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.tentacle.t1 { animation-delay: 0.0s; stroke: #2a0040; stroke-width: 4; }
.tentacle.t2 { animation-delay: 0.2s; stroke: #1a0028; stroke-width: 5; }
.tentacle.t3 { animation-delay: 0.1s; stroke: #220035; stroke-width: 4.5; }
.tentacle.t4 { animation-delay: 0.3s; stroke: #0d0016; stroke-width: 6; }
.tentacle.t5 { animation-delay: 0.4s; stroke: #330044; stroke-width: 3; }
.tentacle.t6 { animation-delay: 0.15s; stroke: #1a0030; stroke-width: 3.5; }
@keyframes tentacleGrow {
    0%   { stroke-dashoffset: 200; opacity: 0; }
    5%   { opacity: 1; }
    100% { stroke-dashoffset: 0;   opacity: 1; }
}

/* ── MYNOGHRA — yeux d'Atou qui s'ouvrent ── */
.myn-eyes-open .myn-lid-top {
    transform-origin: center 0%;
    animation: mynLidTopOpen 1.4s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes mynLidTopOpen {
    0%   { transform: scaleY(1); }
    100% { transform: scaleY(0); }
}
.myn-eyes-open .myn-lid-bot {
    transform-origin: center 100%;
    animation: mynLidBotOpen 1.4s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes mynLidBotOpen {
    0%   { transform: scaleY(1); }
    100% { transform: scaleY(0); }
}
.myn-eyes-open .myn-eye-iris {
    animation: mynIrisGlow 2s ease-in forwards;
}
@keyframes mynIrisGlow {
    0%   { filter: brightness(0.2); }
    100% { filter: brightness(1.2) drop-shadow(0 0 6px #cc0033); }
}
.myn-eyes-open .myn-eye-pupil {
    animation: mynPupilPulse 1.5s ease-in-out infinite;
}
@keyframes mynPupilPulse {
    0%, 100% { transform: scaleY(1); }
    50%       { transform: scaleY(1.15); }
}

/* ── MYNOGHRA — curseur interface ── */
.myn-cursor {
    animation: mynCursorMove 3s ease-in-out infinite;
}
@keyframes mynCursorMove {
    0%   { cx: 48; cy: 32; opacity: 1; }
    30%  { cx: 55; cy: 28; opacity: 1; }
    60%  { cx: 42; cy: 38; opacity: 0.7; }
    100% { cx: 48; cy: 32; opacity: 0; }
}

/* =========================================================================
   SHION + BENIMARU — flammes orange + impact violet
========================================================================= */
/* Flammes de Benimaru */
.sb-flame-main { animation: sbFlameRise 1.5s ease-out infinite alternate; }
.sb-flame-left  { animation: sbFlameRise 1.2s ease-out infinite alternate-reverse; }
.sb-flame-right { animation: sbFlameRise 1.8s ease-out infinite alternate; }
@keyframes sbFlameRise {
    0%   { ry: 55; opacity: 0.7; }
    100% { ry: 72; opacity: 1;   }
}
.sb-flame-col {
    stroke-dasharray: 120; stroke-dashoffset: 120;
    animation: sbColGrow 1.5s ease-out forwards;
}
.sb-flame-col.f2 { animation-delay: 0.1s; }
.sb-flame-col.f3 { animation-delay: 0.2s; }
.sb-flame-col.f4 { animation-delay: 0.3s; }
@keyframes sbColGrow { to { stroke-dashoffset: 0; } }

/* Éclair orange Benimaru */
.sb-lightning-orange { animation: sbOrangeLightning 0.45s infinite; }
@keyframes sbOrangeLightning {
    0%, 84%, 100% { background: transparent; }
    86% { background: #ff660022; box-shadow: inset 0 0 120px #ff660066; }
    90% { background: transparent; }
    93% { background: #ff440011; }
}

/* Tremblement impact Shion */
.sb-shion-shake { animation: sbShake 0.12s infinite; }
@keyframes sbShake {
    0%, 100% { transform: translate(0); }
    20%  { transform: translate(-5px, 2px); }
    40%  { transform: translate(5px, -2px); }
    60%  { transform: translate(-3px, -3px); }
    80%  { transform: translate(3px, 3px); }
}

/* Fissure violette */
.sb-crack-line {
    animation: sbCrackDraw 0.8s ease-out forwards;
}
.sb-crack-line.c2 { animation-delay: 0.4s; }
.sb-crack-line.c3 { animation-delay: 0.5s; }
@keyframes sbCrackDraw { to { stroke-dashoffset: 0; } }

.sb-crack-glow {
    stroke-dasharray: 150; stroke-dashoffset: 150;
    animation: sbCrackDraw 1.2s ease-out forwards;
}

/* =========================================================================
   DIABLO — flammes noires, émergence de l'ombre
========================================================================= */
.dbl-base-flame  { animation: dblFlameBreath 2s ease-in-out infinite alternate; }
.dbl-inner-flame { animation: dblFlameBreath 1.5s ease-in-out infinite alternate-reverse; }
@keyframes dblFlameBreath {
    0%   { ry: 50; opacity: 0.6; }
    100% { ry: 65; opacity: 0.9; }
}
.dbl-col {
    stroke-dasharray: 120; stroke-dashoffset: 120;
    animation: dblColRise 2s ease-out forwards;
}
.dbl-col.df2 { animation-delay: 0.15s; }
.dbl-col.df3 { animation-delay: 0.3s; }
.dbl-col.df4 { animation-delay: 0.45s; }
.dbl-col.df5 { animation-delay: 0.6s; }
@keyframes dblColRise { to { stroke-dashoffset: 0; } }

/* =========================================================================
   FONDS DE DIALOGUE — narrative-screen doit être relative pour le layer
========================================================================= */
#narrative-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: clamp(20px, 5vh, 60px);
}

/* Les sprites et dialogue-box doivent être au-dessus du fond */
#narrative-screen .sprite       { z-index: 10; position: relative; }
#narrative-screen .dialogue-box { z-index: 20; position: relative; }

/* ── Ken Burns — zoom lent ── */
.dialogue-bg-kenburns {
    animation: kenBurns 20s ease-in-out infinite alternate;
    background-size: 110% !important;
}
@keyframes kenBurns {
    0%   { background-size: 100% !important; background-position: 40% 50% !important; }
    100% { background-size: 115% !important; background-position: 60% 45% !important; }
}

/* ── Storm — flash éclair ── */
@keyframes stormFlash {
    0%, 89%, 91%, 93%, 100% { opacity: 0; }
    90%  { opacity: 0.12; }
    92%  { opacity: 0.04; }
}

/* ── Parallax lent ── */
.dialogue-bg-parallax_slow {
    animation: parallaxSlow 12s ease-in-out infinite alternate;
}
@keyframes parallaxSlow {
    0%   { background-position: 48% 50% !important; }
    100% { background-position: 52% 52% !important; }
}

/* ── Particules mana ── */
@keyframes manaFloat {
    0%   { opacity: 0;   transform: translateY(0)    scale(1); }
    20%  { opacity: 0.8; }
    80%  { opacity: 0.6; }
    100% { opacity: 0;   transform: translateY(-80px) scale(1.4); }
}

/* ── Sang qui tombe ── */
@keyframes bloodFall {
    0%   { top: -20px; height: 0px;  opacity: 0; }
    10%  { opacity: 0.7; }
    80%  { opacity: 0.6; }
    100% { top: 110%;   height: 80px; opacity: 0; }
}

/* ── Brume forêt ── */
@keyframes fogDrift {
    0%   { transform: translateX(-3%) scaleX(1.05); opacity: 0.5; }
    100% { transform: translateX(3%)  scaleX(1);    opacity: 0.8; }
}

/* ── Corruption Mynoghra ── */
@keyframes corruptPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%       { opacity: 0.8; transform: scale(1.05); }
}

/* ── Placeholder couleurs bg dialogues ── */
.dialogue-bg-mana_particles  { background: radial-gradient(ellipse at center, #002a1a 0%, #001a2a 50%, #000810 100%); }
.dialogue-bg-blood_drip      { background: radial-gradient(ellipse at top, #1a0000 0%, #0d0000 60%, #000 100%); }
.dialogue-bg-storm           { background: linear-gradient(180deg, #0a0a1a 0%, #1a1a2a 40%, #0d0d20 100%); }
.dialogue-bg-fog_drift       { background: linear-gradient(180deg, #000 0%, #0a1a0a 40%, #050d05 100%); }
.dialogue-bg-corruption      { background: radial-gradient(ellipse at center, #0d0010 0%, #050008 60%, #000 100%); }