/* ==========================================================================
   Happy Birthday — styles
   ========================================================================== */

:root {
  --night: #0a0817;
  --night-2: #140f2b;
  --ink: #f6eef2;
  --muted: rgba(246, 238, 242, .62);
  --faint: rgba(246, 238, 242, .12);
  --rose: #ff5c8a;
  --rose-soft: #ffb3c7;
  --gold: #ffd29d;
  --lilac: #b9a4ff;

  --serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --script: "Great Vibes", "Brush Script MT", "Segoe Script", cursive;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(.2, .7, .1, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 800px at 80% -10%, #2a1446 0%, transparent 60%),
              radial-gradient(900px 700px at -10% 40%, #1b1240 0%, transparent 60%),
              var(--night);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100vh; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

.script { font-family: var(--script); font-weight: 400; }

.kicker {
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--rose-soft);
  margin: 0 0 1rem;
  font-weight: 400;
}

.shimmer {
  background: linear-gradient(100deg, var(--rose-soft) 0%, #fff 20%, var(--gold) 40%, var(--rose) 60%, #fff 80%, var(--rose-soft) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s linear infinite;
}
@keyframes shimmer { to { background-position: -250% 0; } }

/* ---------- canvases & chrome ---------- */
#sky, #fireworks {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
#sky { z-index: 0; }
#fireworks { z-index: 40; }

#progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0;
  background: linear-gradient(90deg, var(--lilac), var(--rose), var(--gold));
  box-shadow: 0 0 12px var(--rose);
  z-index: 60;
}

.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 70;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  color: var(--rose-soft);
  font-size: 12px;
  line-height: 10px;
  text-align: center;
  animation: sparkle .9s var(--ease) forwards;
  text-shadow: 0 0 8px currentColor;
}
@keyframes sparkle {
  from { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
  to   { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2) rotate(140deg); }
}

/* ==========================================================================
   GATE
   ========================================================================== */
#gate {
  position: fixed; inset: 0;
  z-index: 50;
  display: grid; place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, #2b1640 0%, #0d0a1d 55%, #07060f 100%);
  clip-path: circle(150% at 50% 50%);
  transition: clip-path 1.6s cubic-bezier(.7, 0, .2, 1);
}
#gate.open { clip-path: circle(0% at 50% 50%); }
.gate-glow {
  position: absolute; width: 60vmin; height: 60vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 92, 138, .25), transparent 65%);
  filter: blur(20px);
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.15); opacity: .7; } }

