@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Spectral:ital,wght@0,400;1,400&display=swap');

/* ========== GLOBAL RESET ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: clamp(14px, 1.6vw, 18px);
}

body {
  background: #000;
  color: #fff;
  overflow: hidden;
  font-family: 'Cinzel', serif;
}

/* ========== SCENE CONTAINER ========== */
#scene-container {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

/* ========== BACKGROUND (16:9 fullscreen cinematic) ========== */
#scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease, transform 4s ease-in-out;
  z-index: 0;
}

/* Efek vignette lembut di pinggir */
#scene-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
              rgba(0,0,0,0) 70%,
              rgba(0,0,0,0.45) 100%);
  z-index: 1;
}


/* ========== CHARACTERS ========== */
#characters img {
  position: absolute;
  bottom: 10%;
  opacity: 0;
  z-index: 3;
  transition: opacity 1.2s ease, transform 1s ease, bottom 0.8s ease;
  width: clamp(140px, 25vw, 280px);
  height: auto;
}

#characters img.pixie {
  left: 50%;
  transform: translateX(-50%);
}

#characters img.pixie.left {
  left: 35%;
  transform: translateX(-50%);
}

#characters img.bitty.right {
  right: 35%;
  transform: translateX(50%);
}

/* ========== GLOW EFFECT ========== */
.glow-center {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(120px, 20vw, 250px);
  height: clamp(120px, 20vw, 250px);
  background: radial-gradient(circle,
              rgba(255,220,120,0.6) 0%,
              rgba(255,200,80,0.1) 70%,
              transparent 100%);
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0;
  animation: glowPulse 5s ease-in-out infinite;
  z-index: 2;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.1); }
}

/* ========== DIALOG BOX ========== */
.dialog-box {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.9);
  color: #222;
  border-radius: 16px;
  padding: 1rem 1.5rem;
  max-width: 80%;
  box-shadow: 0 0 25px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 1s ease, transform 0.8s ease;
  z-index: 4;
}

.dialog-box.show {
  opacity: 1;
  transform: translate(-50%, -8px);
}

.dialog-box p {
  font-family: 'Spectral', serif;
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.55;
  color: #222;
  text-align: center;
}

/* ========== TITLES ========== */
h1, h2, h3 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ========== NEXT & BACK BUTTONS ========== */
#next-btn, #back-btn {
  position: absolute;
  bottom: 4%;
  background: rgba(255,255,255,0.88);
  border: none;
  padding: 0.6rem 1.1rem;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  font-family: 'Cinzel', serif;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.6s ease, background 0.3s ease, transform 0.3s ease;
  color: #000;
  z-index: 5;
}

#next-btn { right: 5%; }
#back-btn { left: 5%; }

#next-btn:hover, #back-btn:hover {
  background: #ffe89d;
  transform: translateY(-2px);
}

/* ========== MUSIC TOGGLE BUTTON ========== */
#music-toggle {
  position: absolute;
  top: 3%;
  right: 2.5%;
  z-index: 10;
  font-size: 1.4rem;
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255,255,255,0.3);
  transition: all 0.4s ease;
  backdrop-filter: blur(4px);
}

#music-toggle:hover {
  transform: scale(1.1);
  background: rgba(255,255,255,0.95);
}

#music-toggle.active {
  background: rgba(255, 210, 60, 0.95);
  box-shadow: 0 0 20px rgba(255, 215, 80, 0.7);
  animation: musicGlow 2s ease-in-out infinite;
}

@keyframes musicGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 220, 100, 0.5); }
  50% { box-shadow: 0 0 24px rgba(255, 230, 150, 0.9); }
}

/* ========== SAFE ZONE UNTUK LAYAR PENDEK ========== */
@media (max-height: 720px) {
  .dialog-box {
    bottom: 18%;
    max-width: 90%;
    padding: 0.8rem 1.2rem;
  }
  .dialog-box p { font-size: 0.95rem; }
  #next-btn, #back-btn { bottom: 6%; }
}

@media (max-height: 600px) {
  .dialog-box { bottom: 20%; }
  #next-btn, #back-btn { bottom: 7%; }
}

/* ========== RESPONSIVE REFINEMENTS ========== */
@media (max-width: 768px) {
  .dialog-box {
    max-width: 90%;
    padding: 1rem;
    bottom: 12%;
  }

  .dialog-box p { font-size: clamp(0.9rem, 2vw, 1rem); }

  #characters img {
    bottom: 18%;
  }

  #characters img.pixie.left { left: 40%; bottom: 18%; }
  #characters img.bitty.right { right: 40%; bottom: 18%; }

  .glow-center { filter: blur(30px); }

  #next-btn, #back-btn {
    bottom: 3%;
    padding: 0.5rem 1rem;
  }

  #next-btn { right: 4%; }
  #back-btn { left: 4%; }

  #music-toggle {
    top: 4.5%;
    right: 4%;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .dialog-box {
    padding: 0.8rem 1rem;
    bottom: 16%;
  }
  .dialog-box p {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  #characters img {
    width: 150px;
    bottom: 22%;
  }

  #characters img.pixie.left {
    left: 42%;
    bottom: 22%;
  }

  #characters img.bitty.right {
    right: 42%;
    bottom: 22%;
  }

  #next-btn, #back-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

/* ===== Z-INDEX STRUCTURE FIX (setelah intro) ===== */
#scene-bg {
  z-index: 1 !important;  /* background utama */
}

#foreground-layer {
  z-index: 2 !important;  /* kabut / daun */
}

#characters {
  z-index: 3 !important;
}

.dialog-box {
  z-index: 4 !important;
}

#next-btn, #back-btn {
  z-index: 5 !important;
}

#music-toggle {
  z-index: 6 !important;
}

/* === SEMBUNYIKAN MUSIK SAAT INTRO === */
body.intro-active #music-toggle {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ===============================
   FLOATING GLASS MENU (RIGHT SIDE)
================================== */
#scene-menu {
  position: fixed;
  top: 50%;
  right: 2%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 16px 12px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
  z-index: 15;
  transition: all 0.3s ease;
}

/* ===============================
   VISIBILITY CONTROL FOR SCENE MENU
   (hide during intro, fade in after)
================================== */
#scene-menu {
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}

/* Menu aktif setelah intro */
body:not(.intro-active) #scene-menu {
  opacity: 1;
  pointer-events: auto;
}

/* Icon Style */
#scene-menu a {
  color: #ffffff;
  font-size: 1.4rem;
  opacity: 0.8;
  transition: all 0.3s ease;
}

#scene-menu a:hover {
  opacity: 1;
  transform: scale(1.2);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
               0 0 20px rgba(255, 255, 255, 0.6);
}

/* ===== Responsive refinements ===== */
@media (max-width: 768px) {
  #scene-menu {
    right: 3.5%;
    gap: 14px;
    padding: 12px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
  }

  #scene-menu a {
    font-size: 1.15rem;
  }
}

@media (max-width: 480px) {
  #scene-menu {
    right: 4%;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
  }

  #scene-menu a {
    font-size: 1rem;
  }
}
