/* ================================================================
   THE MIDNIGHT CHRONICLE — Scene Styles
   Atmospheric Environments · Interactive Hotspots · Dialogue System
   ================================================================ */

/* ─── Scene Viewport ────────────────────────────────────────────── */
.scene-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--bg-deepest);
}


/* ─── Scene Background ──────────────────────────────────────────── */
.scene-background {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.8s var(--ease-out);
}

/* Atmospheric overlay — always present */
.scene-background::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Vignette */
.scene-background::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
  z-index: 1;
}


/* ─── Scene-Specific Themes ─────────────────────────────────────── */

/* Office — cold fluorescent with warm desk lamp pool */
[data-scene='office'] .scene-background {
  background-image:
    radial-gradient(ellipse 35% 45% at 70% 60%, rgba(212, 168, 83, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 30% 30%, rgba(41, 128, 185, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, #0d111f 0%, #141b2f 40%, #0f1525 100%);
}

/* Café — warm amber glow, intimate atmosphere */
[data-scene='cafe'] .scene-background {
  background-image:
    radial-gradient(ellipse 40% 50% at 50% 55%, rgba(212, 168, 83, 0.15) 0%, transparent 65%),
    radial-gradient(circle at 20% 40%, rgba(192, 100, 40, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(180, 120, 50, 0.08) 0%, transparent 40%),
    linear-gradient(180deg, #12100a 0%, #1a1610 35%, #1c1408 100%);
}

/* Lab — sterile blue-green, clinical lighting */
[data-scene='lab'] .scene-background {
  background-image:
    radial-gradient(ellipse 60% 30% at 50% 0%, rgba(46, 204, 113, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 60% 50%, rgba(52, 152, 219, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #0a1520 0%, #0c1a28 40%, #081218 100%);
}

/* Newsroom — dynamic warm overhead lighting */
[data-scene='newsroom'] .scene-background {
  background-image:
    radial-gradient(ellipse 70% 20% at 50% 5%, rgba(240, 198, 116, 0.1) 0%, transparent 70%),
    radial-gradient(circle at 75% 40%, rgba(212, 168, 83, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 25% 60%, rgba(212, 168, 83, 0.04) 0%, transparent 35%),
    linear-gradient(180deg, #141210 0%, #1a1714 35%, #110f0c 100%);
}

/* Street — moody noir, rain-soaked, neon accents */
[data-scene='street'] .scene-background {
  background-image:
    radial-gradient(circle at 15% 25%, rgba(231, 76, 60, 0.07) 0%, transparent 35%),
    radial-gradient(circle at 85% 30%, rgba(41, 128, 185, 0.06) 0%, transparent 30%),
    radial-gradient(ellipse 80% 20% at 50% 95%, rgba(100, 100, 120, 0.08) 0%, transparent 70%),
    linear-gradient(180deg, #080a14 0%, #0c0f1c 30%, #06080f 100%);
}

/* Street — subtle animated rain effect */
[data-scene='street'] .scene-background::before {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.5) 100%),
    repeating-linear-gradient(
      100deg,
      transparent,
      transparent 98px,
      rgba(150, 160, 200, 0.015) 98px,
      rgba(150, 160, 200, 0.015) 99px
    );
  animation: rainDrift 2s linear infinite;
}

@keyframes rainDrift {
  from { background-position: 0 0, 0 -100px; }
  to { background-position: 0 0, -10px 100px; }
}


/* ─── Hotspot System ────────────────────────────────────────────── */
.scene-hotspots {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  z-index: 6;
  transition: transform var(--transition-fast);
}

/* Hotspot core indicator */
.hotspot::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 168, 83, 0.5) 0%, rgba(212, 168, 83, 0.15) 60%, transparent 70%);
  transition: all var(--transition-base);
}

/* Hotspot pulse ring — undiscovered */
.hotspot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 168, 83, 0.3);
  animation: hotspotPulse 2.5s ease-in-out infinite;
}

.hotspot:hover {
  transform: translate(-50%, -50%) scale(1.2);
}

.hotspot:hover::before {
  background: radial-gradient(circle, rgba(212, 168, 83, 0.8) 0%, rgba(212, 168, 83, 0.3) 55%, transparent 70%);
  box-shadow: 0 0 20px rgba(212, 168, 83, 0.4);
}

.hotspot:hover::after {
  animation: none;
  border-color: rgba(212, 168, 83, 0.6);
}

.hotspot:active {
  transform: translate(-50%, -50%) scale(0.95);
}

/* Discovered state — dim the hotspot */
.hotspot.discovered::after {
  animation: none;
  border-color: rgba(212, 168, 83, 0.1);
}

.hotspot.discovered::before {
  background: radial-gradient(circle, rgba(212, 168, 83, 0.15) 0%, transparent 60%);
}

@keyframes hotspotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* ── Hotspot Type Variants ─── */

/* Objects — amber/gold tint */
.hotspot-item::before {
  background: radial-gradient(circle, rgba(212, 168, 83, 0.5) 0%, rgba(212, 168, 83, 0.15) 60%, transparent 70%);
}

.hotspot-item::after {
  border-color: rgba(212, 168, 83, 0.3);
}

.hotspot-item:hover::before {
  background: radial-gradient(circle, rgba(240, 198, 116, 0.8) 0%, rgba(240, 198, 116, 0.3) 55%, transparent 70%);
  box-shadow: 0 0 24px rgba(240, 198, 116, 0.4);
}

/* Characters — soft blue */
.hotspot-person::before {
  background: radial-gradient(circle, rgba(52, 152, 219, 0.5) 0%, rgba(52, 152, 219, 0.15) 60%, transparent 70%);
}

.hotspot-person::after {
  border-color: rgba(52, 152, 219, 0.3);
}

.hotspot-person:hover::before {
  background: radial-gradient(circle, rgba(52, 152, 219, 0.8) 0%, rgba(52, 152, 219, 0.3) 55%, transparent 70%);
  box-shadow: 0 0 24px rgba(52, 152, 219, 0.4);
}

/* Documents — warm cream */
.hotspot-document::before {
  background: radial-gradient(circle, rgba(241, 196, 15, 0.45) 0%, rgba(241, 196, 15, 0.12) 60%, transparent 70%);
}

.hotspot-document::after {
  border-color: rgba(241, 196, 15, 0.3);
}

.hotspot-document:hover::before {
  background: radial-gradient(circle, rgba(241, 196, 15, 0.75) 0%, rgba(241, 196, 15, 0.25) 55%, transparent 70%);
  box-shadow: 0 0 24px rgba(241, 196, 15, 0.35);
}

/* Hotspot label tooltip */
.hotspot-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  padding: 0.3rem 0.7rem;
  background: var(--glass-bg-heavy);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(212, 168, 83, 0.15);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--gold-light);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.hotspot-label::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(212, 168, 83, 0.15);
}

.hotspot:hover .hotspot-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ─── Scene Transition ──────────────────────────────────────────── */
.scene-transition {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.scene-transition.fade-in {
  background: #000;
  animation: sceneFadeIn 1s var(--ease-out) forwards;
}

.scene-transition.fade-out {
  background: #000;
  animation: sceneFadeOut 0.8s var(--ease-out) forwards;
}

.scene-transition.slide-left {
  background: linear-gradient(90deg, var(--bg-deepest) 0%, transparent 100%);
  animation: sceneSlideLeft 0.7s var(--ease-out) forwards;
}

.scene-transition.slide-right {
  background: linear-gradient(-90deg, var(--bg-deepest) 0%, transparent 100%);
  animation: sceneSlideRight 0.7s var(--ease-out) forwards;
}

@keyframes sceneFadeIn {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes sceneFadeOut {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sceneSlideLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes sceneSlideRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}


/* ═══════════════════════════════════════════════════════════════════
   DIALOGUE SYSTEM
   ═══════════════════════════════════════════════════════════════════ */
.dialogue-box {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: linear-gradient(180deg, rgba(10, 14, 23, 0.75) 0%, rgba(10, 14, 23, 0.96) 30%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 2px solid var(--speaker-color, rgba(212, 168, 83, 0.25));
  box-shadow: 0 -5px 25px var(--speaker-color-glow, rgba(212, 168, 83, 0.05));
  z-index: 8;
  min-height: 120px;
  animation: dialogueSlideUp 0.4s var(--ease-out);
  transition: opacity var(--transition-base), visibility var(--transition-base), border-color 0.45s ease, box-shadow 0.45s ease;
}

.dialogue-box.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
}

@keyframes dialogueSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Portrait */
.dialogue-portrait {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--gold-dim);
  background: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow:
    0 0 0 3px rgba(10, 14, 23, 0.8),
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 16px var(--gold-glow);
  transition: border-color var(--transition-base);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.dialogue-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.dialogue-portrait:hover {
  border-color: var(--gold);
}

/* Content area */
.dialogue-content {
  flex: 1;
  min-width: 0;
}

.dialogue-speaker {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.02em;
}

.dialogue-text {
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
  min-height: 1.7em;
}

/* Typewriter cursor effect for dialogue text */
.dialogue-text.typing::after {
  content: '▎';
  color: var(--gold);
  animation: typewriterBlink 0.6s step-end infinite;
  margin-left: 2px;
}

/* Advance button */
.dialogue-advance {
  align-self: flex-end;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--gold);
  background: rgba(212, 168, 83, 0.08);
  border: 1px solid rgba(212, 168, 83, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  animation: advancePulse 2s ease-in-out infinite;
}

.dialogue-advance:hover {
  background: rgba(212, 168, 83, 0.15);
  border-color: var(--gold);
  transform: scale(1.1);
  box-shadow: 0 0 16px var(--gold-glow);
  animation: none;
}

.dialogue-advance:active {
  transform: scale(0.95);
}

@keyframes advancePulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}


/* ─── Dialogue Choices ──────────────────────────────────────────── */
.dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.dialogue-choice {
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.dialogue-choice::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gold);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.dialogue-choice:hover {
  background: rgba(212, 168, 83, 0.06);
  border-color: rgba(212, 168, 83, 0.2);
  color: var(--text-primary);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.dialogue-choice:hover::before {
  opacity: 1;
}

.dialogue-choice:active {
  transform: translateX(2px) scale(0.99);
  background: rgba(212, 168, 83, 0.1);
}

.dialogue-choice:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Choice number indicator */
.dialogue-choice .choice-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gold);
  background: rgba(212, 168, 83, 0.1);
  border: 1px solid rgba(212, 168, 83, 0.2);
  border-radius: var(--radius-sm);
}

/* Staggered animation for choices */
.dialogue-choice {
  animation: choiceSlideIn 0.3s var(--ease-out) both;
}

.dialogue-choice:nth-child(1) { animation-delay: 0.05s; }
.dialogue-choice:nth-child(2) { animation-delay: 0.1s; }
.dialogue-choice:nth-child(3) { animation-delay: 0.15s; }
.dialogue-choice:nth-child(4) { animation-delay: 0.2s; }

@keyframes choiceSlideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}


/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .dialogue-portrait {
    width: 56px;
    height: 56px;
  }

  .dialogue-box {
    padding: var(--space-md);
    min-height: 100px;
  }

  .hotspot {
    width: 56px;
    height: 56px;
  }
}