.gate-inner { position: relative; text-align: center; }
.gate-kicker { opacity: 0; animation: fadeUp 1.2s var(--ease) .3s forwards; }
.gate-name {
  font-size: clamp(3.2rem, 11vw, 6.5rem);
  margin: 0 0 2.5rem;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 0 40px rgba(255, 92, 138, .5);
  opacity: 0; animation: fadeUp 1.4s var(--ease) .6s forwards;
}
.gate-hint {
  margin-top: 2rem;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  opacity: 0; animation: fadeUp 1.2s var(--ease) 1.4s forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

.seal {
  position: relative;
  width: 116px; height: 116px;
  display: inline-grid; place-items: center;
  opacity: 0; animation: popIn 1s var(--ease-back) 1s forwards;
}
@keyframes popIn { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
.seal-core {
  position: relative; z-index: 2;
  width: 100%; height: 100%;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ff8fb0, #e0346a 55%, #a3123f);
  box-shadow: inset 0 -6px 14px rgba(0, 0, 0, .35), inset 0 4px 10px rgba(255, 255, 255, .35),
              0 10px 40px rgba(255, 60, 120, .55);
  animation: heartbeat 1.6s ease-in-out infinite;
  transition: transform .5s var(--ease);
}
.seal-core svg { width: 44px; fill: #fff3f6; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.seal:hover .seal-core { transform: scale(1.06); }
.seal-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 179, 199, .6);
  animation: ring 2.4s ease-out infinite;
}
.seal-ring.r2 { animation-delay: 1.2s; }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes heartbeat {
  0%, 40%, 100% { transform: scale(1); }
  15% { transform: scale(1.08); }
  28% { transform: scale(1.02); }
}
.seal:disabled { cursor: not-allowed; filter: grayscale(.6) brightness(.7); }
.seal:disabled .seal-ring { display: none; }

#lockBox { margin-top: 2rem; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */
#site { position: relative; z-index: 1; }

.section {
  position: relative;
  min-height: 100vh;
  padding: clamp(80px, 14vh, 160px) clamp(16px, 5vw, 64px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.sec-head { text-align: center; margin-bottom: clamp(40px, 7vh, 80px); }
.sec-head h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.05;
  margin: 0;
  letter-spacing: -.01em;
}
.sec-head h2 em { font-style: italic; color: var(--rose-soft); }

.reveal {
  opacity: 0;
  transform: translateY(40px);
  filter: blur(8px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease), filter 1.2s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; filter: none; }

/* ==========================================================================
   HERO
   ========================================================================== */
#hero { text-align: center; overflow: hidden; }
.hero-inner { position: relative; z-index: 2; }
.hero-kicker { opacity: 0; }
.play .hero-kicker { animation: fadeUp 1.2s var(--ease) .2s forwards; }

.hero-title { margin: 0; font-weight: 300; }
.hero-line {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 9vw, 7.5rem);
  line-height: 1;
  letter-spacing: -.02em;
}
.hero-name {
  display: block;
  font-size: clamp(4rem, 15vw, 12rem);
  line-height: 1.15;
  padding: 0 .2em;
  opacity: 0;
  transform: scale(.9);
  filter: blur(14px);
}
.play .hero-name { animation: nameIn 2s var(--ease) 1.6s forwards, shimmer 7s linear 3.6s infinite; }
@keyframes nameIn { to { opacity: 1; transform: none; filter: none; } }

.char {
  display: inline-block;
  opacity: 0;
  transform: translateY(.5em) rotate(6deg);
  filter: blur(10px);
}
.play .char { animation: charIn 1.1s var(--ease) forwards; animation-delay: calc(var(--i) * 55ms + .5s); }
@keyframes charIn { to { opacity: 1; transform: none; filter: none; } }

.hero-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: var(--muted);
  margin: 1.2rem 0 0;
  opacity: 0;
}
.play .hero-sub { animation: fadeUp 1.4s var(--ease) 3s forwards; }

.scroll-cue {
  position: absolute; bottom: 36px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--muted);
  font-size: .65rem; letter-spacing: .3em; text-transform: uppercase;
  opacity: 0;
}
.play .scroll-cue { animation: fadeUp 1s var(--ease) 4s forwards; }
.mouse { width: 22px; height: 34px; border: 1px solid var(--muted); border-radius: 12px; position: relative; }
.mouse i {
  position: absolute; left: 50%; top: 7px;
  width: 2px; height: 6px; margin-left: -1px;
  background: var(--rose-soft); border-radius: 2px;
  animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }

.float-hearts { position: absolute; inset: 0; pointer-events: none; }
.float-hearts span {
  position: absolute; bottom: -40px;
  color: var(--rose);
  opacity: 0;
  animation: rise linear infinite;
  filter: blur(var(--b, 0));
}
@keyframes rise {
  0%   { transform: translate(0, 0) rotate(0); opacity: 0; }
  10%  { opacity: var(--o, .6); }
  100% { transform: translate(var(--drift), -115vh) rotate(var(--rot)); opacity: 0; }
}

/* ==========================================================================
   DISTANCE
   ========================================================================== */
