/*
 * styles.css — Direction Artistique Cyberpunk Minimaliste & Ultra-Fonctionnelle
 * Timeline Séquenceur avec Cartes Larges (Dialogue & Déplacement), Pop-up GIF, et Suivi 2D.
 */

:root {
  --bg-void: #07080c;
  --bg-page: #0b0d13;
  --bg-panel: #0f121a;
  --bg-card: #141824;
  --bg-card-hover: #1a2030;
  --bg-stage: #090b10;

  /* Typographie & Couleurs de texte */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  /* Néons & Accents Cyber */
  --neon-cyan: #00f0ff;
  --neon-cyan-glow: rgba(0, 240, 255, 0.35);
  --neon-cyan-subtle: rgba(0, 240, 255, 0.12);

  --neon-violet: #c084fc;
  --neon-violet-glow: rgba(192, 132, 252, 0.35);

  --neon-rose: #f43f5e;
  --neon-rose-glow: rgba(244, 63, 94, 0.35);

  --neon-green: #10b981;
  --neon-amber: #f59e0b;

  /* Bordures Laser & Finitions */
  --border-subtle: 1px solid rgba(255, 255, 255, 0.08);
  --border-card: 1px solid rgba(255, 255, 255, 0.12);
  --border-cyan: 1px solid rgba(0, 240, 255, 0.45);
  --border-amber: 1px solid rgba(245, 158, 11, 0.45);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --font-cyber: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --topbar-h: 60px;
  --timeline-h: 120px;
  --stage-ink: #f8fafc;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg-void); color: var(--text-primary); font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, select, input, textarea, label { font-family: var(--font-body); color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }

/* ---------------------------------------------------------------- */
/* Boutons Cyber Minimalistes (Alignement Parfait)                  */
/* ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-cyber);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  transition: all .15s ease;
  position: relative;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}
.btn-label {
  display: inline-block;
  line-height: 1;
}

.btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
}
.btn-primary:hover:not(:disabled) {
  background: var(--neon-cyan);
  color: #000000;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.4);
}

.btn-cyber {
  background: rgba(192, 132, 252, 0.12);
  border-color: var(--neon-violet);
  color: var(--neon-violet);
}
.btn-cyber:hover:not(:disabled) {
  background: var(--neon-violet);
  color: #000000;
  box-shadow: 0 0 20px rgba(192, 132, 252, 0.35);
}

.btn-secondary {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--neon-rose);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--neon-rose);
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: transparent;
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--neon-rose);
}
.btn-danger:hover:not(:disabled) {
  background: var(--neon-rose);
  color: #ffffff;
}

.btn-play {
  background: var(--neon-cyan);
  color: #000000;
  border-color: var(--neon-cyan);
  font-family: var(--font-cyber);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}
.btn-play:hover:not(:disabled) {
  background: #ffffff;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.5);
}
.btn-play.playing {
  background: var(--neon-rose);
  color: #ffffff;
  border-color: var(--neon-rose);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
}

/* Bouton REC Trajet */
.btn-rec {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--neon-rose);
  font-family: var(--font-cyber);
  font-weight: 700;
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-rose);
  display: inline-block;
  box-shadow: 0 0 8px var(--neon-rose);
}
.btn-rec.recording {
  background: var(--neon-rose);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.6);
  animation: pulseRec 0.8s ease-in-out infinite alternate;
}
@keyframes pulseRec {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.04); opacity: 0.85; }
}

