/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink: #f472b6;
  --purple: #a855f7;
  --gold: #fbbf24;
  --teal: #2dd4bf;
  --cream: #fdf6e3;
  --deep: #0d0626;
  --mid: #1a0d3d;
  --soft-glow: 0 0 30px rgba(244, 114, 182, 0.4);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--deep);
  font-family: "Georgia", "Times New Roman", serif;
  cursor: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ============================================================
   CUSTOM CURSOR + SPARKLE TRAIL
   ============================================================ */
#cursor {
  position: fixed;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  transition: transform 0.05s;
}

#cursor.click {
  transform: translate(-50%, -50%) scale(2.5);
}

.trail-dot {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: trail-die 0.6s ease-out forwards;
}

@keyframes trail-die {
  0% {
    opacity: 0.8;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) translateY(-15px);
  }
}

/* ============================================================
   SCREENS SYSTEM
   ============================================================ */
.screen {
  position: fixed;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.8s ease;
  overflow: hidden;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  z-index: 20;
}

/* ============================================================
   PROGRESS HUD
   ============================================================ */
#hud {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 6, 38, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(244, 114, 182, 0.4);
  border-radius: 999px;
  padding: 8px 20px;
  color: white;
  font-size: 13px;
  letter-spacing: 0.05em;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

#hud.visible {
  display: flex;
}

#hud-gems {
  display: flex;
  gap: 5px;
}

.gem {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.4s ease;
}

.gem.found {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

#hud-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

/* ============================================================
   FLOATING MESSAGE BOX
   ============================================================ */
#msg-box {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(13, 6, 38, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(244, 114, 182, 0.5);
  border-radius: 20px;
  padding: 20px 28px;
  max-width: min(380px, 90vw);
  width: 100%;
  text-align: center;
  color: white;
  font-size: 15px;
  line-height: 1.7;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: pre-line;
  box-shadow: 0 8px 40px rgba(168, 85, 247, 0.3);
}

#msg-box.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}

#msg-box::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 21px;
  background: linear-gradient(
    135deg,
    rgba(244, 114, 182, 0.3),
    rgba(168, 85, 247, 0.3),
    transparent
  );
  z-index: -1;
}

#msg-close {
  display: block;
  margin: 14px auto 0;
  padding: 6px 20px;
  background: rgba(244, 114, 182, 0.2);
  border: 1px solid rgba(244, 114, 182, 0.5);
  border-radius: 999px;
  color: var(--pink);
  font-size: 13px;
  cursor: pointer;
  cursor: none;
  letter-spacing: 0.05em;
  transition: background 0.2s;
}

#msg-close:hover {
  background: rgba(244, 114, 182, 0.35);
}

#msg-actions {
  display: none;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

#msg-actions.show {
  display: flex;
}

.msg-action-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(244, 114, 182, 0.45);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
  cursor: none;
  font-size: 13px;
  letter-spacing: 0.04em;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.msg-action-btn:hover {
  transform: translateY(-1px);
  background: rgba(244, 114, 182, 0.18);
  border-color: rgba(244, 114, 182, 0.65);
}

.msg-action-btn.primary {
  background: linear-gradient(
    135deg,
    rgba(244, 114, 182, 0.28),
    rgba(168, 85, 247, 0.3)
  );
  border-color: rgba(244, 114, 182, 0.7);
}

/* ============================================================
   SCENE NAV ARROW
   ============================================================ */
.nav-arrow {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: rgba(244, 114, 182, 0.15);
  border: 1px solid rgba(244, 114, 182, 0.5);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--pink);
  font-size: 22px;
  cursor: pointer;
  cursor: none;
  z-index: 900;
  animation: pulse-border 2s ease-in-out infinite;
  transition: background 0.2s;
}

.nav-arrow:hover {
  background: rgba(244, 114, 182, 0.3);
}

.nav-arrow.visible {
  display: flex;
}

@keyframes pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(244, 114, 182, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(244, 114, 182, 0);
  }
}

/* ============================================================
   MUSIC TOGGLE
   ============================================================ */
#music-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  background: rgba(13, 6, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  cursor: none;
  z-index: 1001;
  transition: background 0.2s;
  color: white;
}

#music-btn:hover {
  background: rgba(168, 85, 247, 0.3);
}

/* ============================================================
   HOTSPOT GLOW (invisible but interactive)
   ============================================================ */
.hotspot {
  position: absolute;
  cursor: pointer;
  cursor: none;
  border-radius: 50%;
  transition: filter 0.3s;
}