.arc-wrap { width: min(1000px, 100%); }
#arcSvg { width: 100%; height: auto; overflow: visible; }
#arcPath { stroke-dasharray: var(--len, 1200); stroke-dashoffset: var(--len, 1200); transition: stroke-dashoffset 2.6s cubic-bezier(.6, 0, .2, 1) .3s; }
.arc-wrap.in #arcPath { stroke-dashoffset: 0; }
.pin .dot { fill: #fff; filter: drop-shadow(0 0 8px var(--rose)); }
.pin .pulse { fill: none; stroke: var(--rose); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: pinPulse 2.4s ease-out infinite; }
.pin .pulse.p2 { animation-delay: 1.2s; }
@keyframes pinPulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(3.4); opacity: 0; } }
.city { fill: var(--ink); font-family: var(--serif); font-size: 26px; text-anchor: middle; font-style: italic; }
.city-sub { fill: var(--rose-soft); font-family: var(--sans); font-size: 11px; letter-spacing: 4px; text-anchor: middle; text-transform: uppercase; }
#traveler { opacity: 0; transition: opacity .6s; }
.arc-wrap.in #traveler { opacity: 1; transition-delay: 2.6s; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 3vw, 40px);
  width: min(960px, 100%);
  margin: clamp(30px, 6vh, 60px) 0;
}
.stat {
  text-align: center;
  padding: 28px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  border: 1px solid var(--faint);
  backdrop-filter: blur(6px);
}
.stat b {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.1;
  color: #fff;
  font-variant-numeric: lining-nums tabular-nums;
}
.stat > span { color: var(--muted); font-size: .9rem; }

.together { text-align: center; margin-top: clamp(30px, 6vh, 60px); }
.clock { display: flex; justify-content: center; gap: clamp(10px, 3vw, 34px); flex-wrap: wrap; }
.clock .u { min-width: 70px; text-align: center; }
.clock .n {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  background: linear-gradient(180deg, #fff, var(--rose-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.clock .l { display: block; margin-top: 8px; font-size: .65rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.clock.small .n { font-size: clamp(1.8rem, 5vw, 3.2rem); }

/* ==========================================================================
   STORY / TIMELINE
   ========================================================================== */
.timeline { position: relative; width: min(1040px, 100%); }
.tl-line {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; margin-left: -1px;
  background: var(--faint);
  border-radius: 2px;
}
.tl-fill {
  width: 100%; height: 0;
  background: linear-gradient(180deg, var(--lilac), var(--rose), var(--gold));
  box-shadow: 0 0 14px var(--rose);
  border-radius: 2px;
}
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 8vw, 110px);
  align-items: center;
  margin-bottom: clamp(70px, 12vh, 140px);
}
.tl-item:last-child { margin-bottom: 0; }
.tl-item::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--night);
  border: 2px solid var(--rose);
  box-shadow: 0 0 0 6px rgba(255, 92, 138, .12);
  transform: scale(0);
  transition: transform .6s var(--ease-back) .3s;
}
.tl-item.in::after { transform: scale(1); }
.tl-item.flip .tl-media { order: 2; }

.tl-media { display: flex; justify-content: center; }
.polaroid {
  background: #fdfaf6;
  padding: 12px 12px 48px;
  border-radius: 3px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
  position: relative;
}
.polaroid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: #ddd; }
.polaroid figcaption {
  position: absolute; left: 0; right: 0; bottom: 10px;
  text-align: center;
  font-family: var(--hand);
  font-size: 1.35rem;
  color: #3a2a33;
}
.tape {
  position: absolute; top: -14px; left: 50%;
  width: 90px; height: 28px; margin-left: -45px;
  background: rgba(255, 222, 230, .55);
  transform: rotate(-4deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  backdrop-filter: blur(2px);
}
.tl-media .polaroid {
  width: min(340px, 100%);
  opacity: 0;
  transform: translateX(var(--from, -80px)) rotate(calc(var(--tilt, -4deg) * 3)) scale(.9);
  transition: opacity 1.2s var(--ease), transform 1.4s var(--ease);
}
.tl-item.in .tl-media .polaroid { opacity: 1; transform: rotate(var(--tilt, -4deg)); }
.tl-media .polaroid:hover { transform: rotate(0) scale(1.03) !important; transition-duration: .5s; }

.tl-text { opacity: 0; transform: translateY(30px); transition: all 1.2s var(--ease) .25s; }
.tl-item.in .tl-text { opacity: 1; transform: none; }
.tl-date { font-size: .72rem; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); }
.tl-text h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.15; margin: .5rem 0 .8rem; }
.tl-text p { color: var(--muted); margin: 0; font-size: 1.02rem; max-width: 38ch; }

