/* Stage Container - Optimized for Desktop Laptop Widescreen (16:9 / 16:10) */
.stage-container {
  position: fixed;
  inset: 0;
  background-color: #050508;
  overflow: hidden;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chapter Emotional Mood Lighting */
.mood-ambient-glow {
  position: absolute;
  inset: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle at center, rgba(212, 163, 115, 0.12) 0%, transparent 65%);
  pointer-events: none !important;
  z-index: 3;
  transition: background 2.5s ease-in-out;
}

/* Atmospheric Warm Light Leak */
.cinematic-light-leak {
  position: absolute;
  inset: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(ellipse at 85% 15%, rgba(230, 213, 195, 0.22) 0%, rgba(212, 163, 115, 0.08) 35%, transparent 70%);
  mix-blend-mode: screen;
  pointer-events: none !important;
  z-index: 7;
  opacity: 0;
  transform: scale(0.96) rotate(-2deg);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinematic-light-leak.flare-burst {
  opacity: 1;
  transform: scale(1.04) rotate(0deg);
}

/* Garis Pendar Cahaya Lensa Horizontal Lembut */
.cinematic-flare-streak {
  position: absolute;
  bottom: calc(100% - 4px);
  left: 50%;
  width: 75%;
  max-width: 680px;
  height: 3px;
  background: radial-gradient(ellipse at center, rgba(230, 213, 195, 0.75) 0%, rgba(212, 163, 115, 0.35) 45%, transparent 80%);
  filter: blur(2px);
  mix-blend-mode: screen;
  pointer-events: none !important;
  z-index: 4;
  opacity: 0;
  transform: translateX(-50%) scaleX(0.3);
  transition: opacity 0.6s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinematic-flare-streak.active {
  opacity: 0.9;
  transform: translateX(-50%) scaleX(1);
}

/* Film Grain Texture */
.film-grain {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  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.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none !important;
  opacity: 0.55;
  animation: grainJitter 8s steps(10) infinite;
  z-index: 5;
}

@keyframes grainJitter {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2%, 2%); }
  40% { transform: translate(2%, -2%); }
  60% { transform: translate(-1%, -1%); }
  80% { transform: translate(1%, 1%); }
}

.cinematic-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 40%, rgba(4, 4, 6, 0.94) 100%);
  pointer-events: none !important;
  z-index: 4;
}

/* Pelindung Kontras Teks Sinematik */
.cinematic-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(4, 4, 6, 0.85) 0%,
    rgba(4, 4, 6, 0.15) 20%,
    rgba(4, 4, 6, 0.35) 60%,
    rgba(4, 4, 6, 0.88) 85%,
    rgba(4, 4, 6, 0.96) 100%
  );
  pointer-events: none !important;
  z-index: 4;
}

/* Floating Gold Sparks Canvas */
.particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  z-index: 6;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.particles-canvas.active {
  opacity: 1;
}

/* ========================================================================== */
/* CINEMATIC MEDIA VIEWPORT (FULL VERTICAL TOP-TO-BOTTOM PRESENTATION)        */
/* ========================================================================== */
.media-viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* 1. Latar Belakang Foto Blur */
.media-backdrop {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  filter: blur(22px) brightness(0.42) saturate(1.15);
  transform: scale(1.06);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
  transition: opacity 1.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.media-backdrop.active {
  opacity: 1;
}

/* 2. Latar Belakang Video Blur */
.video-backdrop {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  filter: blur(22px) brightness(0.42) saturate(1.15);
  transform: scale(1.06);
  z-index: 1;
  opacity: 0;
  display: none;
  pointer-events: none;
  will-change: opacity;
  transition: opacity 1.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.video-backdrop.active {
  display: block !important;
  opacity: 1 !important;
}

/* 3. Wrapper Frame Media Utama */
.media-frame-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}

/* Layer Foto Utama */
.media-layer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100vh;
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 45px rgba(0, 0, 0, 0.95)) contrast(1.03) brightness(0.98);
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: opacity 1.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.media-layer.incoming {
  z-index: 3;
  opacity: 1;
}

.media-layer.active {
  z-index: 2;
  opacity: 1;
}

.media-layer.outgoing {
  z-index: 1;
  opacity: 0;
}

.media-layer.standby {
  z-index: 0;
  opacity: 0;
}

/* Video Player Utama */
.cinematic-video-player {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100vh;
  max-height: 100vh;
  width: auto;
  max-width: 100vw;
  object-fit: contain;
  opacity: 0;
  display: none;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 0 45px rgba(0, 0, 0, 0.95)) contrast(1.03) brightness(0.98);
  border-radius: 0;
  will-change: opacity;
  transition: opacity 1.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.cinematic-video-player.active {
  display: block !important;
  opacity: 1 !important;
}

/* Camera Animations */
.anim-ken-burns {
  animation: kenBurnsZoom 20s ease-in-out infinite alternate;
}

