:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4ede4;
  --text: #2a2320;
  --muted: #6b5f57;
  --border: #e3d8cc;
  --accent: #b23a5b;
  --accent-text: #ffffff;
  --accent-soft: #f8e3e9;
  --yes: #2f7d4f;
  --yes-soft: #e1f2e7;
  --no: #8a5a2b;
  --no-soft: #f5e9dc;
  --pending: #5b6472;
  --pending-soft: #e9ecf1;
  --error: #b42318;
  --error-soft: #fde8e7;
  --focus: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1716;
    --surface: #26201e;
    --surface-2: #2f2826;
    --text: #f3ece6;
    --muted: #b9aca3;
    --border: #3e3532;
    --accent: #e7799a;
    --accent-text: #1b1716;
    --accent-soft: #3d2530;
    --yes: #7fd3a0;
    --yes-soft: #1f3a2a;
    --no: #e3b37f;
    --no-soft: #3b2d1f;
    --pending: #b5bfcc;
    --pending-soft: #2c3138;
    --error: #ff9b91;
    --error-soft: #432220;
    --focus: #7aa7ff;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 20px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 64px; }
.wrap.wide { max-width: 1200px; font-size: 17px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
p { margin: 0 0 12px; }

.hero { text-align: center; padding: 16px 0 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; color: var(--accent); font-weight: 700; }
.details { display: grid; gap: 4px; margin: 16px 0; }
.details div { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.details dt { font-weight: 700; }
.details dd { margin: 0; }
.party-details { white-space: pre-line; color: var(--muted); }
.secret {
  display: inline-block; background: var(--accent-soft); color: var(--text);
  border-radius: 999px; padding: 8px 18px; font-weight: 600; margin-top: 4px;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 20px; margin-top: 24px;
}

label, .label { display: block; font-weight: 600; margin: 18px 0 6px; }
.optional { font-weight: 400; color: var(--muted); }
.hint { color: var(--muted); font-size: .9em; margin-top: 4px; }

input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: 10px; padding: 12px 14px;
}
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; margin: 0 8px 0 0; transform: scale(1.3); vertical-align: middle; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

button {
  font: inherit; cursor: pointer; border-radius: 10px; border: 2px solid var(--border);
  background: var(--surface-2); color: var(--text); padding: 10px 16px;
}
button:disabled { opacity: .6; cursor: progress; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
button.big { display: block; width: 100%; padding: 18px; font-size: 1.1em; margin-top: 12px; }
button.link { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 4px; }

.choice { border: none; padding: 0; margin: 18px 0 0; }
.choice legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.choice-btn[aria-pressed="true"] { border-width: 3px; font-weight: 700; }
.choice-btn.yes[aria-pressed="true"] { background: var(--yes-soft); border-color: var(--yes); }
.choice-btn.no[aria-pressed="true"] { background: var(--no-soft); border-color: var(--no); }

.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button { width: 64px; height: 64px; font-size: 2rem; line-height: 1; padding: 0; font-weight: 700; }
.stepper output { min-width: 2ch; text-align: center; font-size: 2rem; font-weight: 700; }

.error { background: var(--error-soft); color: var(--error); border-radius: 10px; padding: 12px 14px; margin-top: 16px; }

.review { list-style: none; padding: 0; margin: 0 0 8px; }
.review li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.review li:last-child { border-bottom: none; }
.review strong { display: inline-block; min-width: 6.5em; }

.hosts { display: grid; gap: 12px; margin-top: 8px; text-align: left; }
.host {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface-2); border-radius: 10px; padding: 12px 16px;
}
.host a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; padding: 4px 0; }
.host a:hover { text-decoration: underline; }

.done-icon { font-size: 3rem; text-align: center; margin: 0; }
.center { text-align: center; }

/* ---------- admin ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.topbar h1 { margin: 0; font-size: 1.6rem; }
.topbar .who { color: var(--muted); font-size: .9em; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .num { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: .9em; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > input, .row > select { width: auto; flex: 1 1 200px; }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; }
.linkbox input { flex: 1 1 280px; width: auto; font-family: ui-monospace, monospace; font-size: .9em; }

.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td.actions { white-space: nowrap; }
td.actions button { padding: 6px 10px; font-size: .9em; }
.small { font-size: .85em; color: var(--muted); }

.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .85em; font-weight: 600; }
.badge.yes { background: var(--yes-soft); color: var(--yes); }
.badge.no { background: var(--no-soft); color: var(--no); }
.badge.pending { background: var(--pending-soft); color: var(--pending); }
.badge.offlist { background: var(--accent-soft); color: var(--accent); }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); padding: 20px;
}
dialog::backdrop { background: rgb(0 0 0 / 45%); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; max-width: calc(100vw - 32px);
}

@media (max-width: 640px) {
  body { font-size: 19px; }
  h1 { font-size: 1.7rem; }
  .card { padding: 20px 16px; }
}

#lost-link { margin-top: 20px; text-align: center; }
#lost-panel { text-align: left; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