.hotspot:hover {
  filter: brightness(1.4) drop-shadow(0 0 12px rgba(251, 191, 36, 0.8));
  animation: hotspot-wiggle 0.4s ease-in-out;
}

@keyframes hotspot-wiggle {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.hotspot.found-clue {
  filter: brightness(0.7) saturate(0.5);
  pointer-events: none;
}

/* ============================================================
   ╔════════════════════╗
   ║   SCREEN 1: INTRO  ║
   ╚════════════════════╝
   ============================================================ */
#screen-intro {
  background: radial-gradient(ellipse at 50% 60%, #2a0a5e 0%, #0d0626 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0;
}

/* Star field */
.star-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.s-star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: s-twinkle var(--dur) ease-in-out infinite var(--del);
}

@keyframes s-twinkle {
  0%,
  100% {
    opacity: var(--op);
    transform: scale(1);
  }

  50% {
    opacity: 0.1;
    transform: scale(0.5);
  }
}

/* Floating particles */
.intro-particle {
  position: absolute;
  border-radius: 50%;
  animation: float-up var(--dur2) ease-in-out infinite var(--del2);
  opacity: 0.6;
}

@keyframes float-up {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }

  20% {
    opacity: 0.6;
  }

  100% {
    transform: translateY(-100vh) rotate(360deg);
    opacity: 0;
  }
}

.intro-title {
  position: relative;
  z-index: 10;
  font-size: clamp(26px, 5vw, 48px);
  color: white;
  font-weight: normal;
  line-height: 1.4;
  text-shadow: 0 0 40px rgba(244, 114, 182, 0.8);
  animation: title-glow 3s ease-in-out infinite;
  padding: 0 2rem;
}

.intro-title .name-highlight {
  color: var(--pink);
  display: inline-block;
  animation: name-bounce 2s ease-in-out infinite;
}

@keyframes name-bounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes title-glow {
  0%,
  100% {
    text-shadow: 0 0 40px rgba(244, 114, 182, 0.5);
  }

  50% {
    text-shadow:
      0 0 60px rgba(168, 85, 247, 0.8),
      0 0 100px rgba(244, 114, 182, 0.4);
  }
}

.intro-subtitle {
  position: relative;
  z-index: 10;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.6);
  font-size: clamp(13px, 2.5vw, 17px);
  letter-spacing: 0.08em;
  font-style: italic;
}

.intro-btn {
  position: relative;
  z-index: 10;
  margin-top: 48px;
  padding: 16px 48px;
  background: linear-gradient(135deg, #f472b6, #a855f7);
  border: none;
  border-radius: 999px;
  color: white;
  font-size: 16px;
  letter-spacing: 0.1em;
  cursor: pointer;
  cursor: none;
  font-family: inherit;
  animation: btn-pulse 2.5s ease-in-out infinite;
  box-shadow: 0 4px 30px rgba(244, 114, 182, 0.5);
  transition: transform 0.15s;
}

.intro-btn:hover {
  transform: scale(1.06);
}

@keyframes btn-pulse {
  0%,
  100% {
    box-shadow: 0 4px 30px rgba(244, 114, 182, 0.4);
  }

  50% {
    box-shadow:
      0 4px 60px rgba(244, 114, 182, 0.8),
      0 0 80px rgba(168, 85, 247, 0.4);
  }
}

.gift-emoji {
  position: relative;
  z-index: 10;
  font-size: clamp(60px, 10vw, 90px);
  margin-bottom: 28px;
  display: inline-block;
  animation: gift-float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.6));
}

@keyframes gift-float {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }

  50% {
    transform: translateY(-15px) rotate(3deg);
  }
}

/* ============================================================
   ╔═══════════════════════════════╗
   ║  SCREEN 2: WORLD 1 — DREAM SKY  ║
   ╚═══════════════════════════════╝
   ============================================================ */
#screen-world1 {
  background: linear-gradient(
    180deg,
    #0a0520 0%,
    #15073a 30%,
    #1e0d4a 55%,
    #2d1468 70%,
    #3d2080 85%,
    #4a3090 100%
  );
}

/* Mountains silhouette */
.mountain {
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
}

/* Aurora */
.aurora {
  position: absolute;
  width: 200%;
  left: -50%;
  height: 200px;
  top: 15%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(45, 212, 191, 0.08),
    rgba(168, 85, 247, 0.12),
    rgba(244, 114, 182, 0.08),
    transparent
  );
  animation: aurora-move 8s ease-in-out infinite alternate;
  border-radius: 50%;
}

