/* ───────────── Themes ───────────── */
:root,
[data-theme="blush"] {
  --day-1: #ffd6e0; --day-2: #ffe9ef; --day-3: #fff6e9;
  --night-1: #160d2e; --night-2: #3a1f55; --night-3: #6b2d5c;
  --accent: #ff4d79; --accent-2: #ff8fab; --accent-3: #ffc2d1;
  --ink-day: #5a2338; --muted-day: #9b5a72;
  --glass: rgba(255, 255, 255, .55); --glass-border: rgba(255, 255, 255, .8);
  --paper: #fffaf3; --night: 0;
}
[data-theme="lavender"] {
  --day-1: #e7d7ff; --day-2: #f3eaff; --day-3: #ffe9f3;
  --night-1: #0f0c29; --night-2: #302b63; --night-3: #5b3f8c;
  --accent: #9d4edd; --accent-2: #c77dff; --accent-3: #e0c3fc;
  --ink-day: #3c2560; --muted-day: #7d62a3;
}
[data-theme="midnight"] {
  --day-1: #3a2a5d; --day-2: #5b3a70; --day-3: #8a4f7d;
  --night-1: #07061a; --night-2: #1b1240; --night-3: #3d1a4f;
  --accent: #ff4d79; --accent-2: #ff8fab; --accent-3: #ffc2d1;
  --ink-day: #fff4f8; --muted-day: #f3c4d6;
  --glass: rgba(255, 255, 255, .14); --glass-border: rgba(255, 255, 255, .3);
}