/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .dialogue-portrait {
    width: 48px;
    height: 48px;
    border-width: 1.5px;
  }

  .dialogue-box {
    padding: var(--space-sm) var(--space-md);
    min-height: 90px;
    gap: var(--space-sm);
  }

  .dialogue-speaker {
    font-size: var(--text-sm);
  }

  .dialogue-text {
    font-size: var(--text-sm);
  }

  .dialogue-advance {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .hotspot {
    width: 60px;
    height: 60px;
  }

  .dialogue-choice {
    padding: 0.55rem 0.8rem;
    font-size: var(--text-xs);
  }
}

/* ─── Visual Novel Character Sprite Overlay ─────────────────────── */
.scene-character-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  padding-bottom: 90px;
}

.vn-sprite {
  width: 260px;
  height: 380px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(212, 168, 83, 0.35);
  box-shadow: 
    0 15px 35px rgba(0, 0, 0, 0.6), 
    0 0 25px rgba(212, 168, 83, 0.15),
    inset 0 0 20px rgba(255, 255, 255, 0.05);
  transition: all 0.5s var(--ease-spring);
  animation: vnFloat 4s ease-in-out infinite;
  opacity: 0;
  transform: translateY(40px) scale(0.9);
  margin: 0 15px;
}

.vn-sprite::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, transparent 25%, rgba(10, 14, 23, 0.4) 65%, rgba(10, 14, 23, 0.85) 100%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.5s ease;
}

