/* ==========================================================================
   3D BIRTHDAY WISHES EXPERIENCE - LUXURY MODERN STYLESHEET
   ========================================================================== */

:root {
  --bg-dark: #070913;
  --bg-card: rgba(18, 22, 39, 0.72);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(255, 215, 0, 0.35);
  
  /* Primary Theme Accents (Luxury Gold default) */
  --accent-gold: #ffd700;
  --accent-gold-light: #fff3a8;
  --accent-gold-glow: rgba(255, 215, 0, 0.45);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.45);
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-gold: #fbbf24;
  
  --font-heading: 'Playfair Display', serif;
  --font-sans: 'Outfit', sans-serif;
  --font-handwriting: 'Caveat', 'Dancing Script', cursive;
  
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --blur-glass: blur(18px);
}

/* Theme variations */
body[data-theme="midnight-rose"] {
  --accent-gold: #fb7185;
  --accent-gold-light: #fecdd3;
  --accent-gold-glow: rgba(251, 113, 133, 0.5);
  --border-gold: rgba(251, 113, 133, 0.35);
}

body[data-theme="cosmic-violet"] {
  --accent-gold: #c084fc;
  --accent-gold-light: #f3e8ff;
  --accent-gold-glow: rgba(192, 132, 252, 0.5);
  --border-gold: rgba(192, 132, 252, 0.35);
}

body[data-theme="emerald-aurora"] {
  --accent-gold: #34d399;
  --accent-gold-light: #d1fae5;
  --accent-gold-glow: rgba(52, 211, 153, 0.5);
  --border-gold: rgba(52, 211, 153, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body, html {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  user-select: none;
}

/* Canvas 3D Viewport */
#webgl-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: auto;
  cursor: grab;
}

#webgl-canvas:active {
  cursor: grabbing;
}

/* Background Atmosphere Gradients */
.ambient-glow {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: 
    radial-gradient(circle at 15% 20%, rgba(168, 85, 247, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(244, 63, 94, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.05) 0%, transparent 60%);
}

/* Main UI Container */
.app-container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  pointer-events: none; /* Allows canvas clicks through open areas */
}

.interactive-ui {
  pointer-events: auto;
}

/* ==========================================================================
   TOP NAVIGATION & CONTROLS HUD
   ========================================================================== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  background: linear-gradient(180deg, rgba(7, 9, 19, 0.85) 0%, rgba(7, 9, 19, 0) 100%);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.1rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.sparkle-icon {
  font-size: 1.2rem;
  animation: pulse-spin 3s infinite linear;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #fff 0%, var(--accent-gold-light) 50%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 9999px;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  text-decoration: none;
}

.hud-btn:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px var(--accent-gold-glow);
  transform: translateY(-2px);
  color: #fff;
}

.hud-btn.primary-glow {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(244, 63, 94, 0.25) 100%);
  border-color: var(--accent-gold);
}

.hud-btn.primary-glow:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.4) 0%, rgba(244, 63, 94, 0.4) 100%);
}

/* Audio Visualizer Waves inside Audio Button */
.audio-waves {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 14px;
}

.audio-waves span {
  width: 3px;
  height: 4px;
  background: var(--accent-gold);
  border-radius: 3px;
  transition: height 0.2s ease;
}

.audio-playing .audio-waves span:nth-child(1) { animation: wave 1s infinite ease-in-out; }
.audio-playing .audio-waves span:nth-child(2) { animation: wave 1.2s infinite ease-in-out 0.2s; }
.audio-playing .audio-waves span:nth-child(3) { animation: wave 0.8s infinite ease-in-out 0.4s; }

@keyframes wave {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* ==========================================================================
   CHAPTER NAVIGATION TABS (FLOATING DOCK)
   ========================================================================== */
.chapter-dock-container {
  display: flex;
  justify-content: center;
  padding: 0.5rem 1rem;
  margin-top: auto;
  position: sticky;
  bottom: 1.5rem;
  z-index: 40;
}

.chapter-dock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  background: rgba(14, 18, 33, 0.85);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(255, 215, 0, 0.15);
  overflow-x: auto;
  max-width: 95vw;
}

.dock-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 9999px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.dock-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.dock-item.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(244, 63, 94, 0.2) 100%);
  border-color: var(--accent-gold);
  color: #fff;
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

/* ==========================================================================
   STORY CHAPTERS OVERLAY PANELS
   ========================================================================== */