.btn.small { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-large { height: 46px; padding: 0 24px; font-size: 14.5px; border-radius: var(--radius-md); }
.btn-icon-only { width: 36px; height: 36px; padding: 0; font-size: 13px; }

/* ---------------------------------------------------------------- */
/* Top bar Cyber & Scene Switcher                                   */
/* ---------------------------------------------------------------- */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px; border-bottom: var(--border-subtle); background: var(--bg-panel);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0, 240, 255, 0.12); border: var(--border-cyan); color: var(--neon-cyan); font-size: 16px; line-height: 1;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}
.brand-info { display: flex; align-items: center; gap: 10px; }
.brand-name { font-family: var(--font-cyber); font-weight: 700; font-size: 15px; letter-spacing: 0.05em; color: var(--text-primary); }
.brand-badge {
  background: rgba(192, 132, 252, 0.15); border: 1px solid rgba(192, 132, 252, 0.4); border-radius: var(--radius-xs);
  padding: 3px 8px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: var(--neon-violet); letter-spacing: 0.04em;
}

.scene-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: var(--border-card);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}
.scene-switcher-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
}
.scene-switcher select {
  height: 30px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  color: #ffffff;
  padding: 0 8px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▼"; font-size: 9px; margin-left: 6px; color: var(--neon-cyan); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 300px; z-index: 30; padding: 6px;
  background: var(--bg-panel); border: var(--border-card); border-radius: var(--radius-md); box-shadow: 0 16px 36px rgba(0,0,0,0.6), 0 0 20px rgba(0, 240, 255, 0.1);
  display: flex; flex-direction: column; gap: 4px; backdrop-filter: blur(20px);
}
.menu-list button {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 10px 14px; border: 1px solid transparent; border-radius: var(--radius-xs); background: transparent; color: var(--text-primary);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500; transition: all .12s;
}
.menu-list button:hover:not(:disabled) { background: rgba(0, 240, 255, 0.1); border-color: rgba(0, 240, 255, 0.3); color: var(--neon-cyan); }
.menu-list button:disabled { opacity: .35; cursor: not-allowed; }
.menu-list hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.08); margin: 4px 0; }

/* ---------------------------------------------------------------- */
/* Layout & Scène Cyberpunk                                         */
/* ---------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: 1fr 380px; height: calc(100% - var(--topbar-h)); }

/* Mode Plein Écran Cinéma */
.layout.cinema-mode {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100vw;
  height: 100vh;
  grid-template-columns: 1fr;
  background: #000000;
}
.layout.cinema-mode .panel-wrap { display: none; }
.stage.cinema-stage #glCanvas { bottom: 0; height: 100%; }
.stage.cinema-stage .vn-timeline-bar {
  opacity: 0.15;
  transition: opacity .2s ease;
}
.stage.cinema-stage:hover .vn-timeline-bar {
  opacity: 1;
}

.btn-exit-fullscreen {
  position: absolute;
  right: 24px;
  top: 24px;
  z-index: 50;
  padding: 10px 20px;
  background: rgba(12, 15, 22, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid var(--neon-cyan);
  border-radius: var(--radius-pill);
  color: var(--neon-cyan);
  font-family: var(--font-cyber);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
  transition: all .15s;
}
.btn-exit-fullscreen:hover {
  background: var(--neon-cyan);
  color: #000;
}
.btn-exit-fullscreen.hidden { display: none; }

.stage {
  --stage-bg: var(--bg-stage);
  position: relative; overflow: hidden; background: var(--stage-bg); min-width: 0; min-height: 0;
}

/* Couche de Décor d'Arrière-Plan */
.stage-bg-layer {
  position: absolute;
  inset: 0;
  bottom: var(--timeline-h);
  background-size: cover;
  background-position: center;
  z-index: 1;
  pointer-events: none;
  transition: background-image 0.3s ease;
}

#glCanvas { position: absolute; inset: 0; bottom: var(--timeline-h); width: 100%; height: calc(100% - var(--timeline-h)); display: block; z-index: 2; }
.stage.editing #glCanvas { visibility: hidden; }

.stage.dragover::after {
  content: "⚡ DROP IMAGE OU GIF // IMPORT PERSONNAGE"; position: absolute; inset: 20px; bottom: calc(var(--timeline-h) + 20px);
  border: 2px dashed var(--neon-cyan); border-radius: var(--radius-lg);
  display: grid; place-items: center; color: var(--neon-cyan); font-family: var(--font-cyber); font-weight: 700; font-size: 20px; letter-spacing: 0.06em;
  background: rgba(0, 240, 255, 0.08); backdrop-filter: blur(8px); pointer-events: none; z-index: 5; box-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}
.stage-hint {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%); padding: 5px 16px; border-radius: var(--radius-pill);
  background: rgba(14, 18, 26, 0.85); backdrop-filter: blur(12px); color: var(--text-muted); border: var(--border-subtle);
  font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: 0.05em; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 6;
}
.stage-hint.show { opacity: 1; }

