/* ============================================================
   BIRTHDAY SURPRISE — Optimized, mobile-first stylesheet
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #ffd700;
  --gold-light: #ffed4e;
  --purple: #a78bfa;
  --purple-deep: #7c3aed;
  --teal: #06b6d4;
  --pink: #f472b6;
  --dark-1: #0a0a1e;
  --dark-2: #1a103d;
  --dark-3: #2d1b5c;
  --vh: 1vh; /* JS-set for iOS Safari address-bar workaround */
}

html, body {
  height: 100%;
  min-height: 100%;
  font-family: 'Poppins', sans-serif;
  color: #fff;
  background: radial-gradient(ellipse at center, #1a103d 0%, #0a0a1e 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeSpeed;
  touch-action: manipulation;
}

button, input { font-family: inherit; }

img { display: block; max-width: 100%; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1s !important;
  }
}

/* Low-end tweaks */
html.low-end #cursorCanvas { display: none; }
html.low-end .story-card,
html.low-end #giftInput,
html.low-end .mini-btn,
html.low-end .journey-btn,
html.low-end .sound-toggle,
html.low-end .audio-toggle,
html.low-end .audio-menu,
html.low-end .skip-btn,
html.low-end .chapter-menu,
html.low-end .chapter-menu-btn {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.low-end .card-icon,
html.low-end .finale-emojis span,
html.low-end .balloon,
html.low-end .p-ring,
html.low-end .portal-glow,
html.low-end .orb-inner { animation-duration: 6s !important; }
html.low-end .cake-3d { animation-duration: 40s !important; }
html.low-end .reveal-name,
html.low-end .finale-name,
html.low-end .scene-title,
html.low-end .gold-shine { animation-duration: 12s !important; }

/* Background canvases */
#three-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#cursorCanvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; }

/* ============ LOADER ============ */
#loader {
  position: fixed; inset: 0;
  background: radial-gradient(circle at center, #1a103d 0%, #0a0a1e 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 10000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-orb { position: relative; width: 100px; height: 100px; }
.orb-inner {
  position: absolute; inset: 25%; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd700, #a78bfa);
  box-shadow: 0 0 60px #a78bfa, 0 0 100px #ffd700;
  animation: orbPulse 2s ease-in-out infinite;
}
@keyframes orbPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: #ffd700; }
.orb-ring.r1 { animation: spinRev 3s linear infinite; }
.orb-ring.r2 { inset: 10%; border-top-color: #a78bfa; animation: spinRev 2s linear infinite reverse; }
.orb-ring.r3 { inset: 20%; border-top-color: #06b6d4; animation: spinRev 1.5s linear infinite; }
@keyframes spinRev { to { transform: rotate(360deg); } }
.loader-text { margin-top: 28px; font-family: 'Playfair Display', serif; font-style: italic; font-size: 1.1rem; color: rgba(255,255,255,0.7); letter-spacing: 2px; text-align: center; padding: 0 20px; }
.loader-bar { width: 240px; max-width: 80vw; height: 2px; background: rgba(255,255,255,0.08); margin-top: 24px; border-radius: 10px; overflow: hidden; }
.loader-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd700, #a78bfa, #06b6d4); box-shadow: 0 0 20px #a78bfa; transition: width 0.15s ease; }
.loader-percent { margin-top: 12px; font-size: 0.75rem; letter-spacing: 4px; color: rgba(255,255,255,0.4); }

/* ============ SCENES ============ */
#sceneContainer { position: relative; width: 100%; height: 100%; }

.scene {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1;
  opacity: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 80px 20px 120px;
}
.scene.active { display: block; opacity: 1; }
.scene-content {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-height: calc(100vh - 200px);
  min-height: calc(var(--vh, 1vh) * 100 - 200px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.center-content { align-items: center; text-align: center; }

/* ============ OPENING TITLES ============ */
.opening-text { display: flex; flex-direction: column; gap: 18px; margin-bottom: 30px; }
.opening-text .line-small {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.8rem);
  color: rgba(255,255,255,0.7); letter-spacing: 3px;
  opacity: 0; animation: fadeUp 1.2s ease 0.3s forwards;
}
.opening-text .line-big {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: clamp(2rem, 7vw, 5.5rem);
  color: #fff; letter-spacing: 2px; line-height: 1.1;
  opacity: 0; animation: fadeUp 1.2s ease 0.8s forwards;
  text-shadow: 0 0 60px rgba(255,255,255,0.3);
}
.gold-shine {
  background: linear-gradient(90deg, #ffd700 0%, #fff 25%, #a78bfa 50%, #ffd700 75%, #fff 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeUp 1.2s ease 0.8s forwards, shine 6s linear infinite;
}
@keyframes shine { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.poetic-line {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(1rem, 2vw, 1.4rem);
  color: rgba(255,215,0,0.9); margin-top: 15px;
  opacity: 0; animation: fadeUp 1.2s ease 1.5s forwards; letter-spacing: 1px;
}
.scroll-hint {
  display: inline-flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 30px; opacity: 0; animation: fadeUp 1.2s ease 2s forwards;
  color: rgba(255,255,255,0.4); font-size: 0.72rem; letter-spacing: 2px;
}
.scroll-dot { width: 22px; height: 36px; border: 1.5px solid rgba(255,255,255,0.4); border-radius: 20px; position: relative; }
.scroll-dot::after {
  content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 6px; background: #ffd700; border-radius: 2px; animation: scrollDot 2s infinite;
}
@keyframes scrollDot { 0% { top: 8px; opacity: 1; } 100% { top: 22px; opacity: 0; } }

/* ============ JOURNEY BUTTON ============ */
.journey-btn {
  margin: 30px auto 0;
  padding: 16px 36px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem; font-weight: 500;
  letter-spacing: 3px; text-transform: uppercase;
  color: #fff; background: transparent;
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 60px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  position: relative; overflow: hidden;
  opacity: 0; animation: fadeUp 1.2s ease 2s forwards;
  transition: all 0.5s cubic-bezier(0.16,1,0.3,1);
  -webkit-tap-highlight-color: transparent;
  align-self: center;
}
.journey-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, #a78bfa, #ffd700, #06b6d4);
  background-size: 200% 100%; opacity: 0;
  transition: opacity 0.4s; z-index: -1;
  animation: shine 3s linear infinite;
}
.journey-btn:hover, .journey-btn:focus-visible {
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 20px 50px rgba(167,139,250,0.5);
  letter-spacing: 4px;
  outline: none;
}
.journey-btn:hover::before, .journey-btn:focus-visible::before { opacity: 1; }
.journey-btn svg { width: 18px; height: 18px; }
.journey-btn.hidden { display: none; }
.journey-btn.restart-btn { animation-delay: 2.5s; }

/* ============ SCENE TITLES ============ */
.scene-title {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: clamp(1.8rem, 4.5vw, 3.5rem);
  text-align: center; margin-bottom: 12px;
  background: linear-gradient(90deg, #fff 0%, #ffd700 50%, #a78bfa 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 6s linear infinite;
  letter-spacing: 1px;
}
.scene-sub {
  text-align: center;
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: rgba(255,255,255,0.7);
  margin: 0 auto 30px;
  letter-spacing: 1px;
  max-width: 700px;
  padding: 0 10px;
}

/* ============ SCENE 3: PORTAL REVEAL ============ */
.portal-container {
  position: relative;
  width: min(500px, 85vw);
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.portal-glow {
  position: absolute; inset: 30%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, rgba(167,139,250,0.2) 40%, transparent 70%);
  filter: blur(30px);
  animation: portalGlow 4s ease-in-out infinite;
}
@keyframes portalGlow { 0%,100% { opacity: 0.6; transform: scale(1); } 50% { opacity: 1; transform: scale(1.15); } }
.portal-rings { position: absolute; inset: 0; }
.p-ring {
  position: absolute; border-radius: 50%; border: 2px solid transparent;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
}
.p-ring.ring-a { width: 100%; height: 100%; border-top-color: #ffd700; border-right-color: #a78bfa; animation: portalSpin 20s linear infinite; box-shadow: 0 0 40px rgba(255,215,0,0.4); }
.p-ring.ring-b { width: 80%; height: 80%; border-top-color: #06b6d4; border-left-color: #f472b6; animation: portalSpin 15s linear infinite reverse; box-shadow: 0 0 30px rgba(6,182,212,0.4); }
.p-ring.ring-c { width: 60%; height: 60%; border-bottom-color: #a78bfa; border-right-color: #ffd700; animation: portalSpin 12s linear infinite; box-shadow: 0 0 25px rgba(167,139,250,0.4); }
.p-ring.ring-d { width: 45%; height: 45%; border-top-color: rgba(255,255,255,0.6); border-bottom-color: #ffd700; animation: portalSpin 8s linear infinite reverse; }
@keyframes portalSpin { to { transform: translate(-50%,-50%) rotate(360deg); } }
.portal-content { position: relative; z-index: 3; text-align: center; padding: 20px; }
.reveal-tag {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(1rem, 2vw, 1.5rem);
  color: rgba(255,255,255,0.8); letter-spacing: 4px; margin-bottom: 12px;
  opacity: 0; animation: fadeUp 0.8s ease 0.3s forwards;
}
.reveal-name {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: clamp(3rem, 12vw, 8rem);
  background: linear-gradient(45deg, #ffd700 0%, #fff 30%, #a78bfa 60%, #ffd700 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 4s linear infinite, fadeUp 1s ease 0.6s forwards;
  filter: drop-shadow(0 0 40px rgba(255,215,0,0.6));
  line-height: 1; letter-spacing: -1px; opacity: 0;
}
.reveal-sub {
  margin-top: 16px;
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(0.9rem, 1.8vw, 1.2rem);
  color: rgba(255,255,255,0.9); letter-spacing: 2px;
  opacity: 0; animation: fadeUp 0.8s ease 1.2s forwards;
}

/* ============ SCENE 4: STORY CARDS ============ */
.story-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 30px 0 20px;
  width: 100%;
}
.story-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 100%);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.5s cubic-bezier(0.16,1,0.3,1), box-shadow 0.5s, border-color 0.5s;
  overflow: hidden;
  opacity: 0;
  transform: translateY(40px);
}
.story-card.in-view { opacity: 1; transform: translateY(0); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16,1,0.3,1); }
.card-glow {
  position: absolute; inset: -50%;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(255,215,0,0.15), transparent 40%);
  opacity: 0; transition: opacity 0.4s; pointer-events: none;
}
.story-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(255,215,0,0.5);
  box-shadow: 0 25px 60px rgba(167,139,250,0.35), 0 0 30px rgba(255,215,0,0.15);
}
.story-card:hover .card-glow { opacity: 1; }
.card-icon {
  font-size: 3rem; margin-bottom: 16px;
  display: inline-block;
  filter: drop-shadow(0 0 20px rgba(255,215,0,0.5));
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(5deg); } }
.story-card h3 {
  font-family: 'Playfair Display', serif; font-weight: 600;
  font-size: 1.35rem;
  color: #ffd700; margin-bottom: 12px; letter-spacing: 1px;
}
.story-card p {
  font-size: 0.92rem; color: rgba(255,255,255,0.75);
  line-height: 1.7; font-weight: 300;
}

/* ============ SCENE 5: CAKE ============ */
.mic-btn-wrap { margin-bottom: 20px; text-align: center; }
.mini-btn {
  padding: 12px 24px; border-radius: 40px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem; letter-spacing: 1px;
  transition: all 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.mini-btn:hover {
  background: linear-gradient(90deg, rgba(255,215,0,0.3), rgba(167,139,250,0.3));
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(167,139,250,0.3);
}
.mini-btn.listening {
  background: linear-gradient(90deg, rgba(255,20,147,0.5), rgba(167,139,250,0.5));
  animation: micPulse 1s infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,20,147,0.6); }
  50% { box-shadow: 0 0 0 20px rgba(255,20,147,0); }
}
.cake-stage { perspective: 1400px; margin: 20px auto; display: flex; justify-content: center; }
.cake-3d {
  position: relative;
  width: 340px; height: 400px;
  transform-style: preserve-3d;
  animation: cakeRotate 25s linear infinite;
}
@keyframes cakeRotate { from { transform: rotateY(0) rotateX(-10deg); } to { transform: rotateY(360deg) rotateX(-10deg); } }
.cake-plate {
  position: absolute; bottom: 0; left: -40px;
  width: 420px; height: 45px;
  background: radial-gradient(ellipse at center, #f8f8f8 0%, #999 70%, #444 100%);
  border-radius: 50%; box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}
.cake-shadow {
  position: absolute; bottom: -25px; left: -10px;
  width: 360px; height: 35px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.7), transparent);
  filter: blur(20px); border-radius: 50%;
}
.tier {
  position: absolute; left: 50%;
  transform: translateX(-50%);
  border-radius: 15px 15px 10px 10px;
  box-shadow: inset 0 -20px 40px rgba(0,0,0,0.25), 0 8px 20px rgba(0,0,0,0.4);
}
.tier-bot { bottom: 35px; width: 340px; height: 110px; background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 60%, #4c1d95 100%); }
.tier-mid { bottom: 135px; width: 260px; height: 95px; background: linear-gradient(180deg, #a78bfa 0%, #8b5cf6 60%, #7c3aed 100%); }
.tier-top { bottom: 220px; width: 190px; height: 80px; background: linear-gradient(180deg, #fff 0%, #f0e6ff 50%, #d4b3ff 100%); z-index: 2; }
.drips {
  position: absolute; top: 100%; left: 0; width: 100%; height: 28px;
  background:
    radial-gradient(circle at 10% 0%, #ffd700 8%, transparent 8%),
    radial-gradient(circle at 28% 0%, #ffd700 6%, transparent 6%),
    radial-gradient(circle at 45% 0%, #ffd700 10%, transparent 10%),
    radial-gradient(circle at 62% 0%, #ffd700 7%, transparent 7%),
    radial-gradient(circle at 78% 0%, #ffd700 9%, transparent 9%),
    radial-gradient(circle at 92% 0%, #ffd700 6%, transparent 6%);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.2));
}
.frosting-top {
  position: absolute; top: -8px; left: 5%; width: 90%; height: 14px;
  background: linear-gradient(180deg, #fff 0%, #ffd700 100%);
  border-radius: 12px; box-shadow: 0 5px 12px rgba(0,0,0,0.2);
}
.cherry {
  position: absolute; top: -28px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 22px;
  background: radial-gradient(circle at 30% 30%, #ff4d4d, #a00000);
  border-radius: 50%; z-index: 3;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset -3px -3px 6px rgba(0,0,0,0.3);
}
.cherry::before {
  content: ''; position: absolute; top: -10px; left: 8px;
  width: 2px; height: 12px; background: #2d5016; transform: rotate(15deg);
}
.sprinkles { position: absolute; inset: 0; pointer-events: none; }
.sprinkles span { position: absolute; width: 3px; height: 8px; border-radius: 2px; transform: rotate(30deg); }
.sprinkles span:nth-child(1) { top: 20%; left: 20%; background: #ffd700; }
.sprinkles span:nth-child(2) { top: 40%; left: 70%; background: #06b6d4; transform: rotate(-45deg); }
.sprinkles span:nth-child(3) { top: 60%; left: 30%; background: #f472b6; }
.sprinkles span:nth-child(4) { top: 30%; left: 60%; background: #43e97b; transform: rotate(60deg); }
.sprinkles span:nth-child(5) { top: 55%; left: 45%; background: #a78bfa; }
.sprinkles span:nth-child(6) { top: 45%; left: 15%; background: #ffd700; transform: rotate(-30deg); }
.candle-3d {
  position: absolute; bottom: 295px;
  width: 14px; height: 60px;
  background: repeating-linear-gradient(180deg, #ffd700 0px, #ffd700 8px, #fff 8px, #fff 16px);
  border-radius: 3px; z-index: 5; cursor: pointer;
  transition: transform 0.3s;
  box-shadow: 2px 0 5px rgba(0,0,0,0.3);
}
.candle-3d:hover { transform: scale(1.15); filter: brightness(1.2); }
.candle-3d:nth-child(1) { left: 105px; }
.candle-3d:nth-child(2) { left: 135px; }
.candle-3d:nth-child(3) { left: 165px; }
.candle-3d:nth-child(4) { left: 195px; }
.candle-3d:nth-child(5) { left: 225px; }
.wick { position: absolute; top: -5px; left: 50%; transform: translateX(-50%); width: 2px; height: 6px; background: #333; }
.flame-3d {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 28px;
  border-radius: 50% 50% 20% 20%;
  background: radial-gradient(ellipse at 50% 70%, #fff 0%, #ffeb3b 20%, #ff9800 60%, #ff5722 100%);
  box-shadow: 0 0 25px #ff9800, 0 0 50px #ffeb3b, 0 0 80px rgba(255,152,0,0.6);
  animation: flameFlicker 0.15s infinite alternate;
  transform-origin: bottom;
}
.flame-inner {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 14px;
  background: radial-gradient(ellipse, #fff 0%, #a8e0ff 60%, transparent 100%);
  border-radius: 50%; opacity: 0.8;
}
@keyframes flameFlicker {
  0% { transform: translateX(-50%) scale(1) rotate(-3deg); }
  100% { transform: translateX(-50%) scale(1.1) rotate(3deg); }
}
.candle-3d[data-lit="false"] .flame-3d { display: none; }
.smoke {
  position: absolute; top: -32px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 45px;
  background: radial-gradient(circle, rgba(200,200,220,0.7), transparent);
  border-radius: 50%;
  animation: smokeUp 2s ease-out forwards;
  pointer-events: none;
}
@keyframes smokeUp {
  0% { transform: translate(-50%, 0) scale(1); opacity: 0.8; }
  100% { transform: translate(-50%, -100px) scale(2.5); opacity: 0; }
}
.age-badge {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: 1.6rem; color: #7c3aed;
  text-shadow: 0 2px 4px rgba(255,215,0,0.6);
  z-index: 4; pointer-events: none; letter-spacing: 1px;
}

/* ============ SCENE 6: BALLOONS ============ */
.balloon-sky {
  position: relative; width: 100%;
  height: 55vh; min-height: 380px; max-height: 500px;
  overflow: hidden; margin: 15px 0;
}
.balloon {
  position: absolute;
  width: 80px; height: 100px;
  border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
  cursor: pointer;
  animation: balloonFloat 6s ease-in-out infinite;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
  filter: drop-shadow(0 15px 25px rgba(0,0,0,0.4));
  -webkit-tap-highlight-color: transparent;
}
.balloon::before {
  content: ''; position: absolute; bottom: -8px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: inherit;
}
.balloon::after {
  content: ''; position: absolute; bottom: -105px; left: 50%;
  width: 1.5px; height: 105px;
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.1));
}
.balloon:hover { transform: scale(1.15) translateY(-15px); filter: drop-shadow(0 20px 30px rgba(255,215,0,0.6)); }
.balloon.popped { animation: balloonPop 0.18s ease-out forwards; pointer-events: none; will-change: transform, opacity; }
@keyframes balloonPop {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(0); opacity: 0; }
}
@keyframes balloonFloat { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-25px) rotate(3deg); } }
.floating-message {
  min-height: 90px; text-align: center;
  font-family: 'Playfair Display', serif; font-weight: 600; font-style: italic;
  font-size: clamp(1.15rem, 3vw, 2.4rem);
  color: #fff; text-shadow: 0 0 30px rgba(255,215,0,0.8);
  margin: 15px 0; padding: 15px;
  opacity: 0; transition: opacity 0.5s;
}
.floating-message.show { opacity: 1; animation: floatMsg 3s cubic-bezier(0.16,1,0.3,1); }
@keyframes floatMsg {
  0% { transform: translateY(20px) scale(0.8); filter: blur(15px); }
  50% { transform: translateY(-5px) scale(1.03); filter: blur(0); }
  100% { transform: translateY(0) scale(1); filter: blur(0); }
}

/* ============ SCENE 7: PHOTO GALLERY ============ */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 30px auto 20px;
  max-width: 1100px;
  width: 100%;
  min-height: 180px;
}
.photo-tile {
  position: relative; aspect-ratio: 1 / 1;
  border-radius: 18px; overflow: hidden; cursor: pointer;
  box-shadow: 0 20px 45px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,215,0,0.25);
  opacity: 0; transform: translateY(20px) scale(0.94);
  animation: photoIn 0.6s cubic-bezier(0.16,1,0.3,1) forwards;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1), box-shadow 0.4s, border-color 0.4s;
  -webkit-tap-highlight-color: transparent;
}
@keyframes photoIn { to { opacity: 1; transform: translateY(0) scale(1); } }
.photo-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16,1,0.3,1), filter 0.4s;
  filter: saturate(1.05);
}
.photo-tile::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.35) 100%);
  pointer-events: none; opacity: 0.6; transition: opacity 0.4s;
}
.photo-tile:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: rgba(255,215,0,0.7);
  box-shadow: 0 25px 55px rgba(255,215,0,0.22), 0 0 30px rgba(167,139,250,0.3);
}
.photo-tile:hover img { transform: scale(1.08); filter: saturate(1.15) brightness(1.05); }
.photo-tile:hover::after { opacity: 0.2; }
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 50px 20px;
  background: linear-gradient(135deg, rgba(255,215,0,0.05), rgba(167,139,250,0.05));
  border: 2px dashed rgba(255,215,0,0.3);
  border-radius: 18px;
  color: rgba(255,255,255,0.75);
  font-family: 'Cormorant Garamond', serif; font-style: italic;
}
.gallery-empty .empty-icon { font-size: 3.5rem; margin-bottom: 10px; animation: bob 4s ease-in-out infinite; }
.gallery-empty p { font-size: 1.1rem; margin: 6px 0; }
.gallery-empty .empty-hint { font-size: 0.9rem; opacity: 0.7; }
.gallery-empty code { background: rgba(255,215,0,0.15); padding: 2px 8px; border-radius: 6px; font-family: monospace; color: #ffd700; font-size: 0.85em; }

/* ============ LIGHTBOX ============ */
.photo-lightbox {
  position: fixed; inset: 0; z-index: 9997;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
}
.photo-lightbox.active { opacity: 1; pointer-events: auto; }
.lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(6,4,25,0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.lightbox-img {
  position: relative;
  max-width: 92vw; max-height: 85vh;
  border-radius: 14px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.8), 0 0 60px rgba(255,215,0,0.15);
  border: 2px solid rgba(255,215,0,0.4);
  z-index: 2;
  animation: lbZoom 0.4s cubic-bezier(0.16,1,0.3,1);
}
@keyframes lbZoom { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lightbox-close, .lightbox-nav {
  position: absolute;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,215,0,0.4);
  color: #fff; border-radius: 50%; cursor: pointer;
  z-index: 3;
  transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-close { top: 20px; right: 20px; width: 44px; height: 44px; font-size: 1.6rem; }
.lightbox-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 2rem; }
.lightbox-nav.lb-prev { left: 15px; }
.lightbox-nav.lb-next { right: 15px; }
.lightbox-close:hover, .lightbox-nav:hover {
  background: linear-gradient(45deg, #ffd700, #a78bfa);
  box-shadow: 0 10px 30px rgba(167,139,250,0.5);
  transform: scale(1.1);
}
.lightbox-nav:hover { transform: translateY(-50%) scale(1.1); }

/* ============ WARP CANVAS ============ */
#warpCanvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 9996;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
#warpCanvas.active { opacity: 1; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(167,139,250,0.15));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,215,0,0.4);
  color: #fff;
  padding: 12px 22px;
  border-radius: 30px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem; letter-spacing: 0.5px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16,1,0.3,1);
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ SCENE 8: LETTER ============ */
.letter-paper {
  position: relative;
  max-width: 720px;
  margin: 30px auto;
  padding: 45px 40px;
  background: linear-gradient(135deg, #fff9ec 0%, #ffe9c9 100%);
  color: #3a2f1a;
  border-radius: 6px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6), inset 0 0 80px rgba(255,215,0,0.1);
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.05rem, 2.2vw, 1.6rem);
  line-height: 1.8;
  min-height: 300px;
  transform: rotate(-0.8deg);
  word-wrap: break-word;
}
.letter-paper::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 30px;
  background: repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(255,215,0,0.15) 8px, rgba(255,215,0,0.15) 16px);
}
.paper-fold {
  position: absolute; top: 0; right: 0; width: 45px; height: 45px;
  background: linear-gradient(135deg, transparent 50%, #ffd58a 50%);
  border-radius: 0 6px 0 6px;
  box-shadow: -2px 2px 5px rgba(0,0,0,0.15);
}
.type-cursor { animation: blink 0.7s infinite; color: #b8860b; font-weight: 700; }
@keyframes blink { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }

/* ============ SCENE 9: GIFT WISHLIST ============ */
.gift-form {
  display: flex; gap: 10px;
  max-width: 600px; margin: 20px auto;
  flex-wrap: wrap; justify-content: center;
  width: 100%; padding: 0 10px;
}
#giftInput {
  flex: 1; min-width: 200px;
  padding: 14px 22px;
  border-radius: 40px;
  border: 1.5px solid rgba(255,215,0,0.4);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s;
}
#giftInput:focus {
  border-color: #ffd700;
  box-shadow: 0 0 30px rgba(255,215,0,0.4);
  background: rgba(255,255,255,0.12);
}
#giftInput::placeholder { color: rgba(255,255,255,0.4); font-style: italic; }
.add-gift-btn {
  padding: 14px 28px;
  border-radius: 40px;
  border: none;
  background: linear-gradient(45deg, #ffd700, #ffa500);
  color: #2d1b5c;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  transition: all 0.3s;
  box-shadow: 0 8px 30px rgba(255,215,0,0.4);
  letter-spacing: 1px;
  -webkit-tap-highlight-color: transparent;
}
.add-gift-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 40px rgba(255,215,0,0.7); }
.gift-list {
  max-width: 700px; margin: 20px auto;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  width: 100%; padding: 0 10px;
}
.gift-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 30px;
  color: rgba(255,255,255,0.4);
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: 1.1rem;
}
.gift-item {
  background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(167,139,250,0.1));
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 18px;
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: all 0.4s cubic-bezier(0.16,1,0.3,1);
  opacity: 0; transform: translateY(15px) scale(0.9);
  animation: giftIn 0.5s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes giftIn { to { opacity: 1; transform: translateY(0) scale(1); } }
.gift-item:hover { transform: translateY(-4px); border-color: #ffd700; box-shadow: 0 12px 35px rgba(255,215,0,0.25); }
.gift-item .gift-icon { font-size: 1.6rem; flex-shrink: 0; }
.gift-item .gift-text { flex: 1; font-size: 0.95rem; font-weight: 500; color: #fff; word-break: break-word; }
.gift-item .gift-remove {
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 1.1rem;
  transition: all 0.3s;
  flex-shrink: 0;
}
.gift-item .gift-remove:hover { background: rgba(255,20,20,0.6); transform: scale(1.15); }
.gift-actions {
  display: flex; gap: 12px;
  justify-content: center; margin: 20px 0;
  flex-wrap: wrap; padding: 0 10px;
}

/* ============ SCENE 10: FINALE ============ */
#scene-10 { background: rgba(0,0,0,0.5); }
#fireworks-canvas { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.finale-content { position: relative; z-index: 2; }
.finale-emojis { display: flex; gap: 18px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.finale-emojis span {
  font-size: clamp(2rem, 5vw, 3.5rem);
  display: inline-block;
  animation: emojiBounce 2.5s cubic-bezier(0.68,-0.55,0.27,1.55) infinite;
  filter: drop-shadow(0 5px 15px rgba(255,215,0,0.5));
}
.finale-emojis span:nth-child(1) { animation-delay: 0s; }
.finale-emojis span:nth-child(2) { animation-delay: 0.2s; }
.finale-emojis span:nth-child(3) { animation-delay: 0.4s; }
.finale-emojis span:nth-child(4) { animation-delay: 0.6s; }
.finale-emojis span:nth-child(5) { animation-delay: 0.8s; }
@keyframes emojiBounce { 0%,100% { transform: translateY(0) scale(1) rotate(0); } 50% { transform: translateY(-20px) scale(1.2) rotate(12deg); } }
.finale-main {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: clamp(2.2rem, 8vw, 7rem);
  color: #fff;
  text-shadow: 0 0 60px rgba(255,255,255,0.6);
  letter-spacing: 2px; line-height: 1;
}
.finale-main sup { font-size: 0.5em; color: #ffd700; vertical-align: super; margin-left: 4px; }
.finale-name {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: clamp(2.8rem, 10vw, 8rem);
  background: linear-gradient(45deg, #ffd700, #fff, #a78bfa, #ffd700);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 3s linear infinite;
  filter: drop-shadow(0 0 50px rgba(255,215,0,0.9));
  margin: 12px 0 30px;
  line-height: 1; letter-spacing: -1px;
}
.finale-message {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.8;
  color: rgba(255,255,255,0.95);
  max-width: 700px; margin: 0 auto;
  letter-spacing: 1px;
  padding: 0 10px;
}
.finale-sub {
  margin-top: 18px;
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: clamp(0.95rem, 1.5vw, 1.2rem);
  color: #ffd700; letter-spacing: 2px;
  padding: 0 10px;
}
.finale-signature { margin-top: 30px; }
.finale-signature p {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  color: rgba(255,255,255,0.7); letter-spacing: 2px;
}
.finale-signature .signer {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  color: #ffd700; margin-top: 5px;
}
.finale-buttons {
  display: flex; gap: 16px; justify-content: center;
  flex-wrap: wrap; margin-top: 30px;
}

/* ============ UI OVERLAY ============ */
.ui-overlay {
  position: fixed;
  top: max(15px, env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  z-index: 500; text-align: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}
body.on-finale .ui-overlay { opacity: 0; transform: translateX(-50%) translateY(-30px); }
.progress-track { width: 180px; max-width: 60vw; height: 3px; background: rgba(255,255,255,0.12); border-radius: 10px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 10%;
  background: linear-gradient(90deg, #ffd700, #a78bfa, #06b6d4);
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 0 15px rgba(167,139,250,0.6);
}
.progress-label {
  margin-top: 6px; font-size: 0.65rem;
  letter-spacing: 3px; color: rgba(255,255,255,0.5);
  text-transform: uppercase;
}

/* ============ CONTROL BUTTONS (bottom) ============ */
.skip-btn, .chapter-menu-btn, .audio-toggle {
  position: fixed;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255,215,0,0.3);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 500;
  font-size: 1.3rem;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.skip-btn:hover, .chapter-menu-btn:hover, .audio-toggle:hover {
  background: linear-gradient(45deg, #ffd700, #a78bfa);
  border-color: transparent;
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(167,139,250,0.5);
}
.skip-btn:active, .chapter-menu-btn:active, .audio-toggle:active { transform: scale(0.95); }
.audio-panel { position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); right: 20px; z-index: 600; }
.audio-toggle { position: static; }
.skip-btn { bottom: max(20px, env(safe-area-inset-bottom)); right: 80px; }
.chapter-menu-btn { bottom: max(20px, env(safe-area-inset-bottom)); left: 20px; }
body.on-finale .skip-btn, body.on-finale .chapter-menu-btn { opacity: 0; pointer-events: none; }

/* ============ AUDIO MENU ============ */
.audio-menu {
  position: absolute;
  bottom: 60px; right: 0;
  width: 280px; max-width: calc(100vw - 40px);
  background: rgba(20, 10, 45, 0.9);
  backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 18px;
  padding: 14px;
  opacity: 0; transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 40px rgba(167,139,250,0.2);
}
.audio-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.audio-menu-title {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 0.95rem; color: #ffd700;
  padding: 4px 8px 10px;
  border-bottom: 1px solid rgba(255,215,0,0.2);
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.audio-row { padding: 8px; }
.audio-label {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.audio-name { font-size: 0.85rem; color: rgba(255,255,255,0.9); letter-spacing: 0.5px; }
.audio-btn-mini {
  background: rgba(255,215,0,0.18);
  border: 1px solid rgba(255,215,0,0.4);
  color: #ffd700;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s;
  -webkit-tap-highlight-color: transparent;
  font-weight: 600;
}
.audio-btn-mini[data-muted="true"] {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  border-color: rgba(255,255,255,0.15);
}
.audio-btn-mini:hover { transform: translateY(-1px); }
.audio-slider {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.15);
  outline: none;
  cursor: pointer;
}
.audio-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(45deg, #ffd700, #a78bfa);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,215,0,0.5);
  border: 0;
}
.audio-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(45deg, #ffd700, #a78bfa);
  cursor: pointer; border: 0;
  box-shadow: 0 2px 8px rgba(255,215,0,0.5);
}
.audio-hint {
  font-size: 0.7rem; color: rgba(255,255,255,0.4);
  text-align: center; padding: 8px 4px 2px;
  font-style: italic; letter-spacing: 0.5px;
}

/* ============ CHAPTER MENU ============ */
.chapter-menu {
  position: fixed;
  bottom: 80px; left: 20px;
  width: 280px; max-width: calc(100vw - 40px);
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(20, 10, 45, 0.9);
  backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 18px;
  padding: 10px;
  z-index: 600;
  opacity: 0; transform: translateY(15px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 40px rgba(167,139,250,0.2);
}
.chapter-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.chapter-menu-title {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 0.95rem; color: #ffd700;
  padding: 8px 12px 10px;
  border-bottom: 1px solid rgba(255,215,0,0.2);
  margin-bottom: 5px;
  letter-spacing: 1px;
}
.chapter-list { list-style: none; padding: 0; margin: 0; }
.chapter-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  transition: background 0.25s, color 0.25s, transform 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.chapter-item:hover { background: rgba(255,215,0,0.08); color: #fff; transform: translateX(3px); }
.chapter-item.active {
  background: linear-gradient(90deg, rgba(255,215,0,0.15), rgba(167,139,250,0.15));
  color: #ffd700; font-weight: 500;
}
.chapter-item .ch-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,215,0,0.15); color: #ffd700;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600;
  flex-shrink: 0;
  border: 1px solid rgba(255,215,0,0.3);
}
.chapter-item.active .ch-num {
  background: linear-gradient(45deg, #ffd700, #a78bfa);
  color: #2d1b5c; border-color: transparent;
  box-shadow: 0 4px 12px rgba(255,215,0,0.4);
}
.chapter-item .ch-name {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: 1rem; letter-spacing: 0.5px;
}
.chapter-menu::-webkit-scrollbar { width: 6px; }
.chapter-menu::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.3); border-radius: 4px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .scene { padding: 70px 16px 110px; }
  .cake-3d { transform: scale(0.85); transform-origin: center; }
}

@media (max-width: 700px) {
  .story-cards { grid-template-columns: 1fr; gap: 16px; }
  .letter-paper { padding: 35px 24px; }
  .journey-btn { padding: 14px 30px; font-size: 0.78rem; letter-spacing: 2px; }
  .cake-3d { transform: scale(0.75); }
  .balloon { width: 65px; height: 82px; }
  .gift-form { flex-direction: column; }
  #giftInput, .add-gift-btn { width: 100%; }
  .photo-gallery { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; font-size: 1.4rem; }
  .lightbox-nav { width: 42px; height: 42px; font-size: 1.7rem; }
  .lightbox-nav.lb-prev { left: 8px; }
  .lightbox-nav.lb-next { right: 8px; }
}

@media (max-width: 480px) {
  .scene { padding: 60px 12px 100px; }
  .scene-content { min-height: calc(100vh - 160px); min-height: calc(var(--vh, 1vh) * 100 - 160px); }
  .story-card { padding: 26px 20px; }
  .card-icon { font-size: 2.5rem; margin-bottom: 12px; }
  .story-card h3 { font-size: 1.2rem; }
  .cake-3d { transform: scale(0.65); margin-top: -30px; margin-bottom: -30px; }
  .cake-stage { min-height: 320px; }
  .balloon-sky { min-height: 320px; height: 60vh; }
  .balloon { width: 58px; height: 74px; }
  .balloon::after { bottom: -80px; height: 80px; }
  .letter-paper { padding: 28px 20px; margin: 20px auto; min-height: 240px; }
  .progress-track { width: 140px; }
  .progress-label { font-size: 0.6rem; letter-spacing: 2px; }
  .skip-btn, .chapter-menu-btn, .audio-toggle { width: 44px; height: 44px; font-size: 1.15rem; }
  .skip-btn { right: 72px; }
  .audio-menu { width: 260px; padding: 12px; }
  .chapter-menu { width: 260px; max-height: 55vh; }
  .journey-btn { padding: 13px 26px; font-size: 0.72rem; letter-spacing: 1.5px; }
  .finale-emojis { gap: 10px; margin-bottom: 18px; }
  .mini-btn { font-size: 0.78rem; padding: 10px 18px; }
}

@media (max-width: 380px) {
  .cake-3d { transform: scale(0.55); }
  .balloon { width: 52px; height: 66px; }
  .photo-gallery { grid-template-columns: repeat(2, 1fr); }
}

/* Landscape phones — keep cake visible */
@media (max-height: 600px) and (orientation: landscape) {
  .scene { padding: 60px 20px 90px; }
  .cake-3d { transform: scale(0.55); }
  .balloon-sky { min-height: 260px; height: 50vh; }
  .portal-container { width: min(320px, 50vh); }
  .opening-text .line-big { font-size: clamp(1.6rem, 5vw, 3rem); }
  .scene-content { justify-content: flex-start; }
}

