/* ==========================================================================
   core.css — design tokens, layers, step system, components
   ========================================================================== */

:root {
  --bg-0: #0b0509;
  --bg-1: #170811;
  --bg-2: #2a0d1f;
  --rose: #ff5c8a;
  --rose-2: #ff8fb1;
  --blush: #ffd3de;
  --crimson: #e0245e;
  --wine: #8e0c2c;
  --gold: #e9c59c;
  --gold-2: #f7e3c4;
  --cream: #fbf4ea;
  --ink: #3a1d29;
  --ink-2: #6b4552;
  --text: #fff4f7;
  --muted: rgba(255, 232, 240, 0.66);
  --faint: rgba(255, 232, 240, 0.4);
  --stroke: rgba(255, 255, 255, 0.14);

  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Times New Roman', serif;
  --script: 'Pinyon Script', 'Snell Roundhand', cursive;
  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.55, 0, .75, .2);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --hud-h: 56px;
  --gutter: 22px;

  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(120% 70% at 50% 115%, #4b0f30 0%, rgba(75, 15, 48, 0) 62%),
    radial-gradient(90% 55% at 88% -8%, #3a0c2a 0%, rgba(58, 12, 42, 0) 60%),
    radial-gradient(70% 45% at 0% 30%, #24081a 0%, rgba(36, 8, 26, 0) 70%),
    var(--bg-0);
}

button { font: inherit; color: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; }
img { -webkit-user-drag: none; user-select: none; }
svg { display: block; }
h1, h2, h3, p { margin: 0; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow: clip; /* not programmatically scrollable (focus / scrollIntoView) */
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- ambient layers ---------- */

#backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  transition: opacity 1.2s var(--ease), filter 1.2s var(--ease);
}
#backdrop[data-dim="true"] { opacity: .22; }

.vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(140% 90% at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(5, 1, 4, .75) 100%),
    linear-gradient(180deg, rgba(11, 5, 9, .55) 0%, rgba(11, 5, 9, 0) 18%, rgba(11, 5, 9, 0) 78%, rgba(11, 5, 9, .6) 100%);
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .045;
  /* no mix-blend-mode: it turns #app into a backdrop root and kills backdrop-filter */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(4) infinite;
}
@keyframes grain {
  0% { background-position: 0 0; }
  25% { background-position: -37px 23px; }
  50% { background-position: 29px -41px; }
  75% { background-position: -19px -13px; }
  100% { background-position: 0 0; }
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 30;
  height: calc(var(--hud-h) + var(--safe-t));
  padding: calc(var(--safe-t) + 8px) 14px 0;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 14px;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.hud[data-visible="false"] { opacity: 0; transform: translateY(-12px); pointer-events: none; }

.hud-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  padding: 0;
  transition: opacity .4s, transform .25s var(--spring), background .3s;
}
.hud-btn:active { transform: scale(.9); }
.hud-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hud-btn[data-visible="false"] { opacity: 0; pointer-events: none; }

.hud-disc { position: relative; }
.hud-disc .disc { width: 22px; height: 22px; stroke-width: 1.4; }
.hud-disc[data-playing="true"] .disc { animation: spin 3.2s linear infinite; }
.hud-disc[data-playing="true"] { background: rgba(255, 92, 138, .18); border-color: rgba(255, 143, 177, .4); }
.hud-disc .eq { position: absolute; right: -2px; bottom: -2px; display: none; }
.hud-disc[data-playing="true"] .eq { display: flex; }
@keyframes spin { to { transform: rotate(360deg); } }

.hud-progress { display: flex; gap: 5px; align-items: center; height: 40px; }
.hud-progress i {
  position: relative;
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .14);
  overflow: hidden;
}
.hud-progress i::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .8s var(--ease);
}
.hud-progress i[data-state="done"]::after { transform: scaleX(1); }
.hud-progress i[data-state="now"]::after { transform: scaleX(.5); box-shadow: 0 0 10px var(--rose); }

/* ---------- eq bars (shared) ---------- */

.eq { gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 3px; border-radius: 2px; background: var(--rose-2); height: 40%; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.35s; }
.eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* ---------- step system ---------- */

#viewport { position: absolute; inset: 0; z-index: 10; }

.step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + var(--hud-h) + 14px) var(--gutter) calc(var(--safe-b) + 20px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 34px, 0) scale(.965);
  filter: blur(10px);
  transition:
    opacity .6s var(--ease),
    transform .9s var(--ease),
    filter .6s var(--ease),
    visibility 0s linear .9s;
}
.step::-webkit-scrollbar { display: none; }
.step.from-back { transform: translate3d(0, -34px, 0) scale(1.03); }
.step.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  filter: none;
  transition-delay: .18s, .18s, .18s, 0s;
}
.step.is-leaving { transform: translate3d(0, -30px, 0) scale(1.035); }
.step.is-leaving-back { transform: translate3d(0, 30px, 0) scale(.965); }

