@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces.woff2') format('woff2');
  font-weight: 500 800;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --surface-2: #f4ede1;
  --ink: #1d2a24;
  --muted: #5d6b64;
  --line: #e4dccd;
  --pine: #1f4d3a;
  --pine-ink: #ffffff;
  --berry: #b3261e;
  --berry-soft: #fbe9e7;
  --berry-ink: #ffffff;
  --gold: #c9962f;
  --ok: #2e7d4f;
  --focus: #2b6cb0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29, 42, 36, 0.06), 0 8px 24px rgba(29, 42, 36, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111814;
    --surface: #18221d;
    --surface-2: #1f2b25;
    --ink: #eef3ef;
    --muted: #a3b2aa;
    --line: #2c3a33;
    --pine: #5fbf8f;
    --pine-ink: #0d1a14;
    --berry: #ff8a80;
    --berry-soft: #3a1f1d;
    --berry-ink: #2a0d0b;
    --gold: #e2b65a;
    --ok: #6fd39c;
    --focus: #8ab4f8;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); font-weight: 650; }
h3 { font-size: 1.15rem; font-weight: 650; }
p { margin: 0 0 1em; }
a { color: var(--pine); }
img { max-width: 100%; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; }

/* Header and footer */
.top { padding: 14px 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font: 700 1.25rem Fraunces, Georgia, serif; color: var(--ink); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.top nav { display: flex; gap: 14px; font-size: 0.95rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }
footer.site { margin-top: 64px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
footer.site .links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }
footer.site a { color: var(--muted); }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--pine); color: var(--pine-ink);
  font: 600 1rem Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn.berry { background: var(--berry); color: var(--berry-ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 0.9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: 0; color: var(--pine); font: inherit; text-decoration: underline; cursor: pointer; }
.danger { color: var(--berry); }

label { display: block; font-weight: 600; margin: 0 0 6px; font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.88rem; font-weight: 400; }
input[type='text'], input[type='url'], input[type='number'], input[type='date'], input[type='tel'], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
.field { margin-bottom: 18px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row > .shrink { flex: 0 0 auto; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 700; color: var(--berry); margin-bottom: 6px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* Pills and chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font: 500 0.92rem Inter, system-ui, sans-serif; cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

/* Home page */
.hero { padding: 36px 0 28px; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 36em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 18px; color: var(--muted); font-size: 0.92rem; }
.badges span::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.steps .num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--berry-soft); color: var(--berry); font-weight: 700; margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
details.faq { border-bottom: 1px solid var(--line); padding: 14px 0; }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: '+'; float: right; color: var(--muted); }
details.faq[open] summary::after { content: '–'; }
details.faq p { margin: 10px 0 0; color: var(--muted); }

/* Create form */
.person { display: flex; gap: 8px; margin-bottom: 8px; }
.person input { flex: 1; }
.icon-btn { flex: 0 0 48px; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-size: 1.3rem; cursor: pointer; }
.pair { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; margin-bottom: 6px; }

/* Group page */
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.name-btn {
  text-align: left; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 1rem Inter, system-ui, sans-serif; cursor: pointer;
}
.name-btn small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.name-btn:hover { border-color: var(--pine); }
.pin-input { font-size: 2rem !important; letter-spacing: 0.5em; text-align: center; font-variant-numeric: tabular-nums; max-width: 240px; margin: 0 auto; display: block; }

.reveal {
  position: relative; border-radius: var(--radius); padding: 30px 22px; text-align: center; overflow: hidden;
  background: radial-gradient(120% 120% at 0% 0%, #2b6a50 0%, #1f4d3a 55%, #163828 100%); color: #fff;
}
.reveal .eyebrow { color: #f3d48a; }
.reveal .giftee { font: 700 clamp(2rem, 8vw, 3rem) Fraunces, Georgia, serif; margin: 6px 0 4px; }
.reveal .cover {
  position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer;
  background: repeating-linear-gradient(45deg, #b3261e 0 22px, #a0211b 22px 44px); color: #fff;
  font: 700 1.2rem Inter, system-ui, sans-serif; border: 0; width: 100%;
  transition: transform 0.6s cubic-bezier(.6,-0.2,.4,1.2), opacity 0.6s;
}
.reveal .cover span { background: rgba(0,0,0,0.25); padding: 10px 18px; border-radius: 999px; }
.reveal.open .cover { transform: translateY(-105%); opacity: 0; pointer-events: none; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; color: #d9eadf; font-size: 0.95rem; margin-top: 10px; }

.wish { padding: 12px 0; border-bottom: 1px solid var(--line); }
.wish:last-child { border-bottom: 0; }
.wish .w-title { font-weight: 600; }
.wish-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.wish-edit input { margin-bottom: 8px; }

.chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); }
.bubble.mine { align-self: flex-end; background: var(--pine); color: var(--pine-ink); }
.bubble small { display: block; font-size: 0.72rem; opacity: 0.7; margin-bottom: 2px; }

.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.idea { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.idea .why { color: var(--muted); font-size: 0.92rem; flex: 1; }
.idea a.shop { font-weight: 600; text-decoration: none; }
.idea a.shop::after { content: ' →'; }

.share-box { display: flex; gap: 8px; align-items: stretch; }
.share-box input { font-size: 0.9rem; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-row:last-child { border-bottom: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 500;
  transition: transform 0.25s ease; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--berry-soft); color: var(--ink); margin-bottom: 14px; }
.disclosure { font-size: 0.82rem; color: var(--muted); margin-top: 10px; }

/* Party mode */
.turn { font: 700 clamp(2rem, 9vw, 3.4rem) Fraunces, Georgia, serif; margin: 4px 0; }
.timer { font: 700 2.4rem Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.gift-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.gift-row .g-name { flex: 1; font-weight: 600; }
.steals { display: inline-flex; gap: 4px; }
.steals i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--berry); display: inline-block; }
.steals i.on { background: var(--berry); }
.locked { opacity: 0.55; }

@media (max-width: 560px) {
  .top nav a.hide-sm { display: none; }
  .card { padding: 18px; }
  .row.stack-sm { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.badges span.nocheck::before { content: none; }