.main-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-stage.ui-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(35px) scale(0.96);
  visibility: hidden !important;
}

.hero-top-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.peek-cake-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold-light);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.peek-cake-chip:hover {
  background: rgba(255, 215, 0, 0.3);
  transform: translateY(-1px);
}

.hud-btn.active-cinema {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.35) 0%, rgba(168, 85, 247, 0.35) 100%);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.5);
}

.chapter-view {
  display: none;
  position: relative;
  max-width: 860px;
  width: 100%;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.chapter-view.active-chapter {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* --------------------------------------------------
   CHAPTER 1: SURPRISE UNVEIL & MYSTERY BOX
   -------------------------------------------------- */
.hero-card {
  text-align: center;
  padding: 2.75rem 2rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-gold);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.12);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.sub-greeting {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #fff1a8 50%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
}

.hero-person-name {
  color: var(--accent-rose);
  -webkit-text-fill-color: var(--accent-rose);
  text-shadow: 0 0 25px var(--accent-rose-glow);
  font-style: italic;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 1rem auto 2rem;
  line-height: 1.6;
}

.milestone-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem 1.8rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-gold);
  border-radius: 9999px;
  margin-bottom: 2rem;
  font-size: 0.92rem;
  color: var(--text-gold);
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.cta-glow-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 2.2rem;
  background: linear-gradient(135deg, #ffd700 0%, #f59e0b 50%, #f43f5e 100%);
  color: #0b0d19;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(245, 158, 11, 0.4), 0 0 20px var(--accent-gold-glow);
  transition: var(--transition-smooth);
}

.cta-glow-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 40px rgba(245, 158, 11, 0.6), 0 0 35px var(--accent-gold-glow);
}

/* 3D Cinema Mode Utility */
.ui-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.4s ease, visibility 0.4s !important;
}

/* --------------------------------------------------
   CHAPTER 2: 3D CAKE & CANDLE BLOWING CEREMONY
   -------------------------------------------------- */
#view-cake {
  height: calc(100vh - 190px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 1.5rem;
  pointer-events: none;
}

.cake-panel {
  text-align: center;
  pointer-events: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cake-instructions-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.4rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-gold-glow);
  pointer-events: auto;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.flame-icon-animated {
  font-size: 1.25rem;
  animation: flicker 1.2s infinite alternate;
}

.cake-action-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  padding: 1.2rem 2rem;
  max-width: 520px;
  width: 90%;
  margin: 0 auto;
  pointer-events: auto;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.cake-action-card h3 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  color: var(--accent-gold-light);
}

.cake-action-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.blow-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 2rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
}

.blow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 35px rgba(99, 102, 241, 0.6);
}

.blow-btn.blown {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

/* --------------------------------------------------
   CHAPTER 3: 3D FLOATING POLAROID MEMORY GALLERY
   -------------------------------------------------- */
.polaroids-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
  perspective: 1200px;
}

.polaroid-card {
  background: #ffffff;
  color: #1e293b;
  padding: 0.9rem 0.9rem 1.4rem;
  border-radius: 8px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 3px 10px rgba(0, 0, 0, 0.3);
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  position: relative;
  cursor: pointer;
}

.polaroid-card:nth-child(1) { transform: rotate(-3deg); }
.polaroid-card:nth-child(2) { transform: rotate(2deg) translateY(-8px); }
.polaroid-card:nth-child(3) { transform: rotate(-2deg); }

.polaroid-card:hover {
  transform: translateY(-16px) rotate(0deg) scale(1.05);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 30px var(--accent-gold-glow);
  z-index: 20;
}

.polaroid-card.flipped {
  transform: rotateY(180deg) translateY(-10px);
}

