/* ===== Design Tokens =====
   Palette: cream #FFF8F0, blush pink #FFD6E8, lavender #E7D9F7,
            deep plum #4A2E5C, gold #E8B44A, rose #E8759A
   Display: 'Playfair Display' (headings), Script: 'Caveat' (handwritten),
   Body/UI: 'Quicksand'
*/

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --cream: #FFF8F0;
  --blush: #FFD6E8;
  --lavender: #E7D9F7;
  --lavender-deep: #C9AEF0;
  --plum: #4A2E5C;
  --plum-soft: #6B4B82;
  --gold: #E8B44A;
  --gold-soft: #F4D896;
  --rose: #E8759A;
  --rose-soft: #F5A8C0;
  --paper: #FFFCF7;
  --shadow: rgba(74, 46, 92, 0.18);
  --transition-main: 650ms cubic-bezier(0.65, 0, 0.35, 1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--cream);
  font-family: 'Quicksand', sans-serif;
  color: var(--plum);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

button {
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  border: none;
  outline: none;
}

button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.name-script {
  font-family: 'Caveat', cursive;
  color: var(--rose);
  font-weight: 700;
}

/* ===== Canvas for confetti/hearts/sparkles ===== */
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 500;
}

/* ===== Music toggle ===== */
.music-btn {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-soft), var(--gold));
  box-shadow: 0 6px 18px var(--shadow);
  font-size: 22px;
  z-index: 600;
  transition: transform 300ms ease;
  opacity: 0.55;
}
.music-btn.playing { opacity: 1; animation: pulse-music 1.8s ease-in-out infinite; }
.music-btn:hover { transform: scale(1.1); }
@keyframes pulse-music {
  0%, 100% { box-shadow: 0 6px 18px var(--shadow); }
  50% { box-shadow: 0 6px 26px var(--gold); }
}

/* ===== Progress dots ===== */
.progress-dots {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 600;
}
.progress-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(74,46,92,0.2);
  transition: all 400ms ease;
}
.progress-dots .dot.active {
  background: var(--rose);
  width: 20px;
  border-radius: 4px;
}

/* ===== Scene System ===== */
.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.98);
  transition: opacity var(--transition-main), transform var(--transition-main), visibility 0s linear var(--transition-main);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 40px 20px;
}
.scene.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity var(--transition-main), transform var(--transition-main), visibility 0s;
  position: relative;
}

/* On short viewports, switch from centering to top-aligned scroll so
   content never gets clipped above the visible area */
@media (max-height: 700px) {
  .scene { align-items: flex-start; padding-top: 70px; }
}

.scene-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.bg-dawn { background: linear-gradient(160deg, var(--blush) 0%, var(--lavender) 55%, var(--cream) 100%); }
.bg-lavender { background: linear-gradient(160deg, var(--lavender) 0%, var(--blush) 100%); }
.bg-cream { background: linear-gradient(160deg, var(--cream) 0%, var(--blush) 100%); }
.bg-final { background: radial-gradient(ellipse at center, #2c1a3d 0%, #1a0f26 70%, #120a1a 100%); }

.scene-content {
  max-width: 640px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 1;
}
.scene-content.wide { max-width: 900px; }

/* ===== Sparkle field (ambient, scene 1) ===== */
.sparkle-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.sparkle-field::before, .sparkle-field::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, var(--gold) 0%, transparent 60%),
    radial-gradient(2px 2px at 80% 30%, var(--rose) 0%, transparent 60%),
    radial-gradient(3px 3px at 30% 70%, var(--gold-soft) 0%, transparent 60%),
    radial-gradient(2px 2px at 60% 85%, var(--rose-soft) 0%, transparent 60%),
    radial-gradient(2px 2px at 90% 60%, var(--gold) 0%, transparent 60%),
    radial-gradient(2px 2px at 45% 15%, var(--rose) 0%, transparent 60%);
  animation: twinkle 3.5s ease-in-out infinite;
}
.sparkle-field::after { animation-delay: 1.5s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.9; }
}

