/* ==========================================================================
   ask · a tiny interactive love story
   Tokens are OKLCH; the accent hue comes from config (--hue).
   ========================================================================== */

:root {
  --hue: 352; /* pink — overridden from config.theme.hue */

  /* ===== LIGHT (default): a pastel pink page ===== */
  --bg:        oklch(0.95 0.035 var(--hue));    /* baby pink */
  --bg-deep:   oklch(0.91 0.05 var(--hue));
  --bg-glow:   oklch(0.995 0.005 var(--hue) / 0.9);            /* soft light at the top */
  --bg-yes:    oklch(0.925 0.055 calc(var(--hue) + 6));        /* a little rosier after the yes */
  --bg-glow-yes: oklch(0.99 0.01 var(--hue) / 0.9);
  --surface:   oklch(0.985 0.012 var(--hue));   /* near-white pink for cards */
  --surface-2: oklch(0.93 0.045 var(--hue));

  --ink:       oklch(0.30 0.10 var(--hue));     /* deep raspberry */
  --ink-2:     oklch(0.46 0.11 var(--hue));
  --ink-3:     oklch(0.54 0.10 var(--hue));

  --primary:      oklch(0.74 0.16 var(--hue));                 /* pink — buttons, ribbon, heart */
  --primary-deep: oklch(0.62 0.19 var(--hue));
  --accent:       oklch(0.58 0.19 calc(var(--hue) + 4));       /* strong pink — titles on the light ground */
  --shimmer:      oklch(0.84 0.10 calc(var(--hue) + 30));      /* peachy pink — ribbon, stamps */
  --shimmer-deep: oklch(0.72 0.13 calc(var(--hue) + 25));
  --petal:        oklch(0.78 0.13 calc(var(--hue) - 15));      /* orchid */
  --ink-on-primary: oklch(0.24 0.09 var(--hue));

  --letter-bg:    oklch(0.99 0.008 var(--hue));                /* paper: white with a breath of pink */
  --letter-ink:   oklch(0.30 0.09 var(--hue));
  --letter-ink-2: oklch(0.52 0.09 var(--hue));

  --shadow-soft:   oklch(0.35 0.12 var(--hue) / 0.22);
  --shadow-strong: oklch(0.35 0.12 var(--hue) / 0.45);
  --glow:          oklch(0.60 0.18 var(--hue) / 0.28);         /* text glow */
  --line:          oklch(0.40 0.12 var(--hue) / 0.35);         /* ghost borders, underlines */
  --hover-tint:    oklch(0.30 0.10 var(--hue) / 0.06);
  --track:         oklch(0.40 0.12 var(--hue) / 0.18);
  --pill:          oklch(0.99 0.008 var(--hue) / 0.94);        /* music player */
  --pill-hover:    oklch(1 0 0 / 0.98);
  --pill-solid:    oklch(0.99 0.008 var(--hue));

  --font-display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);        /* out-quint */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);

  --z-sky: 0;
  --z-rain: 1;
  --z-scene: 2;
  --z-fx: 3;
  --z-float: 4;
  --z-player: 5;
  --z-flash: 6;
}