.polaroid-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.polaroid-pin {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #ffd700 0%, #b45309 100%);
  border-radius: 50%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.polaroid-front, .polaroid-back {
  backface-visibility: hidden;
  border-radius: 4px;
}

.polaroid-photo-wrapper {
  width: 100%;
  height: 230px;
  overflow: hidden;
  border-radius: 4px;
  background: #e2e8f0;
}

.polaroid-photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.polaroid-card:hover .polaroid-photo-wrapper img {
  transform: scale(1.06);
}

.polaroid-caption {
  font-family: var(--font-handwriting);
  font-size: 1.4rem;
  color: #1e293b;
  margin-top: 0.9rem;
  text-align: center;
  line-height: 1.2;
}

.polaroid-flip-hint {
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Polaroid Back Side (Secret Note) */
.polaroid-back {
  position: absolute;
  inset: 0;
  background: #fefce8;
  padding: 1.5rem 1.2rem;
  border-radius: 6px;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px dashed #f59e0b;
}

.polaroid-back-note {
  font-family: var(--font-handwriting);
  font-size: 1.35rem;
  color: #78350f;
  line-height: 1.45;
}

/* --------------------------------------------------
   CHAPTER 4: THE GOLDEN WAX-SEALED LETTER
   -------------------------------------------------- */
.letter-parchment {
  background: linear-gradient(135deg, #1b2038 0%, #111425 100%);
  border: 1px solid var(--border-gold);
  border-radius: 28px;
  padding: 3rem 2.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(255, 215, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.wax-seal {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, #ef4444 0%, #991b1b 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 15px rgba(185, 28, 28, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  position: absolute;
  top: 1.8rem;
  right: 2rem;
  font-size: 1.6rem;
}

.letter-header {
  margin-bottom: 1.8rem;
}

.letter-salutation {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  color: var(--accent-gold);
  margin-bottom: 0.25rem;
}

.letter-body {
  font-size: 1.15rem;
  line-height: 1.8;
  color: #e2e8f0;
  margin-bottom: 2rem;
  font-style: italic;
}

.special-reasons-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin: 1.8rem 0;
}

.reason-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  color: var(--text-gold);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: var(--transition-smooth);
}

.reason-chip:hover {
  background: rgba(255, 215, 0, 0.12);
  transform: translateX(4px);
}

.letter-signature {
  text-align: right;
  margin-top: 1.5rem;
}

.signature-prefix {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.signature-name {
  font-family: var(--font-handwriting);
  font-size: 2.2rem;
  color: var(--accent-gold);
  line-height: 1.1;
}

/* --------------------------------------------------
   CHAPTER 5: GRAND FIREWORKS & CELEBRATION SHOW
   -------------------------------------------------- */
.celebrate-grand-card {
  text-align: center;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-gold);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.interactive-sparks-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.8rem 0;
}

.spark-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.6rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.spark-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-gold-glow);
}

/* Floating Reactions */
.floating-heart {
  position: fixed;
  font-size: 1.8rem;
  pointer-events: none;
  animation: float-up-fade 2.4s ease-out forwards;
  z-index: 1000;
}

@keyframes float-up-fade {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.6) rotate(0deg);
  }
  50% {
    transform: translateY(-120px) scale(1.2) rotate(15deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-240px) scale(1.4) rotate(-15deg);
  }
}

/* ==========================================================================
   MODAL: CUSTOMIZE / CREATE WISH STUDIO
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.82);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
}

.modal-backdrop.modal-open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #111528;
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.25rem 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px var(--accent-gold-glow);
  position: relative;
  transform: scale(0.94);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.modal-open .modal-card {
  transform: scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  background: var(--accent-rose);
  color: #fff;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-gold);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
  background: rgba(255, 255, 255, 0.08);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.theme-selector-chips {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.theme-chip {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.84rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.theme-chip.selected {
  border-color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.2);
  color: #fff;
}

.share-result-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid #10b981;
  border-radius: 16px;
  padding: 1.25rem;
  margin-top: 1.5rem;
  display: none;
}

.share-link-input-group {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

/* Toast Alert Notification */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: #1e293b;
  border: 1px solid var(--accent-gold);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.92rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: var(--transition-smooth);
  z-index: 300;
  pointer-events: none;
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Keyframes */
@keyframes pulse-spin {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.15) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.92); }
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE PERFECTION
   ========================================================================== */
