/* ------------------------------------------------------------------
   Secret Santa — one stylesheet, no build step
   ------------------------------------------------------------------ */

:root {
  --bg: #070c14;
  --bg-2: #0a1320;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f3f7fc;
  --muted: #9aabc0;
  --muted-2: #73859c;
  --gold: #e9c585;
  --gold-2: #c99a4e;
  --gold-soft: rgba(233, 197, 133, 0.14);
  --green: #4ec49a;
  --green-soft: rgba(78, 196, 154, 0.14);
  --red: #f08080;
  --red-soft: rgba(240, 128, 128, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 16px/1.55 var(--font);
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(29, 78, 116, 0.55), transparent 62%),
    radial-gradient(900px 540px at 96% -6%, rgba(104, 44, 58, 0.4), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(28, 74, 62, 0.35), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

::selection { background: rgba(233, 197, 133, 0.3); }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { position: relative; z-index: 1; }

.wrap {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 30px 20px calc(64px + env(safe-area-inset-bottom));
}

.wrap.wide { max-width: 940px; }

/* ----------------------------- type ------------------------------ */

.display,
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; }

.display {
  margin: 0;
  font-size: clamp(38px, 8vw, 60px);
  line-height: 1.02;
  background: linear-gradient(180deg, #ffffff 10%, #cfdced 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.lede { margin: 14px 0 0; font-size: 17px; color: var(--muted); max-width: 46ch; }

h2 { margin: 0; font-size: 22px; }
h3 { margin: 0; font-size: 18px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.center { text-align: center; }
.gold { color: var(--gold); }

/* ---------------------------- layout ----------------------------- */

.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.brand .mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(160deg, var(--gold-soft), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line-strong);
  font-size: 17px;
}
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted-2); letter-spacing: 0.04em; }

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

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.062), rgba(255, 255, 255, 0.028));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: rise 0.45s ease both;
}

.card.tight { padding: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2 + .muted { margin-top: 6px; }
.card-gap { display: grid; gap: 18px; }

.card.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  background:
    radial-gradient(600px 240px at 12% -20%, rgba(233, 197, 133, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
}

.card.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.06) 45%, transparent 60%);
  background-size: 250% 100%;
  animation: sheen 9s ease-in-out infinite;
}

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

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 600 15.5px/1 var(--font);
  color: #17130b;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  box-shadow: 0 12px 24px -12px rgba(233, 197, 133, 0.6);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }

.btn.secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
  box-shadow: none;
  backdrop-filter: blur(8px);
}
.btn.secondary:hover { background: rgba(255, 255, 255, 0.11); filter: none; }

.btn.ghost {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 500;
}
.btn.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }

.btn.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(240, 128, 128, 0.3);
  box-shadow: none;
}
.btn.danger:hover { background: rgba(240, 128, 128, 0.2); filter: none; }

.btn.small { min-height: 38px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 44px; min-height: 44px; border-radius: 12px; }

/* ----------------------------- forms ----------------------------- */

.field { display: grid; gap: 7px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.field .hint { font-size: 12.5px; color: var(--muted-2); }

.input,
.textarea,
.select {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  font: 16px/1.45 var(--font);
  color: var(--ink);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.textarea { min-height: 118px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: #62748b; }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(233, 197, 133, 0.65);
  box-shadow: 0 0 0 4px rgba(233, 197, 133, 0.12);
  background: rgba(0, 0, 0, 0.35);
}
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }

.inline-form { display: flex; gap: 10px; align-items: stretch; }
.inline-form .input { min-width: 0; }
@media (max-width: 540px) {
  .inline-form { flex-direction: column; }
  .inline-form .btn { width: 100%; }
}

/* ----------------------------- pills ----------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.pill.gold { color: var(--gold); border-color: rgba(233, 197, 133, 0.35); background: var(--gold-soft); }
.pill.green { color: var(--green); border-color: rgba(78, 196, 154, 0.35); background: var(--green-soft); }
.pill.red { color: var(--red); border-color: rgba(240, 128, 128, 0.3); background: var(--red-soft); }

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

.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-2), var(--gold)); transition: width 0.4s ease; }

/* ----------------------------- list rows ------------------------- */

.rows { display: grid; }
.rows > * + * { border-top: 1px solid var(--line); }

.person, .invite {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
}

.avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
  background: linear-gradient(160deg, rgba(233, 197, 133, 0.2), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(233, 197, 133, 0.25);
}

.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-weight: 600; }
.person .who span { font-size: 12.5px; color: var(--muted-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.24);
  font-size: 13.5px;
  color: var(--ink);
}
.chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.chip button:hover { background: var(--red-soft); color: var(--red); }