:root {
  --ink: var(--ink-day);
  --muted: var(--muted-day);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --script: 'Pacifico', 'Dancing Script', cursive;
  --hand: 'Caveat', 'Comic Sans MS', cursive;
}
body.is-night { --ink: #fff4f8; --muted: #e9c6dc; --glass: rgba(255,255,255,.12); --glass-border: rgba(255,255,255,.28); }

/* ───────────── Base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--night-1);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  transition: color .8s;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: .82rem; margin: .2rem 0; }

.sky { position: fixed; inset: 0; z-index: 0; transition: opacity 1.4s ease; }
.sky-day { background: radial-gradient(120% 80% at 50% 0%, var(--day-3), transparent 60%), linear-gradient(180deg, var(--day-1), var(--day-2) 55%, var(--day-3)); }
.sky-night { background: radial-gradient(90% 60% at 50% 110%, var(--night-3), transparent 70%), linear-gradient(180deg, var(--night-1), var(--night-2)); opacity: 0; }
body.is-night .sky-night { opacity: 1; }
#bg, #fx { position: fixed; inset: 0; pointer-events: none; }
#bg { z-index: 1; }
#fx { z-index: 50; }

/* ───────────── Stage & chapters ───────────── */
#stage { position: fixed; inset: 0; z-index: 10; }
.chapter {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(.6rem, 2.2vh, 1.2rem);
  padding: calc(64px + var(--safe-t)) calc(16px + var(--safe-r)) calc(28px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  transition: opacity .6s ease, transform .6s ease;
}
/* Spacers keep content centered but scrollable when it's taller than the screen. */
.chapter::before, .chapter::after { content: ''; flex: 1 0 0; }
.chapter:not(.ch-lock) { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.chapter.entering { opacity: 0; transform: translateY(24px) scale(.98); }
.chapter.leaving { opacity: 0; transform: translateY(-24px) scale(.98); pointer-events: none; }

.title {
  font-weight: 700;
  font-size: clamp(1.45rem, 5.6vw, 2.4rem);
  line-height: 1.25;
  margin: 0;
  max-width: 20ch;
  text-wrap: balance;
}
.title.script, .big-line { font-family: var(--script); font-weight: 400; }
.sub { margin: 0; font-size: clamp(1rem, 3.8vw, 1.25rem); color: var(--muted); max-width: 32ch; text-wrap: balance; }
.label { font-weight: 600; margin: 0; }

/* ───────────── Buttons & cards ───────────── */
.btn {
  -webkit-appearance: none; appearance: none;
  border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 48px; padding: .8em 1.5em;
  border-radius: 999px; font-weight: 700; font-size: 1.05rem;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s, background .25s;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.btn:active { transform: scale(.95); }
.btn:focus-visible { outline: 3px solid var(--accent-3); outline-offset: 3px; }
.btn:disabled { opacity: .7; cursor: default; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px -6px rgba(255, 77, 121, .5), inset 0 1px 0 rgba(255,255,255,.4);
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--accent) 65%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn-ghost { background: var(--glass); border: 1.5px solid var(--glass-border); color: var(--ink); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-lg { font-size: clamp(1.05rem, 4vw, 1.25rem); padding: .9em 1.8em; min-height: 54px; }
.btn-sm { min-height: 42px; padding: .55em 1.2em; font-size: .98rem; }
.card.glass {
  background: var(--glass); border: 1.5px solid var(--glass-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 28px; padding: clamp(1.2rem, 5vw, 2rem);
  box-shadow: 0 20px 60px -20px rgba(120, 30, 70, .35);
}

/* ───────────── HUD ───────────── */
#hud {
  position: fixed; z-index: 40; top: calc(10px + var(--safe-t)); left: 0; right: 0;
  display: flex; justify-content: center; align-items: center; pointer-events: none;
  padding: 0 calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
}
#progress { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-width: 70vw; }
#progress i { width: 14px; height: 14px; display: block; opacity: .35; transition: opacity .5s, transform .5s; }
#progress i::before { content: '♥'; font-style: normal; font-size: 14px; line-height: 14px; color: var(--accent); }
#progress i.on { opacity: 1; transform: scale(1.15); }
#mute {
  position: absolute; right: calc(12px + var(--safe-r)); top: 0;
  width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--glass-border);
  background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  pointer-events: auto; cursor: pointer; font-size: 1.1rem; display: grid; place-items: center; padding: 0;
}
#moon {
  position: fixed; z-index: 39; top: calc(6px + var(--safe-t)); left: calc(10px + var(--safe-l));
  background: none; border: 0; font-size: 2rem; cursor: pointer; padding: 6px;
  filter: drop-shadow(0 0 12px rgba(255, 240, 200, .8));
  opacity: 0; pointer-events: none; transition: opacity 1s;
}
body.is-night #moon { opacity: 1; pointer-events: auto; }

/* ───────────── Mascot ───────────── */
.mascot { flex-shrink: 0; }
.mascot-md { width: clamp(150px, 42vw, 230px); }
.mascot-lg { width: clamp(190px, 58vw, 320px); }
.mascot-svg { width: 100%; height: auto; display: block; overflow: visible; animation: bob 2.6s ease-in-out infinite; }
.m-her { animation: bob 2.6s ease-in-out -.6s infinite; }
.arm-wave { transform-origin: 90px 108px; animation: wave 1s ease-in-out infinite; }
.float-heart { animation: floaty 1.6s ease-in-out infinite; transform-origin: 130px 30px; }
.tear { animation: tear 1.4s ease-in infinite; }
.shake { animation: shake .5s ease; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-28deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.15); } }
@keyframes tear { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(14px); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* ───────────── Lock ───────────── */
.lock-card { display: flex; flex-direction: column; align-items: center; gap: .9rem; width: min(100%, 400px); }
.sign { font-size: clamp(1.15rem, 4.5vw, 1.4rem); }
.sign b { font-family: var(--script); font-weight: 400; color: var(--accent); }
.lock-form { display: flex; flex-direction: column; align-items: center; gap: .8rem; width: 100%; }
.pin-input, .text-input {
  width: 100%; max-width: 280px; text-align: center;
  font: 700 1.6rem var(--font); color: var(--ink);
  padding: .55em .8em; border-radius: 18px;
  border: 2px solid var(--glass-border); background: rgba(255, 255, 255, .7);
  outline: none; transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.pin-input { letter-spacing: .25em; }
.text-input { font-size: 1.2rem; }
.pin-input:focus, .text-input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 30%, transparent); }
.lock-msg { min-height: 1.4em; margin: 0; font-weight: 600; }

