@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #FAF4E8;
  --card: #FFFDF8;
  --ink: #1D2B25;
  --muted: #56635B;
  --line: #A39880;
  --line-soft: #E4DAC6;
  --pine: #1F5B43;
  --pine-deep: #17402F;
  --berry: #BF3A2B;
  --berry-deep: #9C2D20;
  --gold: #E3A93B;
  --gold-soft: #F6E3B4;
  --mint: #DCEBDF;
  --blush: #F8DDD6;
  --display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }

.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  background-color: var(--pine-deep);
  /* a handful of still snowflakes; nothing moves */
  background-image:
    radial-gradient(circle at 8% 38%, rgba(255,255,255,.55) 0 2px, transparent 2.5px),
    radial-gradient(circle at 22% 72%, rgba(255,255,255,.35) 0 1.5px, transparent 2px),
    radial-gradient(circle at 41% 24%, rgba(255,255,255,.4) 0 1.5px, transparent 2px),
    radial-gradient(circle at 63% 58%, rgba(255,255,255,.3) 0 2px, transparent 2.5px),
    radial-gradient(circle at 79% 30%, rgba(255,255,255,.5) 0 1.5px, transparent 2px),
    radial-gradient(circle at 93% 66%, rgba(255,255,255,.4) 0 2px, transparent 2.5px);
  color: var(--paper);
  padding-bottom: 56px;
  overflow: hidden;
}

.lights { display: block; }