/* ===== Scene 1: Countdown ===== */
.pre-reveal {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 500;
  color: var(--plum-soft);
  opacity: 1;
  transition: opacity 600ms ease;
}
.pre-reveal.fade-out { opacity: 0; height: 0; overflow: hidden; }

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 700;
  color: var(--plum);
  line-height: 1.15;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
}
.reveal-title.show {
  animation: reveal-pop 900ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes reveal-pop {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.btn-primary {
  background: linear-gradient(135deg, var(--rose), var(--gold));
  color: white;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 16px 36px;
  border-radius: 50px;
  box-shadow: 0 10px 28px var(--shadow);
  opacity: 0;
  transform: translateY(20px);
  transition: transform 250ms ease, box-shadow 250ms ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.reveal-btn.show {
  animation: fade-slide-up 700ms ease forwards;
  animation-delay: 200ms;
}
@keyframes fade-slide-up {
  to { opacity: 1; transform: translateY(0); }
}
.btn-primary:hover { transform: translateY(-4px); box-shadow: 0 14px 34px var(--shadow); }
.btn-primary:active { transform: translateY(-1px) scale(0.97); }
.sparkle-icon { display: inline-block; animation: spin-sparkle 2.5s linear infinite; }
@keyframes spin-sparkle { to { transform: rotate(360deg); } }

.btn-secondary {
  background: var(--paper);
  color: var(--plum);
  font-weight: 600;
  font-size: 1rem;
  padding: 13px 30px;
  border-radius: 50px;
  border: 2px solid var(--lavender-deep);
  transition: all 250ms ease;
}
.btn-secondary:hover { background: var(--lavender-deep); color: white; transform: translateY(-3px); }
.next-btn { margin-top: 12px; }
.hidden { display: none !important; }

/* ===== Scene 2: Gift Box ===== */
.scene-instruction {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--plum-soft);
  margin-bottom: 10px;
}
.gift-wrap {
  perspective: 900px;
  padding: 40px 0;
}
.gift-box {
  position: relative;
  width: 180px;
  height: 160px;
  cursor: pointer;
  transform-style: preserve-3d;
  animation: gift-idle 2.4s ease-in-out infinite;
}
@keyframes gift-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-1.5deg); }
}
.gift-box.opened { animation: none; }

.gift-base {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 105px;
  background: linear-gradient(135deg, var(--rose), var(--rose-soft));
  border-radius: 8px;
  box-shadow: 0 20px 40px var(--shadow), inset 0 -10px 20px rgba(0,0,0,0.08);
}
.ribbon-v {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 26px;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
}
.gift-lid {
  position: absolute;
  top: 0;
  left: -8px;
  width: calc(100% + 16px);
  height: 46px;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  border-radius: 10px;
  box-shadow: 0 8px 16px var(--shadow);
  transform-origin: left center;
  transition: transform 900ms cubic-bezier(0.68, -0.4, 0.4, 1.5), opacity 900ms ease 600ms;
  z-index: 3;
}
.gift-box.opened .gift-lid {
  transform: translateY(-110px) rotate(-100deg) translateX(-10px);
  opacity: 0;
}
.gift-bow {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 40px;
}
.bow-loop {
  position: absolute;
  width: 26px;
  height: 26px;
  background: var(--rose);
  border-radius: 50% 50% 50% 0;
  top: 0;
}
.bow-loop-left { left: 4px; transform: rotate(45deg); }
.bow-loop-right { right: 4px; transform: rotate(-45deg) scaleX(-1); }
.bow-knot {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: var(--gold);
  border-radius: 50%;
}
.gift-glow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,180,74,0.5) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 600ms ease;
  z-index: -1;
}
.gift-box.opened .gift-glow { opacity: 1; animation: glow-pulse 1.6s ease-in-out infinite; }
@keyframes glow-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== Scene 3: Letter ===== */
.letter-wrap { perspective: 1400px; width: 100%; }
.letter-paper {
  background: var(--paper);
  border-radius: 6px;
  padding: 40px 32px;
  box-shadow: 0 20px 50px var(--shadow);
  max-width: 560px;
  margin: 0 auto;
  transform-origin: top center;
  transform: rotateX(-90deg);
  opacity: 0;
  transition: transform 900ms cubic-bezier(0.34, 1.2, 0.64, 1), opacity 500ms ease;
  position: relative;
}
.letter-paper.unfolded { transform: rotateX(0deg); opacity: 1; }
.letter-paper::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid var(--lavender-deep);
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.4;
}
.letter-heading {
  font-family: 'Caveat', cursive;
  font-size: 2.4rem;
  color: var(--rose);
  margin-bottom: 18px;
  text-align: left;
}
.letter-body {
  font-family: 'Quicksand', sans-serif;
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--plum);
  text-align: left;
  white-space: pre-wrap;
}
.letter-body .cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--rose);
  margin-left: 2px;
  animation: blink-cursor 0.8s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes blink-cursor { 50% { opacity: 0; } }