/* children stagger in */
.step [data-rise] { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform 1s var(--ease); }
.step.is-active [data-rise] { opacity: 1; transform: none; }
.step.is-active [data-rise="1"] { transition-delay: .35s; }
.step.is-active [data-rise="2"] { transition-delay: .48s; }
.step.is-active [data-rise="3"] { transition-delay: .62s; }
.step.is-active [data-rise="4"] { transition-delay: .78s; }
.step.is-active [data-rise="5"] { transition-delay: .95s; }

.step-head { flex: none; }
.step-body { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 0; }
.step-foot {
  flex: none;
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 calc(var(--gutter) * -1) calc(-1 * (var(--safe-b) + 20px));
  padding: 26px var(--gutter) calc(var(--safe-b) + 20px);
  background: linear-gradient(180deg, rgba(11, 5, 9, 0) 0%, rgba(11, 5, 9, .82) 42%);
  pointer-events: none;
}
.step-foot > * { pointer-events: auto; }
.step-foot:has(.cta[data-ready="false"]) { background: none; }

/* ---------- typography ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 10.5px/1 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow::before { content: ''; width: 20px; height: 1px; background: currentColor; opacity: .6; }
.center .eyebrow { justify-content: center; }
.center .eyebrow::after { content: ''; width: 20px; height: 1px; background: currentColor; opacity: .6; }

.title {
  margin-top: 14px;
  font: 500 40px/1.04 var(--serif);
  letter-spacing: -.015em;
  text-wrap: balance;
}
.title em, .grad-script {
  font-family: var(--script);
  font-style: normal;
  font-weight: 400;
  font-size: 1.22em;
  line-height: .8;
  padding: 0 .12em 0 .04em;
  background: linear-gradient(100deg, #ffe1e9 0%, #ff86a9 38%, #ff5c8a 58%, #f3c79c 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin-top: 12px;
  max-width: 34ch;
  font: 400 15px/1.55 var(--sans);
  color: var(--muted);
  text-wrap: pretty;
}
.hint {
  font: 500 12px/1.4 var(--sans);
  color: var(--faint);
  letter-spacing: .02em;
}

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

.cta {
  position: relative;
  width: 100%;
  height: 56px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: 600 15px/1 var(--sans);
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(135deg, #ff7aa0 0%, #ee3a72 50%, #c41d58 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .4),
    inset 0 -10px 20px rgba(110, 0, 40, .35),
    0 18px 40px -14px rgba(255, 60, 120, .75);
  overflow: hidden;
  isolation: isolate;
  transition: transform .3s var(--spring), opacity .6s var(--ease), translate .6s var(--ease);
}
.cta::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sheen 3.6s var(--ease) infinite 1s;
}
.cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.cta:active { transform: scale(.97); }
.cta:active svg { transform: translateX(3px); }
.cta[data-ready="false"] { opacity: 0; translate: 0 14px; pointer-events: none; }
@keyframes sheen { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }

.ghost {
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 14px/1 var(--sans);
  color: var(--text);
  transition: transform .25s var(--spring), background .3s;
  text-decoration: none;
}
.ghost:active { transform: scale(.96); background: rgba(255, 255, 255, .12); }
.ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- glass ---------- */

.glass {
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: linear-gradient(160deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .035));
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 30px 60px -30px rgba(0, 0, 0, .7);
}

/* ==========================================================================
   01 · gate (lock screen)
   ========================================================================== */