/* ==========================================================================
   GALLERY — 3D RING
   ========================================================================== */
#gallery { overflow: hidden; }
.ring-stage {
  position: relative;
  width: 100%;
  height: clamp(380px, 62vh, 560px);
  perspective: 1400px;
  perspective-origin: 50% 40%;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
.ring-stage.dragging { cursor: grabbing; }
.ring {
  position: absolute; left: 50%; top: 45%;
  transform-style: preserve-3d;
}
.ring-item {
  position: absolute;
  width: var(--w); height: calc(var(--w) * 1.42);
  left: calc(var(--w) / -2); top: calc(var(--w) * -0.71);
  padding: 10px 10px 42px;
  background: #fdfaf6;
  border-radius: 3px;
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, .7);
  -webkit-box-reflect: below 14px linear-gradient(transparent 70%, rgba(255, 255, 255, .16));
}
.ring-item img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; background: #ddd; }
.ring-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 8px;
  text-align: center; font-family: var(--hand); font-size: 1.2rem; color: #3a2a33;
}
.ring-floor {
  position: absolute; left: 50%; bottom: 0;
  width: 80%; height: 120px; margin-left: -40%;
  background: radial-gradient(ellipse at center, rgba(255, 92, 138, .22), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}

#lightbox {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(6, 4, 14, .86);
  backdrop-filter: blur(10px);
  cursor: zoom-out;
  animation: fade .4s ease;
}
#lightbox figure {
  margin: 0;
  background: #fdfaf6;
  padding: 14px 14px 56px;
  border-radius: 4px;
  position: relative;
  max-width: min(560px, 92vw);
  animation: lbIn .7s var(--ease-back);
}
#lightbox img { max-height: 72vh; width: auto; margin: auto; object-fit: contain; }
#lightbox figcaption { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-family: var(--hand); font-size: 1.6rem; color: #3a2a33; }
@keyframes fade { from { opacity: 0; } }
@keyframes lbIn { from { opacity: 0; transform: scale(.7) rotate(-6deg); } }

/* ==========================================================================
   REASONS — FLIP CARDS
   ========================================================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: clamp(14px, 2vw, 24px);
  width: min(1040px, 100%);
}
.card { perspective: 1000px; height: 260px; }
.card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 1s var(--ease-back);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card:not(.flipped):hover .card-inner { transform: rotateY(12deg) rotateX(4deg) translateY(-4px); }
.card-face {
  position: absolute; inset: 0;
  border-radius: 20px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px;
  text-align: center;
  overflow: hidden;
}
.card-front {
  background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border: 1px solid var(--faint);
  backdrop-filter: blur(8px);
}
.card-front::before {
  content: "";
  position: absolute; inset: -40%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 92, 138, .25), transparent 30%);
  animation: spin 8s linear infinite;
  opacity: .6;
}
.card-front::after {
  content: "";
  position: absolute; inset: 1px;
  border-radius: 19px;
  background: linear-gradient(160deg, #1c1436, #120d26);
}
.card-front > * { position: relative; z-index: 1; }
@keyframes spin { to { transform: rotate(1turn); } }
.card-num { font-family: var(--serif); font-style: italic; font-variant-numeric: lining-nums; font-size: 4.2rem; line-height: 1; color: var(--rose-soft); }
.card-tap { margin-top: 12px; font-size: .65rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(150deg, #ff7aa2, #d63a6e 60%, #8f2a7a);
  box-shadow: 0 20px 50px -20px rgba(255, 60, 120, .6);
}
.card-back p { font-family: var(--serif); font-size: 1.35rem; line-height: 1.35; margin: 0; color: #fff; font-style: italic; }
.card-back .mini { position: absolute; top: 14px; left: 18px; font-size: .7rem; letter-spacing: .25em; color: rgba(255,255,255,.7); }

/* ==========================================================================
   LETTER — ENVELOPE
   ========================================================================== */