.tw { animation: twinkle 5s ease-in-out infinite; }
.tw.b { animation-delay: -1.2s; }
.tw.c { animation-delay: -2.6s; }
.tw.d { animation-delay: -3.8s; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.hero-inner {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  text-align: center;
}

.hero-art { width: 168px; height: auto; flex: none; }

.eyebrow {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  font: 700 clamp(2.25rem, 9.5vw, 3.5rem)/1.02 var(--display);
  letter-spacing: -.02em;
  margin-top: 10px;
  text-wrap: balance;
}

.lede {
  margin: 14px auto 0;
  max-width: 34ch;
  color: #E6E1D2;
  font-size: 1.06rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 15px 8px 12px;
  border: 1.5px solid rgba(250, 244, 232, .4);
  border-radius: 999px;
  background: rgba(250, 244, 232, .1);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
}
.chip svg { flex: none; }
.chip.live { background: var(--gold); border-color: var(--gold); color: var(--ink); }

.drift {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 44px;
  fill: var(--paper);
}

/* ---------- sections ---------- */

main { padding-top: 22px; padding-bottom: 8px; }

.section-title {
  font: 700 .8rem/1.2 var(--body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.how ol { display: grid; gap: 14px; }
.how li { display: flex; align-items: center; gap: 14px; }
.how svg { width: 48px; height: 48px; flex: none; }
.how strong { display: block; font-weight: 700; line-height: 1.3; }
.how span { display: block; color: var(--muted); font-size: .95rem; line-height: 1.4; margin-top: 2px; }

#stage { margin-top: 30px; scroll-margin-top: 14px; }

.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--ink);
  padding: 22px 18px 24px;
}
.card.center { text-align: center; }
.card h2 {
  font: 700 1.7rem/1.12 var(--display);
  letter-spacing: -.01em;
  outline: none;
  text-wrap: balance;
}
.card.center > p { margin: 10px auto 0; max-width: 40ch; color: var(--muted); }
.big-icon { width: 72px; height: 72px; margin-bottom: 10px; }

.hint { color: var(--muted); margin-top: 6px; font-size: .98rem; }
.hint strong { color: var(--ink); white-space: nowrap; }

/* ---------- progress ---------- */

.progress {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted);
}
.progress li { display: flex; align-items: center; gap: 8px; }
.progress li + li { flex: 1; }
.progress li + li::before {
  content: '';
  flex: 1;
  height: 2px;
  min-width: 14px;
  margin: 0 6px;
  background: var(--line-soft);
  border-radius: 2px;
}
.progress .dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  font-size: .85rem;
  flex: none;
}
.progress .on { color: var(--ink); }
.progress .on .dot { background: var(--berry); border-color: var(--ink); color: #fff; }
.progress .done .dot { background: var(--pine); border-color: var(--ink); color: #fff; }
.progress .done::before, .progress .on::before { background: var(--pine) !important; }

/* ---------- fields ---------- */

.field { margin-top: 18px; }
.field label { display: block; font-weight: 700; font-size: .98rem; margin-bottom: 6px; }

input {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border: 2px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font: 400 1.0625rem/1.3 var(--body); /* 17px: no zoom-on-focus in iOS */
  appearance: none;
}
input::placeholder { color: #8A8F86; }
input:focus-visible { outline: 3px solid rgba(227, 169, 59, .7); outline-offset: 1px; border-color: var(--pine); }
input[aria-invalid='true'] { border-color: var(--berry); background: #FFF7F5; }

.money { position: relative; }
.money span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}
.money input { padding-left: 46px; font-variant-numeric: tabular-nums; }

.err { color: var(--berry-deep); font-size: .93rem; font-weight: 600; margin-top: 6px; }
.shop {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 3px 11px 3px 8px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--pine-deep);
  font-size: .88rem;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.shop::before { content: '✓'; }

.alert {
  background: var(--blush);
  border: 2px solid var(--berry);
  border-radius: 13px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: .97rem;
}

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

.actions { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 26px; }

.btn {
  width: 100%;
  min-height: 54px;
  padding: 12px 22px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--berry);
  color: #fff;
  font: 700 1.08rem/1.2 var(--body);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { background: var(--berry-deep); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible, .link:focus-visible, .gift-head:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.ghost:hover { background: var(--gold-soft); }
.btn.small { width: auto; min-height: 44px; padding: 8px 18px; font-size: .98rem; box-shadow: 0 3px 0 var(--ink); }

.link {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 1rem/1.2 var(--body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  touch-action: manipulation;
}
.link:hover { color: var(--ink); }

/* ---------- gift cards ---------- */

.gifts { display: grid; gap: 10px; margin-top: 18px; }

.gift { border: 2px solid var(--line-soft); border-radius: 16px; background: #fff; }
.gift.open { border-color: var(--ink); }
.gift.bad:not(.open) { border-color: var(--berry); }

.gift-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.gift-ico { width: 34px; height: 34px; flex: none; }
.gift-ico .box { fill: #F1EADB; }
.gift-ico .rib { fill: #F1EADB; }
.gift.ok .gift-ico .rib { fill: var(--gold); }
.gift.ok[data-i='0'] .gift-ico .box { fill: #E8503C; }
.gift.ok[data-i='1'] .gift-ico .box { fill: #3BA175; }
.gift.ok[data-i='2'] .gift-ico .box { fill: #F2BE4B; }
.gift.ok[data-i='2'] .gift-ico .rib { fill: #E8503C; }

.gift-txt { flex: 1; min-width: 0; }
.gift-name { display: block; font-weight: 700; line-height: 1.25; }
.gift-sum {
  display: block;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-tick { width: 24px; height: 24px; flex: none; display: none; }
.gift.ok .gift-tick { display: block; }
.gift-chev { width: 22px; height: 22px; flex: none; color: var(--muted); transition: transform .15s ease; }
.gift.open .gift-chev { transform: rotate(180deg); }

.gift-body { padding: 0 14px 18px; }
.gift-body .field:first-child { margin-top: 4px; }

/* ---------- review + lists ---------- */

.review { margin-top: 18px; border-top: 2px solid var(--line-soft); }
.review div { display: flex; gap: 14px; padding: 11px 0; border-bottom: 2px solid var(--line-soft); }
.review dt { width: 62px; flex: none; color: var(--muted); font-weight: 700; font-size: .93rem; padding-top: 1px; }
.review dd { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }

.wishes { display: grid; gap: 10px; margin-top: 16px; text-align: left; counter-reset: wish; }
.wishes li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 12px;
  align-items: start;
  padding: 12px 14px;
  border: 2px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
  counter-increment: wish;
}
.wishes li::before {
  content: counter(wish);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--blush);
  font-weight: 700;
  font-size: .9rem;
}
.wishes li:nth-child(2)::before { background: var(--mint); }
.wishes li:nth-child(3)::before { background: var(--gold-soft); }
.wishes b { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.wishes span { color: var(--muted); font-size: .93rem; overflow-wrap: anywhere; }

/* ---------- joined ---------- */

.wrapped { width: 132px; height: auto; margin: 0 auto 4px; display: block; overflow: visible; }
.wrapped .lid, .wrapped .bow, .wrapped .sparks { transform-box: fill-box; transform-origin: 50% 100%; }
.pop .lid { animation: lid .55s cubic-bezier(.3, 1.4, .5, 1) both; }
.pop .bow { animation: bow .4s cubic-bezier(.3, 1.6, .5, 1) .45s both; }
.pop .sparks { transform-origin: 50% 50%; animation: sparks .5s ease-out .75s both; }
@keyframes lid { from { transform: translateY(-46px) rotate(-10deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bow { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes sparks { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- crew ---------- */

.crew { margin-top: 34px; }
.crew ul { display: flex; flex-wrap: wrap; gap: 8px; }
.crew li {
  padding: 5px 13px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  font-weight: 600;
  font-size: .95rem;
}
.crew li:nth-child(3n + 1) { background: var(--blush); }
.crew li:nth-child(3n + 2) { background: var(--mint); }
.crew li:nth-child(3n) { background: var(--gold-soft); }

.foot { padding-top: 34px; padding-bottom: max(34px, env(safe-area-inset-bottom)); color: var(--muted); font-size: .9rem; text-align: center; }

/* ---------- step change ---------- */

.step.enter { animation: step .22s ease-out both; }
@keyframes step { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- wider screens ---------- */

@media (min-width: 700px) {
  body { font-size: 18px; }
  .hero { padding-bottom: 76px; }
  .hero-inner { flex-direction: row; justify-content: space-between; gap: 32px; padding-top: 26px; text-align: left; }
  .hero-art { width: 250px; }
  .lede { margin-left: 0; }
  .drift { height: 60px; }
  main { padding-top: 30px; }
  .how ol { grid-template-columns: repeat(3, 1fr); gap: 22px; }
  .how li { flex-direction: column; align-items: flex-start; gap: 10px; }
  #stage { margin-top: 40px; }
  .card { padding: 32px 36px 34px; }
  .card h2 { font-size: 2rem; }
  .actions { flex-direction: row-reverse; justify-content: flex-start; gap: 10px; }
  .card.center .actions { justify-content: center; }
  .btn { width: auto; min-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- host page ---------- */

.host-head { background: var(--pine-deep); color: var(--paper); padding: 22px 0 26px; }
.host-head h1 { font-size: 1.9rem; margin: 6px 0 0; }
.host main { padding-top: 24px; }
#panel { display: grid; gap: 22px; }
#panel > * { min-width: 0; }
.host .card h2 { font-size: 1.35rem; }
.host .row { display: grid; gap: 0 14px; }
.host textarea {
  width: 100%;
  min-height: 84px;
  padding: 11px 14px;
  border: 2px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font: 400 1.0625rem/1.4 var(--body);
  resize: vertical;
}
.host textarea:focus-visible { outline: 3px solid rgba(227, 169, 59, .7); outline-offset: 1px; border-color: var(--pine); }
.host .btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.host .stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--card);
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.35;
}
.tag.good { background: var(--mint); }
.tag.warn { background: var(--gold-soft); }
.tag.bad { background: var(--blush); }
.copy { display: flex; gap: 10px; margin-top: 14px; }
.copy input { flex: 1; min-width: 0; font-size: .95rem; }
.people { margin-top: 14px; display: grid; gap: 10px; }
.people li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 12px 14px;
  border: 2px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
}
.people .who { flex: 1 1 200px; min-width: 0; }
.people .who b { display: block; overflow-wrap: anywhere; }
.people .who span { display: block; color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.people .why { flex-basis: 100%; color: var(--berry-deep); font-size: .9rem; }
.note { margin-top: 10px; color: var(--muted); font-size: .95rem; }
.toast { margin-top: 14px; padding: 10px 14px; border-radius: 13px; background: var(--mint); font-weight: 600; font-size: .97rem; }
.toast.bad { background: var(--blush); }
.preview { margin-top: 16px; border: 2px solid var(--line-soft); border-radius: 14px; background: #F3EBDA; overflow: hidden; }
@media (min-width: 700px) {
  .host .row { grid-template-columns: 1fr 1fr; }
}