@keyframes kenBurnsZoom {
  0% { transform: translateX(-50%) scale(1); }
  100% { transform: translateX(-50%) scale(1.05); }
}

.anim-zoom-out {
  animation: zoomOutAnim 20s ease-in-out infinite alternate;
}

@keyframes zoomOutAnim {
  0% { transform: translateX(-50%) scale(1.05); }
  100% { transform: translateX(-50%) scale(1); }
}

.anim-pan-left {
  animation: panLeft 22s linear infinite alternate;
}

@keyframes panLeft {
  0% { transform: translateX(-49.5%) scale(1.03); }
  100% { transform: translateX(-50.5%) scale(1.03); }
}

.anim-pan-right {
  animation: panRight 22s linear infinite alternate;
}

@keyframes panRight {
  0% { transform: translateX(-50.5%) scale(1.03); }
  100% { transform: translateX(-49.5%) scale(1.03); }
}

.anim-parallax {
  animation: parallaxDrift 18s ease-in-out infinite alternate;
}

@keyframes parallaxDrift {
  0% { transform: translateX(-50%) scale(1.02); }
  100% { transform: translateX(-50%) scale(1.04); }
}

.anim-blur-focus {
  animation: blurToFocus 2.2s ease-out forwards;
}

@keyframes blurToFocus {
  0% { filter: blur(10px) brightness(1.06); transform: translateX(-50%) scale(1.03); }
  100% { filter: blur(0px) brightness(1); transform: translateX(-50%) scale(1); }
}

/* ========================================================================== */
/* DYNAMIC CHAPTER HEADER                                                     */
/* ========================================================================== */
.cinematic-top-header {
  position: absolute;
  left: 50%;
  width: 90%;
  max-width: 920px;
  text-align: center;
  z-index: 15;
  pointer-events: none;
  transition: top 2.4s cubic-bezier(0.22, 1, 0.36, 1), 
              transform 2.4s cubic-bezier(0.22, 1, 0.36, 1), 
              opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.cinematic-top-header.scale-enter {
  top: 50%;
  transform: translate(-50%, -50%) scale(0.68);
  opacity: 0;
}

.cinematic-top-header.in-center {
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.cinematic-top-header.in-center .chapter-badge {
  font-size: 1.15rem;
  letter-spacing: 9px;
  margin-bottom: 16px;
}

.cinematic-top-header.in-center .chapter-title {
  font-size: 3.8rem;
  letter-spacing: 3px;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.98), 0 0 32px rgba(212, 163, 115, 0.45);
}

.cinematic-top-header.at-top {
  top: 44px;
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

.cinematic-top-header.at-top .chapter-badge {
  font-size: 0.9rem;
  letter-spacing: 6px;
  margin-bottom: 8px;
}

.cinematic-top-header.at-top .chapter-title {
  font-size: 2.6rem;
  letter-spacing: 1.5px;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.95);
}

.chapter-badge {
  font-family: var(--font-cinematic);
  color: var(--accent-champagne);
  text-transform: uppercase;
  transition: font-size 2s cubic-bezier(0.22, 1, 0.36, 1), letter-spacing 2s cubic-bezier(0.22, 1, 0.36, 1);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}

.chapter-title {
  font-family: var(--font-serif);
  font-weight: 400;
  color: #ffffff;
  transition: font-size 2s cubic-bezier(0.22, 1, 0.36, 1), letter-spacing 2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ========================================================================== */
/* CENTER STAGE & TYPEWRITER NARRATION                                        */
/* ========================================================================== */
.cinematic-center-stage {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 960px;
  text-align: center;
  z-index: 10;
  pointer-events: none;
  padding: 16px 24px;
}

/* Kapsul Gelombang Suara Mikro Murni */
.voice-indicator {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) scale(0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 16px;
  background: rgba(18, 16, 20, 0.75);
  border: 1px solid rgba(212, 163, 115, 0.35);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 16px rgba(212, 163, 115, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  z-index: 5;
}

.voice-indicator.active {
  transform: translateX(-50%) scale(1) !important;
  opacity: 1 !important;
}

/* 4 Bilah Gelombang Suara Mikro */
.voice-wave {
  width: 3.5px;
  height: 8px;
  background: linear-gradient(to top, var(--accent-champagne), var(--accent-gold));
  border-radius: 3px;
  animation: microWavePulse 1.1s infinite ease-in-out;
}
.voice-wave:nth-child(1) { height: 7px; animation-delay: 0.1s; }
.voice-wave:nth-child(2) { height: 16px; animation-delay: 0.35s; }
.voice-wave:nth-child(3) { height: 11px; animation-delay: 0.2s; }
.voice-wave:nth-child(4) { height: 18px; animation-delay: 0.45s; }

@keyframes microWavePulse {
  0%, 100% { transform: scaleY(0.4); opacity: 0.6; }
  50% { transform: scaleY(1.35); opacity: 1; }
}

/* Teks Narasi */
.story-text {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  line-height: 1.75;
  color: #fdfdfd;
  font-style: italic;
  min-height: 80px;
  text-shadow: 0 4px 32px rgba(0, 0, 0, 0.98), 0 2px 14px rgba(0, 0, 0, 0.95), 0 0 20px rgba(230, 213, 195, 0.25);
  transition: opacity 0.4s ease;
  position: relative;
  z-index: 2;
}

.typewriter-cursor {
  display: inline-block;
  width: 3px;
  height: 1.35em;
  background-color: var(--accent-champagne);
  margin-left: 6px;
  vertical-align: middle;
  box-shadow: 0 0 12px rgba(212, 163, 115, 0.95);
  animation: cursorBlink 0.8s infinite ease-in-out;
}

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

.letter-desk-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 44px;
  background: rgba(18, 16, 20, 0.85);
  border: 1px solid rgba(212, 163, 115, 0.25);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  text-align: left;
}

.letter-flow-lines {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 2.1;
  color: var(--accent-gold);
  font-style: italic;
  white-space: pre-wrap;
}

/* ========================================================================== */
/* TOMBOL NAVIGASI LANGSUNG ANTAR BAB (HANYA ICON BULAT TRANSPARAN & ELEGAN)  */
/* ========================================================================== */
.chapter-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  z-index: 55;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0.35;
  transition: opacity 0.35s ease, background 0.35s ease, border-color 0.35s ease, transform 0.25s ease, color 0.35s ease;
  pointer-events: auto;
}

.chapter-nav-btn.nav-prev {
  left: 20px;
}

.chapter-nav-btn.nav-next {
  right: 20px;
}

/* Hilangkan teks hint sepenuhnya */
.chapter-nav-hint {
  display: none !important;
}

.chapter-nav-btn:hover {
  opacity: 0.95;
  background: rgba(18, 18, 24, 0.7);
  border-color: rgba(212, 163, 115, 0.4);
  color: var(--accent-gold);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65), 0 0 16px rgba(212, 163, 115, 0.2);
}

