:root {
  --paper: #f7f1e5;
  --paper-2: #efe6d3;
  --ink: #1d1a16;
  --muted: #6b6255;
  --green: #16382b;
  --green-2: #1f4a39;
  --red: #a3262c;
  --red-2: #8a1f24;
  --gold: #b8892f;
  --gold-soft: #e9d6a8;
  --line: #d9ccb2;
  --ok: #2e6b3f;
  --ok-bg: #dcebd9;
  --wait: #8a5a12;
  --wait-bg: #f6e3bd;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "DejaVu Serif", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 8px 24px -12px rgba(22, 56, 43, 0.25);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--green); }

.wrap { width: min(760px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
.tiny { font-size: 0.85rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(184, 137, 47, 0.25), transparent 60%),
    linear-gradient(180deg, var(--green) 0%, var(--green-2) 100%);
  color: #f7f1e5;
  padding: 64px 0 56px;
  overflow: hidden;
}
.hero::after {
  /* candy-stripe rail along the bottom, like a racetrack rail */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 14px, #f7f1e5 14px 28px);
}
.eyebrow {
  font: 600 0.78rem/1.2 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
}
.hero .eyebrow { color: var(--gold-soft); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 6.5vw, 3.6rem); margin: 0 0 18px; }
h1 span { display: block; color: var(--gold-soft); font-style: italic; font-weight: 600; }
.lede { font-size: 1.15rem; max-width: 36ch; margin: 0 0 28px; color: #e9e2d2; }
.lede strong { color: #fff; }

.due-banner {
  display: inline-flex; align-items: center; gap: 8px;
  margin: -8px 0 18px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(163, 38, 44, 0.9);
  color: #fff;
  font-size: 0.95rem;
}
.wheel-link { font-weight: 700; color: var(--red); text-decoration: none; }
.wheel-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.purse {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(233, 214, 168, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  max-width: 460px;
  margin-bottom: 26px;
}
.purse-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.purse-label { font: 600 0.75rem var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-soft); }
.purse-amount { font-family: var(--serif); font-size: 1.1rem; }
.purse-amount b { font-size: 1.5rem; color: #fff; }
.purse-track { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.purse-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), #e2b95a);
  border-radius: inherit;
  transition: width 0.8s cubic-bezier(.2,.8,.2,1);
}

.cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 13px 22px;
  border-radius: 999px;
  border: 2px solid transparent;
  font: 650 1rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn small { text-align: center; font-weight: 500; font-size: 0.78rem; opacity: 0.85; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px -8px rgba(163, 38, 44, 0.8); }
.btn-primary:hover { background: var(--red-2); }
.btn-ghost { border-color: rgba(247, 241, 229, 0.5); color: #f7f1e5; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn-stripe { background: #635bff; color: #fff; }
.btn-stripe:hover { background: #5148e5; }
.btn-venmo { background: #008cff; color: #fff; }
.btn-venmo:hover { background: #0074d4; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Sections ---------- */
.section { padding: 56px 0 8px; }
.section-head { margin-bottom: 22px; }
.section-head h2 { font-size: clamp(1.8rem, 4.5vw, 2.4rem); margin: 0 0 4px; }
.section-head h2::after {
  content: ""; display: block; width: 56px; height: 4px; margin-top: 10px;
  background: var(--red); border-radius: 4px;
}
.section-head p { margin: 10px 0 0; }

/* ---------- The Field (race card) ---------- */
.field { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.post {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 14px;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 12px 12px;
  box-shadow: var(--shadow);
}
.post.skeleton { display: block; color: var(--muted); text-align: center; padding: 22px; }
.post-num {
  width: 52px; height: 52px; border-radius: 10px;
  display: grid; place-items: center;
  font: 700 1.35rem var(--serif);
  color: #fff;
  background: var(--silk, var(--green));
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}
.post-body { min-width: 0; }
.post-name { font: 700 1.15rem/1.2 var(--serif); margin: 0; }
.post-charity { margin: 2px 0 0; font-size: 0.95rem; color: var(--muted); overflow-wrap: anywhere; }
.post-charity a { color: var(--green); font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.post.empty { background: transparent; box-shadow: none; border-style: dashed; }
.post.empty .post-num { background: transparent; color: var(--muted); border: 2px dashed var(--line); box-shadow: none; }
.post.empty .post-name { color: var(--muted); }

.status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  font: 700 0.78rem/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
  white-space: nowrap;
}
.pill-paid { background: var(--ok-bg); color: var(--ok); }
.pill-pending { background: var(--wait-bg); color: var(--wait); }
.pay-link {
  font: 600 0.82rem var(--sans); color: var(--red);
  background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- Rules ---------- */
.prose { font-size: 1.05rem; }
.prose p { margin: 0 0 1em; }
.prose h3 { font-size: 1.35rem; margin: 1.8em 0 0.5em; color: var(--green); }
.bombshell {
  background: var(--paper-2); border-left: 4px solid var(--red);
  padding: 12px 16px; border-radius: 0 10px 10px 0;
}
.callout {
  background: #fffaf0; border: 1px solid var(--gold-soft); border-radius: var(--radius);
  padding: 16px 18px 4px; margin: 0 0 1em;
  box-shadow: inset 4px 0 0 var(--gold);
}
.callout-title { font: 700 0.78rem var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px !important; }

/* ---------- Form ---------- */
.card {
  background: #fffaf0; border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; box-shadow: var(--shadow);
}
.form { display: grid; gap: 6px; }
.field-label { font: 650 0.92rem var(--sans); margin-top: 10px; }
.form input, .form select {
  width: 100%;
  font: 1rem var(--sans);
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  appearance: none;
}
.form select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px; background-repeat: no-repeat;
  padding-right: 40px;
}
.form input:focus, .form select:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(22, 56, 43, 0.15); }
.form .btn { margin-top: 18px; }
.form-error { margin: 10px 0 0; color: var(--red); font-weight: 600; }
.form-full { text-align: center; margin: 8px 0 0; font-size: 1.05rem; }
.form.is-full label, .form.is-full input, .form.is-full select, .form.is-full button { display: none; }

/* ---------- Footer ---------- */
.footer { margin-top: 64px; padding: 32px 0 48px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }
.footer p { margin: 0 0 4px; }

/* ---------- Dialog ---------- */
dialog {
  width: min(440px, 100% - 28px);
  border: 0; border-radius: 20px;
  padding: 26px 22px 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(16, 30, 24, 0.55); backdrop-filter: blur(2px); }
dialog h2 { font-size: 1.7rem; margin: 0 0 6px; }
dialog .eyebrow { color: var(--red); }
.dialog-close-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.dialog-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper-2); font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink); }
.pay-options { display: grid; gap: 10px; margin-top: 18px; }
.qr { margin: 18px 0 0; display: grid; justify-items: center; gap: 6px; }
.qr img { border-radius: 12px; background: #fff; padding: 8px; border: 1px solid var(--line); }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .hero { padding: 44px 0 44px; }
  .post { grid-template-columns: 44px 1fr; }
  .post-num { width: 44px; height: 44px; font-size: 1.15rem; }
  .status { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
  .cta .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .purse-fill { transition: none; }
}