@media (max-width: 768px) {
  /* Prevent any horizontal page shaking or overflow */
  body, html {
    overflow-x: hidden;
    position: relative;
    width: 100%;
  }

  .app-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
  }

  /* ----------------------------------------------------
     HEADER & TOP HUD - ALL 3 BUTTONS VISIBLE IN ONE ROW
     ---------------------------------------------------- */
  .top-nav {
    padding: 0.5rem 0.65rem;
    gap: 0.35rem;
    background: linear-gradient(180deg, rgba(7, 9, 19, 0.95) 0%, rgba(7, 9, 19, 0.6) 80%, transparent 100%);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .brand-badge {
    padding: 0.32rem 0.55rem;
    gap: 0.35rem;
    flex-shrink: 1;
    min-width: 0;
    max-width: 125px;
  }

  .sparkle-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 0.74rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-sender-text {
    display: none; /* Hide sender text in header on mobile to fit buttons comfortably */
  }

  .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
  }

  .hud-btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
    gap: 0.25rem;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .hud-label {
    font-size: 0.72rem;
    font-weight: 500;
  }

  /* Audio waves in header button */
  .audio-waves {
    height: 11px;
    gap: 2px;
  }
  .audio-waves span {
    width: 2.5px;
  }

  /* ----------------------------------------------------
     MAIN STAGE - ALIGNED TO BOTTOM SO 3D CAKE SHINES ABOVE
     ---------------------------------------------------- */
  .main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Card stays at bottom; 3D Cake is fully visible in top 55% */
    align-items: center;
    padding: 0.5rem 0.75rem calc(68px + env(safe-area-inset-bottom, 8px)) 0.75rem;
    min-height: calc(100dvh - 58px);
    box-sizing: border-box;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
  }

  .main-stage.ui-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(40px);
    visibility: hidden !important;
  }

  .chapter-view {
    max-width: 100%;
    width: 100%;
    pointer-events: none;
  }

  .chapter-view.active-chapter {
    pointer-events: auto;
  }

  /* ----------------------------------------------------
     CHAPTER 1: SLEEK GLASS HERO CARD (NON-BLOCKING)
     ---------------------------------------------------- */
  .hero-card {
    padding: 1.05rem 0.95rem 1.15rem 0.95rem;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    background: rgba(11, 15, 32, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 215, 0, 0.38);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 215, 0, 0.12);
    text-align: center;
  }

  .hero-top-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
  }

  .sub-greeting {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    margin-bottom: 0;
    text-align: left;
  }

  .peek-cake-chip {
    padding: 0.2rem 0.55rem;
    font-size: 0.68rem;
    border-radius: 9999px;
    white-space: nowrap;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid var(--border-gold);
    color: #fff;
  }

  .hero-title {
    font-size: clamp(1.4rem, 6.2vw, 1.85rem);
    line-height: 1.18;
    margin-bottom: 0.4rem;
  }

  .milestone-ribbon {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem 0.4rem;
    font-size: 0.72rem;
    padding: 0.35rem 0.6rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--border-gold);
  }

  .ribbon-divider {
    color: var(--accent-gold);
    opacity: 0.6;
    font-size: 0.7rem;
  }

  .ribbon-chip {
    white-space: nowrap;
  }

  .hero-tagline {
    font-size: 0.84rem;
    line-height: 1.35;
    margin: 0.3rem auto 0.85rem;
    max-width: 100%;
    color: #cbd5e1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Compact 2-column or clean stacked buttons */
  .action-row.hero-actions {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .hero-actions button, .hero-actions .cta-glow-btn, .hero-actions .gift-btn {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 0.5rem;
    font-size: 0.82rem;
    gap: 0.35rem;
    border-radius: 12px;
    white-space: nowrap;
  }

  /* ----------------------------------------------------
     CHAPTER 2: 3D CAKE & BLOW CANDLES CARD
     ---------------------------------------------------- */
  .cake-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
  }

  .cake-instructions-badge {
    font-size: 0.75rem;
    padding: 0.32rem 0.75rem;
    margin-bottom: 0.45rem;
    border-radius: 9999px;
  }

  .cake-action-card {
    padding: 1.15rem 1rem;
    border-radius: 20px;
    width: 100%;
    background: rgba(11, 15, 32, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 215, 0, 0.38);
    text-align: center;
  }

  .cake-action-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.3rem;
  }

  .cake-action-card p {
    font-size: 0.82rem;
    line-height: 1.35;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
  }

  .cake-action-card .action-row {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .cake-action-card .action-row button {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 0.6rem;
    font-size: 0.82rem;
    gap: 0.35rem;
    white-space: nowrap;
  }

  /* ----------------------------------------------------
     CHAPTER 3: POLAROIDS GALLERY
     ---------------------------------------------------- */
  .polaroids-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
    max-width: 310px;
    margin: 0 auto;
    perspective: 1000px;
    max-height: 68vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
  }

  .polaroid-card {
    width: 100%;
    max-width: 290px;
    transform: none !important;
    margin: 0 auto;
    min-height: 340px;
  }

  .polaroid-card.flipped {
    transform: rotateY(180deg) !important;
  }

  .polaroid-photo-wrapper {
    height: 220px;
    overflow: hidden;
    border-radius: 4px;
  }

  .polaroid-photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .polaroid-caption {
    font-size: 1.05rem;
    margin-top: 0.35rem;
  }

  .polaroid-back {
    padding: 1.25rem 0.85rem;
  }

  .polaroid-back-note {
    font-size: 1.05rem;
    line-height: 1.35;
  }

  /* ----------------------------------------------------
     CHAPTER 4: GOLDEN WAX SEALED LETTER
     ---------------------------------------------------- */
  .letter-parchment {
    max-height: 65vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.4rem 1rem;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    background: rgba(14, 18, 33, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .letter-salutation {
    font-size: 1.35rem;
  }

  .letter-body {
    font-size: 0.92rem;
    line-height: 1.5;
  }

  .special-reasons-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 1rem 0;
  }

  .reason-chip {
    font-size: 0.8rem;
    padding: 0.4rem 0.65rem;
    text-align: left;
  }

  /* ----------------------------------------------------
     CHAPTER 5: GRAND CELEBRATION & FIREWORKS
     ---------------------------------------------------- */
  .celebrate-grand-card {
    padding: 1.25rem 1rem;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    background: rgba(11, 15, 32, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 215, 0, 0.38);
    text-align: center;
  }

  .celebrate-grand-card h2.hero-title {
    font-size: 1.45rem !important;
  }

  .celebrate-grand-card .hero-tagline {
    font-size: 0.84rem;
    margin-bottom: 0.85rem;
  }

  .interactive-sparks-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.35rem;
    width: 100%;
  }

  .interactive-sparks-row .spark-btn {
    padding: 0.55rem 0.3rem;
    font-size: 0.72rem;
    flex-direction: column;
    gap: 0.2rem;
    white-space: nowrap;
    border-radius: 12px;
  }

  .celebrate-grand-card .cta-glow-btn {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
    border-radius: 14px;
    margin-top: 0.65rem;
  }

  /* ----------------------------------------------------
     FLOATING DOCK - SLEEK, COMPACT, NEVER OVERFLOWING
     ---------------------------------------------------- */
  .chapter-dock-container {
    position: fixed;
    bottom: max(0.45rem, env(safe-area-inset-bottom, 6px));
    left: 0;
    right: 0;
    padding: 0 0.5rem;
    justify-content: center;
    z-index: 100;
    pointer-events: auto;
  }

  .chapter-dock {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0.2rem;
    padding: 0.3rem 0.35rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 9999px;
    background: rgba(10, 14, 28, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-gold);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 215, 0, 0.15);
  }

  .dock-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.32rem 0.15rem;
    border-radius: 14px;
    min-width: 0;
    gap: 0.15rem;
    border: 1px solid transparent;
  }

  .dock-icon {
    font-size: 1.05rem;
    line-height: 1;
  }

  .dock-label {
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .dock-item.active {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(244, 63, 94, 0.25) 100%);
    border-color: var(--accent-gold);
    color: #fff;
  }
}

