:root {
  --bg: #f7f2ea;
  --card: #fffdf9;
  --ink: #2b2a27;
  --muted: #7a746a;
  --line: #e9e1d4;
  --green: #1f4d3a;
  --green-soft: #e3ece6;
  --red: #a8323e;
  --red-soft: #f6e4e4;
  --gold: #c39a45;
  --shadow: 0 1px 2px rgb(60 40 20 / .05), 0 6px 20px rgb(60 40 20 / .06);
  --radius: 18px;
  --snow: rgb(31 77 58 / .07);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1d18;
    --card: #172a23;
    --ink: #f1ece2;
    --muted: #a7b1aa;
    --line: #26413a;
    --green: #8cc5a4;
    --green-soft: #1f3a30;
    --red: #e7808a;
    --red-soft: #3a2026;
    --gold: #dcb867;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    --snow: rgb(255 255 255 / .09);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body.solo { padding-bottom: 32px; }
a { color: var(--green); }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 7vw, 2.5rem); color: var(--green); }
h2 { font-size: 1.25rem; }
p { margin: 0 0 .8em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Snow: a few quiet flakes, drifting slowly */
.snow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 12% 18%, var(--snow) 50%, transparent 51%),
    radial-gradient(3px 3px at 72% 9%, var(--snow) 50%, transparent 51%),
    radial-gradient(2px 2px at 40% 42%, var(--snow) 50%, transparent 51%),
    radial-gradient(3px 3px at 88% 55%, var(--snow) 50%, transparent 51%),
    radial-gradient(2px 2px at 22% 78%, var(--snow) 50%, transparent 51%),
    radial-gradient(3px 3px at 58% 88%, var(--snow) 50%, transparent 51%);
  background-size: 320px 320px;
  animation: drift 60s linear infinite;
}
@keyframes drift { to { background-position: 40px 320px; } }
@media (prefers-reduced-motion: reduce) { .snow { animation: none; } }