/* Boutons interactifs sur le cadre du sticker (Suppression & Redimensionnement) */
.sticker-delete {
  position: absolute; left: 0; top: 0; z-index: 6; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(244, 63, 94, 0.25); color: var(--neon-rose); border: 1.5px solid var(--neon-rose); box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
  transform: translate(-50%, -50%); font-size: 14px; font-weight: 700; transition: transform .12s, background .12s;
}
.sticker-delete:hover { background: var(--neon-rose); color: #ffffff; transform: translate(-50%, -50%) scale(1.18); }
.sticker-delete[hidden] { display: none; }

.sticker-resize-handle {
  position: absolute; left: 0; top: 0; z-index: 6; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 240, 255, 0.25); color: var(--neon-cyan); border: 1.5px solid var(--neon-cyan); box-shadow: 0 0 14px rgba(0, 240, 255, 0.4);
  transform: translate(-50%, -50%); font-size: 15px; font-weight: 700; cursor: nwse-resize; transition: transform .12s, background .12s;
}
.sticker-resize-handle:hover { background: var(--neon-cyan); color: #000000; transform: translate(-50%, -50%) scale(1.18); }
.sticker-resize-handle[hidden] { display: none; }

.stage.editing .sticker-delete, .stage.editing .sticker-resize-handle { display: none; }

/* ---------------------------------------------------------------- */
/* Bulle Cyber Manga (Haute Lisibilité & Suivi 2D)                  */
/* ---------------------------------------------------------------- */
.manga-bubble {
  position: absolute;
  z-index: 10;
  max-width: 380px;
  min-width: 240px;
  background: rgba(8, 11, 18, 0.96);
  backdrop-filter: blur(28px);
  border: 1.5px solid var(--neon-cyan);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0,0,0,0.85), 0 0 24px rgba(0, 240, 255, 0.25);
  padding: 12px 16px;
  transform: translate(-50%, -100%);
  color: var(--text-primary);
  user-select: none;
  transition: border-color .15s, box-shadow .15s;
}
.manga-bubble.dragging {
  border-color: #ffffff;
  box-shadow: 0 24px 56px rgba(0,0,0,0.9), 0 0 36px rgba(0, 240, 255, 0.45);
  opacity: 0.96;
}
.manga-bubble.hidden { display: none; }

.manga-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: grab;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.manga-bubble-header:active { cursor: grabbing; }

.manga-bubble-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.manga-bubble-name {
  flex: 1;
  font-family: var(--font-cyber);
  font-weight: 700;
  font-size: 13px;
  color: var(--neon-cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manga-bubble-edit-btn {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 12px;
  opacity: 0.7;
  transition: opacity .1s;
}
.manga-bubble-edit-btn:hover { opacity: 1; }

.manga-bubble-text {
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.5;
  color: #ffffff;
  font-weight: 600;
  margin: 0;
  word-break: break-word;
  cursor: text;
}
.manga-bubble-next {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--neon-cyan);
  background: var(--bg-card);
  color: var(--neon-cyan);
  font-family: var(--font-cyber);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
  transition: all .12s;
}
.manga-bubble-next:hover {
  background: var(--neon-cyan);
  color: #000000;
  transform: scale(1.15);
}

.manga-bubble-tail {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 12px solid var(--neon-cyan);
  pointer-events: none;
}
.manga-bubble-tail::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: -7px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid #080b12;
}
.manga-bubble.narrator .manga-bubble-tail { display: none; }