@keyframes aurora-move {
  0% {
    transform: translateX(0) scaleY(1);
    opacity: 0.6;
  }

  100% {
    transform: translateX(-10%) scaleY(1.3);
    opacity: 1;
  }
}

/* Moon */
#w1-moon {
  position: absolute;
  width: clamp(70px, 12vw, 110px);
  height: clamp(70px, 12vw, 110px);
  background: radial-gradient(circle at 35% 35%, #fef9c3, #fbbf24 40%, #f59e0b);
  border-radius: 50%;
  top: 8%;
  right: 12%;
  box-shadow:
    0 0 40px rgba(251, 191, 36, 0.6),
    0 0 80px rgba(251, 191, 36, 0.2);
  animation: moon-glow 4s ease-in-out infinite;
  cursor: pointer;
  cursor: none;
}

@keyframes moon-glow {
  0%,
  100% {
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.6);
  }

  50% {
    box-shadow:
      0 0 70px rgba(251, 191, 36, 0.9),
      0 0 120px rgba(251, 191, 36, 0.3);
  }
}

#w1-moon .moon-crater {
  position: absolute;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 50%;
}

/* Cloud SVGs */
.cloud-svg {
  position: absolute;
  animation: cloud-drift var(--cd) ease-in-out infinite alternate;
  cursor: pointer;
  cursor: none;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
  transition: filter 0.3s;
}

.cloud-svg:hover {
  filter: drop-shadow(0 0 20px rgba(244, 114, 182, 0.8));
}

@keyframes cloud-drift {
  0% {
    transform: translateX(0) translateY(0);
  }

  100% {
    transform: translateX(var(--cx, 20px)) translateY(var(--cy, 8px));
  }
}

/* Animated stars (decorative + clickable) */
.w1-star {
  position: absolute;
  font-size: var(--sz, 20px);
  cursor: pointer;
  cursor: none;
  animation: star-twinkle var(--std, 2s) ease-in-out infinite var(--stddel, 0s);
  transition:
    filter 0.2s,
    transform 0.2s;
  line-height: 1;
}

.w1-star:hover {
  filter: drop-shadow(0 0 15px var(--gold)) brightness(1.5);
  transform: scale(1.4);
}

@keyframes star-twinkle {
  0%,
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }

  50% {
    opacity: 0.3;
    transform: scale(0.7) rotate(20deg);
  }
}

/* Shooting star */
#shooting-star {
  position: absolute;
  top: 18%;
  left: -10%;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, white, transparent);
  border-radius: 999px;
  animation: shoot 15s linear infinite 2s;
  cursor: pointer;
  cursor: none;
}

@keyframes shoot {
  0% {
    left: -20%;
    top: 15%;
    opacity: 0;
    transform: rotate(-30deg);
  }

  10% {
    opacity: 1;
  }

  100% {
    left: 110%;
    top: 35%;
    opacity: 0;
  }
}

/* World label */
.world-label {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  z-index: 5;
}

/* ============================================================
   ╔═══════════════════════════════╗
   ║  SCREEN 3: WORLD 2 — COZY CAFE  ║
   ╚═══════════════════════════════╝
   ============================================================ */
#screen-world2 {
  background: linear-gradient(180deg, #1a0a02 0%, #2d1200 40%, #1a0a02 100%);
}

/* Cafe warm overlay */
.cafe-warmth {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 30%,
    rgba(251, 146, 60, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
}

/* Cafe window light */
.window-light {
  position: absolute;
  background: linear-gradient(
    180deg,
    rgba(254, 215, 170, 0.3) 0%,
    rgba(251, 146, 60, 0.15) 60%,
    transparent 100%
  );
  animation: flicker 5s ease-in-out infinite;
}

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

  45% {
    opacity: 0.85;
  }

  47% {
    opacity: 1;
  }

  60% {
    opacity: 0.9;
  }
}

/* Rain on window */
.rain-drop {
  position: absolute;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(180, 220, 255, 0.6),
    transparent
  );
  animation: rain-fall var(--rd) linear infinite var(--rdel);
}

@keyframes rain-fall {
  0% {
    transform: translateY(-30px);
    opacity: 0;
  }

  10% {
    opacity: 0.6;
  }

  90% {
    opacity: 0.4;
  }

  100% {
    transform: translateY(200px);
    opacity: 0;
  }
}

/* Coffee steam */
.steam {
  position: absolute;
  width: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
  animation: steam-rise var(--sr) ease-in-out infinite var(--srdel);
  filter: blur(1px);
}

