:root {
  /* St. Louis flag: red field, blue rivers, white borders, gold disc */
  --flag-red: #c70f2e;
  --flag-blue: #012773;
  --flag-gold: #f5dc0f;

  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #eeebe2;
  --ink: #0f1b38;
  --muted: #5a6175;
  --line: #e0dccf;
  --brand: #c70f2e;
  --brand-ink: #ffffff;
  --brand-soft: #fbe1e5;
  --blue: #012773;
  --blue-soft: #e1e8f6;
  --gold: #f5dc0f;
  --danger: #b00d29;
  --shadow: 0 1px 2px rgb(15 27 56 / 6%), 0 6px 20px rgb(15 27 56 / 6%);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08122b;
    --surface: #101d3d;
    --surface-2: #1a2850;
    --ink: #f3f1ea;
    --muted: #a9b1c7;
    --line: #26355f;
    --brand: #e63a55;
    --brand-ink: #ffffff;
    --brand-soft: #3a1426;
    --blue: #a9c1ff;
    --blue-soft: #1a2c5c;
    --danger: #ff7a8a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: Merriweather, Georgia, serif; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 900; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0; }
em { font-style: normal; color: var(--muted); font-weight: 400; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Hero: the real city flag, then the event details */
.hero { text-align: center; padding-top: 40px; padding-bottom: 28px; }
.flag {
  display: block; width: min(300px, 72vw); height: auto; margin: 0 auto 28px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgb(15 27 56 / 10%), 0 12px 32px rgb(15 27 56 / 18%);
}
.logo { max-width: 180px; max-height: 140px; margin: 0 auto 16px; display: block; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; font-weight: 700; color: var(--brand); margin-bottom: 10px; }
.theme { font-family: Merriweather, Georgia, serif; font-style: italic; font-weight: 700; font-size: clamp(1.2rem, 3.4vw, 1.6rem); color: var(--brand); margin-top: 8px; }
.when { font-weight: 600; font-size: 1.05rem; margin-top: 18px; }
.where { color: var(--muted); }
.blurb { max-width: 600px; margin: 16px auto 0; color: var(--muted); }

/* Cards & layout */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.step { margin-bottom: 26px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--flag-gold); color: var(--flag-blue);
  font-family: Merriweather, Georgia, serif; font-weight: 800;
}
.step-sub { margin: -6px 0 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 8px; text-align: center;
}
.stat strong { display: block; font-family: Merriweather, Georgia, serif; font-size: 1.8rem; line-height: 1; }
.stat span { font-size: 0.8rem; color: var(--muted); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }
/* 16px minimum: iPhone Safari zooms the page when you tap a smaller text box */
input, select {
  font: inherit; font-size: max(16px, 1em); color: inherit;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.btn {
  font: inherit; font-weight: 600;
  min-height: 44px; padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn.icon { width: 44px; padding: 0; font-size: 1.3rem; flex: none; }
.btn.add { width: 100%; border-style: dashed; margin-top: 14px; color: var(--brand); }

.link { font: inherit; background: none; border: 0; padding: 4px; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link.danger { color: var(--danger); font-size: 0.85rem; }

.gate { max-width: 420px; margin: 0 auto 40px; display: flex; flex-direction: column; gap: 14px; }
.error { color: var(--danger); font-weight: 500; min-height: 1.5em; }

.rsvp-form { display: flex; flex-direction: column; gap: 16px; }
.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper input { text-align: center; font-weight: 700; font-size: 1.1rem; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.btn.claim-btn { align-self: flex-start; padding: 0; min-height: 36px; color: var(--brand); text-align: left; }
.claim { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }

.confirmed { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--blue-soft); border-radius: 12px; padding: 16px; }
.confirmed-title { font-weight: 700; font-size: 1.15rem; color: var(--blue); }

/* Section jump chips */
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; position: sticky; top: 0; z-index: 5;
  background: var(--bg); padding: 10px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 0.875rem; font-weight: 500;
  padding: 6px 12px; min-height: 36px;
  border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink);
  text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--brand); }
.jump-chip b { background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-size: 0.8rem; }
.jump-chip.full b { background: var(--blue-soft); color: var(--blue); }
.jump-chip.zero b { background: var(--brand-soft); color: var(--brand); }

/* Category cards */
.cat { scroll-margin-top: 70px; }
.cat-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.cat-head .muted { margin-top: 4px; font-size: 0.95rem; }
.cat-count { text-align: right; flex: none; }
.cat-count strong { font-family: Merriweather, Georgia, serif; font-size: 1.8rem; line-height: 1; display: block; }
.cat-count span { font-size: 0.8rem; color: var(--muted); }

.meter { height: 8px; background: var(--surface-2); border-radius: 999px; margin: 14px 0 10px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--blue); border-radius: inherit; transition: width 0.4s; }

.pill { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--blue-soft); color: var(--blue); }
.pill.need { background: var(--brand-soft); color: var(--brand); }

.dishes { list-style: none; padding: 0; margin: 14px 0 0; }
.dishes li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.dishes li.mine .dish-name::after { content: "you"; margin-left: 8px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand); }
.dish-name { font-weight: 600; }
.dish-who { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 0.9rem; }
.tag { display: inline-block; margin-left: 6px; font-size: 0.72rem; padding: 1px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); vertical-align: 1px; }
.empty { color: var(--muted); font-style: italic; margin-top: 12px; }

.ideas { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.ideas-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-right: 4px; }
.idea.taken { text-decoration: line-through; color: var(--muted); opacity: 0.65; }

.add-form { margin-top: 16px; padding: 16px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; }
.tags { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tags legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; padding: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; min-height: 32px; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }

/* Guest table */
.table-wrap { overflow-x: auto; margin-top: 12px; }
.guests { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.guests th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 10px 8px 0; }
.guests td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.guests td:nth-child(2), .guests td:nth-child(3), .guests th:nth-child(2), .guests th:nth-child(3) { text-align: center; width: 60px; }
.guests tr.mine td:first-child strong { color: var(--brand); }
.note { font-size: 0.85rem; color: var(--muted); }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0 40px; color: var(--muted); font-size: 0.9rem; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, calc(100% + 40px)); visibility: hidden;
  max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-weight: 500;
  transition: transform 0.25s; z-index: 20;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.error { background: var(--danger); color: #fff; }

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 18px 16px; }
  .guests th:nth-child(4), .guests td:nth-child(4) { display: none; }
}

@media (max-width: 560px) {
  /* Wrap the section chips onto several rows; unstick them so they don't cover the page */
  .jump { position: static; gap: 6px; }
  .jump-chip { font-size: 0.8rem; padding: 4px 10px; min-height: 32px; }
}