/* Curseur Typewriter */
.typewriter-cursor {
  display: inline-block;
  color: var(--neon-cyan);
  margin-left: 3px;
  font-weight: 700;
  animation: blinkCaret 0.8s infinite;
}
@keyframes blinkCaret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------------------------------------------------------------- */
/* Barre de Dialogue RPG Cinéma (Haute Lisibilité)                  */
/* ---------------------------------------------------------------- */
.rpg-dialogue-box {
  position: absolute;
  left: 24px;
  right: 24px;
  max-width: 880px;
  margin: 0 auto;
  bottom: calc(var(--timeline-h) + 16px);
  z-index: 8;
  background: rgba(8, 11, 18, 0.95);
  backdrop-filter: blur(28px);
  border: 1.5px solid var(--neon-cyan);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 48px rgba(0,0,0,0.85), 0 0 24px rgba(0, 240, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.rpg-dialogue-box:hover {
  box-shadow: 0 24px 56px rgba(0,0,0,0.9), 0 0 32px rgba(0, 240, 255, 0.35);
  transform: translateY(-2px);
}
.rpg-dialogue-box.hidden { display: none; }

.rpg-avatar {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.25);
}
.rpg-avatar img { width: 100%; height: 100%; object-fit: contain; }
.rpg-avatar.hidden { display: none; }

.rpg-content { flex: 1; min-width: 0; }
.rpg-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rpg-name {
  font-family: var(--font-cyber);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--neon-cyan);
  letter-spacing: 0.04em;
}
.rpg-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.rpg-body { min-height: 24px; }
.rpg-text {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: #ffffff;
  font-weight: 600;
  margin: 0;
  word-break: break-word;
}
.rpg-next-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--neon-cyan);
  background: rgba(0, 240, 255, 0.15);
  color: var(--neon-cyan);
  font-family: var(--font-cyber);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.2);
  flex-shrink: 0;
  transition: all .15s;
}
.rpg-next-btn:hover {
  background: var(--neon-cyan);
  color: #000000;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.5);
}

/* ---------------------------------------------------------------- */
/* Timeline Séquenceur & Cartes Larges                             */
/* ---------------------------------------------------------------- */
.vn-timeline-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--timeline-h);
  background: var(--bg-panel);
  border-top: var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 9;
}
.timeline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  border-bottom: var(--border-subtle);
  background: var(--bg-void);
}
.timeline-btn-group { display: flex; align-items: center; gap: 6px; }
.frame-counter {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11.5px;
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}
.timeline-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
}
.timeline-setting {
  display: flex;
  align-items: center;
  gap: 6px;
}
.setting-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.timeline-setting select {
  height: 30px;
  padding: 0 22px 0 8px;
  font-size: 11.5px;
  background: var(--bg-card);
  border: var(--border-card);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  appearance: none;
}
.vn-timeline-track {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.3) transparent;
}

.timeline-empty-notice {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}
.timeline-empty-notice b { color: var(--neon-cyan); }

/* Cartes Larges Dialogue & Déplacement */
.timeline-card {
  flex-shrink: 0;
  width: 260px;
  height: 58px;
  background: var(--bg-card);
  border: var(--border-card);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: grab;
  position: relative;
  transition: all .15s ease;
  user-select: none;
}
.timeline-card:active { cursor: grabbing; }
.timeline-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}
.timeline-card.dialogue.active {
  background: rgba(0, 240, 255, 0.08);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
  transform: translateY(-2px);
}
.timeline-card.movement {
  border-color: rgba(245, 158, 11, 0.3);
}
.timeline-card.movement.active {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--neon-amber);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
  transform: translateY(-2px);
}

