:root {
  --night-1: #12061f;
  --night-2: #2a0b3d;
  --night-3: #5b1650;
  --rose: #ff6f9f;
  --hot: #ff4f8b;
  --blush: #ffb3cd;
  --gold: #ffd58a;
  --cream: #fff6ef;
  --ink: #5b2337;
  --text: #fff3f7;
  --muted: rgba(255, 232, 242, 0.74);
  --script: "Great Vibes", cursive;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Quicksand", system-ui, sans-serif;
  --hand: "Dancing Script", cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 60% at 50% 115%, #8a1f5c 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 85% 0%, rgba(120, 40, 140, 0.45), transparent 70%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
  background-color: var(--night-1);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
}

canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#sky { z-index: 0; }
#fx { z-index: 1; }

button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- Scenes ---------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: max(64px, calc(env(safe-area-inset-top) + 56px)) max(16px, env(safe-area-inset-right)) max(32px, calc(env(safe-area-inset-bottom) + 20px)) max(16px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.05);
  filter: blur(10px);
  transition: opacity 0.8s ease, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.8s ease, visibility 0s linear 0.9s;
}
.scene.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  filter: none;
  transition: opacity 1s ease 0.3s, transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s, filter 1s ease 0.3s, visibility 0s;
}
.scene.leaving { transform: scale(0.94); }

.inner {
  margin: auto;
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
}

.scene.active .rv {
  animation: rise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--d, 0) * 1s + 0.5s);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); filter: blur(6px); }
}

/* ---------- Type ---------- */
.script {
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(40px, min(10vw, 11vh), 92px);
  line-height: 1.15;
  padding: 0 0.2em;
  background: linear-gradient(90deg, var(--blush), var(--gold), #fff, var(--blush));
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 111, 159, 0.4));
  animation: shimmer 7s linear infinite;
}
@keyframes shimmer { to { background-position: 300% center; } }

.eyebrow {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(17px, 2.8vw, 23px);
  color: var(--muted);
  letter-spacing: 0.03em;
}
.sub {
  font-family: var(--serif);
  font-size: clamp(17px, 3.4vw, 21px);
  line-height: 1.6;
  color: var(--muted);
  max-width: 34ch;
}
.hint { font-size: 14px; color: var(--muted); letter-spacing: 0.06em; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 50px;
  padding: 14px 30px;
  border: 0;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #ff86b0, var(--hot) 55%, #d63384);
  box-shadow: 0 12px 34px -10px rgba(255, 79, 139, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 6px;
}
@media (hover: hover) { .btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -10px rgba(255, 79, 139, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.4); } }
.btn:active { transform: scale(0.96); }
.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn:focus-visible, .gift:focus-visible, .envelope:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Lock countdown ---------- */
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 84px)); gap: 8px; justify-content: center; width: 100%; }
.unit {
  padding: 14px 4px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.unit b { display: block; font-family: var(--serif); font-weight: 500; font-size: clamp(24px, 7vw, 34px); color: #fff; font-variant-numeric: tabular-nums; }
.unit span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }

/* ---------- Intro heart ---------- */
.gift {
  position: relative;
  width: 170px;
  height: 170px;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.gift svg {
  position: relative;
  z-index: 1;
  width: 112px;
  height: 112px;
  filter: drop-shadow(0 0 26px rgba(255, 79, 139, 0.85));
  animation: beat 1.4s ease-in-out infinite;
}
.gift .ring {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 150, 190, 0.6);
  animation: ripple 2.7s ease-out infinite;
}
.gift .ring:nth-child(2) { animation-delay: 0.9s; }
.gift .ring:nth-child(3) { animation-delay: 1.8s; }
.gift.opening svg { animation: bloom 0.9s ease forwards; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  60% { transform: scale(1); }
}
@keyframes ripple { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.9); opacity: 0; } }
@keyframes bloom { to { transform: scale(6); opacity: 0; } }