@keyframes steam-rise {
  0% {
    transform: translateY(0) scaleX(1);
    opacity: 0;
  }

  20% {
    opacity: 0.6;
  }

  60% {
    transform: translateY(-40px) scaleX(1.5) translateX(5px);
  }

  100% {
    transform: translateY(-70px) scaleX(0.5) translateX(-3px);
    opacity: 0;
  }
}

/* Fairy lights */
.fairy-light {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: light-glow var(--flg) ease-in-out infinite var(--flgdel);
}

@keyframes light-glow {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.4);
    box-shadow: 0 0 10px currentColor;
  }
}

/* ============================================================
   ╔═══════════════════════════════╗
   ║  SCREEN 4: WORLD 3 — THE ROOM   ║
   ╚═══════════════════════════════╝
   ============================================================ */
#screen-world3 {
  background: linear-gradient(180deg, #0a0210 0%, #140520 40%, #0a0210 100%);
}

/* Room floor */
.room-floor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(180deg, #1c0a2e 0%, #0e0518 100%);
  border-top: 1px solid rgba(168, 85, 247, 0.2);
}

/* Room wall pattern */
.wall-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 35%;
  overflow: hidden;
}

/* THE LOCKED GIFT BOX */
#gift-box {
  position: absolute;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(90px, 15vw, 130px);
  height: clamp(90px, 15vw, 130px);
  cursor: pointer;
  cursor: none;
  z-index: 10;
  transition:
    filter 0.5s,
    transform 0.3s;
}

#gift-box.locked {
  filter: grayscale(0.7) brightness(0.6);
}

#gift-box.unlocked {
  filter: drop-shadow(0 0 25px var(--gold))
    drop-shadow(0 0 50px rgba(251, 191, 36, 0.4));
  animation: gift-ready 2s ease-in-out infinite;
}

@keyframes gift-ready {
  0%,
  100% {
    transform: translateX(-50%) scale(1) rotate(-2deg);
  }

  50% {
    transform: translateX(-50%) scale(1.06) rotate(2deg);
  }
}

.gift-lock-msg {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  white-space: nowrap;
  letter-spacing: 0.1em;
  transition: opacity 0.5s;
}

/* ============================================================
   ╔════════════════════════╗
   ║  SCREEN 5: FINAL GIFT   ║
   ╚════════════════════════╝
   ============================================================ */
#screen-final {
  background: radial-gradient(ellipse at 50% 40%, #2a0a5e 0%, #0d0626 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

#screen-final.active {
  display: flex;
}

.final-ribbon {
  font-size: clamp(60px, 12vw, 100px);
  margin-bottom: 12px;
  animation: ribbon-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: scale(0);
  opacity: 0;
  display: inline-block;
}

@keyframes ribbon-pop {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.final-msg {
  max-width: 480px;
  color: white;
  font-size: clamp(15px, 2.5vw, 19px);
  line-height: 1.8;
  white-space: pre-line;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s ease 0.5s;
  padding: 0 1rem;
}

.final-msg.show {
  opacity: 1;
  transform: translateY(0);
}

.final-stars {
  font-size: 24px;
  margin-top: 20px;
  opacity: 0;
  transition: opacity 0.8s ease 1.2s;
  letter-spacing: 6px;
}

.final-stars.show {
  opacity: 1;
}

.replay-btn {
  margin-top: 32px;
  padding: 10px 30px;
  background: transparent;
  border: 1px solid rgba(244, 114, 182, 0.5);
  border-radius: 999px;
  color: rgba(244, 114, 182, 0.8);
  font-size: 13px;
  cursor: pointer;
  cursor: none;
  font-family: inherit;
  letter-spacing: 0.1em;
  opacity: 0;
  transition:
    opacity 0.5s ease 2s,
    background 0.2s;
}

.replay-btn.show {
  opacity: 1;
}

.replay-btn:hover {
  background: rgba(244, 114, 182, 0.1);
}

/* ============================================================
   CONFETTI
   ============================================================ */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 8000;
  animation: confetti-fall var(--cf-dur) ease-in var(--cf-del) forwards;
  border-radius: var(--cf-r, 0);
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20px) rotate(0deg) translateX(0);
    opacity: 1;
  }

  100% {
    transform: translateY(110vh) rotate(var(--cf-rot)) translateX(var(--cf-x));
    opacity: 0;
  }
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 600px) {
  #msg-box {
    font-size: 14px;
    padding: 16px 20px;
  }

  .nav-arrow {
    bottom: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
  }
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden {
  display: none !important;
}

.clue-flash {
  animation: clue-flash-anim 0.3s ease-in-out 3;
}

@keyframes clue-flash-anim {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(3) drop-shadow(0 0 20px var(--gold));
  }
}