/* ───────────── Intro / countdown ───────────── */
.intro-text { display: flex; flex-direction: column; gap: 1rem; max-width: 30ch; }
.type-line { margin: 0; font-size: clamp(1.15rem, 4.6vw, 1.6rem); min-height: 1.3em; }
.type-line.big-line { font-size: clamp(2rem, 9vw, 3.4rem); }
.typing::after { content: '|'; margin-left: 2px; animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.countdown { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.cd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(.4rem, 2vw, .9rem); }
.cd-grid div { background: var(--glass); border: 1.5px solid var(--glass-border); border-radius: 18px; padding: .7rem .4rem; min-width: clamp(64px, 18vw, 96px); }
.cd-grid b { display: block; font-size: clamp(1.6rem, 7vw, 2.6rem); font-variant-numeric: tabular-nums; }
.cd-grid span { font-size: .8rem; color: var(--muted); }

/* ───────────── Ready (Yes/No) ───────────── */
.yn { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 90px; }
.yn .yes { position: relative; z-index: 2; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.yn .no { z-index: 30; transition: left .25s ease, top .25s ease, transform .25s; white-space: nowrap; }
.ready-msg { min-height: 1.2em; }

/* ───────────── Gift box ───────────── */
.giftbox {
  --s: clamp(160px, 46vw, 240px);
  position: relative; width: var(--s); height: var(--s);
  background: none; border: 0; cursor: pointer; padding: 0; margin: 1.5rem 0 .5rem;
  animation: bob 2.4s ease-in-out infinite;
}
.gb-body { position: absolute; left: 6%; right: 6%; bottom: 0; height: 66%; border-radius: 10px; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: inset 0 -12px 0 rgba(0,0,0,.08), 0 18px 40px -12px rgba(150, 30, 80, .5); }
.gb-ribbon { position: absolute; left: 50%; width: 16%; transform: translateX(-50%); bottom: 0; height: 66%; background: #ffd166; z-index: 1; }
.gb-lid { position: absolute; left: 0; right: 0; top: 22%; height: 18%; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); z-index: 3; transition: transform .8s cubic-bezier(.3, 1.5, .6, 1), opacity .8s; box-shadow: 0 6px 12px -4px rgba(0,0,0,.2); }
.gb-lid::after { content: ''; position: absolute; left: 50%; width: 16%; transform: translateX(-50%); top: 0; bottom: 0; background: #ffd166; }
.gb-bow { position: absolute; left: 50%; bottom: 92%; transform: translateX(-50%); width: 60%; height: 50%; }
.gb-bow i { position: absolute; bottom: 0; width: 46%; height: 100%; border: 7px solid #ffd166; border-radius: 50% 50% 10% 50%; }
.gb-bow i:first-child { left: 2%; transform: rotate(-25deg); }
.gb-bow i:last-child { right: 2%; transform: rotate(25deg) scaleX(-1); }
.gb-rays { position: absolute; inset: -60%; z-index: -1; opacity: 0; background: repeating-conic-gradient(from 0deg, rgba(255, 230, 150, .55) 0 10deg, transparent 10deg 30deg); border-radius: 50%; mask-image: radial-gradient(closest-side, #000 30%, transparent); -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent); transition: opacity .8s; }
.giftbox.wobble { animation: wobble .6s ease; }
.giftbox.shake { animation: shakeBig .7s ease; }
.giftbox.open { animation: none; }
.giftbox.open .gb-lid { transform: translateY(-160%) rotate(-25deg); opacity: 0; }
.giftbox.open .gb-rays { opacity: 1; animation: spin 10s linear infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes shakeBig { 0%, 100% { transform: translate(0) rotate(0); } 15% { transform: translate(-8px, -4px) rotate(-10deg); } 30% { transform: translate(8px, 2px) rotate(10deg); } 45% { transform: translate(-6px, -6px) rotate(-8deg); } 60% { transform: translate(6px, 0) rotate(8deg); } 80% { transform: translate(-3px, -2px) rotate(-3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
.gift-msg { min-height: 1.4em; }

/* ───────────── Cake ───────────── */
.cake-wrap { --w: clamp(230px, 68vw, 340px); width: var(--w); position: relative; touch-action: none; margin-top: 1.2rem; user-select: none; -webkit-user-select: none; }
.candles { display: flex; justify-content: center; align-items: flex-end; gap: clamp(6px, 2.4vw, 14px); flex-wrap: wrap; padding: 0 12%; position: relative; z-index: 2; margin-bottom: -6px; min-height: 90px; }
.candle { position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 26px 4px 0; }
.candle .stick { width: 10px; height: 46px; border-radius: 3px; background: repeating-linear-gradient(45deg, #fff 0 6px, var(--accent-2) 6px 12px); box-shadow: inset -2px 0 0 rgba(0,0,0,.08); }
.candle.digit .num { font-family: var(--script); font-size: 64px; line-height: 1; color: var(--accent-2); -webkit-text-stroke: 3px #fff; paint-order: stroke; text-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, transparent); }
.flame { position: absolute; top: 0; left: 50%; width: 18px; height: 28px; transform: translateX(-50%); transition: opacity .25s; }
.flame i { position: absolute; inset: 0; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 75%, #fff 0 18%, #ffe066 30%, #ff9f1c 60%, rgba(255, 90, 0, 0) 72%); filter: drop-shadow(0 0 10px rgba(255, 190, 60, .95)); animation: flicker .18s ease-in-out infinite alternate; transform-origin: 50% 90%; }
.flame.flicker i { animation-duration: .06s; transform: skewX(-12deg) scaleY(.85); }
.flame.out i { opacity: 0; transform: scale(.2); transition: all .3s; }
.flame.out::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 8px; height: 8px; border-radius: 50%; background: rgba(200, 200, 200, .7); animation: smoke 1.6s ease-out forwards; }
@keyframes flicker { from { transform: scale(1) rotate(-2deg); } to { transform: scale(1.06, .94) rotate(2deg); } }
@keyframes smoke { 0% { transform: translate(-50%, 0) scale(1); opacity: .8; } 100% { transform: translate(-30%, -60px) scale(4); opacity: 0; } }
.cake { display: flex; flex-direction: column; align-items: center; }
.tier { position: relative; border-radius: 14px 14px 10px 10px; background: linear-gradient(180deg, #ffe3ec, #ffc2d1); box-shadow: inset 0 -10px 0 rgba(200, 80, 120, .15); }
.tier.t2 { width: 70%; height: clamp(54px, 15vw, 72px); background: linear-gradient(180deg, #fff3e0, #ffd6a5); }
.tier.t1 { width: 100%; height: clamp(70px, 20vw, 96px); }
.drip { position: absolute; top: 0; left: 0; right: 0; height: 26px; border-radius: 14px 14px 0 0; background: #fff; -webkit-mask: radial-gradient(circle at 10px 26px, transparent 9px, #000 10px) 0 0 / 20px 100%; mask: radial-gradient(circle at 10px 26px, transparent 9px, #000 10px) 0 0 / 20px 100%; }
.t1 .drip { background: var(--accent-2); }
.sprinkles { position: absolute; inset: 34px 10px 12px; background:
  radial-gradient(circle, #ffd166 2px, transparent 3px) 0 0 / 26px 22px,
  radial-gradient(circle, #8ecae6 2px, transparent 3px) 13px 11px / 26px 22px,
  radial-gradient(circle, #c77dff 2px, transparent 3px) 6px 16px / 30px 26px; opacity: .9; }
.plate { width: 116%; height: 18px; margin-top: -4px; border-radius: 50%; background: linear-gradient(180deg, #fff, #e8e0f0); box-shadow: 0 10px 24px -8px rgba(80, 30, 60, .4); }
.cake-actions { display: flex; flex-direction: column; align-items: center; gap: .5rem; min-height: 80px; }
.blow-actions { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.meter { width: 200px; height: 8px; border-radius: 8px; background: var(--glass); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .08s; }
.ch-cake.lights-out .cake-wrap { filter: brightness(.75) saturate(.9); transition: filter 1s; }
.wish-overlay { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; background: rgba(10, 5, 25, .82); color: #fff; font-size: clamp(1.2rem, 5vw, 1.7rem); animation: fadeIn .8s ease; padding: 24px; }
.wish-overlay p { max-width: 16ch; text-align: center; margin: 0; line-height: 1.4; }
.wish-overlay .dots { display: flex; gap: 10px; }
.wish-overlay .dots i { width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }
.wish-overlay .dots i:nth-child(2) { animation-delay: .2s; }
.wish-overlay .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes fadeIn { from { opacity: 0; } }

/* ───────────── Memories ───────────── */
.together { font-size: clamp(1rem, 4vw, 1.2rem); background: var(--glass); border: 1.5px solid var(--glass-border); padding: .7rem 1.2rem; border-radius: 20px; line-height: 1.5; }
.together b { color: var(--accent); font-size: 1.3em; font-variant-numeric: tabular-nums; }
.stack { --w: clamp(230px, 70vw, 330px); position: relative; width: var(--w); height: calc(var(--w) * 1.24); margin: .6rem 0; flex-shrink: 0; }
.polaroid {
  position: absolute; inset: 0; perspective: 1200px;
  transform: rotate(var(--r)) translateY(calc(var(--depth, 0) * 8px)) scale(calc(1 - var(--depth, 0) * .04));
  transition: transform .45s cubic-bezier(.3, 1.3, .6, 1), opacity .45s;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
.polaroid:not(.top) { pointer-events: none; }
.pol-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.2, .5, 1); }
.polaroid.flipped .pol-inner { transform: rotateY(180deg); }
.pol-front, .pol-back { position: absolute; inset: 0; background: #fff; border-radius: 6px; box-shadow: 0 14px 34px -10px rgba(70, 20, 50, .45); backface-visibility: hidden; -webkit-backface-visibility: hidden; color: #4a2c2a; }
.pol-front { padding: 6% 6% 0; display: flex; flex-direction: column; }
.pol-img { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 2px; background: linear-gradient(135deg, var(--accent-3), #ffe5d9 60%, #e0c3fc); display: grid; place-items: center; }
.pol-img img, .pol-img video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s; }
.pol-img.loaded img, .pol-img.loaded video { opacity: 1; }
.vid-sound { position: absolute; right: 8px; bottom: 8px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 1.1rem; display: grid; place-items: center; cursor: pointer; padding: 0; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.pol-img.is-video::after { content: "LIVE"; position: absolute; left: 8px; top: 8px; z-index: 2; font: 700 .65rem/1 var(--font); letter-spacing: .08em; color: #fff; background: rgba(255, 77, 121, .85); padding: .3em .5em; border-radius: 6px; }
.pol-ph { font-size: 4rem; }
.pol-cap { font-family: var(--hand); font-size: clamp(1.4rem, 5.6vw, 1.8rem); font-weight: 700; margin-top: .3em; line-height: 1.1; }
.pol-date { font-family: var(--hand); font-size: 1.15rem; color: #9b6a7a; }
.pol-back { transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12%; background: repeating-linear-gradient(#fffaf3 0 30px, #f3d9e2 30px 31px); }
.pol-back p { font-family: var(--hand); font-size: clamp(1.5rem, 6vw, 2rem); margin: 0; line-height: 1.2; }
.pol-back span { position: absolute; bottom: 12px; font-size: .75rem; color: #b08a98; }
.mem-nav { display: flex; align-items: center; gap: 1rem; }
.mem-nav .btn { width: 46px; padding: 0; font-size: 1.5rem; }
.count { font-weight: 700; min-width: 4ch; }

/* ───────────── Jar ───────────── */
.jar { --w: clamp(170px, 48vw, 240px); position: relative; width: var(--w); height: calc(var(--w) * 1.3); background: none; border: 0; padding: 0; cursor: pointer; margin: .8rem 0; }
.jar-lid { position: absolute; left: 18%; right: 18%; top: 0; height: 12%; border-radius: 10px; background: repeating-linear-gradient(90deg, var(--accent) 0 12px, #fff 12px 24px); box-shadow: 0 4px 0 rgba(0,0,0,.1); z-index: 2; }
.jar-body { position: absolute; left: 4%; right: 4%; top: 10%; bottom: 0; border-radius: 26% 26% 22% 22% / 14% 14% 12% 12%; background: rgba(255, 255, 255, .32); border: 3px solid rgba(255, 255, 255, .85); overflow: hidden; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); box-shadow: inset 0 -20px 40px rgba(255, 143, 171, .25), 0 20px 40px -18px rgba(120, 30, 70, .4); }
.jar-hearts i { position: absolute; transform: rotate(var(--rot)); font-style: normal; }
.jar-hearts i::before { content: '❤'; font-size: clamp(20px, 6vw, 28px); color: hsl(var(--h) 90% 66%); text-shadow: 0 2px 0 rgba(0,0,0,.08); }
.jar-shine { position: absolute; left: 12%; top: 8%; width: 12%; height: 60%; border-radius: 20px; background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,0)); }
.jar-label { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%) rotate(-3deg); background: var(--paper); color: #5a2338; font-family: var(--hand); font-weight: 700; font-size: 1.4rem; padding: .2em .8em; border-radius: 6px; box-shadow: 0 4px 10px rgba(0,0,0,.12); white-space: nowrap; z-index: 2; }
.jar.wiggle { animation: wobble .5s ease; }
.note-pop { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(40, 10, 30, .45); padding: 24px; animation: fadeIn .3s ease; }
.note-card { width: min(100%, 380px); background: repeating-linear-gradient(var(--paper) 0 34px, #f6d6e1 34px 35px); color: #4a2338; border-radius: 16px; padding: 1.6rem 1.4rem 1.2rem; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); animation: popIn .5s cubic-bezier(.3, 1.6, .5, 1); text-align: center; }
.note-num { font-weight: 700; color: var(--accent); letter-spacing: .05em; }
.note-text { font-family: var(--hand); font-size: clamp(1.6rem, 6.4vw, 2.1rem); line-height: 1.15; margin: .5rem 0 1rem; }
@keyframes popIn { from { transform: scale(.4) rotate(-10deg); opacity: 0; } }

/* ───────────── Scratch card ───────────── */
.scratch-card { position: relative; width: clamp(270px, 84vw, 400px); height: clamp(170px, 50vw, 220px); border-radius: 22px; overflow: hidden; box-shadow: 0 20px 50px -18px rgba(120, 30, 70, .5); margin: .6rem 0; flex-shrink: 0; }
.scratch-under { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 1rem 1.2rem; background: linear-gradient(135deg, #fff0f3, #ffe5ec 50%, #f3e8ff); color: #5a2338; }
.su-kicker { font-weight: 700; color: var(--accent); }
.su-text { font-family: var(--hand); font-size: clamp(1.35rem, 5.4vw, 1.8rem); font-weight: 700; line-height: 1.15; margin: 0; }
.scratch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; transition: opacity .8s; }
.scratch-canvas.gone { opacity: 0; pointer-events: none; }

/* ───────────── Letter ───────────── */
.envelope { --w: clamp(260px, 80vw, 380px); position: relative; width: var(--w); height: calc(var(--w) * .66); margin: 3.5rem 0 1rem; perspective: 1000px; flex-shrink: 0; }
.env-back { position: absolute; inset: 0; border-radius: 10px; background: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 80%, #000 6%); }
.env-paper { position: absolute; left: 6%; right: 6%; top: 6%; height: 86%; background: var(--paper); border-radius: 6px; display: grid; place-items: center; font-family: var(--hand); font-size: 1.5rem; color: #5a2338; transition: transform 1s cubic-bezier(.3, 1.2, .5, 1) .5s; z-index: 1; }
.env-front { position: absolute; inset: 0; border-radius: 0 0 10px 10px; background: linear-gradient(160deg, var(--accent-3), var(--accent-2)); clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%); z-index: 2; }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 62%; background: var(--accent-2); background: linear-gradient(180deg, var(--accent-2), color-mix(in srgb, var(--accent-2) 85%, #000 8%)); clip-path: polygon(0 0, 100% 0, 50% 100%); -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .8s ease, z-index 0s .4s; z-index: 3; }
.seal { position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%); z-index: 4; width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; background: radial-gradient(circle at 35% 30%, #ff6b81, #c9184a 70%); color: #ffe5ec; font-family: var(--script); font-size: 1.6rem; box-shadow: 0 6px 14px rgba(120, 10, 40, .45), inset 0 -4px 0 rgba(0,0,0,.15); animation: pulse2 1.6s ease-in-out infinite; transition: transform .4s, opacity .4s; }
@keyframes pulse2 { 0%, 100% { box-shadow: 0 6px 14px rgba(120,10,40,.45), 0 0 0 0 rgba(255,77,121,.5); } 50% { box-shadow: 0 6px 14px rgba(120,10,40,.45), 0 0 0 14px rgba(255,77,121,0); } }
.envelope.open .seal { transform: translate(-50%, -50%) scale(0) rotate(90deg); opacity: 0; }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .env-paper { transform: translateY(-58%); }
.letter-modal { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: rgba(40, 10, 30, .55); animation: fadeIn .6s ease; }
.paper { width: min(100%, 600px); height: min(calc(100% - 40px), 760px); display: flex; flex-direction: column; background: repeating-linear-gradient(var(--paper) 0 38px, #f2d4de 38px 39px); color: #4a2338; border-radius: 14px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.55); animation: popIn .6s cubic-bezier(.3, 1.4, .5, 1); overflow: hidden; }
.paper-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 1.4rem 1.5rem .5rem; text-align: left; }
.letter-text { font-family: var(--hand); font-size: clamp(1.45rem, 5.6vw, 1.9rem); line-height: 39px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.signature { font-family: var(--hand); font-size: clamp(1.45rem, 5.6vw, 1.9rem); line-height: 39px; text-align: right; margin: .6rem 0 0; }
.signature b { color: var(--accent); }
.paper-actions { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; padding: .8rem 1rem 1rem; background: linear-gradient(transparent, var(--paper) 30%); }
.skip-hint { color: #fff; opacity: .8; }

/* ───────────── Finale ───────────── */
.fin-q, .fin-end { display: flex; flex-direction: column; align-items: center; gap: 1rem; animation: fadeUp .8s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } }
.photo-heart { position: relative; width: clamp(260px, 80vw, 420px); aspect-ratio: 1; flex-shrink: 0; }
.photo-heart img { position: absolute; width: clamp(34px, 10vw, 58px); aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 3px solid #fff; transform: translate(-50%, -50%) scale(0); box-shadow: 0 6px 14px rgba(0,0,0,.25); animation: phIn .6s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes phIn { to { transform: translate(-50%, -50%) scale(1); } }
.ph-center { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); font-size: clamp(3rem, 12vw, 5rem); animation: beat 1.2s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 15% { transform: translate(-50%, -50%) scale(1.2); } 30% { transform: translate(-50%, -50%) scale(1); } 45% { transform: translate(-50%, -50%) scale(1.12); } }
.ch-finale .title.script { font-size: clamp(2rem, 9vw, 3.4rem); max-width: 14ch; }
.sign-off { font-family: var(--hand); font-size: 1.8rem; margin: 0; }
.fin-actions { display: flex; gap: .7rem; flex-wrap: wrap; justify-content: center; }

/* ───────────── Misc ───────────── */
.trail-heart { position: fixed; z-index: 60; pointer-events: none; font-size: 16px; transform: translate(-50%, -50%); animation: trail 1s ease-out forwards; }
@keyframes trail { to { transform: translate(-50%, -160%) scale(.4); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 70; transform: translate(-50%, 30px); opacity: 0; transition: all .4s; background: rgba(40, 15, 40, .88); color: #fff; padding: .8rem 1.2rem; border-radius: 16px; max-width: min(90vw, 420px); text-align: center; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
#loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--day-1); transition: opacity .5s; text-align: center; padding: 24px; }
#loader.hidden { display: grid !important; opacity: 0; pointer-events: none; }
.loader-msg { font-size: 1.15rem; line-height: 1.6; color: #5a2338; max-width: 30ch; }
.loader-msg::first-line { font-size: 3rem; }
.loader-heart { font-size: 3rem; animation: beat2 1s ease-in-out infinite; }
@keyframes beat2 { 50% { transform: scale(1.25); } }
.demo-badge { position: fixed; z-index: 41; bottom: calc(10px + var(--safe-b)); right: calc(10px + var(--safe-r)); background: rgba(0,0,0,.55); color: #fff; padding: .45rem .8rem; border-radius: 999px; font-size: .8rem; text-decoration: none; font-weight: 600; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; z-index: 200; background: #fff; margin: 0; font-size: 1.2rem; }

/* ───────────── Responsive tweaks ───────────── */
/* Short screens (landscape phones) */
@media (max-height: 560px) {
  .chapter { padding-top: calc(52px + var(--safe-t)); gap: .5rem; }
  .mascot-md { width: 120px; }
  .mascot-lg { width: 150px; }
  .stack { --w: 190px; }
  .cake-wrap { --w: 220px; }
  .giftbox { --s: 140px; }
  .jar { --w: 130px; }
  .photo-heart { width: 230px; }
  .envelope { --w: 240px; margin-top: 2.5rem; }
}
/* Tablets & desktops */
@media (min-width: 768px) and (min-height: 700px) {
  .chapter { gap: 1.4rem; }
  .title { font-size: 2.6rem; }
  .cake-wrap { --w: 380px; }
  .candle .stick { width: 12px; height: 56px; }
  .candle.digit .num { font-size: 84px; }
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); }
  .btn-primary:hover { box-shadow: 0 12px 30px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}
