:root {
  --cream: #fffaf3;
  --paper: #fffdf9;
  --blush: #fde4ea;
  --blush-2: #fff3f6;
  --rose: #e76f8e;
  --rose-deep: #c2456a;
  --ink: #4b2a36;
  --muted: #8a6671;
  --line: #f3d3db;
  --fr-blue: #0055a4;
  --fr-red: #ef4135;
  --md-yellow: #ffd200;

  --script: 'Dancing Script', 'Segoe Script', 'Brush Script MT', cursive;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Quicksand', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, #ffe3ea 0, transparent 38%),
    radial-gradient(circle at 88% 92%, #ffecd9 0, transparent 42%),
    var(--cream);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

/* ---------- floating hearts ---------- */
.bg-hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-hearts span {
  position: absolute;
  bottom: -60px;
  color: var(--rose);
  opacity: .22;
  animation: float-up linear infinite;
}
@keyframes float-up {
  0% { transform: translateY(0) rotate(-10deg); }
  50% { transform: translateY(-55vh) translateX(20px) rotate(10deg); }
  100% { transform: translateY(-115vh) rotate(-10deg); }
}

/* ---------- layout ---------- */
.stage {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  min-height: calc(100dvh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.screen { display: none; width: 100%; }
.screen.active { display: block; animation: rise .6s cubic-bezier(.2, .8, .2, 1); }
.stage:has(.screen.wide.active) { max-width: 820px; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.card {
  position: relative;
  background: var(--paper);
  border: 1px solid #f6e3e8;
  border-radius: 24px;
  padding: 40px 32px 32px;
  text-align: center;
  box-shadow: 0 24px 60px -24px rgba(194, 69, 106, .35), 0 2px 0 rgba(75, 42, 54, .03);
}
/* airmail envelope border */
.card.airmail {
  border: 9px solid transparent;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    repeating-linear-gradient(135deg,
      var(--fr-red) 0 14px, #fff 14px 22px,
      var(--fr-blue) 22px 36px, #fff 36px 44px) border-box;
}

.stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 64px;
  padding: 8px 4px 6px;
  background: #fff;
  border: 2px dashed #e9b7c4;
  border-radius: 6px;
  transform: rotate(7deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 4px 10px -6px rgba(0, 0, 0, .25);
}
.stamp span { font-size: 1.6rem; line-height: 1; }
.stamp small { font: 700 .55rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--fr-blue); }

/* ---------- type ---------- */
.script { font-family: var(--script); font-size: 1.9rem; color: var(--rose-deep); margin: 4px 0 2px; }
h1, h2 { font-family: var(--serif); font-weight: 700; margin: 0 0 14px; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.45rem, 4.2vw, 1.9rem); }
h1 em, h2 em { font-weight: 500; color: var(--rose-deep); }
.sub { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; margin: 26px 0 12px; }
.lead { font-size: 1.05rem; line-height: 1.6; margin: 0 auto 14px; max-width: 30em; text-wrap: pretty; }
.lead.small { font-size: .95rem; color: var(--muted); }
.yes-word { color: var(--rose-deep); }

/* ---------- mascot ---------- */
.mascot { width: 96px; height: auto; display: block; margin: 0 auto 6px; overflow: visible; }
.mascot.beat { animation: beat 1.4s ease-in-out infinite; }
.mascot.bounce { animation: bounce .9s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.1); } 30% { transform: scale(.97); } 45% { transform: scale(1.06); } }
@keyframes bounce { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(4deg); } }
#ask-mouth, #ask-tear { transition: opacity .3s; }

/* ---------- buttons ---------- */
.btn {
  font: 700 1rem var(--sans);
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s, opacity .2s;
  touch-action: manipulation;
}
.btn-lg { font-size: 1.1rem; padding: 15px 32px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #f38fab, var(--rose-deep));
  box-shadow: 0 12px 26px -10px rgba(194, 69, 106, .7);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 30px -10px rgba(194, 69, 106, .8); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--muted); padding-left: 10px; padding-right: 10px; }
.btn-ghost:hover { color: var(--rose-deep); }
.btn:focus-visible, .option:focus-visible, .chip:focus-visible, .cal-day:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid #f7b6c6; outline-offset: 3px;
}