.timeline-card.dragging {
  opacity: 0.35;
  transform: scale(0.95);
}
.timeline-card.drop-target {
  border-left: 4px solid var(--neon-cyan);
  box-shadow: -4px 0 12px var(--neon-cyan);
  transform: scale(1.02);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
}
.card-seq {
  font-family: var(--font-mono);
  color: var(--neon-cyan);
  font-weight: 700;
  font-size: 10.5px;
}
.card-type-tag {
  font-family: var(--font-cyber);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.03em;
}
.tag-dialogue {
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}
.tag-move {
  background: rgba(245, 158, 11, 0.15);
  color: var(--neon-amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.card-actor {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-cyber);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-primary);
}
.card-del-btn {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.1);
  color: var(--neon-rose);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.7;
  transition: all .12s;
}
.timeline-card:hover .card-del-btn { opacity: 1; }
.card-del-btn:hover { background: var(--neon-rose); color: #ffffff; }

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-detail {
  flex: 1;
  font-size: 11.5px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}
.card-duration {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Statusbar */
.statusbar {
  position: absolute; left: 20px; bottom: calc(var(--timeline-h) + 20px); max-width: min(540px, calc(100% - 40px)); z-index: 6;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: var(--radius-sm);
  background: rgba(14, 18, 26, 0.9); backdrop-filter: blur(16px); border: var(--border-card); color: var(--text-primary); font-family: var(--font-cyber); font-weight: 600; font-size: 13px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  transition: opacity .2s;
}
.statusbar.hidden { opacity: 0; pointer-events: none; }
.statusbar.error { border-color: var(--neon-rose); color: var(--neon-rose); }
.progress { width: 0; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; transition: width .2s; }
.statusbar.busy .progress { width: 90px; }
.progress i { display: block; height: 100%; width: 0; background: var(--neon-cyan); box-shadow: 0 0 10px var(--neon-cyan); transition: width .15s; }
.progress i.indeterminate { animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* Pop-up de Chargement GIF */
.gif-loading-modal {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgba(5, 7, 12, 0.82);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gif-loading-modal.hidden { display: none; }
.gif-loading-box {
  width: 380px;
  background: var(--bg-panel);
  border: 1.5px solid var(--neon-violet);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 48px rgba(0,0,0,0.8), 0 0 30px rgba(192, 132, 252, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.gif-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(192, 132, 252, 0.2);
  border-top-color: var(--neon-violet);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gif-loading-box h3 {
  font-family: var(--font-cyber);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.gif-loading-box p {
  font-size: 13.5px;
  color: var(--neon-violet);
  margin: 0;
}
.gif-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.gif-progress-fill {
  height: 100%;
  width: 30%;
  background: var(--neon-violet);
  box-shadow: 0 0 12px var(--neon-violet);
  transition: width 0.2s ease;
}

/* Dropzone Accueil */
.dropzone { position: absolute; inset: 0; bottom: var(--timeline-h); display: grid; place-items: center; padding: 28px; z-index: 4; }
.dropzone.hidden { display: none; }
.empty {
  max-width: 540px; text-align: center; color: var(--text-primary);
  background: rgba(15, 18, 26, 0.9); backdrop-filter: blur(24px); border: var(--border-card); border-radius: var(--radius-lg);
  padding: 40px 36px; box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 30px rgba(0, 240, 255, 0.08);
}
.empty-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1); border: 1px solid rgba(0, 240, 255, 0.3); padding: 4px 12px; border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.empty h1 { font-family: var(--font-cyber); font-size: 24px; font-weight: 700; letter-spacing: 0.04em; }
.empty p { margin-top: 12px; color: var(--text-secondary); font-size: 14.5px; line-height: 1.55; }
.empty-actions { display: flex; gap: 14px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.empty-foot { margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.cyber-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--neon-green); box-shadow: 0 0 8px var(--neon-green); }

/* ---------------------------------------------------------------- */
/* Cutout Editor                                                    */
/* ---------------------------------------------------------------- */
.editor { position: absolute; inset: 0; z-index: 7; background: #07090e; }
.editor[hidden] { display: none; }
#editCanvas { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.editor.brush #editCanvas { cursor: none; }
.editor.keying #editCanvas { cursor: cell; }
.edit-toolbar {
  position: absolute; left: 16px; right: 16px; top: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius-md); background: rgba(15, 18, 26, 0.95); backdrop-filter: blur(20px); border: var(--border-card); box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.tools { display: inline-flex; border: var(--border-card); border-radius: var(--radius-sm); overflow: hidden; }
.tools button { height: 34px; padding: 0 14px; border: 0; background: var(--bg-card); color: var(--text-secondary); font-family: var(--font-cyber); font-size: 12.5px; font-weight: 600; }
.tools button + button { border-left: var(--border-card); }
.tools button.active { background: rgba(0, 240, 255, 0.15); color: var(--neon-cyan); }

/* GIF Multi-Frames Scrubber */
.gif-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(192, 132, 252, 0.1);
  border: 1px solid rgba(192, 132, 252, 0.3);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
}
.gif-toolbar.hidden { display: none; }
.gif-frame-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--neon-violet);
  white-space: nowrap;
}

.mini { display: none; align-items: center; gap: 8px; color: var(--text-secondary); font-family: var(--font-mono); font-weight: 700; font-size: 11.5px; }
.mini input[type=range] { width: 110px; }
.editor.brush .brush-only, .editor.keying .key-only { display: inline-flex; }
.spacer { flex: 1; }
.edit-hint {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 8px 20px; border-radius: var(--radius-pill);
  background: rgba(15, 18, 26, 0.9); backdrop-filter: blur(16px); border: var(--border-cyan); color: var(--neon-cyan); font-family: var(--font-mono); font-size: 12px; white-space: nowrap;
}

/* ---------------------------------------------------------------- */
/* Panneau Latéral HUD Épuré                                        */
/* ---------------------------------------------------------------- */
.panel-wrap { display: flex; flex-direction: column; min-height: 0; border-left: var(--border-subtle); background: var(--bg-panel); overflow-y: auto; }

.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 16px 20px 14px; border-bottom: var(--border-subtle); background: var(--bg-void); }
.panel-title { display: flex; flex-direction: column; min-width: 0; }
.panel-title #panelStoryName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-cyber); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; color: var(--text-primary); }
.panel-sub { font-weight: 500; color: var(--text-muted); font-size: 12px; }

/* Story Inspector */
.story-inspector {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.node-fields { display: flex; flex-direction: column; gap: 14px; }
.node-fields.hidden { display: none; }

.story-section-title {
  font-family: var(--font-cyber);
  font-weight: 700;
  font-size: 12px;
  color: var(--neon-violet);
  letter-spacing: 0.05em;
  padding-top: 10px;
  border-top: var(--border-subtle);
}

.story-field { display: flex; flex-direction: column; gap: 6px; }
.story-field label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.04em;
}
.story-field input, .story-field select, .story-field textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  border: var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s;
}
.story-field input:focus, .story-field select:focus, .story-field textarea:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
  background: #181d2a;
}
.story-field textarea { resize: vertical; min-height: 70px; line-height: 1.45; }

.duration-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.duration-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-cyan);
}

.quick-duration-pills {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.quick-duration-pills button {
  flex: 1;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  transition: all .12s;
}
.quick-duration-pills button:hover {
  background: rgba(0, 240, 255, 0.15);
  color: var(--neon-cyan);
  border-color: rgba(0, 240, 255, 0.4);
}

.story-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

/* Sliders */
input[type=range] {
  --t: 0.5;
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
}
input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%; background: #ffffff; border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
  transition: transform .1s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type=range]:focus-visible { outline: none; }

/* ---------------------------------------------------------------- */
/* Responsive                                                       */
/* ---------------------------------------------------------------- */
@media (max-width: 960px) {
  body { overflow: auto; }
  .topbar { height: auto; padding: 12px 14px; flex-wrap: wrap; }
  .brand-badge { display: none; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 60vh auto; height: auto; }
  .panel-wrap { border-left: 0; border-top: var(--border-subtle); }
}