.vn-sprite img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.5s var(--ease-out);
}

.vn-sprite.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.vn-sprite.dimmed {
  opacity: 0.35;
  filter: grayscale(80%) brightness(0.6) drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
  transform: scale(0.93) translateY(15px);
  border-color: rgba(212, 168, 83, 0.15);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

/* Character Nametag inside the Card */
.vn-sprite-nametag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 12px 14px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 14, 23, 0.85) 30%, rgba(10, 14, 23, 0.98) 100%);
  border-top: 1px solid rgba(212, 168, 83, 0.25);
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

.vn-sprite-name {
  font-size: var(--text-md);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.vn-sprite-title {
  font-size: var(--text-xxs);
  font-weight: 500;
  color: var(--gold-dim);
  margin-top: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  opacity: 0.9;
  line-height: 1.2;
}

@keyframes vnFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@media (max-width: 768px) {
  .scene-character-overlay {
    padding-bottom: 70px;
  }
  .vn-sprite {
    width: 170px;
    height: 250px;
    margin: 0 8px;
    border-radius: 14px;
  }
  .vn-sprite img {
    height: 100%;
    width: 100%;
  }
  .vn-sprite-name {
    font-size: var(--text-xs);
  }
  .vn-sprite-title {
    font-size: 9px;
  }
}

/* Hide hotspots for pure story-driven mode */
.hotspot {
  display: none !important;
}

/* Audio Toggle Button in HUD */
.audio-toggle-btn {
  background: rgba(212, 168, 83, 0.1);
  border: 1px solid rgba(212, 168, 83, 0.3);
  color: var(--gold-light);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 15px;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  box-shadow: 0 0 10px rgba(212, 168, 83, 0.1);
  outline: none;
}

.audio-toggle-btn:hover {
  background: rgba(212, 168, 83, 0.25);
  border-color: var(--gold);
  transform: scale(1.08);
  box-shadow: 0 0 15px rgba(212, 168, 83, 0.3);
}

.audio-toggle-btn.muted {
  color: #7f8c8d;
  border-color: rgba(127, 140, 141, 0.3);
  background: rgba(127, 140, 141, 0.05);
}

/* Screen Shake Animation */
.screen-shake {
  animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

@keyframes screenShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* Red Screen Flash Overlay */
.screen-flash-red {
  position: absolute;
  inset: 0;
  background: rgba(231, 76, 60, 0.45);
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 10;
  animation: flashFade 0.4s ease-out forwards;
}

/* Green Screen Flash Overlay */
.screen-flash-green {
  position: absolute;
  inset: 0;
  background: rgba(46, 204, 113, 0.4);
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 10;
  animation: flashFade 0.4s ease-out forwards;
}

@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Speech Speed pill-shape styling */
#btn-speech-speed {
  border-radius: 16px !important;
  width: auto !important;
  padding: 0 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 10px;
}

/* Dancer Ghost FX */
.vn-sprite.ghost {
  filter: invert(0.8) sepia(1) saturate(3) hue-rotate(90deg) brightness(0.9) drop-shadow(0 0 15px rgba(0, 255, 100, 0.6));
  animation: vnFloat 3s ease-in-out infinite, ghostFlicker 1.5s infinite alternate !important;
  opacity: 0.85;
  border-color: rgba(46, 204, 113, 0.7);
  box-shadow: 0 0 30px rgba(46, 204, 113, 0.4), inset 0 0 15px rgba(46, 204, 113, 0.2);
}

@keyframes ghostFlicker {
  0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% {
    opacity: 0.85;
    filter: invert(0.8) sepia(1) saturate(3) hue-rotate(90deg) brightness(0.9) drop-shadow(0 0 15px rgba(0, 255, 100, 0.6));
  }
  20%, 21.999%, 63%, 63.999%, 65%, 69.999% {
    opacity: 0.15;
    filter: invert(0.8) sepia(1) saturate(1) hue-rotate(90deg) brightness(0.4) drop-shadow(0 0 2px rgba(0, 255, 100, 0.1));
  }
}

/* Nurse Jen SVG Overlay */
.vn-sprite[data-char-id="jen"]::before,
.dialogue-portrait[data-char-id="jen"]::before {
  content: '';
  position: absolute;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50"><path d="M 10 40 L 25 15 Q 50 5 75 15 L 90 40 Q 50 30 10 40 Z" fill="white" stroke="%23dddddd" stroke-width="1"/><rect x="46" y="17" width="8" height="14" fill="%23e74c3c"/><rect x="43" y="20" width="14" height="8" fill="%23e74c3c"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 5;
}

.vn-sprite[data-char-id="jen"]::before {
  top: 35px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 40px;
}

.dialogue-portrait[data-char-id="jen"]::before {
  top: -5px;
  left: 50%;
  transform: translateX(-50%) scale(0.65);
  width: 50px;
  height: 30px;
}

/* Crimson Text Overlay (Spooky Horror Event) */
.crimson-text-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 7;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease-in-out;
}

.crimson-text-overlay.active {
  opacity: 1;
  pointer-events: none;
}

.crimson-text-content {
  font-family: 'Playfair Display', 'IBM Plex Sans Thai', serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: #ff2222;
  text-align: center;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.8), 0 0 40px rgba(255, 0, 0, 0.5);
  animation: bloodDrip 3s infinite alternate, textPulse 2s infinite alternate;
  letter-spacing: 2px;
}

@keyframes bloodDrip {
  0% { transform: translateY(0); }
  100% { transform: translateY(5px); }
}

@keyframes textPulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.05); opacity: 1; }
}