/* ----------------------------- groups ---------------------------- */

.group-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.group-card:hover { border-color: rgba(233, 197, 133, 0.35); transform: translateY(-2px); }
.group-card h3 { font-size: 20px; }
.group-card .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.empty {
  padding: 34px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ----------------------------- reveal ---------------------------- */

.reveal {
  position: relative;
  overflow: hidden;
  padding: 34px 24px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid rgba(233, 197, 133, 0.28);
  background:
    radial-gradient(520px 260px at 50% -20%, rgba(233, 197, 133, 0.22), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  box-shadow: 0 30px 80px -40px rgba(233, 197, 133, 0.45);
  animation: pop 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

.reveal .for {
  font-size: 11.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.reveal .name {
  margin: 12px 0 4px;
  font-family: var(--serif);
  font-size: clamp(44px, 12vw, 74px);
  line-height: 1.02;
  background: linear-gradient(180deg, #fff8e9 15%, var(--gold) 60%, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.7s ease both 0.1s;
}

.reveal .spark { font-size: 22px; letter-spacing: 8px; opacity: 0.9; }

.note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(233, 197, 133, 0.25);
  background: var(--gold-soft);
  font-size: 14px;
  color: #f0dfc0;
}
.note b { color: var(--gold); }

.panel-likes, .panel-avoid {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  padding: 16px 18px;
}
.panel-likes { border-color: rgba(78, 196, 154, 0.25); }
.panel-avoid { border-color: rgba(240, 128, 128, 0.22); }
.panel-likes h4, .panel-avoid h4 {
  margin: 0 0 8px;
  font: 600 11.5px/1 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.panel-likes h4 { color: var(--green); }
.panel-avoid h4 { color: var(--red); }
.panel-likes p, .panel-avoid p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; }
.panel-likes p.empty-text, .panel-avoid p.empty-text { color: var(--muted-2); font-style: italic; }

/* ----------------------------- modal ----------------------------- */

.modal {
  width: min(480px, calc(100vw - 32px));
  margin: auto;
  padding: 24px;
  color: var(--ink);
  background: #0d1624;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(3, 6, 11, 0.72); backdrop-filter: blur(4px); }
.modal h2 { font-size: 21px; margin-bottom: 6px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal .modal-actions .btn { flex: 1; }

/* ----------------------------- toasts ---------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 50;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(16, 26, 40, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 14px;
  text-align: center;
  animation: toast 0.25s ease both;
}
.toast.good { border-color: rgba(78, 196, 154, 0.4); color: #d8f6ea; }
.toast.bad { border-color: rgba(240, 128, 128, 0.4); color: #ffe1e1; }

/* ------------------------------ misc ----------------------------- */

.divider { height: 1px; background: var(--line); margin: 4px 0; }

.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.snow span {
  position: absolute;
  top: -12px;
  color: rgba(255, 255, 255, 0.55);
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}

.footnote { margin-top: 26px; text-align: center; color: var(--muted-2); font-size: 12.5px; }
.footnote a { color: var(--muted); }

details.help { border-top: 1px solid var(--line); }
details.help > summary {
  cursor: pointer;
  padding: 14px 4px;
  font-size: 13.5px;
  color: var(--muted);
  list-style: none;
}
details.help > summary::-webkit-details-marker { display: none; }
details.help > summary::before { content: "＋"; margin-right: 8px; color: var(--muted-2); }
details.help[open] > summary::before { content: "－"; }
details.help .help-body { padding: 0 4px 16px; font-size: 13.5px; color: var(--muted); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-title h2 { font-size: 20px; }
.section-title .small { color: var(--muted-2); }

.stat-row { display: flex; gap: 22px; flex-wrap: wrap; }
.stat { min-width: 90px; }
.stat b { display: block; font-size: 24px; font-family: var(--serif); color: var(--ink); }
.stat span { font-size: 12px; color: var(--muted-2); letter-spacing: 0.04em; text-transform: uppercase; }

.link-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.spin {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  height: 96px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ---------------------------- animation -------------------------- */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes fall { to { transform: translate3d(24px, 105vh, 0); } }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sheen { 0%, 100% { background-position: 200% 0; } 50% { background-position: -50% 0; } }

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

@media (max-width: 520px) {
  .wrap { padding: 22px 16px 56px; }
  .card { padding: 18px; border-radius: 18px; }
  .card.hero { padding: 22px; }
  .display { font-size: clamp(34px, 10vw, 44px); }
  .topbar { margin-bottom: 20px; }
}