/* ===== DARK: the deep-rose night (config: theme.mode = "dark") ===== */
:root[data-theme="dark"] {
  --bg:        oklch(0.23 0.07 var(--hue));
  --bg-deep:   oklch(0.17 0.055 var(--hue));
  --bg-glow:   oklch(0.55 0.13 var(--hue) / 0.35);
  --bg-yes:    oklch(0.30 0.10 calc(var(--hue) + 6));
  --bg-glow-yes: oklch(0.68 0.14 var(--hue) / 0.5);
  --surface:   oklch(0.31 0.08 var(--hue));
  --surface-2: oklch(0.37 0.085 var(--hue));
  --ink:       oklch(0.975 0.012 var(--hue));
  --ink-2:     oklch(0.89 0.045 var(--hue));
  --ink-3:     oklch(0.80 0.06 var(--hue));
  --primary:      oklch(0.76 0.16 var(--hue));
  --primary-deep: oklch(0.64 0.19 var(--hue));
  --accent:       oklch(0.90 0.07 calc(var(--hue) + 8));
  --shimmer:      oklch(0.93 0.05 calc(var(--hue) + 30));
  --shimmer-deep: oklch(0.82 0.09 calc(var(--hue) + 25));
  --petal:        oklch(0.84 0.10 calc(var(--hue) - 15));
  --ink-on-primary: oklch(0.20 0.07 var(--hue));
  --letter-bg:    oklch(0.965 0.022 var(--hue));
  --letter-ink:   oklch(0.32 0.08 var(--hue));
  --letter-ink-2: oklch(0.55 0.08 var(--hue));
  --shadow-soft:   oklch(0 0 0 / 0.35);
  --shadow-strong: oklch(0 0 0 / 0.8);
  --glow:          oklch(0.76 0.16 var(--hue) / 0.5);
  --line:          oklch(1 0 0 / 0.28);
  --hover-tint:    oklch(1 0 0 / 0.07);
  --track:         oklch(1 0 0 / 0.18);
  --pill:          oklch(0.30 0.08 var(--hue) / 0.94);
  --pill-hover:    oklch(0.36 0.085 var(--hue) / 0.96);
  --pill-solid:    oklch(0.30 0.08 var(--hue));
}

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

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100%;
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-ui);
  background:
    radial-gradient(120% 70% at 50% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-color: var(--bg);
  transition: background-color 1.4s var(--ease);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body.is-yes {
  --bg: var(--bg-yes);
  background:
    radial-gradient(120% 70% at 50% -10%, var(--bg-glow-yes), transparent 60%),
    var(--bg);
}

[hidden] { display: none !important; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; text-wrap: pretty; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }

/* ---------- canvases & overlays ---------- */

#sky, #rain, #fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#sky  { z-index: var(--z-sky); }
#fx   { z-index: var(--z-fx); }
#rain {
  z-index: var(--z-rain);
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
#rain.is-on { opacity: 1; }

.flash {
  position: fixed;
  inset: 0;
  z-index: var(--z-flash);
  background: var(--primary);
  opacity: 0;
  pointer-events: none;
}
.flash.is-on { animation: flash 1s var(--ease) both; }
@keyframes flash {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---------- scenes ---------- */

.scene {
  position: fixed;
  inset: 0;
  z-index: var(--z-scene);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(28px + env(safe-area-inset-top, 0px))
    20px
    calc(104px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.75s var(--ease),
    filter 0.5s var(--ease),
    visibility 0s linear 0.75s;
}
.scene:focus { outline: none; }
.scene.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition-delay: 0s;
}
.scene.is-leaving {
  opacity: 0;
  transform: translateY(-22px) scale(0.985);
  filter: blur(5px);
  pointer-events: none;
}

.scene__inner {
  margin: auto;               /* centres, but never clips when taller than the viewport */
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}
.scene__inner--wide { max-width: 720px; }

.scene__title {
  font: italic 500 clamp(1.9rem, 6.5vw, 2.9rem) / 1.15 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Entrance choreography — runs only once the scene is active */
.reveal-item { opacity: 0; }
.scene.is-active .reveal-item {
  animation: rise 0.85s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 120ms + 120ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 13px 28px;
  border: 0;
  border-radius: 999px;
  font: 600 1.02rem / 1 var(--font-ui);
  letter-spacing: 0.005em;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.22s var(--ease),
    background-color 0.22s,
    box-shadow 0.22s,
    opacity 0.35s;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn--primary {
  background: var(--primary);
  color: var(--ink-on-primary);
  box-shadow: 0 10px 28px -14px oklch(0.55 0.18 var(--hue) / 0.75);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -12px oklch(0.55 0.18 var(--hue) / 0.85); }
.btn--primary:active { transform: scale(0.97); }

.btn--ghost { box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--ghost:hover { background: var(--hover-tint); }
.btn--ghost:active { transform: scale(0.97); }

.btn--link {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--line);
}
.btn--link:hover { color: var(--ink); }

.btn--next::after { content: "→"; font-weight: 500; }

/* ---------- 1a · heart ---------- */

.scene--heart { padding: 0; }
.heart3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.heart__tap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.heart__tap:focus-visible { outline: 2px solid var(--accent); outline-offset: -6px; }
.heart__words {
  position: absolute;
  left: 0;
  right: 0;
  top: 45%;
  pointer-events: none;
}
.heart__word {
  position: absolute;
  top: 0;
  translate: 0 -50%;
  font: 500 clamp(1.6rem, 6.4vw, 3.4rem) / 1 var(--font-hand);
  color: var(--accent);
  text-shadow: 0 0 24px var(--glow);
  opacity: 0;
  transition: opacity 1.2s ease, transform 1.4s var(--ease);
}
.heart__word--l { left: 5%; transform: translateX(-16px); }
.heart__word--r { right: 5%; transform: translateX(16px); }
.scene--heart.is-open .heart__word { opacity: 1; transform: none; transition-delay: 0.9s; }
.heart__caption {
  position: absolute;
  left: 20px;
  right: 20px;
  top: var(--heart-bottom, 62%);
  margin-top: 26px;
  text-align: center;
  font: italic 500 clamp(1.15rem, 4.6vw, 1.6rem) / 1.3 var(--font-display);
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 1.5s, transform 1.2s var(--ease) 1.5s;
}
.scene--heart.is-open .heart__caption { opacity: 1; transform: none; }
.heart__hint,
.heart__sound {
  position: absolute;
  left: 20px;
  right: 20px;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.4s;
}
.heart__hint {
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  font: 500 1.05rem var(--font-ui);
  color: var(--ink-2);
  animation: pulse 2.2s ease-in-out infinite;
}
.heart__sound {
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  font-size: 0.85rem;
  color: var(--ink-3);
}
.scene--heart.is-open .heart__sound { opacity: 0; }
.scene--heart.is-open .heart__hint { opacity: 0; animation: none; }
.scene--heart.is-open.is-ready .heart__hint { opacity: 1; animation: pulse 2.2s ease-in-out infinite; }

/* ---------- 1b · gift ---------- */

.scene--gift .scene__inner { gap: 26px; }

.gift {
  position: relative;
  display: block;
  width: 210px;
  height: 236px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: bob 3.4s ease-in-out infinite;
}
.gift:focus-visible { outline: none; }
.gift:focus-visible .gift__box { box-shadow: 0 0 0 3px var(--accent); }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
.gift.is-shaking { animation: shake 0.6s ease-in-out both; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20%  { transform: rotate(-4deg) translateY(-2px); }
  40%  { transform: rotate(4deg) translateY(-4px); }
  60%  { transform: rotate(-3deg) translateY(-2px); }
  80%  { transform: rotate(3deg); }
}
.gift.is-open { animation: none; }

.gift__glow {
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 240px;
  height: 70px;
  translate: -50% 0;
  background: radial-gradient(closest-side, oklch(0.76 0.16 var(--hue) / 0.5), transparent);
  filter: blur(12px);
  transition: opacity 0.6s;
}
.gift__box {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 152px;
  height: 120px;
  translate: -50% 0;
  background: var(--primary-deep);
  border-radius: 6px 6px 10px 10px;
  box-shadow:
    inset 0 -28px 32px -20px oklch(0 0 0 / 0.5),
    inset 24px 0 30px -26px oklch(1 0 0 / 0.28);
  transition: transform 0.6s var(--ease), opacity 0.5s;
}
.gift__ribbon {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 26px;
  translate: -50% 0;
  background: var(--shimmer);
  box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.08);
}
.gift__lid {
  position: absolute;
  left: 50%;
  top: 84px;
  width: 170px;
  height: 38px;
  translate: -50% 0;
  z-index: 2;
  background: var(--primary);
  border-radius: 6px;
  box-shadow: 0 8px 10px -6px var(--shadow-strong);
  transform-origin: 10% 100%;
  transition: transform 0.75s var(--ease), opacity 0.55s ease 0.15s;
}
.gift__lid::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 26px;
  translate: -50% 0;
  background: var(--shimmer);
}
.gift__bow {
  position: absolute;
  left: 50%;
  top: -28px;
  width: 84px;
  height: 32px;
  translate: -50% 0;
}
.gift__bow i {
  position: absolute;
  top: 2px;
  width: 36px;
  height: 28px;
  border: 7px solid var(--shimmer);
  border-radius: 55% 55% 50% 50% / 65% 65% 40% 40%;
}
.gift__bow i:first-child { left: 4px; transform: rotate(-22deg); }
.gift__bow i:nth-child(2) { right: 4px; transform: rotate(22deg); }
.gift__bow b {
  position: absolute;
  left: 50%;
  top: 11px;
  width: 15px;
  height: 15px;
  translate: -50% 0;
  background: var(--shimmer-deep);
  border-radius: 4px;
}
.gift__tag {
  position: absolute;
  left: calc(50% + 40px);
  top: 34px;
  z-index: 3;
  padding: 7px 12px 6px;
  background: var(--letter-bg);
  color: var(--letter-ink);
  font: 600 1.2rem / 1 var(--font-hand);
  border-radius: 3px;
  rotate: 12deg;
  box-shadow: 0 4px 6px -2px var(--shadow-strong);
  white-space: nowrap;
}
.gift__tag::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 9px;
  width: 16px;
  height: 1.5px;
  background: oklch(0.86 0.04 var(--hue));
  rotate: -30deg;
}

.gift.is-open .gift__lid { transform: translate(-46px, -170px) rotate(-38deg); opacity: 0; }
.gift.is-open .gift__box { transform: scale(1.05); }
.gift.is-open .gift__tag { opacity: 0; transition: opacity 0.3s; }
.gift.is-open .gift__glow { opacity: 0; }

.gift__hint {
  font: 500 1.05rem var(--font-ui);
  color: var(--ink-2);
  animation: pulse 2.2s ease-in-out infinite;
  transition: opacity 0.3s;
}
.gift.is-open ~ .gift__hint,
.gift.is-open ~ .gift__sound { opacity: 0; animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.gift__sound {
  font-size: 0.85rem;
  color: var(--ink-3);
}

/* ---------- 2 · reveal ---------- */

.reveal__word {
  font: italic 500 clamp(1.9rem, 7.5vw, 3.6rem) / 1.15 var(--font-display);
  color: var(--ink);
  text-shadow: 0 0 40px var(--glow);
  opacity: 0;
  transform: scale(1.25);
  transition: opacity 0.35s ease, transform 0.6s var(--ease), filter 0.4s;
  max-width: 14ch;
}
.reveal__word.is-digit {
  font-style: normal;
  font-weight: 700;
  font-size: clamp(4rem, 22vw, 7rem);
  line-height: 1;
  color: var(--accent);
}
.reveal__word.is-in  { opacity: 1; transform: none; }
.reveal__word.is-out { opacity: 0; transform: scale(0.92); filter: blur(6px); }

/* ---------- 3 · letter ---------- */

.letter {
  position: relative;
  width: 100%;
  padding: clamp(24px, 6vw, 36px) clamp(20px, 6vw, 34px) 24px;
  background: var(--letter-bg);
  color: var(--letter-ink);
  text-align: left;
  border-radius: 6px;
  rotate: -1deg;
  box-shadow: 0 34px 44px -30px var(--shadow-strong), 0 2px 4px var(--shadow-soft);
  cursor: pointer;
}
.letter.is-done { cursor: default; }
.letter__greeting {
  font: italic 500 clamp(1.7rem, 5.5vw, 2.1rem) / 1.2 var(--font-display);
  margin-bottom: 16px;
}
.letter__body p {
  font: 500 1.4rem / 1.4 var(--font-hand);
  min-height: 1.4em;
  margin-bottom: 10px;
  text-wrap: pretty;
}
.letter__body p.is-typing::after {
  content: "|";
  color: var(--primary-deep);
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.letter__signoff {
  font: 600 1.6rem / 1.2 var(--font-hand);
  text-align: right;
  margin-top: 18px;
  opacity: 0;
  transition: opacity 0.7s ease;
}
.letter.is-done .letter__signoff { opacity: 1; }
.letter__skip {
  margin-top: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--letter-ink-2);
  transition: opacity 0.3s;
}
.letter.is-done .letter__skip { opacity: 0; }

/* ---------- 4 · reasons (deck) ---------- */

.deck {
  position: relative;
  width: min(330px, 86vw);
  aspect-ratio: 4 / 5;
  margin-top: 6px;
}
.deck::after {
  content: "♥";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 400 5rem / 1 var(--font-display);
  color: var(--primary);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.8s ease 0.3s, transform 1s var(--ease) 0.3s;
  pointer-events: none;
}
.deck.is-empty::after { opacity: 0.9; transform: none; }
.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 26px;
  text-align: center;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 16px 28px -18px var(--shadow-strong), 0 1px 3px var(--shadow-soft);
  transform: translateY(calc(var(--i) * 12px)) scale(calc(1 - var(--i) * 0.05)) rotate(var(--r, 0deg));
  z-index: calc(20 - var(--i));
  opacity: 1;
  transition: transform 0.55s var(--ease), opacity 0.4s;
  will-change: transform;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.card.is-deep { opacity: 0; }
.card.is-dragging { transition: none; cursor: grabbing; }
.card.is-gone {
  transform: translate(var(--tx), var(--ty)) rotate(var(--tr));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.6s var(--ease-expo), opacity 0.45s ease 0.1s;
}
.card__emoji { font-size: 3.6rem; line-height: 1; }
.card__title {
  font: italic 500 1.95rem / 1.15 var(--font-display);
  color: var(--accent);
}
.card__text {
  font-size: 1.06rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 28ch;
}
.card__count {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-3);
}
.deck__hint {
  font-size: 0.88rem;
  color: var(--ink-3);
  transition: opacity 0.3s;
}
.scene.is-active .deck__hint.is-hidden { animation: none; opacity: 0; }

/* ---------- 5 · memories (film strip → heart mosaic) ---------- */

.scene--memories { padding: 0; }
.film {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(26px + env(safe-area-inset-top, 0px)) 0 calc(96px + env(safe-area-inset-bottom, 0px));
  transition: opacity 0.6s ease, transform 0.7s var(--ease);
}
.scene--memories.is-heart .film { opacity: 0; transform: scale(0.96); pointer-events: none; }
.film__title { padding: 0 20px; flex: none; text-align: center; }
.film__viewport {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  --card-w: min(74vw, 380px, 48vh);
  --gap: 18px;
}
.film__viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.film__viewport:active { cursor: grabbing; }
.film__track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  will-change: transform;
  --card-w: inherit;
  --gap: inherit;
}
.film__card {
  position: absolute;
  top: 50%;
  margin: 0;
  width: var(--card-w);
  height: calc(var(--card-w) * 1.25);
  translate: 0 -50%;
  padding: 8px 8px 8px;
  background: var(--letter-bg);
  border-radius: 14px;
  box-shadow: 0 18px 30px -18px var(--shadow-strong), 0 2px 4px var(--shadow-soft);
  transform: scale(0.86);
  opacity: 0.5;
  will-change: transform, opacity;
}
.film__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  background: oklch(0.9 0.03 var(--hue));
  pointer-events: none;
}
.film__caption {
  flex: none;
  min-height: 3.6em;
  max-width: 34ch;
  margin: 14px 24px 0;
  text-align: center;
  font: italic 500 clamp(1.1rem, 4.4vw, 1.45rem) / 1.35 var(--font-display);
  color: var(--ink);
}
.film__caption.is-swap { animation: caption-swap 0.5s var(--ease) both; }
@keyframes caption-swap {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.film__count {
  flex: none;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.film__hint {
  flex: none;
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--ink-3);
  transition: opacity 0.5s;
}
.film__hint.is-hidden { opacity: 0; }

.mosaic {
  position: absolute;
  left: 20px;
  right: 20px;
  top: calc(84px + env(safe-area-inset-top, 0px));
  bottom: calc(196px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.mosaic__heart { position: absolute; inset: 0; }
.scene--memories.is-formed .mosaic__heart {
  filter: drop-shadow(0 0 28px oklch(0.7 0.18 var(--hue) / 0.5));
}
.mosaic__frame {
  position: absolute;
  background: var(--primary);
  transform: scale(1.035);
  opacity: 0;
  transition: opacity 0.8s ease;
}
.scene--memories.is-formed .mosaic__frame { opacity: 1; }
.mosaic__clip {
  position: absolute;
  overflow: hidden;
  background: oklch(0.9 0.05 var(--hue));
}
.mosaic__tile {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--t);
  height: var(--t);
  object-fit: cover;
  transform: translate(var(--x), var(--y)) scale(var(--s, 1));
  transition: transform 1s var(--ease);
  transition-delay: var(--d, 0ms);
  will-change: transform;
}
.memories__end {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  pointer-events: none;
}
.memories__end > * { pointer-events: auto; }
.mosaic__caption {
  max-width: 34ch;
  font: italic 500 clamp(1.1rem, 4.4vw, 1.45rem) / 1.35 var(--font-display);
  color: var(--ink);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease, transform 0.9s var(--ease);
}
.scene--memories.is-formed .mosaic__caption { opacity: 1; transform: none; }
.scene.is-active .memories__end .btn--next { animation: rise 0.85s var(--ease) both; }

/* ---------- 5b · bouquet (tap the buds) ---------- */

.scene--bouquet { padding: 0; }
.bouquet__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.bouquet__tap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bouquet__tap:focus-visible { outline: 2px solid var(--accent); outline-offset: -6px; }
.bouquet__title {
  position: absolute;
  left: 20px;
  right: 20px;
  top: calc(30px + env(safe-area-inset-top, 0px));
  text-align: center;
  pointer-events: none;
}
.bouquet__hint {
  position: absolute;
  left: 20px;
  right: 20px;
  top: calc(30px + env(safe-area-inset-top, 0px) + 3.6em);
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-2);
  pointer-events: none;
  transition: opacity 0.4s;
}
.scene.is-active .bouquet__hint.is-hidden { animation: none; opacity: 0; }
.bouquet__caption {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(166px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font: italic 500 clamp(1.15rem, 4.6vw, 1.5rem) / 1.3 var(--font-display);
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease, transform 0.9s var(--ease);
}
.scene--bouquet.is-done .bouquet__caption { opacity: 1; transform: none; }
.bouquet__next {
  position: absolute;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  translate: -50% 0;
  white-space: nowrap;
}
.scene.is-active .bouquet__next { animation: rise 0.85s var(--ease) both; }

/* ---------- 6 · the question ---------- */

.scene--question .scene__inner { gap: 16px; }
.question__reaction {
  font-size: 3.8rem;
  line-height: 1;
  transition: transform 0.3s var(--ease);
}
.question__reaction.is-bump { transform: scale(1.2) rotate(-8deg); }
.question__title {
  font: italic 500 clamp(2.2rem, 8.5vw, 3.9rem) / 1.08 var(--font-display);
  letter-spacing: -0.015em;
  color: var(--ink);
}
.question__lead {
  display: block;
  font: 600 0.62em / 1.2 var(--font-hand);
  color: var(--accent);
  margin-bottom: 0.25em;
}
.question__title em { font-style: italic; }

.answers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  min-height: 64px;
  margin-top: 8px;
  width: 100%;
}
.btn--yes {
  font-size: 1.15rem;
  padding: 15px 36px;
  transform-origin: 50% 0;
  transition: transform 0.45s var(--ease), box-shadow 0.3s;
}
.btn--no {
  transition: transform 0.4s var(--ease), opacity 0.25s, background-color 0.3s, color 0.3s;
}
.btn--no.is-loose {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  z-index: var(--z-float);
  will-change: transform;
}
.btn--no.is-surrender {
  background: var(--primary);
  color: var(--ink-on-primary);
  box-shadow: none;
}
.question__plead {
  min-height: 1.6em;
  font-style: italic;
  color: var(--ink-2);
}

/* ---------- 7 · celebration ---------- */

.scene--yes .scene__inner { gap: 14px; position: relative; z-index: 1; }
.meadow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.yes__emoji {
  font-size: 4.6rem;
  line-height: 1;
  animation: heartbeat 1.2s ease-in-out 3;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.12); }
  60%      { transform: scale(1.04); }
}
.yes__title {
  font: 800 clamp(3.2rem, 15vw, 6rem) / 0.95 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--accent);
  text-shadow: 0 2px 20px var(--glow);
}
.yes__subtitle {
  font: italic 500 clamp(1.5rem, 5.5vw, 2.1rem) / 1.2 var(--font-display);
}
.yes__message {
  color: var(--ink-2);
  max-width: 32ch;
  font-size: 1.05rem;
}
.scene--yes .btn--next { margin-top: 12px; }