.step.gate {
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding-top: calc(var(--safe-t) + 34px);
  padding-bottom: calc(var(--safe-b) + 28px);
}
.gate-top { display: flex; flex-direction: column; align-items: center; }
.gate-lock { width: 20px; height: 20px; fill: none; stroke: rgba(255, 240, 245, .85); stroke-width: 1.6; stroke-linecap: round; margin-bottom: 14px; transition: transform .5s var(--spring); }
.gate.is-unlocked .gate-lock { transform: translateY(-4px) rotate(-12deg); }
.gate-date { font: 500 16px/1 var(--sans); color: rgba(255, 240, 245, .85); letter-spacing: .01em; }
.gate-time {
  margin-top: 6px;
  font: 300 108px/.95 var(--serif);
  letter-spacing: -.03em;
  background: linear-gradient(180deg, #ffffff 20%, #ffc9d7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 30px rgba(255, 92, 138, .35));
  font-variant-numeric: lining-nums;
}

.notif {
  width: 100%;
  display: flex;
  gap: 12px;
  padding: 14px 14px 15px;
  text-align: left;
  border-radius: 22px;
  opacity: 0;
  transform: translateY(-14px) scale(.96);
}
.step.gate.is-active .notif { animation: notifIn 1s var(--spring) 1.1s forwards; }
@keyframes notifIn { to { opacity: 1; transform: none; } }
.notif-icon {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #ff86a9, #e0245e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 6px 14px -4px rgba(224, 36, 94, .6);
}
.notif-icon svg { width: 20px; height: 20px; fill: #fff; }
.notif-main { flex: 1; min-width: 0; }
.notif-head { display: flex; justify-content: space-between; font: 600 12px/1 var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.notif-head time { text-transform: none; letter-spacing: 0; font-weight: 500; }
.notif-title { margin-top: 6px; font: 700 15px/1.2 var(--sans); }
.notif-body { margin-top: 3px; font: 400 14px/1.4 var(--sans); color: rgba(255, 240, 245, .8); }

.gate-bottom { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.slider {
  --x: 0px;
  --p: 0;
  position: relative;
  width: 100%;
  height: 68px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 20px 40px -20px rgba(0, 0, 0, .7);
  outline: none;
  overflow: hidden;
  touch-action: none;
}
.slider-fill {
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: calc(var(--x) + 56px);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 92, 138, .05), rgba(255, 92, 138, .5));
}
.slider-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-left: 40px;
  font: 500 16px/1 var(--sans);
  letter-spacing: .04em;
  background: linear-gradient(90deg, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, .35) 40%, #fff 50%, rgba(255, 255, 255, .35) 60%, rgba(255, 255, 255, .35) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.6s linear infinite;
  opacity: calc(1 - var(--p) * 1.6);
  pointer-events: none;
}
@keyframes shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
.slider-knob {
  position: absolute;
  left: 6px; top: 6px;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #ffe3ea 45%, #ffb3c6 100%);
  box-shadow: inset 0 -3px 8px rgba(224, 36, 94, .25), 0 8px 20px -6px rgba(255, 92, 138, .7);
  transform: translate3d(var(--x), 0, 0);
  touch-action: none;
  cursor: grab;
}
.slider-knob svg { width: 24px; height: 24px; fill: var(--crimson); transition: transform .4s var(--spring); }
.slider.is-snap .slider-knob, .slider.is-snap .slider-fill { transition: transform .45s var(--spring), width .45s var(--spring); }
.slider.is-drag .slider-knob svg { transform: scale(1.15); }
.gate.is-unlocked .slider-knob svg { transform: scale(1.5); }
.gate.is-unlocked .slider { box-shadow: 0 0 0 1px rgba(255, 143, 177, .6), 0 0 50px rgba(255, 92, 138, .6); transition: box-shadow .4s; }
.slider.is-nudge .slider-knob { animation: nudge .9s var(--ease); }
@keyframes nudge { 30% { transform: translateX(46px); } 60% { transform: translateX(0); } 75% { transform: translateX(14px); } 100% { transform: translateX(0); } }

/* ==========================================================================
   02 · media (soundtrack)
   ========================================================================== */

.player { margin-top: 22px; padding: 10px; }
.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #120509;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.player-frame iframe, .player-frame > div { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0; }
.player-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 18px; text-align: center;
  font: 500 13px/1.5 var(--sans); color: var(--muted);
}
.player-meta { display: flex; align-items: center; gap: 12px; padding: 12px 6px 4px; }
.player-meta .eq { display: flex; opacity: .25; }
.player-meta[data-playing="true"] .eq { opacity: 1; }
.player-meta[data-playing="false"] .eq i { animation-play-state: paused; }
.player-now { flex: 1; min-width: 0; }
.player-now small { display: block; font: 600 10px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.player-now b { display: block; margin-top: 5px; font: 500 20px/1.1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-toggle {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #ff86a9, #e0245e);
  box-shadow: 0 8px 18px -6px rgba(224, 36, 94, .7);
  transition: transform .25s var(--spring);
}
.player-toggle:active { transform: scale(.9); }
.player-toggle svg { width: 18px; height: 18px; fill: #fff; }
.player-toggle .i-pause { display: none; }
.player-meta[data-playing="true"] .player-toggle .i-play { display: none; }
.player-meta[data-playing="true"] .player-toggle .i-pause { display: block; }

.tracks { list-style: none; margin: 12px 0 0; padding: 6px; display: flex; flex-direction: column; gap: 2px; border-radius: 22px; }
.track {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  transition: background .3s, transform .2s var(--spring);
}
.track:active { transform: scale(.985); background: rgba(255, 255, 255, .06); }
.track[aria-current="true"] { background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.track-n { font: 500 13px/1 var(--sans); color: var(--faint); font-variant-numeric: tabular-nums; }
.track[aria-current="true"] .track-n { color: var(--rose-2); }
.track-t { display: block; font: 600 15px/1.2 var(--sans); }
.track-a { display: block; margin-top: 2px; font: 400 12.5px/1.2 var(--sans); color: var(--muted); }
.track .eq { display: none; }
.track[aria-current="true"][data-playing="true"] .eq { display: flex; }
.media-hint { margin-top: 12px; text-align: center; }

/* ==========================================================================
   03 · doc (envelope + letter)
   ========================================================================== */

.step.doc { overflow: hidden; }
.env-scene {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  perspective: 1400px;
  transition: opacity .7s var(--ease), transform .9s var(--ease);
}
.doc.is-reading .env-scene { opacity: 0; transform: translateY(60px) scale(.9); pointer-events: none; }

.envelope {
  position: relative;
  width: min(82vw, 330px);
  aspect-ratio: 1.5;
  transform-style: preserve-3d;
  animation: floaty 5.5s ease-in-out infinite;
  cursor: pointer;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotateX(8deg) rotateZ(-1.5deg); }
  50% { transform: translateY(-10px) rotateX(4deg) rotateZ(1.5deg); }
}
.env-back {
  position: absolute; inset: 0;
  border-radius: 12px;
  background: linear-gradient(165deg, #efd6bb 0%, #dcb792 100%);
  box-shadow: 0 50px 70px -30px rgba(0, 0, 0, .75), 0 0 0 1px rgba(120, 70, 40, .15) inset;
}
.env-letter {
  position: absolute;
  left: 6%; right: 6%; top: 5%;
  height: 90%;
  z-index: 2;
  border-radius: 6px;
  background: linear-gradient(180deg, #fffaf3, #f6e8d6);
  box-shadow: 0 -6px 20px -8px rgba(90, 40, 20, .35);
  display: flex;
  justify-content: center;
  padding-top: 14%;
  transition: transform 1.1s var(--ease);
}
.env-letter span { font: 400 30px/1 var(--script); color: #b3264f; opacity: .9; }
.env-front {
  position: absolute; inset: 0;
  z-index: 3;
  border-radius: 12px;
  background: linear-gradient(170deg, #f4dfc7 0%, #e6c6a3 100%);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}
.env-front::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(0deg, #f8e7d3 0%, #ecd1b4 100%);
  clip-path: polygon(0 100%, 50% 46%, 100% 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .05);
}
.env-front::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(120, 70, 40, .12), transparent 30%, transparent 70%, rgba(120, 70, 40, .12));
}
.env-flap {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 60%;
  z-index: 4;
  transform-origin: 50% 0;
  transform: rotateX(0deg);
  transition: transform .9s var(--ease), z-index 0s linear .45s;
}
.env-flap::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #e9cdaf 0%, #d8b28c 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .2));
}
.envelope.is-open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.is-out .env-letter { transform: translateY(-62%); }

.env-seal {
  position: absolute;
  left: 50%; top: 60%;
  z-index: 5;
  width: 70px; height: 70px;
  margin: -35px 0 0 -35px;
  border: 0;
  padding: 0;
  border-radius: 48% 52% 50% 50% / 53% 47% 53% 47%;
  background: radial-gradient(circle at 34% 28%, #ff7394 0%, #d11a48 45%, #8e0c2c 100%);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, .35), inset 0 -5px 10px rgba(60, 0, 15, .45), 0 8px 18px -4px rgba(110, 0, 30, .65);
  display: grid;
  place-items: center;
  transition: transform .6s var(--spring), opacity .5s;
}
.env-seal::before {
  content: '';
  position: absolute; inset: 9px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(60, 0, 15, .25);
}
.env-seal::after {
  content: '';
  position: absolute; inset: -10px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 143, 177, .6);
  animation: pulse-ring 2.2s var(--ease) infinite;
}
.env-seal svg { width: 26px; height: 26px; fill: rgba(80, 0, 20, .45); filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .25)); }
.envelope.is-open .env-seal { transform: scale(1.5) rotate(20deg); opacity: 0; pointer-events: none; }
@keyframes pulse-ring { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.env-tap { transition: opacity .4s; }
.doc.is-opening .env-tap { opacity: 0; }

.paper {
  position: absolute;
  left: 12px; right: 12px;
  top: calc(var(--safe-t) + var(--hud-h) + 6px);
  bottom: calc(var(--safe-b) + 12px);
  z-index: 5;
  border-radius: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, .7) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(100% 100% at 50% 50%, #fbf3e7 0%, #f5e6d2 75%, #ecd6bd 100%);
  box-shadow: 0 50px 90px -30px rgba(0, 0, 0, .8), inset 0 0 80px rgba(160, 100, 60, .14);
  opacity: 0;
  transform: translateY(70px) scale(.9) rotateX(10deg);
  transform-origin: 50% 100%;
  pointer-events: none;
  transition: opacity .8s var(--ease), transform 1.1s var(--ease);
}
.paper::-webkit-scrollbar { display: none; }
.doc.is-reading .paper { opacity: 1; transform: none; pointer-events: auto; }
.paper-inner { padding: 36px 26px 30px; }
.paper-mark { display: flex; justify-content: center; margin-bottom: 18px; }
.paper-mark svg { width: 22px; height: 22px; fill: #d64673; opacity: .6; }
.paper-greet { font: 400 48px/1 var(--script); color: #b3264f; margin-bottom: 18px; }
.paper p { font: 400 20.5px/1.55 var(--serif); margin: 0 0 18px; color: var(--ink); text-wrap: pretty; }
.paper p strong { font-weight: 600; color: #a61f49; }
.polaroid {
  position: relative;
  width: 64%;
  margin: 12px auto 28px;
  padding: 9px 9px 12px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 16px 30px -14px rgba(80, 30, 40, .45), 0 0 0 1px rgba(0, 0, 0, .04);
  transform: rotate(var(--tilt, 0deg));
}
.polaroid::before {
  content: '';
  position: absolute;
  top: -11px; left: 50%;
  width: 78px; height: 24px;
  transform: translateX(-50%) rotate(-4deg);
  background: rgba(255, 164, 190, .55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  -webkit-mask: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
  mask: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
}
.polaroid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #fff6f8; border-radius: 1px; }
.paper-sign { margin-top: 26px; text-align: right; font: italic 400 19px/1.2 var(--serif); color: var(--ink-2); }
.paper-sign b { display: block; margin-top: 6px; font: 400 42px/1 var(--script); color: #b3264f; }
.paper .cta { margin-top: 32px; }

.ink { opacity: 0; transform: translateY(14px); filter: blur(5px); transition: opacity 1s var(--ease), transform 1.1s var(--ease), filter 1s var(--ease); }
.ink.is-in { opacity: 1; transform: none; filter: none; }
.polaroid.ink { transform: translateY(14px) rotate(var(--tilt, 0deg)); }
.polaroid.ink.is-in { transform: rotate(var(--tilt, 0deg)); }

/* ==========================================================================
   04 · stack (swipe deck)
   ========================================================================== */

.deck {
  position: relative;
  flex: 1;
  min-height: 360px;
  margin: 22px 0 6px;
  perspective: 1200px;
}
.deck-card {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 34px;
  margin: 0 auto;
  max-width: 340px;
  border-radius: 28px;
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: linear-gradient(165deg, #fffafb 0%, #ffeaf0 100%);
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .75), inset 0 0 0 1px rgba(255, 255, 255, .8);
  transform-origin: 50% 110%;
  touch-action: none;
  will-change: transform;
  transition: transform .55s var(--ease), opacity .4s;
}
.deck-card.is-drag { transition: none; }
.deck-card.is-gone { pointer-events: none; }
.deck-gif {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(179, 38, 79, .08);
}
.deck-gif img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.deck-meta { display: flex; justify-content: space-between; align-items: center; margin: 14px 6px 0; font: 700 10.5px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: #c2466e; }
.deck-meta svg { width: 14px; height: 14px; fill: #e0245e; }
.deck-text { margin: 8px 6px 0; font: 500 24px/1.22 var(--serif); text-wrap: balance; }
.deck-stamp {
  position: absolute;
  top: 26px;
  padding: 8px 14px;
  border: 2px solid currentColor;
  border-radius: 10px;
  font: 800 13px/1 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
}
.deck-stamp.l { left: 24px; color: #e0245e; transform: rotate(-12deg); }
.deck-stamp.r { right: 24px; color: #d4a24c; transform: rotate(12deg); }
.deck-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.deck-count { font: 500 15px/1 var(--serif); color: var(--muted); font-variant-numeric: tabular-nums; }
.deck-count b { font-weight: 600; color: var(--text); font-size: 20px; }
.deck-swipe { display: flex; align-items: center; gap: 8px; }
.deck-swipe svg { width: 16px; height: 16px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.deck-swipe svg:first-child { animation: swipeL 1.8s ease-in-out infinite; }
.deck-swipe svg:last-child { animation: swipeR 1.8s ease-in-out infinite; }
@keyframes swipeL { 50% { transform: translateX(-4px); } }
@keyframes swipeR { 50% { transform: translateX(4px); } }
.deck-empty {
  position: absolute;
  inset: 0 0 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  opacity: 0;
  transform: scale(.95);
  transition: opacity .6s var(--ease) .2s, transform .6s var(--ease) .2s;
  pointer-events: none;
}
.deck.is-done .deck-empty { opacity: 1; transform: none; pointer-events: auto; }
.deck-empty p { font: 400 30px/1.1 var(--serif); }
.deck-empty p em { font-family: var(--script); font-style: normal; color: var(--rose-2); font-size: 1.2em; }

/* ==========================================================================
   05 · grid (open-when notes) + sheet
   ========================================================================== */

.notes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.note {
  position: relative;
  aspect-ratio: .86;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  border-radius: 22px;
  transition: transform .35s var(--spring), border-color .4s;
}
.note:active { transform: scale(.96); }
.note-env {
  position: relative;
  width: 58px; height: 40px;
  border-radius: 5px;
  background: linear-gradient(165deg, #f4dfc7, #ddb996);
  box-shadow: 0 10px 18px -8px rgba(0, 0, 0, .6);
  perspective: 300px;
}
.note-env::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 5px;
  background: linear-gradient(0deg, #f8e7d3, #ecd1b4);
  clip-path: polygon(0 100%, 50% 42%, 100% 100%);
}
.note-env i {
  position: absolute;
  left: 0; right: 0; top: 0; height: 62%;
  transform-origin: 50% 0;
  transition: transform .6s var(--ease);
}
.note-env i::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #e7c9a8, #d2a982);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.note-env b {
  position: absolute;
  left: 50%; top: 62%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7394, #b3163f);
  transition: transform .4s var(--spring), opacity .3s;
}
.note.is-opened .note-env i { transform: rotateX(180deg); }
.note.is-opened .note-env b { transform: scale(0); opacity: 0; }
.note-when { font: 600 10px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.note-label { margin-top: 6px; font: 500 22px/1.1 var(--serif); }
.note-check {
  position: absolute;
  top: 14px; right: 14px;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 92, 138, .9);
  transform: scale(0);
  transition: transform .4s var(--spring);
}
.note-check svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.note.is-opened .note-check { transform: scale(1); }

.sheet { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.sheet[data-open="true"] { pointer-events: auto; }
.sheet-scrim {
  position: absolute; inset: 0;
  background: rgba(8, 2, 6, .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .5s var(--ease);
}
.sheet[data-open="true"] .sheet-scrim { opacity: 1; }
.sheet-panel {
  position: absolute;
  left: 10px; right: 10px;
  bottom: calc(var(--safe-b) + 10px);
  max-height: calc(100% - var(--safe-t) - 70px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-radius: 30px;
  padding: 12px 24px 24px;
  color: var(--ink);
  background: radial-gradient(100% 100% at 50% 0%, #fffaf3 0%, #f5e6d2 100%);
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .6);
  transform: translateY(calc(100% + 40px));
  transition: transform .65s var(--ease);
}
.sheet-panel::-webkit-scrollbar { display: none; }
.sheet[data-open="true"] .sheet-panel { transform: translateY(var(--drag, 0px)); }
.sheet-panel.is-drag { transition: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; margin: 0 auto 18px; background: rgba(58, 29, 41, .18); }
.sheet-kicker { font: 700 10.5px/1 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: #c2466e; }
.sheet-title { margin-top: 8px; font: 500 34px/1.05 var(--serif); }
.sheet-title em { font-family: var(--script); font-style: normal; color: #b3264f; font-size: 1.15em; }
.sheet-gif { margin: 18px auto 16px; width: 60%; border-radius: 18px; overflow: hidden; background: #fff; box-shadow: 0 14px 30px -16px rgba(80, 30, 40, .5); }
.sheet-gif img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.sheet-body { font: 400 20px/1.55 var(--serif); text-wrap: pretty; }
.sheet-close { margin-top: 22px; width: 100%; height: 50px; border: 0; border-radius: 999px; background: #3a1d29; color: #fff; font: 600 14px/1 var(--sans); letter-spacing: .02em; }
.sheet-close:active { transform: scale(.98); }

/* ==========================================================================
   06 · scratch
   ========================================================================== */

.scratch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.scard {
  position: relative;
  aspect-ratio: .78;
  border-radius: 20px;
  overflow: hidden;
  background: #2a0f1d;
  box-shadow: 0 24px 40px -22px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08);
  transform: translateZ(0);
}
.scard-reveal {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background:
    radial-gradient(120% 80% at 50% 0%, #ff8fb1 0%, rgba(255, 143, 177, 0) 60%),
    linear-gradient(170deg, #e0245e 0%, #8e0c2c 100%);
}
.scard-reveal > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scard-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 12px 12px;
  font: 500 16px/1.2 var(--serif);
  color: #fff;
  background: linear-gradient(0deg, rgba(20, 4, 12, .8), transparent);
}
.coupon {
  width: 100%; height: 100%;
  border-radius: 14px;
  border: 1.5px dashed rgba(255, 235, 242, .55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  text-align: center;
}
.coupon-k { font: 700 9.5px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--gold-2); }
.coupon svg { width: 34px; height: 34px; fill: none; stroke: #fff; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.coupon-t { font: 500 20px/1.15 var(--serif); color: #fff; text-wrap: balance; }
.scard canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; transition: opacity .8s var(--ease); }
.scard.is-revealed canvas { opacity: 0; pointer-events: none; }
.scard.is-revealed .coupon, .scard.is-revealed .scard-reveal > img { animation: pop .7s var(--spring); }
@keyframes pop { 0% { transform: scale(.92); } 100% { transform: none; } }
.scratch-count { margin-top: 16px; text-align: center; }

/* ==========================================================================
   07 · geo (globe)
   ========================================================================== */

.step.geo { overflow: hidden; }
.geo-stage {
  position: relative;
  flex: 1;
  min-height: 300px;
  margin: 0 calc(var(--gutter) * -1);
}
.geo-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; opacity: 0; transition: opacity 1.4s var(--ease); }
.geo-stage.is-live canvas { opacity: 1; }
.geo-label {
  position: absolute;
  left: 0; top: 0;
  z-index: 2;
  max-width: 80vw;
  padding: 12px 18px 13px;
  border-radius: 18px;
  text-align: center;
  pointer-events: none;
  transform: translate3d(var(--lx, 50vw), var(--ly, 40%), 0) translate(-50%, calc(-100% - 22px));
  transition: opacity .35s var(--ease);
  opacity: 0;
}
.geo-label.is-on { opacity: 1; }
.geo-label::after {
  content: '';
  position: absolute;
  left: 50%; top: 100%;
  width: 1px; height: 20px;
  background: linear-gradient(180deg, rgba(255, 180, 200, .8), rgba(255, 180, 200, 0));
}
.geo-label-inner { transition: opacity .3s var(--ease), transform .4s var(--ease); }
.geo-label.is-swap .geo-label-inner { opacity: 0; transform: translateY(6px); }
.geo-lang { font: 700 9.5px/1 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.geo-phrase { margin-top: 7px; font: 500 28px/1.12 var(--serif); color: #fff; text-wrap: balance; }
.geo-phrase.is-long { font-size: 22px; }
.geo-phrase.is-xlong { font-size: 18px; }
.geo-roman { margin-top: 4px; font: italic 400 14px/1.2 var(--serif); color: var(--muted); }
.geo-roman:empty { display: none; }
.geo-count {
  position: absolute;
  left: 0; right: 0; bottom: 6px;
  text-align: center;
  font: 500 12px/1 var(--sans);
  letter-spacing: .06em;
  color: var(--faint);
  pointer-events: none;
}
.geo-count b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chips {
  position: relative;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 10px calc(var(--gutter) * -1) 0;
  padding: 4px var(--gutter) 6px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent);
  mask: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .06);
  font: 500 13px/1 var(--sans);
  color: var(--muted);
  transition: background .3s, color .3s, border-color .3s, transform .2s var(--spring);
}
.chip:active { transform: scale(.94); }
.chip[aria-current="true"] { color: #fff; border-color: transparent; background: linear-gradient(135deg, #ff7aa0, #d91f5d); box-shadow: 0 8px 18px -8px rgba(255, 60, 120, .8); }

/* ==========================================================================
   08 · hold
   ========================================================================== */

.hold-stage {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 320px;
  transition: opacity .6s var(--ease), transform .8s var(--ease);
}
.hold.is-done .hold-stage { opacity: 0; transform: scale(.8); pointer-events: none; position: absolute; inset: 0; }
.hold-btn {
  position: relative;
  width: 232px; height: 232px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 92, 138, .18), rgba(255, 92, 138, 0) 65%);
  touch-action: none;
  -webkit-touch-callout: none;
  outline: none;
}
.hold-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.hold-ring circle { fill: none; stroke-width: 3; }
.hold-ring .track { stroke: rgba(255, 255, 255, .1); }
.hold-ring .bar { stroke: url(#hold-grad-ring); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 6px rgba(255, 92, 138, .8)); }
.hold-heart {
  position: absolute;
  left: 50%; top: 50%;
  width: 150px; height: 150px;
  margin: -75px 0 0 -75px;
  overflow: visible;
  filter: drop-shadow(0 18px 30px rgba(224, 36, 94, .45));
  transition: transform .4s var(--spring);
}
.hold-btn.is-holding .hold-heart { animation: beat .9s ease-in-out infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.08); }
  30% { transform: scale(.98); }
  45% { transform: scale(1.06); }
}
.hold-heart .h-base { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 210, 222, .55); stroke-width: .35; }
.hold-heart .h-shine { fill: rgba(255, 255, 255, .5); }
.hold-label { font: 600 12px/1 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--muted); transition: color .3s; }
.hold-btn.is-holding + .hold-label { color: var(--rose-2); }

.hold-done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(20px) scale(.96);
  pointer-events: none;
  transition: opacity .8s var(--ease) .25s, transform 1s var(--spring) .25s;
}
.hold:not(.is-done) .hold-done { position: absolute; inset: 0; }
.hold.is-done .hold-done { opacity: 1; transform: none; pointer-events: auto; }
.bubble-gif {
  width: 190px; height: 190px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .08), 0 0 0 6px rgba(233, 197, 156, .5), 0 30px 60px -20px rgba(224, 36, 94, .6);
}
.bubble-gif img { width: 100%; height: 100%; object-fit: contain; }
.hold-done h3 { margin-top: 8px; font: 500 36px/1.05 var(--serif); }
.hold-done p { max-width: 30ch; font: 400 15px/1.5 var(--sans); color: var(--muted); }

/* ==========================================================================
   09 · prompt (yes / no)
   ========================================================================== */

.step.prompt { text-align: center; align-items: stretch; }
.prompt-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.prompt .bubble-gif { width: 168px; height: 168px; transition: transform .6s var(--spring); }
.prompt.is-yes .bubble-gif { transform: scale(1.08); }
.prompt-q { font: 500 34px/1.1 var(--serif); text-wrap: balance; max-width: 16ch; transition: opacity .35s; }
.prompt-sub { font: 400 15px/1.5 var(--sans); color: var(--muted); min-height: 1.5em; }
.arena { position: relative; width: 100%; height: 190px; flex: none; }
.btn-yes {
  --grow: 1;
  position: absolute;
  left: 50%; top: 18px;
  width: 58%;
  transform: translateX(-50%) scale(var(--grow));
  transform-origin: 50% 0;
  transition: transform .45s var(--spring), opacity .5s;
}
.btn-yes:active { transform: translateX(-50%) scale(calc(var(--grow) * .96)); }
.btn-no {
  position: absolute;
  left: 50%; top: 96px;
  height: 46px;
  padding: 0 22px;
  transform: translateX(-50%);
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font: 600 14px/1 var(--sans);
  color: var(--muted);
  white-space: nowrap;
  transition: left .45s var(--spring), top .45s var(--spring), transform .45s var(--spring), opacity .4s;
}
.btn-no.is-free { transform: none; }
.prompt.is-yes .arena { opacity: 0; pointer-events: none; transition: opacity .4s; }

/* ==========================================================================
   10 · outro
   ========================================================================== */

.step.outro { text-align: center; justify-content: flex-end; align-items: center; }
.outro-spacer { flex: 1; min-height: 38vh; }
.outro-script {
  font: 400 76px/1 var(--script);
  padding: 0 .1em .08em;
  background: linear-gradient(100deg, #ffe1e9 0%, #ff86a9 40%, #ff5c8a 60%, #f3c79c 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  clip-path: inset(0 100% 0 0);
  position: relative;
  isolation: isolate;
}
.outro-script::before {
  content: '';
  position: absolute;
  inset: -10% 4%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 92, 138, .28), rgba(255, 92, 138, 0));
}
.outro.is-active .outro-script { animation: write 2.4s var(--ease) 1.4s forwards; }
@keyframes write { to { clip-path: inset(0 -10% 0 0); } }
.outro-lines { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.outro-lines p { font: italic 400 20px/1.4 var(--serif); color: rgba(255, 240, 245, .85); }
.outro-sign { margin-top: 18px; display: flex; align-items: center; gap: 12px; justify-content: center; }
.outro-sign .bubble-gif { width: 58px; height: 58px; box-shadow: 0 0 0 2px rgba(233, 197, 156, .6); }
.outro-sign span { font: 400 30px/1 var(--script); color: var(--gold-2); }
.outro-actions { width: 100%; margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.outro-actions .ghost { width: 100%; }

/* ==========================================================================
   fx layer / toast
   ========================================================================== */

#fx { position: absolute; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
#fx i { position: absolute; left: 0; top: 0; display: block; will-change: transform, opacity; }
#fx i svg { width: 100%; height: 100%; fill: currentColor; }
#fx i.c { border-radius: 2px; }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 90px);
  z-index: 70;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(30, 10, 20, .8);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--stroke);
  font: 500 13px/1.3 var(--sans);
  text-align: center;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   guards: orientation + desktop
   ========================================================================== */

.guard {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--bg-0);
}
.guard-orientation svg { width: 44px; height: 44px; fill: none; stroke: var(--rose-2); stroke-width: 1.4; animation: tilt 2.4s var(--ease) infinite; }
.guard-orientation p { font: 500 15px/1.4 var(--sans); color: var(--muted); }
@keyframes tilt { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0deg); } }
@media (orientation: landscape) and (max-height: 520px) {
  .guard-orientation { display: flex; }
}

html.is-desktop .guard-desktop { display: flex; background:
  radial-gradient(60% 60% at 50% 40%, #3a0c2a 0%, rgba(58, 12, 42, 0) 70%), var(--bg-0); }
html.is-desktop #app { display: none; }
.guard-card { max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.guard-heart { width: 40px; height: 40px; fill: var(--rose); filter: drop-shadow(0 0 20px rgba(255, 92, 138, .7)); animation: beat 1.6s ease-in-out infinite; }
.guard-card h1 { font: 500 38px/1.05 var(--serif); }
.guard-card p { font: 400 15px/1.55 var(--sans); color: var(--muted); }
.guard-qr { margin-top: 10px; padding: 14px; border-radius: 18px; background: #fff; line-height: 0; }
.guard-qr:empty { display: none; }
.guard-qr svg { width: 168px; height: 168px; }

/* desktop preview frame (?preview) */
html.is-preview body { background: #050204; }
html.is-preview #app {
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  width: 390px;
  height: min(844px, 100vh);
  transform: translate(-50%, -50%);
  border-radius: 44px;
  box-shadow: 0 0 0 10px #1a1016, 0 0 0 11px #2c1d25, 0 60px 120px -30px rgba(0, 0, 0, .9);
  background:
    radial-gradient(120% 70% at 50% 115%, #4b0f30 0%, rgba(75, 15, 48, 0) 62%),
    radial-gradient(90% 55% at 88% -8%, #3a0c2a 0%, rgba(58, 12, 42, 0) 60%),
    var(--bg-0);
}

@media (prefers-reduced-motion: reduce) {
  .grain, .envelope, .cta::before, .slider-label { animation: none; }
}

/* small phones */
@media (max-height: 700px) {
  :root { --hud-h: 50px; }
  .title { font-size: 34px; }
  .gate-time { font-size: 88px; }
  .lede { font-size: 14px; margin-top: 8px; }
  .notes, .scratch-grid { margin-top: 16px; gap: 10px; }
  .note { aspect-ratio: 1; }
  .deck { min-height: 320px; }
  .deck-text { font-size: 21px; }
  .hold-btn { width: 200px; height: 200px; }
  .prompt .bubble-gif { width: 132px; height: 132px; }
  .prompt-q { font-size: 29px; }
  .outro-script { font-size: 64px; }
}