/* ===== Scene 4: Memory Gallery ===== */
.fairy-lights {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.fairy-lights::before {
  content: '';
  position: absolute;
  top: 20px; left: -5%;
  width: 110%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 4px, transparent 4px 40px);
  box-shadow: 0 0 8px var(--gold);
}
.fairy-lights::after {
  content: '';
  position: absolute;
  top: 24px; left: 0; right: 0;
  height: 20px;
  background-image: radial-gradient(circle, var(--gold) 3px, transparent 4px);
  background-size: 40px 20px;
  animation: lights-twinkle 2s ease-in-out infinite alternate;
}
@keyframes lights-twinkle { 0% { opacity: 0.5; } 100% { opacity: 1; } }

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: var(--plum);
  margin-bottom: 8px;
}

.polaroid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 26px 20px;
  padding: 20px 10px 10px;
  width: 100%;
}
.polaroid {
  background: var(--paper);
  padding: 12px 12px 36px;
  box-shadow: 0 12px 24px var(--shadow);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px) rotate(var(--rot, 0deg));
  transition: transform 300ms ease, box-shadow 300ms ease;
  position: relative;
}
.polaroid.in-view {
  animation: polaroid-in 700ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes polaroid-in {
  to { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)); }
}
.polaroid:hover { transform: translateY(-8px) rotate(0deg) scale(1.04); box-shadow: 0 20px 36px var(--shadow); z-index: 2; }
.polaroid img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
  border-radius: 1px;
  background: linear-gradient(135deg, var(--lavender), var(--blush));
}
.polaroid .tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 50px;
  height: 18px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.polaroid .caption {
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  color: var(--plum-soft);
  text-align: center;
  margin-top: 8px;
}
.polaroid .doodle {
  position: absolute;
  font-size: 1.1rem;
  bottom: 6px;
  right: 10px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(26, 15, 38, 0.88);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 350ms ease, visibility 0s linear 350ms;
  padding: 20px;
}
.lightbox.show {
  opacity: 1;
  visibility: visible;
  transition: opacity 350ms ease, visibility 0s;
}
.lightbox-inner {
  background: var(--paper);
  padding: 16px 16px 24px;
  border-radius: 6px;
  max-width: 480px;
  width: 100%;
  transform: scale(0.85);
  transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.lightbox.show .lightbox-inner { transform: scale(1); }
.lightbox-inner img { width: 100%; border-radius: 4px; max-height: 60vh; object-fit: cover; background: linear-gradient(135deg, var(--lavender), var(--blush)); }
.lightbox-inner p { font-family: 'Caveat', cursive; font-size: 1.4rem; color: var(--plum-soft); margin-top: 12px; }

/* ===== Scene 5: Why You're Special ===== */
.orbit-wrap {
  position: relative;
  width: min(340px, 80vw);
  height: min(340px, 80vw);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
}
.orbit-photo {
  width: 46%;
  height: 46%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 6px var(--paper), 0 12px 34px var(--shadow);
  z-index: 2;
  background: linear-gradient(135deg, var(--blush), var(--gold-soft));
}
.orbit-words {
  position: absolute;
  inset: 0;
}
.orbit-word {
  position: absolute;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: clamp(0.75rem, 3.4vw, 1.3rem);
  color: var(--rose);
  background: var(--paper);
  padding: 5px 11px;
  border-radius: 30px;
  box-shadow: 0 6px 16px var(--shadow);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
  white-space: nowrap;
  max-width: 40vw;
  overflow: visible;
  animation: word-float 5s ease-in-out infinite, word-in 600ms ease forwards;
}
@keyframes word-in { to { opacity: 1; transform: scale(1); } }
@keyframes word-float {
  0%, 100% { margin-top: 0px; }
  50% { margin-top: -12px; }
}

/* ===== Scene 6: Cake ===== */
.cake-wrap {
  position: relative;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cake {
  position: relative;
  width: 220px;
}
.cake-plate {
  width: 240px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(180deg, #E4D4F5, #C9AEF0);
  box-shadow: 0 10px 20px var(--shadow);
  margin-left: -10px;
}
.cake-layer {
  border-radius: 10px 10px 4px 4px;
  box-shadow: inset 0 -8px 14px rgba(0,0,0,0.08), 0 6px 14px var(--shadow);
  position: relative;
}
.cake-bottom { width: 220px; height: 60px; background: linear-gradient(160deg, #F6C6DA, var(--rose-soft)); }
.cake-mid { width: 180px; height: 50px; margin: 0 auto; margin-top: -8px; background: linear-gradient(160deg, #FBE0EC, var(--blush)); }
.cake-top { width: 140px; height: 42px; margin: 0 auto; margin-top: -8px; background: linear-gradient(160deg, var(--gold-soft), var(--gold)); overflow: visible; }
.drip {
  position: absolute;
  bottom: -6px; left: 10%;
  width: 80%;
  height: 12px;
  background: var(--gold-soft);
  border-radius: 0 0 40% 40%;
}
.candle-row {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
}
.candle {
  width: 8px;
  height: 40px;
  background: repeating-linear-gradient(180deg, var(--rose), var(--rose) 6px, white 6px, white 12px);
  border-radius: 2px;
  position: relative;
}
.flame {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 16px;
  background: radial-gradient(circle at 50% 70%, #FFE9A8, var(--gold) 60%, #E86A2A 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 0.35s ease-in-out infinite alternate;
  transform-origin: bottom center;
}
@keyframes flicker {
  0% { transform: translateX(-50%) rotate(-4deg) scale(1); }
  100% { transform: translateX(-50%) rotate(4deg) scale(1.08); }
}
.candle.out .flame { animation: none; opacity: 0; transition: opacity 300ms ease; }

.smoke-container {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 80px;
  pointer-events: none;
}
.smoke-puff {
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 10px;
  background: rgba(200,200,200,0.5);
  border-radius: 50%;
  animation: smoke-rise 1.6s ease-out forwards;
}
@keyframes smoke-rise {
  0% { opacity: 0.7; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(2.5); }
}

.wish-text {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  color: var(--rose);
  animation: fade-slide-up 700ms ease forwards;
}

/* ===== Scene 7: Wishes Wall ===== */
.notes-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 22px;
  width: 100%;
  padding: 10px;
}
.sticky-note {
  padding: 24px 18px;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--plum);
  border-radius: 3px;
  box-shadow: 0 10px 20px var(--shadow);
  transform: translateY(30px) rotate(var(--rot, 0deg)) scale(0.8);
  opacity: 0;
}
.sticky-note.in-view {
  animation: note-in 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes note-in {
  to { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)) scale(1); }
}
.sticky-note:hover { transform: translateY(-6px) rotate(0deg) scale(1.03); }
.note-1 { background: var(--blush); }
.note-2 { background: var(--gold-soft); }
.note-3 { background: var(--lavender); }
.note-4 { background: #C9E4DE; }
.note-5 { background: var(--rose-soft); }
.note-6 { background: #FFF3B0; }

/* ===== Scene 8: Final ===== */
.star-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: star-twinkle 2.5s ease-in-out infinite;
}
@keyframes star-twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}
.rising-balloons {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.rise-balloon {
  position: absolute;
  bottom: -100px;
  width: 44px;
  height: 56px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: balloon-rise linear infinite;
  opacity: 0.85;
}
.rise-balloon::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 50%;
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.4);
}
@keyframes balloon-rise {
  0% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-60vh) translateX(20px); }
  100% { transform: translateY(-130vh) translateX(-10px); }
}

.final-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 7vw, 3.4rem);
  color: #FFF3E0;
  text-shadow: 0 0 24px rgba(232,180,74,0.5);
}
.final-message {
  font-size: clamp(1rem, 3vw, 1.2rem);
  line-height: 1.85;
  color: #EAD9F5;
  max-width: 560px;
}
.final-signoff {
  font-size: 1.2rem;
  color: #FFF3E0;
  margin-top: 10px;
  line-height: 1.6;
}
.final-signoff .name-script { font-size: 2rem; color: var(--gold-soft); }
.restart-btn { margin-top: 20px; border-color: var(--gold-soft); color: #FFF3E0; background: rgba(255,255,255,0.08); }
.restart-btn:hover { background: var(--gold-soft); color: var(--plum); }

/* ===== Responsive ===== */

/* Global safety: nothing is ever allowed to force horizontal scroll */
html, body { max-width: 100%; }
.scene, .scene-content, .scene-content.wide { max-width: 100%; }
img { max-width: 100%; }

@media (max-width: 600px) {
  .scene { padding: 90px 16px 40px; align-items: flex-start; }
  .scene-content { gap: 16px; }

  .hero-title { font-size: clamp(1.7rem, 8vw, 2.6rem); line-height: 1.25; padding: 0 4px; }
  .pre-reveal { font-size: 1rem; padding: 0 10px; }
  .btn-primary, .btn-secondary { padding: 13px 26px; font-size: 0.95rem; }

  .gift-wrap { padding: 20px 0; }
  .gift-box { width: 140px; height: 125px; }
  .gift-lid { height: 38px; }
  .gift-bow { width: 48px; height: 32px; top: -18px; }
  .bow-loop { width: 20px; height: 20px; }

  .letter-wrap { padding: 0 4px; }
  .letter-paper { padding: 26px 18px; max-width: 100%; }
  .letter-heading { font-size: 2rem; }
  .letter-body { font-size: 0.98rem; line-height: 1.75; }

  .section-title { font-size: clamp(1.5rem, 7vw, 2rem); padding: 0 8px; }

  .polaroid-grid { grid-template-columns: repeat(2, 1fr); gap: 18px 14px; padding: 16px 4px 4px; }
  .polaroid { padding: 10px 10px 30px; }
  .polaroid .caption { font-size: 1rem; }

  .orbit-wrap { width: min(300px, 88vw); height: min(300px, 88vw); margin: 12px 0; }
  .orbit-word { font-size: 0.82rem; padding: 5px 10px; }

  .cake-wrap { margin: 16px 0; }
  .cake { width: 170px; }
  .cake-bottom { width: 170px; height: 50px; }
  .cake-mid { width: 138px; height: 42px; }
  .cake-top { width: 106px; height: 34px; }
  .candle-row { top: -40px; gap: 14px; }
  .candle { height: 34px; width: 7px; }

  .notes-wall { grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 6px; }
  .sticky-note { min-height: 110px; font-size: 1.25rem; padding: 18px 14px; }

  .final-title { font-size: clamp(1.6rem, 8vw, 2.4rem); padding: 0 6px; }
  .final-message { font-size: 0.95rem; padding: 0 8px; }

  .music-btn { width: 46px; height: 46px; font-size: 18px; bottom: 16px; right: 16px; }
  .progress-dots { top: 14px; }

  .lightbox-inner { padding: 12px 12px 18px; }
}

@media (max-width: 380px) {
  .polaroid-grid { grid-template-columns: 1fr 1fr; gap: 14px 10px; }
  .notes-wall { grid-template-columns: 1fr 1fr; }
  .orbit-wrap { width: min(260px, 90vw); height: min(260px, 90vw); }
  .orbit-word { font-size: 0.72rem; padding: 4px 8px; }
  .gift-box { width: 120px; height: 108px; }
  .cake { width: 150px; }
  .cake-bottom { width: 150px; height: 44px; }
  .cake-mid { width: 122px; height: 38px; }
  .cake-top { width: 94px; height: 30px; }
}

/* Landscape phones: content taller than viewport → allow scroll, keep top-aligned */
@media (max-height: 480px) and (orientation: landscape) {
  .scene { padding: 60px 16px 30px; align-items: flex-start; }
  .orbit-wrap { width: min(220px, 60vh); height: min(220px, 60vh); }
}