/* Header */
.top { position: relative; z-index: 2; background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .top { background: #10251d; border-bottom: 1px solid var(--line); } }
.top-inner {
  max-width: 640px; margin: 0 auto; padding: 18px 16px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.15rem; font-weight: 700; display: flex; gap: 8px; align-items: center; min-width: 0; }
.brand-mark { color: var(--gold); }
.link-btn { background: none; border: 0; color: rgb(255 255 255 / .75); font: inherit; font-size: .85rem; cursor: pointer; padding: 6px 0; }
.link-btn:hover { color: #fff; }

.garland {
  display: flex; justify-content: space-between; padding: 0 6px;
  height: 14px; position: relative; overflow: hidden;
  background: radial-gradient(120% 16px at 50% -6px, transparent 9px, rgb(255 255 255 / .25) 10px, transparent 11px) 0 0 / 46px 14px repeat-x;
}
.garland span { width: 7px; height: 10px; border-radius: 50% 50% 45% 45%; margin-top: 4px; opacity: .9; }
.garland span:nth-child(4n+1) { background: #e9b949; }
.garland span:nth-child(4n+2) { background: #e56b6f; }
.garland span:nth-child(4n+3) { background: #f4f1e8; }
.garland span:nth-child(4n)   { background: #8fd1a9; }
@media (prefers-reduced-motion: no-preference) {
  .garland span { animation: twinkle 3.2s ease-in-out infinite; }
  .garland span:nth-child(3n) { animation-delay: 1.1s; }
  .garland span:nth-child(3n+1) { animation-delay: 2.2s; }
}
@keyframes twinkle { 50% { opacity: .45; } }

/* Layout */
.wrap { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 22px 16px 24px; }
.hero { margin: 4px 0 22px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 600; color: var(--red); margin-bottom: .5em; }
.lead { color: var(--muted); font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; margin: 0; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: .85rem; margin: 12px 0 0; }
.empty { color: var(--muted); font-style: italic; }
.big-emoji { font-size: 2.4rem; margin: 0 0 .2em; line-height: 1.2; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px; margin: 0 0 16px; border: 1px solid var(--line);
}
.card h2 { color: var(--ink); }

.flash, .notice, .error {
  border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; font-size: .95rem;
}
.flash { background: var(--green-soft); color: var(--green); font-weight: 500; }
.notice { background: var(--red-soft); color: var(--red); }
.error { background: var(--red-soft); color: var(--red); margin-bottom: 14px; }

.facts { list-style: none; padding: 0; margin: 14px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.facts li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-weight: 600; }
.facts span { display: block; font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* Forms */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: .9rem; font-weight: 500; }
.opt { color: var(--muted); font-weight: 400; font-size: .8rem; }
input, select, textarea {
  font: inherit; font-size: 16px; /* no iOS zoom */
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: transparent; }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px !important; font-weight: 400 !important; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 520px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; border-radius: 999px; border: 1px solid transparent;
  padding: 13px 22px; cursor: pointer; text-decoration: none; min-height: 48px;
  transition: transform .1s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0f1d18; } }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--green); }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: .9rem; }
.btn.big { width: 100%; font-size: 1.1rem; min-height: 56px; }
.danger-text { color: var(--red) !important; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; list-style: none;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* The gift */
.gift { margin: 0 0 16px; }
.gift summary {
  list-style: none; cursor: pointer; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 18px 22px;
}
.gift summary::-webkit-details-marker { display: none; }
.gift-box {
  display: block; position: relative; margin: 0 auto 14px; width: 84px; height: 72px;
  background: var(--red); border-radius: 8px;
}
.gift-box::before { /* lid */
  content: ""; position: absolute; left: -6px; right: -6px; top: -4px; height: 18px;
  background: var(--red); filter: brightness(1.12); border-radius: 6px;
}
.ribbon { position: absolute; left: 50%; top: -4px; bottom: 0; width: 12px; margin-left: -6px; background: var(--gold); }
.bow { position: absolute; left: 50%; top: -18px; width: 36px; height: 18px; margin-left: -18px; }
.bow::before, .bow::after {
  content: ""; position: absolute; top: 2px; width: 16px; height: 14px; border: 4px solid var(--gold); border-radius: 50% 50% 10% 50%;
}
.bow::before { left: 0; transform: rotate(-12deg); }
.bow::after { right: 0; transform: scaleX(-1) rotate(-12deg); }
@media (prefers-reduced-motion: no-preference) {
  .gift:not([open]) .gift-box { animation: wiggle 4s ease-in-out infinite; }
}
@keyframes wiggle { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(-5deg); } 93% { transform: rotate(5deg); } 96% { transform: rotate(-2deg); } }
.gift-cta { font-weight: 600; color: var(--green); }
.gift[open] summary { display: none; }
.gift-reveal {
  margin-bottom: 16px;
  text-align: center; padding: 26px 18px; border-radius: var(--radius);
  background: var(--green); color: #fff; box-shadow: var(--shadow);
  background-image: radial-gradient(circle at 20% 20%, rgb(255 255 255 / .08) 0 2px, transparent 3px), radial-gradient(circle at 80% 70%, rgb(255 255 255 / .08) 0 2px, transparent 3px);
  background-size: 60px 60px;
}
@media (prefers-color-scheme: dark) { .gift-reveal {
  margin-bottom: 16px; background-color: #1f4d3a; } }
@media (prefers-reduced-motion: no-preference) { .gift[open] .gift-reveal {
  margin-bottom: 16px; animation: pop .45s cubic-bezier(.2, .9, .3, 1.3); } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }
.gift-reveal .eyebrow { color: #f2d39a; }
.receiver { font-family: var(--serif); font-size: clamp(2.4rem, 12vw, 3.4rem); font-weight: 700; margin: 0; line-height: 1.1; }
.gift-reveal .hint { color: rgb(255 255 255 / .7); }

/* Wishes */
.wishes { list-style: none; margin: 0; padding: 0; }
.wish { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.wish:first-child { border-top: 0; padding-top: 4px; }
.wish-body { flex: 1; min-width: 0; }
.wish-title { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.wish-note { color: var(--muted); font-size: .9rem; margin: 2px 0 0; overflow-wrap: anywhere; }
.wish-link { display: inline-block; font-size: .9rem; margin-top: 4px; font-weight: 500; }
.wish-actions { display: flex; gap: 2px; }
.inline-edit { flex: 1; }
.tick button {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: transparent;
  display: grid; place-items: center; cursor: pointer; color: transparent; margin-top: -2px;
}
.tick svg { width: 18px; height: 18px; stroke-width: 2.6; }
.wish.done .tick button { background: var(--green); border-color: var(--green); color: var(--card); }
.wish.done .wish-title { text-decoration: line-through; color: var(--muted); }

.row-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--ink); }
.row-link strong { display: block; }
.row-link > span:last-child { font-size: 1.3rem; color: var(--green); }

/* Admin */
.steps { list-style: none; padding: 0; margin: 14px 0 0; display: flex; gap: 8px; flex-wrap: wrap; counter-reset: s; }
.steps li { counter-increment: s; font-size: .85rem; font-weight: 500; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: var(--ink); font-size: .75rem; margin-right: 6px; }
.steps li.ok { color: var(--green); border-color: var(--green-soft); background: var(--green-soft); }
.steps li.ok::before { content: "✓"; background: var(--green); color: var(--card); }
.count { display: inline-block; font-family: var(--sans); font-size: .8rem; background: var(--green-soft); color: var(--green); border-radius: 999px; padding: 2px 9px; vertical-align: middle; margin-left: 4px; }

.invite { padding-bottom: 18px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-family: var(--serif); font-weight: 700; }
.people li:nth-child(2n) .avatar { background: var(--green-soft); color: var(--green); }
.person { flex: 1; min-width: 0; }
.person .name { font-weight: 600; margin: 0; }
.person .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: .7rem; font-weight: 600; background: var(--gold); color: #fff; padding: 1px 7px; border-radius: 999px; vertical-align: 2px; }
.tag.soft { background: var(--line); color: var(--muted); }

.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 44px; z-index: 5; min-width: 220px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px;
}
.menu-pop button { width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--ink); padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.menu-pop button:hover { background: var(--bg); }
.menu-pop .danger { color: var(--red); }

.excl { list-style: none; padding: 0; margin: 0 0 14px; }
.excl li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0 6px 14px; margin-bottom: 6px; background: var(--bg); border-radius: 12px; font-weight: 500; }
.arrow { color: var(--red); margin: 0 6px; }
.excl-form { padding-top: 4px; }

.share { border-color: var(--gold); }
.copy { display: flex; gap: 8px; margin: 0 0 10px; }
.copy input { font-size: .85rem; padding: 10px 12px; }
.draw .btn.big { margin-top: 6px; }

/* Bottom tabs */
.tabs {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; max-width: 160px; display: grid; justify-items: center; gap: 2px; padding: 6px 4px;
  text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 500; border-radius: 12px;
}
.tabs a.on { color: var(--green); background: var(--green-soft); }
.tabs svg { width: 24px; height: 24px; }