.answer-row { display: flex; gap: 16px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 22px 0 10px; min-height: 70px; }
.btn-yes { transform: scale(var(--grow, 1)); transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s; }
.btn-yes:hover { transform: scale(calc(var(--grow, 1) * 1.06)); }
.btn-no { background: #fff; color: var(--ink); border: 2px solid var(--line); white-space: nowrap; }
.btn-no.runaway { position: fixed; z-index: 50; margin: 0; transition: left .28s cubic-bezier(.3, 1.4, .5, 1), top .28s cubic-bezier(.3, 1.4, .5, 1); }
.btn-no.runaway.teleport { transition: none; }
.btn-no.poof { animation: poof .4s ease-out; }
@keyframes poof { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.hint { min-height: 1.5em; color: var(--muted); font-size: .95rem; font-style: italic; margin: 8px 0 0; }

/* ---------- flags ---------- */
.flags { margin: 22px 0 0; color: var(--muted); font-weight: 700; display: flex; gap: 8px; align-items: center; justify-content: center; }
.flag { display: inline-block; width: 27px; height: 18px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.flag.fr { background: linear-gradient(90deg, var(--fr-blue) 33.3%, #fff 33.3% 66.6%, var(--fr-red) 66.6%); }
.heart-mini { color: var(--rose); font-size: 1.2rem; }

/* ---------- progress ---------- */
.progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 8px; }
.progress i { width: 30px; height: 6px; border-radius: 3px; background: var(--line); }
.progress i.on { background: var(--rose); }

/* ---------- calendar ---------- */
.cal { max-width: 340px; margin: 10px auto 0; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-head strong { font-family: var(--serif); font-size: 1.1rem; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--blush-2); color: var(--rose-deep); font-size: 1.4rem; line-height: 1;
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: .72rem; font-weight: 700; color: var(--muted); padding: 4px 0; text-transform: uppercase; letter-spacing: .05em; }
.cal-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font: 600 .95rem var(--sans);
  color: var(--ink);
  cursor: pointer;
  position: relative;
  transition: background .15s, color .15s, transform .15s;
}
.cal-day:hover:not(:disabled) { background: var(--blush); }
.cal-day:disabled { color: #dcc8ce; cursor: default; }
.cal-day.weekend:not(:disabled) { color: var(--rose-deep); }
.cal-day.selected { background: var(--rose); color: #fff !important; transform: scale(1.08); box-shadow: 0 6px 14px -6px rgba(194, 69, 106, .8); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 420px; margin: 0 auto; }
.chip {
  border: 2px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: 700 .95rem var(--sans); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--rose); }
.chip.selected { background: var(--rose); border-color: var(--rose); color: #fff; }
.picked { min-height: 1.5em; margin: 18px 0 0; font-weight: 600; color: var(--rose-deep); }

/* ---------- option cards ---------- */
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; text-align: left; margin-top: 18px; }
.option {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px 16px;
  cursor: pointer;
  font: inherit; color: inherit; text-align: left;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.option:hover { transform: translateY(-2px); border-color: #eeaabb; }
.option.selected { border-color: var(--rose); background: var(--blush-2); box-shadow: 0 10px 22px -12px rgba(231, 111, 142, .8); }
.option.selected::after {
  content: '❤'; position: absolute; top: 10px; right: 12px;
  color: var(--rose); font-size: 1.1rem; animation: pop .3s;
}
@keyframes pop { from { transform: scale(0); } 60% { transform: scale(1.4); } to { transform: scale(1); } }
.option .emoji { font-size: 1.9rem; line-height: 1; }
.option .body { display: block; width: 100%; }
.option .t { display: block; font-weight: 700; font-family: var(--serif); font-size: 1.08rem; margin: 8px 0 4px; padding-right: 18px; }
.option .d { display: block; font-size: .88rem; color: var(--muted); margin: 0; line-height: 1.45; }
.option .spot { display: block; margin-top: 8px; font-size: .78rem; font-weight: 700; color: var(--rose-deep); }
.option .badge {
  position: absolute; top: -10px; left: 14px;
  background: var(--md-yellow); color: var(--ink);
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.other-field { text-align: left; margin: 16px 0 0; animation: rise .35s ease-out; }
.other-field label { display: block; font-weight: 700; margin-bottom: 6px; }
.other-field input {
  width: 100%; border: 2px solid var(--rose); border-radius: 14px; padding: 12px 14px;
  font: 500 1rem var(--sans); color: var(--ink); background: #fff;
}
.other-field input:focus { outline: 3px solid #f7b6c6; outline-offset: 2px; }
.counter { margin: 14px 0 0; color: var(--muted); font-weight: 600; min-height: 1.4em; }

.nav-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* ---------- recap ---------- */
.recap { text-align: left; background: #fff; border: 2px dashed var(--line); border-radius: 18px; padding: 6px 18px; margin: 16px 0 20px; }
.recap-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.recap-row:last-child { border-bottom: 0; }
.recap-row .ico { font-size: 1.4rem; line-height: 1.2; }
.recap-row .txt { flex: 1; }
.recap-row .txt small { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.recap-row .txt b { font-weight: 700; }
.recap-row .edit { background: none; border: 0; color: var(--rose-deep); font: 700 .85rem var(--sans); cursor: pointer; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }
.note-label { display: block; text-align: left; font-weight: 700; margin-bottom: 6px; }
.note-label span { font-weight: 500; color: var(--muted); }
textarea {
  width: 100%; resize: vertical; min-height: 80px;
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font: 500 1rem var(--sans); color: var(--ink); background: #fff;
}
textarea:focus { outline: none; border-color: var(--rose); }
.error { color: var(--fr-red); font-weight: 600; margin: 14px 0 0; }

/* ---------- done ---------- */
.summary { background: var(--blush-2); border-radius: 16px; padding: 14px 18px; margin: 6px auto 20px; max-width: 420px; line-height: 1.7; }
.countdown { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.countdown div { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 6px 8px; min-width: 68px; }
.countdown b { display: block; font-family: var(--serif); font-size: 1.7rem; color: var(--rose-deep); line-height: 1.1; }
.countdown span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.ps { color: var(--muted); font-style: italic; margin: 20px auto 0; max-width: 28em; }
.signature { font-family: var(--script); font-size: 1.7rem; color: var(--rose-deep); margin: 18px 0 8px; line-height: 1.2; }
.small-link { font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- confetti ---------- */
.confetti { position: fixed; top: -40px; z-index: 60; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .9; } }

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .card { padding: 34px 20px 24px; border-radius: 20px; }
  .card.airmail { border-width: 7px; }
  .stamp { top: 10px; right: 10px; width: 52px; transform: rotate(7deg) scale(.9); }
  .mascot { width: 80px; }
  .options { grid-template-columns: 1fr; }
  .option { flex-direction: row; flex-wrap: wrap; column-gap: 12px; }
  .option .emoji { font-size: 1.6rem; }
  .option .body { flex: 1; min-width: 0; width: auto; }
  .option .t { margin-top: 0; }
  .countdown div { min-width: 60px; }
  .nav-row .btn-lg { padding: 14px 22px; }
}

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