/* Extra small devices (iPhone SE, smaller Android phones < 370px) */
@media (max-width: 375px) {
  .top-nav {
    padding: 0.4rem 0.5rem;
  }
  .brand-badge {
    max-width: 95px;
    padding: 0.28rem 0.45rem;
  }
  .hud-btn {
    padding: 0.3rem 0.45rem;
    font-size: 0.68rem;
  }
  .hud-label {
    font-size: 0.66rem;
  }
  .dock-label {
    font-size: 0.58rem;
  }
}

/* ==========================================================================
   3D CARTOON STORY CHARACTER BADGES & CARDS
   ========================================================================== */
.story-character-badge {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: rgba(14, 18, 33, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 20px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.story-character-badge:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 215, 0, 0.25);
  border-color: var(--accent-gold);
}

.story-character-img {
  width: 90px;
  height: 90px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.35);
  flex-shrink: 0;
}

.story-character-info {
  text-align: left;
}

.story-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.3);
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  margin-bottom: 0.35rem;
}

.story-desc {
  font-family: var(--font-handwriting);
  font-size: 1.22rem;
  color: #fff;
  line-height: 1.35;
  margin: 0;
}

@media (max-width: 600px) {
  .story-character-badge {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
    gap: 0.75rem;
  }
  .story-character-info {
    text-align: center;
  }
  .story-character-img {
    width: 100px;
    height: 100px;
  }
}

