/* ============================================================
   For my Jaan — dusk-to-dawn love letter
   Night sky that slowly turns to sunrise as you scroll,
   cream paper cards, handwritten letters, butterflies.
   ============================================================ */

:root {
  --ink: #4b1a40;
  --ink-soft: #85476f;
  --paper: #fff8f2;
  --paper-2: #ffeaf0;
  --rose: #ff5d98;
  --rose-d: #d92b6c;
  --blush: #ffc2d6;
  --peach: #ffd3b8;
  --lilac: #cdb4ff;
  --gold: #ffd98a;
  --cream: #fff4ec;
  --font-script: "Dancing Script", "Segoe Script", "Snell Roundhand", "Brush Script MT", cursive;
  --font-body: "Quicksand", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --font-ar: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --p: 0;
  --sp: 0;
  --shadow: 0 22px 54px rgba(40, 4, 44, 0.38), 0 2px 0 rgba(255, 255, 255, 0.75) inset;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: #1b0a2d; }
body {
  min-height: 100vh;
  color: var(--cream);
  background: #1b0a2d;
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.6;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.svg-defs { position: absolute; }
::selection { background: #ffc2d8; color: #3a0f30; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 12px; }

/* ---------- sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(180deg, #160826 0%, #2e0f4a 20%, #5a1a62 40%, #9b3472 60%, #d4507f 80%, #f0708f 100%);
  background-size: 100% 400%;
  background-position: 0 calc(var(--p) * 100%);
}
.stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: clamp(0, calc(1.1 - var(--p) * 1.5), 1); }
.stars i {
  position: absolute; width: var(--s); height: var(--s); border-radius: 50%;
  left: var(--x); top: var(--y); background: #fff;
  box-shadow: 0 0 calc(var(--s) * 3) rgba(255, 220, 240, 0.9);
  animation: twinkle var(--d) ease-in-out var(--delay) infinite;
}
.moon {
  position: fixed; z-index: 0; top: 6vh; right: 9vw; width: clamp(70px, 14vw, 130px); aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 36% 34%, #fffaf2 0 38%, #ffe6ef 64%, #ffc2d6 100%);
  box-shadow: 0 0 60px 18px rgba(255, 194, 214, 0.35), 0 0 160px 60px rgba(255, 150, 190, 0.18);
  opacity: clamp(0, calc(1 - var(--p) * 1.8), 1);
}
.veil {
  position: fixed; inset: 0; z-index: 15; pointer-events: none; opacity: 0; transition: opacity 1.2s ease;
  background: radial-gradient(circle at 50% 55%, rgba(255, 93, 152, 0.28), rgba(16, 3, 26, 0.93) 70%);
}
body.holding .veil { opacity: 1; }
#fly { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 20; pointer-events: none; }

.progress {
  position: fixed; top: 0; left: 0; z-index: 31; height: 3px; width: calc(var(--sp) * 100%);
  background: linear-gradient(90deg, #ffb3cf, var(--gold)); box-shadow: 0 0 12px rgba(255, 179, 207, 0.9);
}

/* ---------- loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 12px;
  background: #1b0a2d; color: var(--blush); font-weight: 600; transition: opacity 0.8s, visibility 0.8s;
}
.loader.is-hidden { opacity: 0; visibility: hidden; }
.loader-fly { font-size: 3rem; animation: bob 1.6s ease-in-out infinite; filter: drop-shadow(0 0 14px rgba(255, 150, 200, 0.8)); }

/* ---------- shared ---------- */
.script-title, .title, .hero-title { font-family: var(--font-script); font-weight: 700; line-height: 1.08; }
.kicker {
  display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--blush);
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.22);
}
.kicker::before { content: "\2661\00a0"; color: var(--gold); }
.kicker.dark { color: var(--rose-d); background: rgba(255, 93, 152, 0.1); border-color: rgba(255, 93, 152, 0.22); }
.kicker.dark::before { color: var(--rose); }
.center { display: flex; justify-content: center; margin-top: 26px; }

.paper {
  position: relative; color: var(--ink); border-radius: 26px; padding: 28px 22px;
  background: radial-gradient(circle at 15% 0%, #fffdfa, transparent 55%), linear-gradient(180deg, #fff9f4, #ffeee8);
  box-shadow: var(--shadow);
}
.paper.tape::before {
  content: ""; position: absolute; top: -12px; left: 50%; width: 96px; height: 26px; border-radius: 3px;
  transform: translateX(-50%) rotate(-3deg); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  background: repeating-linear-gradient(45deg, rgba(255, 183, 208, 0.9) 0 8px, rgba(255, 228, 238, 0.9) 8px 16px);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 28px;
  border: 0; border-radius: 999px; color: #fff; font-weight: 700; font-size: 1rem; letter-spacing: 0.02em;
  background: linear-gradient(135deg, #ff7eb3, #ff4f8e 60%, #ff7a6b);
  box-shadow: 0 10px 26px rgba(255, 79, 142, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(255, 79, 142, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn:active { transform: scale(0.96); }
.btn.ghost { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.4); box-shadow: none; backdrop-filter: blur(8px); }
.btn.small { min-height: 42px; padding: 8px 20px; font-size: 0.92rem; }

.seal {
  display: grid; place-items: center; width: 84px; height: 84px; margin: -66px auto 10px;
  border-radius: 52% 48% 50% 50% / 48% 52% 48% 52%; color: #ffd3e0; font-size: 2.4rem; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #ff9db9, #e0245e 58%, #a3123f);
  box-shadow: 0 10px 22px rgba(160, 18, 63, 0.5), inset 0 -5px 9px rgba(0, 0, 0, 0.25), inset 0 3px 7px rgba(255, 255, 255, 0.4);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: sealBeat 2.6s ease-in-out infinite;
}
.seal.small { width: 58px; height: 58px; margin: -48px auto 8px; font-size: 1.6rem; animation: none; }

/* ---------- stages ---------- */
.stage {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 28px 18px;
  opacity: 0; visibility: hidden; transition: opacity 0.9s ease, visibility 0.9s;
}
.stage.is-active { opacity: 1; visibility: visible; }

.lock-card { width: min(92vw, 390px); text-align: center; margin-top: 56px; }
.lock-card .script-title { font-size: clamp(2.5rem, 11vw, 3.4rem); color: var(--rose-d); margin: 10px 0 4px; }
.lock-copy { color: var(--ink-soft); font-size: 0.98rem; min-height: 3em; padding: 0 6px; }

.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 16px 0 6px; }
.pin-dots span {
  width: 24px; height: 22px; background: #ffd4e3; transition: transform 0.35s var(--ease), background 0.3s;
  -webkit-mask: var(--heart) center / contain no-repeat; mask: var(--heart) center / contain no-repeat;
  --heart: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'><path d='M12 21.5C5 15.7 1 12 1 7.2 1 3.8 3.6 1.5 6.7 1.5c2 0 3.8 1 5.3 3 1.5-2 3.3-3 5.3-3C20.4 1.5 23 3.8 23 7.2c0 4.8-4 8.5-11 14.3z'/></svg>");
}
.pin-dots span.on { background: linear-gradient(160deg, #ff9cc0, #ff4f8b); transform: scale(1.2); }
.pin-dots.shake { animation: shake 0.45s; }
.pin-msg { min-height: 2.6em; font-size: 0.88rem; color: var(--rose-d); font-weight: 600; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; max-width: 300px; margin: 8px auto 4px; }
.key {
  aspect-ratio: 1; max-height: 74px; border: 1px solid rgba(217, 43, 108, 0.2); border-radius: 50%;
  color: var(--ink); font-size: 1.45rem; font-weight: 700; background: linear-gradient(180deg, #fff, #ffe9f0);
  box-shadow: 0 6px 14px rgba(217, 43, 108, 0.16), inset 0 -2px 0 rgba(217, 43, 108, 0.08);
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}
.key:hover { background: linear-gradient(180deg, #fff4f8, #ffd6e4); }
.key:active { transform: scale(0.9); box-shadow: 0 2px 6px rgba(217, 43, 108, 0.2); }
.key.util { font-size: 0.95rem; color: var(--rose-d); }
.lock-card.is-busy { opacity: 0.85; pointer-events: none; }

.wake-inner { display: grid; justify-items: center; gap: 10px; text-align: center; max-width: 460px; }
.wake-inner .script-title { font-size: clamp(2.6rem, 11vw, 4rem); color: #fff; text-shadow: 0 4px 30px rgba(255, 93, 152, 0.7); }
.wake-copy { color: var(--blush); }
.big-heart {
  position: relative; width: clamp(150px, 46vw, 200px); margin: 14px 0 6px; padding: 0; border: 0; background: none;
  filter: drop-shadow(0 0 28px rgba(255, 79, 142, 0.85)); animation: beat 1.2s ease-in-out infinite; -webkit-tap-highlight-color: transparent;
}
.big-heart svg { display: block; width: 100%; height: auto; }
.big-heart:active { transform: scale(0.9); animation: none; }
.meter { width: min(70vw, 280px); height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 0.3s var(--ease); background: linear-gradient(90deg, #ff7eb3, #ffd98a); box-shadow: 0 0 14px rgba(255, 179, 207, 0.9); }
.meter-text { font-family: var(--font-script); font-size: 1.8rem; color: var(--gold); }

.intro { background: radial-gradient(circle at 50% 45%, rgba(58, 18, 80, 0.94), rgba(14, 3, 24, 0.98) 75%); z-index: 15; }
.intro-line {
  max-width: 14em; text-align: center; font-family: var(--font-script); font-weight: 700; font-size: clamp(2rem, 8vw, 3.4rem); line-height: 1.2;
  color: #fff; text-shadow: 0 0 30px rgba(255, 120, 180, 0.8); opacity: 0; filter: blur(10px); transform: translateY(12px);
  transition: opacity 1.1s ease, filter 1.1s ease, transform 1.1s var(--ease);
}
.intro-line.on { opacity: 1; filter: none; transform: none; }
.skip { position: absolute; bottom: calc(26px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); border: 0; background: none; color: rgba(255, 220, 235, 0.55); font-size: 0.85rem; letter-spacing: 0.1em; }

/* ---------- world ---------- */
.world { position: relative; z-index: 5; opacity: 0; transition: opacity 1.8s ease; }
.world.show { opacity: 1; }

.hero { min-height: 100svh; display: grid; align-content: center; justify-items: center; gap: 18px; padding: 90px 22px 70px; text-align: center; }
.hero-title { max-width: 11em; font-size: clamp(3rem, 12.5vw, 6.6rem); background: linear-gradient(180deg, #fff 10%, #ffd0e2 70%, #ffe3b8 120%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 30px rgba(255, 93, 152, 0.55)); }
.hero-title .w { display: inline-block; opacity: 0; transform: translateY(24px) scale(0.96); filter: blur(8px); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease), filter 1.2s var(--ease); transition-delay: calc(var(--i) * 140ms + 300ms); }
.world.show .hero-title .w { opacity: 1; transform: none; filter: none; }
.hero-copy { max-width: 31em; font-size: clamp(1.02rem, 3.4vw, 1.25rem); color: #ffeaf1; text-shadow: 0 2px 14px rgba(80, 8, 60, 0.6); }
.scroll-cue { margin-top: 22px; display: grid; justify-items: center; gap: 2px; color: var(--blush); text-decoration: none; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; }
.scroll-cue i { font-style: normal; font-size: 1.4rem; animation: bob 1.8s ease-in-out infinite; }

.chapter { width: min(100%, 1040px); margin: 0 auto; padding: clamp(70px, 12vw, 130px) 20px 0; }
.chapter-head { display: grid; justify-items: center; gap: 12px; margin-bottom: 36px; text-align: center; }
.title { max-width: 14em; font-size: clamp(2.3rem, 8vw, 3.8rem); color: #fff; text-shadow: 0 3px 26px rgba(120, 10, 80, 0.55); }
.sub { max-width: 28em; color: #ffe6ef; text-shadow: 0 2px 12px rgba(80, 8, 60, 0.6); }
.chapter-head::after { content: "\2661  \2726  \2661"; margin-top: 4px; color: var(--blush); letter-spacing: 0.7em; text-indent: 0.7em; font-size: 0.85rem; opacity: 0.85; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* counters */
.together-grid { display: grid; gap: 30px; }
.counter { text-align: center; padding-top: 34px; }
.counter-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.big-days { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin: 4px 0 14px; }
.big-days strong { font-family: var(--font-script); font-size: clamp(4.4rem, 20vw, 6.4rem); line-height: 1; background: linear-gradient(180deg, #ff7eb3, #d92b6c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.big-days span { font-family: var(--font-script); font-size: 2rem; color: var(--rose-d); }
.dream-date { font-family: var(--font-script); font-size: clamp(1.7rem, 6vw, 2.3rem); font-weight: 700; color: var(--rose-d); margin: 6px 0 18px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chip { min-width: 70px; padding: 10px 12px; border-radius: 18px; background: #ffe3ec; border: 1px solid rgba(217, 43, 108, 0.16); }
.chip b { display: block; font-size: 1.5rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.chip small { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }

/* timeline */
.timeline { position: relative; list-style: none; padding: 0; max-width: 620px; margin: 0 auto; display: grid; gap: 34px; }
.timeline::before { content: ""; position: absolute; left: 31px; top: 20px; bottom: 20px; width: 3px; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.7) 0 7px, transparent 7px 15px); border-radius: 3px; }
.tl-item { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: start; }
.tl-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; color: var(--rose-d); background: radial-gradient(circle at 35% 30%, #fff, #ffe0ea); box-shadow: 0 0 0 5px rgba(255, 194, 214, 0.35), 0 10px 26px rgba(80, 8, 60, 0.4); }
.tl-card { padding: 20px 20px 18px; border-radius: 22px; }
.tl-card h3 { font-family: var(--font-script); font-size: 1.75rem; line-height: 1.1; color: var(--rose-d); margin-bottom: 6px; }
.tl-card p { color: var(--ink); }
.tl-item.in .tl-dot { animation: pop 0.8s var(--ease); }

/* notes */
.note-wrap { display: grid; justify-items: center; gap: 22px; }
.note-card { display: grid; width: min(100%, 520px); padding: 0; border: 0; background: none; perspective: 1400px; -webkit-tap-highlight-color: transparent; }
.note-face {
  grid-area: 1 / 1; display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 300px; padding: 34px 28px; border-radius: 28px;
  text-align: center; color: var(--ink); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 0.8s var(--ease);
  background: radial-gradient(circle at 18% 0%, #fffdfb, transparent 55%), linear-gradient(160deg, #fff6f0, #ffdce8); box-shadow: var(--shadow);
}
.note-front b { font-size: 3.2rem; animation: bob 2.4s ease-in-out infinite; }
.note-front strong { font-family: var(--font-script); font-size: 2.1rem; color: var(--rose-d); line-height: 1.1; }
.note-front small { font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.note-back { transform: rotateY(180deg); }
.note-back em { font-family: var(--font-hand); font-style: normal; font-weight: 600; font-size: clamp(1.45rem, 5.4vw, 1.85rem); line-height: 1.4; }
.note-card.flipped .note-front { transform: rotateY(-180deg); }
.note-card.flipped .note-back { transform: rotateY(0); }
.note-card.swap { animation: noteSwap 0.7s var(--ease); }

/* letters */
.letter-tools { display: grid; gap: 10px; justify-items: center; margin-bottom: 26px; }
.search input { width: min(88vw, 420px); padding: 13px 20px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 999px; color: #fff; font: inherit; background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(8px); }
.search input::placeholder { color: rgba(255, 230, 240, 0.7); }
.letters-count { font-size: 0.85rem; color: #ffe6ef; }
.letters-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.env {
  position: relative; display: grid; align-content: end; justify-items: center; min-height: 160px; padding: 56px 12px 14px; border: 0; border-radius: 14px; color: var(--ink); text-align: center; overflow: hidden;
  background: linear-gradient(165deg, #fff6f0, #ffdbe6); box-shadow: 0 12px 28px rgba(40, 4, 44, 0.34); transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.env::before { content: ""; position: absolute; inset: 0 0 38% 0; background: linear-gradient(165deg, #ffe7ee, #ffbfd3); clip-path: polygon(0 0, 100% 0, 50% 100%); transition: transform 0.5s var(--ease); transform-origin: top; }
.env:hover { transform: translateY(-5px) rotate(-0.8deg); box-shadow: 0 18px 34px rgba(40, 4, 44, 0.42); }
.env:hover::before { transform: rotateX(40deg); }
.env .wax { position: absolute; top: 25%; left: 50%; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; transform: translate(-50%, -50%); font-size: 1rem; color: #ffd3e0; background: radial-gradient(circle at 35% 30%, #ff9db9, #d71f5c 65%, #a3123f); box-shadow: 0 4px 9px rgba(160, 18, 63, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.4); }
.env strong { position: relative; font-size: 0.93rem; line-height: 1.28; font-weight: 700; }
.env.opened .wax { background: radial-gradient(circle at 35% 30%, #e7d6df, #b99aab 70%); color: #fff; }
.letters-empty { text-align: center; color: #ffe6ef; margin-top: 20px; }

/* modal letter */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0.4s; }
.modal.open { opacity: 1; visibility: visible; }
.modal-scrim { position: absolute; inset: 0; background: rgba(20, 5, 32, 0.7); backdrop-filter: blur(6px); }
.sheet {
  position: relative; width: min(94vw, 560px); max-height: 86vh; margin-top: 40px; overflow: auto; text-align: center; padding: 34px 24px 22px;
  transform: translateY(40px) rotate(-1.5deg) scale(0.96); transition: transform 0.7s var(--ease);
  background: linear-gradient(180deg, #fffaf6, #fff0ea);
}
.modal.open .sheet { transform: none; }
.modal-close { position: absolute; top: 10px; right: 14px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(217, 43, 108, 0.1); color: var(--rose-d); font-size: 1.6rem; line-height: 1; }
.sheet-title { font-family: var(--font-script); font-size: clamp(1.9rem, 7vw, 2.5rem); line-height: 1.1; color: var(--rose-d); margin: 8px 0 12px; }
.sheet-text {
  text-align: left; font-family: var(--font-hand); font-weight: 500; font-size: clamp(1.35rem, 4.8vw, 1.6rem); line-height: 34px; color: #5a2149; padding: 2px 4px 6px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 33px, rgba(255, 93, 152, 0.18) 33px 34px);
}
.sheet-text .off { visibility: hidden; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.sheet-foot small { color: var(--ink-soft); font-weight: 600; }

/* reflections */
.reflect { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px max(20px, calc(50% - 210px)) 22px; margin: 0 -20px; scrollbar-width: none; }
.reflect::-webkit-scrollbar { display: none; }
.ref-card { flex: 0 0 min(86vw, 420px); scroll-snap-align: center; text-align: center; display: grid; gap: 12px; align-content: start; }
.ref-card .src { justify-self: center; padding: 5px 14px; border-radius: 99px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rose-d); background: rgba(255, 93, 152, 0.1); }
.arabic { font-family: var(--font-ar); font-size: 1.85rem; line-height: 2; color: var(--rose-d); direction: rtl; }
.ref-card .tr { font-style: italic; }
.ref-card .re { color: var(--ink-soft); }
.dots { display: flex; justify-content: center; gap: 8px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); transition: all 0.3s; }
.dots i.on { width: 24px; border-radius: 99px; background: #fff; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.stat { display: grid; justify-items: center; gap: 4px; padding: 26px 12px 22px; text-align: center; }
.stat .ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; font-size: 1.5rem; color: var(--rose-d); background: linear-gradient(145deg, #ffe3ec, #ffc2d6); margin-bottom: 6px; }
.stat strong { font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.1; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }

/* hold */
.hold-zone { text-align: center; }
.hold-stage { position: relative; display: grid; place-items: center; height: 300px; }
.hold-btn { position: relative; z-index: 17; width: 150px; padding: 0; border: 0; background: none; filter: drop-shadow(0 0 26px rgba(255, 79, 142, 0.8)); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform 0.4s var(--ease); }
.hold-btn svg { display: block; width: 100%; height: auto; pointer-events: none; }
body.holding .hold-btn { animation: beat 0.86s ease-in-out infinite; }
.ring { position: absolute; width: 150px; aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255, 179, 207, 0.7); opacity: 0; pointer-events: none; z-index: 16; }
body.holding .ring { animation: ripple 2.6s ease-out infinite; }
body.holding .ring.r2 { animation-delay: 0.85s; }
body.holding .ring.r3 { animation-delay: 1.7s; }
body.holding .hold-zone .chapter-head { position: relative; z-index: 16; }
.hold-msg { position: relative; z-index: 16; min-height: 3em; font-family: var(--font-script); font-size: clamp(1.6rem, 6vw, 2.2rem); color: #fff; opacity: 0; transition: opacity 1.2s; text-shadow: 0 0 24px rgba(255, 120, 180, 0.9); }
.hold-msg.on { opacity: 1; }

/* bucket */
.bucket { list-style: none; max-width: 560px; margin: 0 auto; padding: 30px 22px 18px; display: grid; gap: 4px; }
.bucket li { border-bottom: 1px dashed rgba(217, 43, 108, 0.2); }
.bucket li:last-child { border: 0; }
.bucket button { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 4px; border: 0; background: none; text-align: left; color: var(--ink); font-weight: 700; font-size: 1.08rem; }
.bucket .box { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #ffb3cf; color: transparent; font-size: 1.1rem; transition: all 0.4s var(--ease); }
.bucket button[aria-pressed="true"] .box { color: #fff; border-color: transparent; background: linear-gradient(135deg, #ff7eb3, #ff4f8e); transform: scale(1.1); box-shadow: 0 6px 14px rgba(255, 79, 142, 0.45); }
.bucket button[aria-pressed="true"] .lbl { color: var(--rose-d); }

/* sky */
.sky-box { position: relative; height: clamp(340px, 78vw, 500px); border-radius: 28px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.25); background: radial-gradient(ellipse at 50% 100%, rgba(255, 120, 170, 0.35), transparent 60%), linear-gradient(180deg, #14061f, #2a0d44); box-shadow: var(--shadow); }
.sky-box svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sky-box line { stroke: rgba(255, 220, 240, 0.35); stroke-width: 1.4; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.star-btn { position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; padding: 0; border: 0; background: none; border-radius: 50%; }
.star-btn::before { content: "\2726"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.7rem; color: #ffe9a8; text-shadow: 0 0 14px #ffd166, 0 0 30px rgba(255, 209, 102, 0.7); animation: twinkle2 3s ease-in-out infinite; }
.star-btn.opened::before { color: #ffc2d6; text-shadow: 0 0 14px #ff7eb3; animation: none; }
.star-btn.secret::before { font-size: 1.1rem; opacity: 0.8; color: #e9d9ff; text-shadow: 0 0 12px #b48cff; }
.star-card { max-width: 520px; margin: 26px auto 0; text-align: center; }
.star-card h3 { font-family: var(--font-script); font-size: 2rem; line-height: 1.1; color: var(--rose-d); margin: 6px 0; }
.star-card.pop { animation: pop 0.7s var(--ease); }

/* photos (shown only if photos exist in the content) */
.polaroids { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.polaroid { width: min(78vw, 260px); padding: 12px 12px 14px; background: #fffaf5; border-radius: 6px; box-shadow: var(--shadow); transform: rotate(var(--r)); transition: transform 0.4s var(--ease); }
.polaroid:hover { transform: rotate(0) scale(1.04); }
.polaroid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; }
.polaroid figcaption { margin-top: 10px; text-align: center; font-family: var(--font-hand); font-size: 1.35rem; color: var(--ink); }

/* ending */
.ending { display: grid; justify-items: center; gap: 30px; padding-bottom: calc(150px + env(safe-area-inset-bottom)); min-height: 90vh; align-content: center; text-align: center; }
.ending-lines { display: grid; gap: 8px; }
.ending-lines span { display: block; font-family: var(--font-script); font-weight: 700; font-size: clamp(1.7rem, 6.4vw, 2.6rem); line-height: 1.25; color: #fff; text-shadow: 0 3px 22px rgba(120, 10, 80, 0.6); opacity: 0; filter: blur(8px); transform: translateY(14px); transition: opacity 1.4s var(--ease), filter 1.4s var(--ease), transform 1.4s var(--ease); }
.ending-lines span.on { opacity: 1; filter: none; transform: none; }
.ending-lines span:last-child { font-size: clamp(3rem, 13vw, 5.4rem); color: #fff; text-shadow: 0 0 36px rgba(255, 93, 152, 0.95), 0 0 80px rgba(255, 150, 190, 0.6); }

.finale { position: fixed; inset: 0; z-index: 25; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 28px; text-align: center; opacity: 0; visibility: hidden; transition: opacity 2s ease, visibility 2s; background: radial-gradient(circle at 50% 38%, #3f1357, #110419 72%); }
.finale.on { opacity: 1; visibility: visible; }
.finale-love { font-family: var(--font-script); font-weight: 700; font-size: clamp(3.4rem, 16vw, 7rem); line-height: 1; color: #ffd0e2; text-shadow: 0 0 40px rgba(255, 93, 152, 0.95), 0 0 100px rgba(255, 150, 190, 0.6); }
.finale-copy { max-width: 26em; min-height: 4em; color: #ffe6ef; font-size: 1.08rem; }

/* extras */
.music { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 32; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(8px); font-size: 1.25rem; color: #fff; transition: transform 0.2s, background 0.3s; }
.music:hover { transform: scale(1.08); }
.music[aria-pressed="true"] { background: linear-gradient(135deg, #ff7eb3, #ff4f8e); animation: beat 1.6s ease-in-out infinite; }
.toasts { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45; display: grid; gap: 8px; width: min(92vw, 380px); transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 20px; color: var(--ink); background: #fff8f2; box-shadow: 0 14px 34px rgba(40, 4, 44, 0.4); animation: toastIn 0.6s var(--ease); transition: opacity 0.4s, transform 0.4s; }
.toast.out { opacity: 0; transform: translateY(14px); }
.toast span { font-size: 1.5rem; }
.toast strong { display: block; font-size: 0.95rem; line-height: 1.2; color: var(--rose-d); }
.toast small { font-size: 0.82rem; color: var(--ink-soft); }
.pfx { position: fixed; z-index: 34; left: 0; top: 0; pointer-events: none; font-size: var(--s); color: var(--c); text-shadow: 0 0 10px var(--c); animation: pfx 1.2s ease-out forwards; }

/* ---------- desktop ---------- */
@media (min-width: 760px) {
  .together-grid { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .letters-grid { grid-template-columns: repeat(4, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .timeline { max-width: 700px; }
  .paper { padding: 32px 30px; }
}
@media (min-width: 1100px) {
  .letters-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- motion ---------- */
@keyframes twinkle { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.3); } }
@keyframes twinkle2 { 0%, 100% { transform: scale(0.82); opacity: 0.75; } 50% { transform: scale(1.22); opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes beat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.1); } 28% { transform: scale(1); } 42% { transform: scale(1.07); } }
@keyframes sealBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes noteSwap { 0% { transform: rotateY(0) scale(1); } 50% { transform: rotateY(90deg) scale(0.96); } 100% { transform: rotateY(0) scale(1); } }
@keyframes ripple { 0% { transform: scale(0.8); opacity: 0.85; } 100% { transform: scale(3.4); opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pfx { 0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--r)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-title .w { opacity: 1; transform: none; filter: none; }
  #fly { display: none; }
}