.envelope {
  --ew: min(360px, 82vw);
  position: relative;
  width: var(--ew); height: calc(var(--ew) * .64);
  margin-top: 60px;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .5));
  transition: transform .6s var(--ease), opacity .8s var(--ease);
}
.envelope:hover:not(.open) { transform: translateY(-6px) rotate(-1deg); }
.envelope > span { position: absolute; display: block; }
.env-back { inset: 0; background: #e8b8c4; border-radius: 6px; }
.env-paper {
  left: 6%; right: 6%; top: 6%; height: 88%;
  background: #fbf4ea;
  border-radius: 4px;
  z-index: 2;
  transition: transform 1.1s var(--ease) .5s;
  padding: 18px;
}
.env-paper-lines {
  position: absolute; inset: 22px 22px auto;
  height: 60%;
  background: repeating-linear-gradient(180deg, transparent 0 14px, rgba(160, 110, 130, .3) 14px 15px);
}
.env-front {
  inset: 0; z-index: 3;
  background: linear-gradient(160deg, #f6cfd9, #eab0c0);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  border-radius: 6px;
}
.env-flap {
  left: 0; right: 0; top: 0; height: 58%;
  z-index: 4;
  background: linear-gradient(180deg, #f2bfcc, #e3a2b4);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .8s var(--ease), z-index 0s .4s;
  border-radius: 6px 6px 0 0;
}
.env-seal {
  left: 50%; top: 58%;
  width: 54px; height: 54px;
  margin: -27px 0 0 -27px;
  z-index: 5;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ff8fb0, #c8235a 60%, #8d0f37);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .35), inset 0 -3px 6px rgba(0, 0, 0, .3);
  transition: transform .5s var(--ease), opacity .4s;
  animation: heartbeat 1.8s ease-in-out infinite;
}
.env-seal svg { width: 22px; fill: #ffe6ee; }

.envelope.open .env-seal { transform: scale(0) rotate(90deg); opacity: 0; animation: none; }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .env-paper { transform: translateY(-62%); }
.envelope.gone { opacity: 0; transform: translateY(60px) scale(.9); pointer-events: none; }

.env-hint { margin-top: 28px; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.15rem; }

.paper {
  position: relative;
  width: min(700px, 100%);
  margin-top: 10px;
  padding: clamp(32px, 6vw, 64px) clamp(24px, 6vw, 70px);
  background:
    radial-gradient(circle at 100% 0, rgba(255, 200, 210, .35), transparent 40%),
    linear-gradient(180deg, #fdf7ee, #f7ecdd);
  color: #3a2630;
  border-radius: 6px;
  box-shadow: 0 50px 100px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  transform-origin: top center;
  animation: paperIn 1.4s var(--ease) both;
}
.paper::before {
  content: "";
  position: absolute; inset: 14px;
  border: 1px solid rgba(176, 42, 91, .14);
  border-radius: 3px;
  pointer-events: none;
}
@keyframes paperIn { from { opacity: 0; transform: translateY(80px) rotateX(30deg) scale(.92); } }
.paper-body { position: relative; font-family: var(--serif); font-size: clamp(1.15rem, 2.2vw, 1.4rem); line-height: 1.7; }
.paper-body p { margin: 0 0 1.1em; }
.paper-body p:first-child { font-family: var(--script); font-size: 2.3em; line-height: 1.2; color: #b02a5b; }
.w { display: inline-block; opacity: 0; transform: translateY(8px); filter: blur(4px); animation: charIn .8s var(--ease) forwards; animation-delay: var(--t); white-space: pre; }
.sign { position: relative; text-align: right; margin: 1.5em 0 0; display: flex; flex-direction: column; align-items: flex-end; font-family: var(--serif); font-style: italic; color: #6b4a58; opacity: 0; animation: fadeUp 1s var(--ease) forwards; animation-delay: var(--t, 0s); }
.sign .script { font-style: normal; font-size: 2.8rem; color: #b02a5b; line-height: 1.1; }

/* ==========================================================================
   CAKE
   ========================================================================== */
.cake-wrap { display: flex; justify-content: center; padding-top: 90px; }
.cake { position: relative; display: flex; flex-direction: column; align-items: center; }
.tier { position: relative; border-radius: 14px 14px 10px 10px; overflow: hidden; }
.tier.top {
  width: 190px; height: 74px;
  background: linear-gradient(180deg, #ffd9e3, #f7a8bd);
  box-shadow: inset 0 -10px 20px rgba(150, 30, 70, .2);
  z-index: 2;
}
.tier.bottom {
  width: 270px; height: 96px;
  margin-top: -2px;
  background: linear-gradient(180deg, #fff1e3, #f2c9a6);
  box-shadow: inset 0 -12px 22px rgba(120, 60, 20, .2);
}
.drip {
  position: absolute; top: 0; left: 0; right: 0; height: 30px;
  background:
    radial-gradient(circle at 10px 18px, #fff 9px, transparent 10px) 0 0 / 34px 30px repeat-x,
    linear-gradient(#fff, #fff) 0 0 / 100% 14px no-repeat;
}
.tier.top .drip { background:
    radial-gradient(circle at 10px 18px, #ff5c8a 9px, transparent 10px) 0 0 / 30px 30px repeat-x,
    linear-gradient(#ff5c8a, #ff5c8a) 0 0 / 100% 14px no-repeat; }
.sprinkles {
  position: absolute; inset: 34px 10px 10px;
  background-image:
    radial-gradient(circle, #fff 1.5px, transparent 2px),
    radial-gradient(circle, var(--gold) 1.5px, transparent 2px),
    radial-gradient(circle, var(--lilac) 1.5px, transparent 2px);
  background-size: 28px 22px, 36px 26px, 22px 30px;
  background-position: 0 0, 10px 8px, 6px 14px;
  opacity: .8;
}
.plate {
  width: 330px; height: 22px; margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #fff, #cfc7d8 70%);
  box-shadow: 0 16px 30px rgba(0, 0, 0, .45);
}
.candles {
  display: flex; gap: 18px; justify-content: center; align-items: flex-end;
  position: relative; z-index: 3;
  margin-bottom: -4px;
}
.candle {
  position: relative;
  width: 12px; height: 58px;
  border-radius: 3px 3px 0 0;
  background: repeating-linear-gradient(-45deg, #fff 0 6px, var(--rose) 6px 12px);
  cursor: pointer;
  box-shadow: inset -2px 0 3px rgba(0, 0, 0, .15);
}
.candle::before { /* wick */
  content: ""; position: absolute; left: 50%; top: -8px;
  width: 2px; height: 9px; margin-left: -1px;
  background: #3a2a2a; border-radius: 1px;
}
.flame {
  position: absolute; left: 50%; bottom: calc(100% + 4px);
  width: 16px; height: 30px; margin-left: -8px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 80%, #fff 0 20%, #ffe58a 35%, #ff9a3c 65%, rgba(255, 80, 40, 0) 75%);
  transform-origin: 50% 90%;
  animation: flicker 1.4s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 10px rgba(255, 180, 80, .9)) drop-shadow(0 0 24px rgba(255, 120, 60, .6));
  transition: transform .35s ease, opacity .35s ease;
}
.candle:nth-child(2n) .flame { animation-duration: 1.1s; }
.candle:nth-child(3n) .flame { animation-duration: 1.7s; }
@keyframes flicker {
  0%   { transform: scale(1, 1) rotate(-2deg); }
  25%  { transform: scale(.95, 1.08) rotate(2deg); }
  50%  { transform: scale(1.04, .94) rotate(-1deg); }
  75%  { transform: scale(.97, 1.05) rotate(3deg); }
  100% { transform: scale(1.02, 1) rotate(-3deg); }
}
.candle.out .flame { transform: scale(0, .3); opacity: 0; animation: none; }
.smoke {
  position: absolute; left: 50%; bottom: calc(100% + 4px);
  width: 8px; height: 8px; margin-left: -4px;
  border-radius: 50%;
  background: rgba(220, 220, 230, .5);
  filter: blur(3px);
  animation: smoke 2.2s ease-out forwards;
}
@keyframes smoke {
  from { opacity: .8; transform: translate(0, 0) scale(1); }
  to   { opacity: 0; transform: translate(var(--sx, 10px), -90px) scale(4); }
}
.cake-glow {
  position: absolute; left: 50%; top: -80px;
  width: 360px; height: 260px; margin-left: -180px;
  background: radial-gradient(ellipse at center, rgba(255, 190, 110, .25), transparent 65%);
  pointer-events: none;
  transition: opacity 1s;
}
.cake.dark .cake-glow { opacity: 0; }

.wish-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 40px; }
.wish-hint { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--muted); }

.btn {
  padding: 12px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose), #c2347a);
  color: #fff;
  font-size: .85rem;
  letter-spacing: .08em;
  box-shadow: 0 10px 30px -8px rgba(255, 60, 120, .6);
  transition: transform .3s var(--ease), box-shadow .3s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 36px -8px rgba(255, 60, 120, .8); }
.btn.ghost { background: transparent; border: 1px solid var(--faint); box-shadow: none; color: var(--muted); }
.btn.ghost:hover { border-color: var(--rose-soft); color: var(--ink); }

.finale { text-align: center; margin-top: 40px; position: relative; z-index: 45; }
.finale-title { font-size: clamp(4rem, 14vw, 9rem); line-height: 1.1; margin: 0; padding: 0 .2em; animation: nameIn 1.8s var(--ease) both, shimmer 7s linear 1.8s infinite; filter: blur(14px); opacity: 0; }
.finale-msg { font-family: var(--serif); font-style: italic; font-size: clamp(1.3rem, 3vw, 1.9rem); max-width: 30ch; margin: 1rem auto; opacity: 0; animation: fadeUp 1.4s var(--ease) 1.2s forwards; }
.finale-sign { color: var(--rose-soft); font-family: var(--serif); font-size: 1.3rem; opacity: 0; animation: fadeUp 1.2s var(--ease) 2s forwards; }
.finale .btn { margin-top: 1.5rem; opacity: 0; animation: fadeUp 1s var(--ease) 3s forwards; }

.confetti {
  position: fixed; top: -20px;
  width: 9px; height: 14px;
  z-index: 46;
  pointer-events: none;
  animation: confetti linear forwards;
}
@keyframes confetti {
  to { transform: translate(var(--cx), 110vh) rotate(var(--cr)) rotateY(720deg); }
}

/* ==========================================================================
   FOOTER, MUSIC
   ========================================================================== */
.foot { position: relative; z-index: 1; text-align: center; padding: 40px 16px 60px; color: var(--muted); font-family: var(--serif); font-style: italic; }

#musicBtn {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 65;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 15, 43, .7);
  border: 1px solid var(--faint);
  backdrop-filter: blur(10px);
}
.bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.bars i { width: 3px; height: 100%; background: var(--rose-soft); border-radius: 2px; transform-origin: bottom; animation: bar 1s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: .2s; }
.bars i:nth-child(3) { animation-delay: .4s; }
.bars i:nth-child(4) { animation-delay: .1s; }
#musicBtn.paused .bars i { animation: none; transform: scaleY(.25); }
@keyframes bar { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr; }
  .tl-line { left: 14px; }
  .tl-item { grid-template-columns: 1fr; gap: 28px; padding-left: 44px; }
  .tl-item::after { left: 14px; top: 0; }
  .tl-item .tl-media, .tl-item.flip .tl-media { order: 0 !important; justify-content: flex-start; }
  .tl-media .polaroid { --from: 0px !important; width: min(300px, 100%); }
  .city { font-size: 34px; }
  .city-sub { font-size: 15px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { height: 220px; }
  .card-back p { font-size: 1.1rem; }
  .card-num { font-size: 3.2rem; }
  .tier.bottom { width: 240px; }
  .plate { width: 290px; }
}
@media (max-width: 400px) {
  .cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .3s !important; }
  html { scroll-behavior: auto; }
}
