:root {
  color-scheme: light;
  --bg: #FBF4EC;
  --glow: #F5D9C6;
  --surface: #FFFDFA;
  --ink: #3A1420;
  --ink-soft: #6E4A52;
  --primary: #A3213F;
  --primary-strong: #861733;
  --primary-tint: #FBEAE8;
  --gold: #C9893A;
  --gold-ink: #8A5A12;
  --line: #E9D6C7;
  --shadow: 0 1px 2px rgb(58 20 32 / .06), 0 18px 40px -18px rgb(58 20 32 / .25);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 400 1rem/1.55 var(--body);
  color: var(--ink);
  background:
    radial-gradient(60rem 40rem at 85% -10%, var(--glow), transparent 60%),
    radial-gradient(50rem 35rem at -10% 110%, #F3DCD6, transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button, input, textarea { font: inherit; color: inherit; }
button, a, label { touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

/* ---------- Screens ---------- */
.screen {
  display: none;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(24px, 6vw, 56px) 20px 96px;
}
.screen.is-active { display: grid; }
.inner { width: min(100%, 560px); text-align: center; }
/* animate the inner wrapper (never the screen) so fixed children stay viewport-relative;
   "backwards" fill leaves no transform behind once the animation ends */
.screen.enter .inner { animation: rise .55s var(--ease) backwards; }
@keyframes rise { from { opacity: 0; translate: 0 18px; } }

/* ---------- Type ---------- */
.display, .title, .card-title, legend { font-family: var(--display); font-weight: 600; letter-spacing: -.02em; margin: 0; }
.display { font-size: clamp(2.4rem, 8.5vw, 4.25rem); line-height: 1.04; text-wrap: balance; }
.title, legend { font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.12; text-wrap: balance; }
.display em, .title em { font-style: italic; font-weight: 500; color: var(--primary); }
.eyebrow {
  margin: 0 0 14px;
  font-size: .75rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold-ink);
}
.lede { margin: 14px auto 0; max-width: 36ch; font-size: 1.125rem; color: var(--ink-soft); }
.signature { margin: 18px 0 0; font: italic 500 1.5rem var(--display); color: var(--primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 52px; padding: 0 26px;
  border: 1.5px solid transparent; border-radius: 999px;
  font-weight: 700; font-size: 1rem; line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background-color .2s, border-color .2s, color .2s, translate .2s var(--ease), scale .35s var(--ease), box-shadow .2s;
}
.btn:active { translate: 0 1px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 10px 24px -12px rgb(163 33 63 / .7); }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-primary:focus-visible { outline-color: var(--ink); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #D7B8A5; }
.btn-link { color: var(--primary); padding: 0 10px; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-big { min-height: 60px; min-width: 140px; font-size: 1.15rem; }

/* ---------- Lock ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: var(--shadow); padding: clamp(28px, 7vw, 48px);
}
.badge {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 20px;
  border-radius: 50%; background: var(--primary-tint); color: var(--primary);
}
#lock-form { margin-top: 28px; text-align: left; }
.label { display: block; margin-bottom: 8px; font-weight: 500; font-size: .95rem; }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; }
.field-row .input { flex: 1 1 180px; }
.field-row .btn { flex: 1 0 auto; }
.input {
  width: 100%; min-height: 52px; padding: 12px 16px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; font-size: 1.05rem;
  transition: border-color .2s;
}
.input:focus-visible { outline-offset: 2px; border-color: var(--primary); }
textarea.input { resize: vertical; margin-top: 24px; text-align: left; }
.hint { min-height: 1.6em; margin: 12px 0 0; font: italic 500 1.05rem var(--display); color: var(--primary); }
.shake { animation: shake .45s var(--ease); }
@keyframes shake {
  20% { translate: -10px 0; } 40% { translate: 8px 0; } 60% { translate: -5px 0; } 80% { translate: 3px 0; }
}

/* ---------- Question ---------- */
.choices { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 40px; min-height: 96px; }
#yes { scale: var(--grow, 1); }
/* Once it starts running, No is fixed to the viewport; all its motion is done in JS (Web Animations). */
#no.loose { position: fixed; z-index: 30; /* always above Yes: a tap on No can never land on Yes */ margin: 0; transition: scale .3s var(--ease); }

.escape-note {
  position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom));
  min-height: 44px; padding: 10px 14px;
  background: none; border: 0; border-radius: 12px;
  font-size: .8125rem; color: var(--ink-soft); cursor: pointer; z-index: 45; /* stays reachable above gags */
}
#ask:has(.overlay:not([hidden])) .escape-note { background: var(--surface); box-shadow: var(--shadow); }
.escape-note:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Yes ---------- */
.big-heart { color: var(--primary); display: block; margin: 0 auto 18px; animation: heartpop 1s var(--ease) both; }
@keyframes heartpop { 0% { scale: 0; } 55% { scale: 1.25; } 75% { scale: .92; } 100% { scale: 1; } }
.date-card {
  position: relative; margin: 32px 0 28px; padding: 24px 24px 18px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.date-card::before { /* thin gold ticket edge */
  content: ""; position: absolute; inset: 0 24px auto; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold);
}
.card-title { font-size: 1.6rem; line-height: 1.15; }
.meta { list-style: none; margin: 16px 0 20px; padding: 0; display: grid; gap: 10px; }
.meta li { display: flex; align-items: center; gap: 12px; }
.meta svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--primary); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card-label { width: 100%; font-size: .875rem; font-weight: 500; color: var(--ink-soft); }
.tickets { margin: 10px 0 0 -10px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-top: 16px; border-top: 1.5px dashed var(--line); }

/* ---------- Questionnaire ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { width: 100%; padding: 0; }
legend + .options { margin-top: 28px; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option { position: relative; }
.option:last-child:nth-child(odd) { grid-column: 1 / -1; }
.option input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.option span {
  display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 12px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px;
  font-weight: 500; transition: border-color .2s, background-color .2s, color .2s;
}
.option:hover span { border-color: #D7B8A5; }
.option input:checked + span { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-strong); font-weight: 700; }
.option input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 3px; }
.other { margin-top: 18px; text-align: left; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.step-nav .btn { flex: 1; max-width: 200px; }

/* ---------- No ---------- */
.flower { display: block; margin: 0 auto 24px; overflow: visible; }
.flower .stem-low, .flower .stem-up { stroke: #7C8B6A; stroke-width: 4; stroke-linecap: round; fill: none; }
.flower .leaf { fill: #93A27F; }
.flower .head ellipse, .flower .petal-fall { fill: #E3A49B; }
.flower .center { fill: var(--gold); }
.flower .top { transform-box: view-box; transform-origin: 60px 112px; animation: droop 2.6s .5s ease-in-out forwards; }
.flower .petal-fall { opacity: 0; transform-box: fill-box; transform-origin: center; animation: petal 2.4s 2.4s ease-in forwards; }
@keyframes droop { to { rotate: 34deg; } }
@keyframes petal { 0% { opacity: 1; } 100% { opacity: 0; translate: -18px 70px; rotate: 120deg; } }
.no-message { margin: 0 auto; max-width: 30ch; font: 400 clamp(1.3rem, 4.5vw, 1.6rem)/1.4 var(--display); }

/* ---------- Bad-UI gag dialogs ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  padding: 16px 16px 72px; background: rgb(58 20 32 / .4); animation: fade .2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  position: relative; width: min(100%, 440px); max-height: calc(100dvh - 88px); overflow: auto;
  padding: 28px 24px 24px; text-align: left;
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow);
  animation: rise .3s var(--ease);
}
.dialog-title { margin: 0 40px 12px 0; font: 600 1.45rem/1.2 var(--display); letter-spacing: -.01em; }
.dialog p { margin: .6em 0; }
.dialog-close {
  position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: none; color: var(--ink-soft); cursor: pointer;
}
.dialog-close:hover { background: var(--primary-tint); color: var(--primary); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.gag-status { min-height: 1.5em; font: italic 500 1.05rem var(--display); color: var(--primary); }
.big-num { font: 600 1.5rem var(--display); color: var(--primary); }
.progress { height: 12px; margin: 18px 0 6px; border-radius: 99px; background: #F1E2D6; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); scale: 0 1; transform-origin: left; transition: scale .5s var(--ease); }
.equation {
  margin: 16px 0 !important; padding: 16px; border-radius: 14px; text-align: center;
  background: var(--primary-tint); font: 500 1.35rem/1.4 var(--display);
}
.terms {
  max-height: 150px; overflow: auto; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fff; font-size: .9rem;
}
.terms ol { margin: 0; padding-left: 1.2em; }
.terms li { margin: .4em 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-weight: 500; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); cursor: pointer; }
.captcha { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.tile {
  min-height: 84px; padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font-size: .85rem; font-weight: 500; line-height: 1.25; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.tile[aria-pressed="true"]::before { content: "✓ "; }
.tile[aria-pressed="true"] { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-strong); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