/* ========================================================================== */
/* ULTRA-SUBTLE GHOST CONTROLS                                                */
/* ========================================================================== */
.top-left-access {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cinematic-controls {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 60;
  display: flex;
  gap: 12px;
}

.glass-btn-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.18;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.35s ease, background 0.35s ease, transform 0.25s ease, border-color 0.35s ease;
  pointer-events: auto;
}

.glass-btn-icon:hover,
.glass-btn-icon:focus-visible,
.glass-btn-icon:active {
  opacity: 0.95;
  background: rgba(18, 18, 24, 0.65);
  border-color: rgba(212, 163, 115, 0.3);
  color: #fff;
  transform: scale(1.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.glass-btn-pill {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: rgba(18, 18, 24, 0.6);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  pointer-events: auto;
}

.tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 25%;
  z-index: 8;
  cursor: pointer;
}
.zone-left { left: 0; }
.zone-right { right: 0; }

.gate-screen {
  position: fixed;
  inset: 0;
  background: #060608;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
  transition: opacity 1.4s cubic-bezier(0.16, 1, 0.3, 1), transform 1.4s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.gate-screen.active {
  opacity: 1 !important;
  transform: scale(1) !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.gate-screen.hiding {
  opacity: 0 !important;
  transform: scale(1.06) !important;
  pointer-events: none !important;
}

.gate-content {
  position: relative;
  z-index: 10000;
  text-align: center;
  max-width: 680px;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.gate-screen.hiding .gate-content {
  opacity: 0;
  transform: scale(0.96);
}

.gate-pretitle {
  font-family: var(--font-serif);
  color: var(--accent-rose);
  font-style: italic;
  font-size: 1.4rem;
  pointer-events: none;
}

.gate-title {
  font-family: var(--font-cinematic);
  font-size: 4.8rem;
  letter-spacing: 12px;
  color: var(--accent-gold);
  margin: 18px 0;
  pointer-events: none;
}

.gate-subtitle {
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.9;
  color: var(--text-secondary);
  font-size: 1.15rem;
  margin-bottom: 44px;
  pointer-events: none;
}

.gate-action-wrapper {
  position: relative;
  z-index: 10001;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  pointer-events: auto !important;
}

#btn-start-story {
  position: relative;
  z-index: 10002;
  pointer-events: auto !important;
  cursor: pointer !important;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 840px) {
  .chapter-nav-btn { display: none; }
  .gate-title { font-size: 3rem; letter-spacing: 6px; }
  .cinematic-top-header.in-center .chapter-title { font-size: 2.4rem; }
  .cinematic-top-header.at-top .chapter-title { font-size: 1.8rem; }
  .story-text { font-size: 1.35rem; }
  .cinematic-top-header.at-top { top: 28px; }
  .cinematic-center-stage { bottom: 36px; padding: 12px 16px; }
  .letter-desk-container { padding: 24px; }
  .letter-flow-lines { font-size: 1.1rem; }
}