/* ---------- 8 · plan ---------- */

.plan__steps {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.plan__steps li {
  width: 30px;
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  transition: background-color 0.3s;
}
.plan__steps li.is-done    { background: var(--primary); }
.plan__steps li.is-current { background: var(--accent); }

.plan { width: 100%; }
.plan__step {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.plan__step.is-active {
  display: flex;
  animation: rise 0.55s var(--ease) both;
}
.chips {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
.chip {
  min-height: 54px;
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: 500 1.05rem / 1.25 var(--font-ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease), background-color 0.2s, color 0.2s;
}
.chip { box-shadow: 0 2px 8px -4px var(--shadow-soft); }
.chip:hover { background: var(--surface-2); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.is-picked {
  background: var(--primary);
  color: var(--ink-on-primary);
  transform: scale(1.03);
}
.chip.is-dim { opacity: 0.45; }

/* ---------- 9 · ticket ---------- */

.ticket {
  width: 100%;
  background: var(--letter-bg);
  color: var(--letter-ink);
  border-radius: 14px;
  text-align: left;
  rotate: 1deg;
  overflow: hidden;
  box-shadow: 0 30px 40px -28px var(--shadow-strong), 0 2px 4px var(--shadow-soft);
}
.ticket__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 20px 22px 18px;
  border-bottom: 2px dashed oklch(0.84 0.05 var(--hue));
}
.ticket__names {
  font: italic 500 clamp(1.4rem, 5vw, 1.7rem) / 1.15 var(--font-display);
  min-width: 0;
}
.ticket__names i { color: var(--primary-deep); margin: 0 0.15em; }
.ticket__stamp {
  flex: none;
  font: 800 0.8rem / 1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-deep);
  border: 2px solid currentColor;
  border-radius: 6px;
  padding: 6px 8px;
  rotate: -8deg;
}
.ticket__rows {
  margin: 0;
  padding: 16px 22px 6px;
  display: grid;
  gap: 12px;
}
.ticket__rows div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.ticket__rows dt {
  font: 600 0.74rem / 1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--letter-ink-2);
}
.ticket__rows dd {
  margin: 0;
  font: 500 1.08rem / 1.3 var(--font-ui);
  text-align: right;
}
.ticket__foot {
  padding: 12px 22px 16px;
  text-align: center;
  font: 600 1.05rem / 1 var(--font-hand);
  color: var(--letter-ink-2);
}
/* ---------- music player ---------- */

.player {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-player);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 8px 16px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink);
  box-shadow: 0 10px 24px -12px var(--shadow-strong);
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.5s, transform 0.6s var(--ease), background-color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.player.is-visible { opacity: 1; transform: translate(-50%, 0); }
.player:hover { background: var(--pill-hover); }
.player:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.player__disc {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary), var(--shimmer), var(--petal), var(--primary));
  box-shadow: inset 0 0 0 2px oklch(0 0 0 / 0.25);
}
.player__disc::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: var(--pill-solid);
}
.player.is-playing .player__disc { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}
.player__title {
  max-width: 170px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player__artist {
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--ink-2);
}
.player__artist:empty { display: none; }
.player__eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 14px;
  height: 14px;
  margin-left: 2px;
}
.player__eq i {
  width: 3px;
  height: 25%;
  border-radius: 1px;
  background: var(--primary);
  transition: height 0.3s;
}
.player.is-playing .player__eq i { animation: eq 0.8s ease-in-out infinite alternate; }
.player.is-playing .player__eq i:nth-child(2) { animation-delay: -0.25s; }
.player.is-playing .player__eq i:nth-child(3) { animation-delay: -0.5s; }
@keyframes eq {
  from { height: 25%; }
  to   { height: 100%; }
}

/* ---------- larger screens ---------- */

@media (min-width: 720px) {
  .player { left: 24px; transform: translate(0, 16px); }
  .player.is-visible { transform: none; }
  .chips { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .film__viewport { --card-w: min(420px, 50vh); --gap: 26px; }
  .mosaic { left: 40px; right: 40px; }
  .deck { width: 340px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.25s !important;
    scroll-behavior: auto !important;
  }
  .reveal-item { opacity: 1; }
  .mosaic__tile { transition-duration: 0.3s !important; transition-delay: 0ms !important; }
  .gift { animation: none; }
  .scene { transform: none; }
  .scene.is-leaving { filter: none; transform: none; }
  .btn--no.is-loose { transition: opacity 0.2s !important, transform 0s !important; }
  .reveal__word { transform: none; }
}