/* ---------- 3-2-1 ---------- */
.big-count {
  font-family: var(--serif);
  font-size: clamp(110px, min(32vw, 40vh), 280px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 40px rgba(255, 111, 159, 0.9), 0 0 100px rgba(255, 111, 159, 0.5);
  opacity: 0;
}
.big-count.pop { animation: countPop 1s ease both; }
@keyframes countPop {
  0% { transform: scale(2.3); opacity: 0; filter: blur(12px); }
  25% { transform: scale(1); opacity: 1; filter: none; }
  75% { opacity: 1; }
  100% { transform: scale(0.6); opacity: 0; }
}

/* ---------- Happy Birthday ---------- */
.hbd {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(42px, min(12vw, 14vh), 124px);
  line-height: 1.05;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.32em;
}
.hbd .word { display: inline-flex; }
.hbd .ch {
  display: inline-block;
  background: linear-gradient(180deg, #fff 10%, var(--blush) 55%, var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 20px rgba(255, 111, 159, 0.55));
  opacity: 0;
  animation: drop 0.9s cubic-bezier(0.3, 1.6, 0.5, 1) forwards, wave 2.8s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.07s + 0.5s), calc(var(--i) * 0.11s + 2s);
}
@keyframes drop {
  from { opacity: 0; transform: translateY(-90px) rotate(-25deg) scale(0.3); }
  to { opacity: 1; transform: none; }
}
@keyframes wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.name { font-size: clamp(52px, min(13vw, 14vh), 116px); }

/* ---------- Cake ---------- */
.cake-wrap {
  --w: min(74vw, 300px, 52vh);
  position: relative;
  width: var(--w);
  margin: 10px auto 6px;
  padding-top: 78px;
}
.cake-wrap::after {
  content: "";
  position: absolute;
  left: -30%;
  right: -30%;
  top: -10%;
  bottom: -10%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 190, 120, 0.25), transparent);
  transition: opacity 1s;
}
.cake-wrap.dark::after { opacity: 0.2; }
.candles {
  position: absolute;
  left: 17%;
  right: 17%;
  top: 10px;
  height: 78px;
  z-index: 2;
  display: flex;
  justify-content: space-evenly;
  align-items: flex-end;
}
.candle {
  position: relative;
  width: 12px;
  height: 52px;
  border: 0;
  border-radius: 3px 3px 2px 2px;
  background: repeating-linear-gradient(135deg, #fff 0 6px, #ff8fb4 6px 12px);
  box-shadow: inset -3px 0 4px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}
.candle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 2px;
  height: 9px;
  border-radius: 1px;
  background: #3b2a2a;
  transform: translateX(-50%);
}
.candle::after { content: ""; position: absolute; inset: -40px -10px -4px; } /* bigger tap target */
.flame {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  width: 14px;
  height: 26px;
  margin-left: -7px;
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  background: radial-gradient(ellipse at 50% 80%, #fff 0 18%, #ffe28a 35%, #ff9a3c 62%, rgba(255, 80, 40, 0) 74%);
  transform-origin: 50% 90%;
  animation: flicker 0.9s ease-in-out infinite;
  transition: opacity 0.35s, transform 0.35s;
}
.flame::after {
  content: "";
  position: absolute;
  inset: -24px -28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 100, 0.45), transparent 65%);
}
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(-2deg); }
  25% { transform: scale(0.92, 1.08) rotate(2deg); }
  50% { transform: scale(1.05, 0.95) rotate(-1deg); }
  75% { transform: scale(0.95, 1.05) rotate(1.5deg); }
}
.candle.out .flame { animation: none; opacity: 0; transform: scale(0.2) translateY(-8px); }
.smoke {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: rgba(225, 220, 235, 0.55);
  filter: blur(3px);
  pointer-events: none;
  animation: smoke 1.8s ease-out both;
}
@keyframes smoke { to { transform: translate(var(--sx), -80px) scale(3.6); opacity: 0; } }

.cake { position: relative; display: flex; flex-direction: column; align-items: center; }
.tier {
  position: relative;
  border-radius: 14px 14px 10px 10px;
  box-shadow: inset 0 -12px 20px rgba(120, 30, 70, 0.25);
}
.tier.top { width: 72%; height: 80px; background: linear-gradient(90deg, #f3b6cb, #ffdbe7 42%, #eda5bf); z-index: 1; }
.tier.bottom { width: 100%; height: 98px; margin-top: -2px; background: linear-gradient(90deg, #8e4561, #b86584 42%, #82395a); }
.frost {
  position: absolute;
  left: -3px;
  right: -3px;
  top: -4px;
  height: 24px;
  border-radius: 14px 14px 0 0;
  background: #fff7fa;
}
.frost::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 14px;
  background: radial-gradient(circle at 10px 0, #fff7fa 9px, transparent 10px) 0 0 / 20px 14px repeat-x;
}
.sprinkles { position: absolute; inset: 36px 10px 10px; }
.sprinkles i {
  position: absolute;
  width: 8px;
  height: 3px;
  border-radius: 2px;
}
.plate {
  width: 122%;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: linear-gradient(#fff, #d9cfe0);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

/* ---------- Polaroids ---------- */
.polaroids {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px 16px;
  padding: 14px 0 8px;
  max-width: 900px;
}
.polaroid {
  position: relative;
  width: min(200px, calc(50% - 8px));
  padding: 10px 10px 0;
  border-radius: 4px;
  background: #fffdf9;
  box-shadow: 0 20px 40px -14px rgba(0, 0, 0, 0.6);
  transform: rotate(var(--r));
  cursor: pointer;
  transition: transform 0.35s ease;
}
.polaroid::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 62px;
  height: 20px;
  transform: translateX(-50%) rotate(-4deg);
  background: rgba(255, 220, 232, 0.7);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
@media (hover: hover) { .polaroid:hover { transform: rotate(0deg) scale(1.05); z-index: 2; } }
.polaroid:active { transform: rotate(0deg) scale(0.98); }
.scene.active .polaroid {
  animation: dealIn 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
  animation-delay: calc(var(--i) * 0.15s + 0.7s);
}
@keyframes dealIn {
  from { opacity: 0; transform: translateY(80px) rotate(calc(var(--r) * -3)) scale(0.7); }
}
.ph {
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 44px;
  background: linear-gradient(135deg, #ffc3d6, #d6b4ff);
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid figcaption {
  padding: 10px 4px 12px;
  font-family: var(--hand);
  font-size: clamp(15px, 4.2vw, 19px);
  line-height: 1.2;
  color: var(--ink);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 3, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, visibility 0s linear 0.35s;
}
.lightbox.open { opacity: 1; visibility: visible; transition: opacity 0.35s; }
.lightbox figure {
  width: min(92vw, 520px, 68vh);
  padding: 14px 14px 0;
  border-radius: 4px;
  background: #fffdf9;
  transform: scale(0.85) rotate(-3deg);
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.lightbox.open figure { transform: none; }
.lb-media { display: grid; place-items: center; aspect-ratio: 1 / 1; max-height: 70vh; overflow: hidden; background: linear-gradient(135deg, #ffc3d6, #d6b4ff); font-size: 110px; }
.lb-media img { width: 100%; height: 100%; object-fit: cover; }
.lightbox figcaption { padding: 14px 6px 18px; text-align: center; font-family: var(--hand); font-size: 26px; color: var(--ink); }

/* ---------- Reasons ---------- */
.card-holder { width: min(100%, 460px); perspective: 1000px; }
.reason-card {
  position: relative;
  min-height: 230px;
  padding: 34px 22px 46px;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 60px -22px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.reason-card.swap { animation: cardSwap 0.7s ease; }
@keyframes cardSwap {
  45% { transform: rotateY(90deg) scale(0.94); opacity: 0.2; }
  55% { transform: rotateY(-90deg) scale(0.94); opacity: 0.2; }
}
.reason-num { font-family: var(--serif); font-style: italic; font-size: 15px; letter-spacing: 0.22em; color: var(--gold); text-transform: uppercase; }
.reason-text { font-family: var(--serif); font-size: clamp(21px, 4.8vw, 27px); line-height: 1.45; color: #fff; }
.reason-heart { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: var(--rose); font-size: 18px; animation: beat 1.4s infinite; }
.dots { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); transition: background 0.3s, transform 0.3s; }
.dots span.on { background: var(--rose); transform: scale(1.25); box-shadow: 0 0 10px var(--rose); }

/* ---------- Letter ---------- */
.env-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.envelope {
  --ew: min(82vw, 340px, 60vh);
  position: relative;
  width: var(--ew);
  height: calc(var(--ew) * 0.64);
  margin: min(70px, 12vh) auto 6px;
  cursor: pointer;
  perspective: 900px;
}
.scene.active .envelope:not(.open) { animation: rise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) backwards calc(0.25s + 0.5s), floaty 3.4s ease-in-out 1.8s infinite; }
@keyframes floaty { 50% { transform: translateY(-10px) rotate(-1deg); } }
.env-back { position: absolute; inset: 0; border-radius: 10px; background: #c9607e; box-shadow: 0 34px 60px -20px rgba(0, 0, 0, 0.65); }
.env-letter {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 7%;
  bottom: 6%;
  z-index: 1;
  display: grid;
  place-items: start center;
  padding-top: 12%;
  border-radius: 6px;
  background: var(--cream);
  font-family: var(--script);
  font-size: 30px;
  color: var(--ink);
  transition: transform 0.9s cubic-bezier(0.3, 0.8, 0.3, 1) 0.55s;
}
.env-front {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 10px;
  background: linear-gradient(160deg, #f29bb2, #dc7896);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}
.env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 60%;
  z-index: 3;
  background: linear-gradient(180deg, #f8b6c8, #e88aa4);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 0.7s ease, z-index 0s linear 0.35s;
}
.seal {
  position: absolute;
  left: 50%;
  top: 57%;
  z-index: 4;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #ffe3ec;
  background: radial-gradient(circle at 35% 30%, #ff7c9f, #b8174d);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: opacity 0.35s, transform 0.35s;
}
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .seal { opacity: 0; transform: scale(0.3); }
.envelope.open .env-letter { transform: translateY(-58%); }

.paper {
  position: relative;
  width: min(100%, 580px);
  padding: 34px clamp(18px, 5vw, 28px) 30px;
  border-radius: 10px;
  text-align: left;
  color: var(--ink);
  font-family: var(--hand);
  font-size: clamp(19px, 4.8vw, 25px);
  line-height: 34px;
  background:
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(214, 120, 150, 0.22) 33px 34px) 0 30px / 100% calc(100% - 60px) no-repeat,
    var(--cream);
  box-shadow: 0 34px 70px -24px rgba(0, 0, 0, 0.7);
  animation: unfold 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  user-select: text;
  -webkit-user-select: text;
}
.paper #letterText { display: inline; white-space: pre-wrap; }
@keyframes unfold { from { opacity: 0; transform: translateY(40px) scaleY(0.6); filter: blur(4px); } }
.caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--hot); animation: blink 0.8s steps(1) infinite; }
.caret.done { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.sign { margin-top: 18px; text-align: right; font-family: var(--script); font-size: 34px; color: var(--hot); animation: rise 1s both; }

/* ---------- Finale ---------- */
.heart-anchor {
  position: relative;
  width: min(84vw, 420px, 52vh);
  aspect-ratio: 1.1 / 1;
  display: grid;
  place-items: center;
}
.finale-name { font-size: clamp(40px, min(12vw, 8vh), 96px); transform: translateY(-6%); }
.finale-msg { max-width: 40ch; }

/* ---------- Floating tap hearts ---------- */
.pop-heart {
  position: fixed;
  z-index: 55;
  left: 0;
  top: 0;
  pointer-events: none;
  font-size: var(--s);
  color: var(--c);
  text-shadow: 0 0 10px currentColor;
  animation: fly 1.2s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes fly {
  from { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  to { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1) rotate(var(--rot)); opacity: 0; }
}

/* ---------- Music button ---------- */
.music-btn {
  position: fixed;
  z-index: 70;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
}
.music-btn span { width: 3px; height: 6px; border-radius: 2px; background: var(--blush); }
.music-btn.on span { animation: eq 0.9s ease-in-out infinite; }
.music-btn.on span:nth-child(2) { animation-delay: -0.3s; }
.music-btn.on span:nth-child(3) { animation-delay: -0.6s; }
.music-btn.on span:nth-child(4) { animation-delay: -0.15s; }
@keyframes eq { 50% { height: 18px; } }

/* ---------- Open when… ---------- */
.ow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(100%, 640px);
  padding: 8px 0;
}
@media (min-width: 640px) { .ow-grid { grid-template-columns: repeat(3, 1fr); } }
.ow-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 132px;
  padding: 26px 10px 16px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(160deg, #fff0f4, #ffc9d9);
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.6);
  transform: rotate(var(--r));
  transition: transform 0.25s ease, opacity 0.3s;
}
.ow-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 52%;
  background: linear-gradient(180deg, #ffb3c9, #f59ab5);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  opacity: 0.6;
}
.scene.active .ow-card { animation: dealIn 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards; animation-delay: calc(var(--i) * 0.12s + 0.6s); }
.ow-card:active { transform: scale(0.96); }
@media (hover: hover) { .ow-card:hover { transform: rotate(0deg) translateY(-4px); } }
.ow-emoji { position: relative; font-size: 30px; line-height: 1.2; }
.ow-k { position: relative; font-size: 10px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.65; }
.ow-t { position: relative; font-family: var(--hand); font-size: clamp(18px, 4.8vw, 21px); line-height: 1.15; }
.ow-card.opened { opacity: 0.72; }
.ow-card.opened::after {
  content: "opened ♥";
  position: absolute;
  top: 7px;
  right: 9px;
  font-size: 10px;
  font-weight: 600;
  color: var(--hot);
}

.note {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 3, 18, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, visibility 0s linear 0.35s;
}
.note.open { opacity: 1; visibility: visible; transition: opacity 0.35s; }
.note-card {
  width: min(100%, 420px);
  max-height: 100%;
  overflow-y: auto;
  padding: 28px 22px 24px;
  border-radius: 14px;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.7);
  transform: translateY(40px) scale(0.9) rotate(2deg);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.note.open .note-card { transform: none; }
.note-emoji { font-size: 46px; }
.note-title { margin-top: 4px; font-family: var(--script); font-size: clamp(32px, 9vw, 40px); line-height: 1.1; color: var(--hot); }
.note-text { margin: 12px 0 20px; font-family: var(--hand); font-size: clamp(20px, 5.4vw, 23px); line-height: 1.45; }

/* ---------- When we meet ---------- */
.pill {
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  color: var(--gold);
  background: rgba(255, 213, 138, 0.1);
  border: 1px solid rgba(255, 213, 138, 0.35);
}
.promises { list-style: none; display: flex; flex-direction: column; gap: 10px; width: min(100%, 480px); }
.scene.active .promise-li { animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--i) * 0.1s + 0.7s); }
.promise {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border-radius: 16px;
  text-align: left;
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 0.3s, border-color 0.3s, transform 0.2s;
}
.promise:active { transform: scale(0.98); }
.promise .box {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.promise.done { background: rgba(255, 111, 159, 0.18); border-color: rgba(255, 111, 159, 0.6); }
.promise.done .box { background: var(--hot); border-color: var(--hot); transform: scale(1.12); }
.promise.done .box::after { content: "✓"; }
.sealed { font-family: var(--script); font-size: clamp(36px, 9vw, 46px); color: var(--gold); animation: rise 1s both; }

/* ---------- Hug ---------- */
.hug-wrap { width: min(100%, 340px); }
.btn.hug {
  position: relative;
  overflow: hidden;
  width: 100%;
  touch-action: none;
  -webkit-touch-callout: none;
}
.hug-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.5));
  transform-origin: left;
  transform: scaleX(var(--p, 0));
}
.hug-label { position: relative; }
.btn.hug.holding { animation: hugShake 0.4s ease-in-out infinite; }
@keyframes hugShake { 50% { transform: scale(1.03); } }

.toast {
  position: fixed;
  z-index: 65;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  background: rgba(40, 12, 50, 0.85);
  border: 1px solid rgba(255, 179, 205, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Small & landscape phones ---------- */
@media (max-width: 360px) {
  .inner { gap: 14px; }
  .btn { padding: 13px 22px; font-size: 15px; }
  .gift { width: 140px; height: 140px; }
  .gift svg { width: 92px; height: 92px; }
  .reason-card { min-height: 200px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .scene { padding-top: 56px; }
  .inner { gap: 12px; }
  .gift { width: 120px; height: 120px; }
  .gift svg { width: 80px; height: 80px; }
  .polaroid { width: min(170px, calc(25% - 12px)); }
}

@media (prefers-reduced-motion: reduce) {
  .hbd .ch { animation: drop 0.01s forwards; }
  .gift svg, .reason-heart, .flame { animation-duration: 3s; }
}
