:root {
  color-scheme: dark;
  --paper: #100e0d;
  --surface: #1b1816;
  --raised: #25201c;
  --ink: #fbf5ee;
  --copy: #e0d5ca;
  --muted: #bdb0a4;
  --rule: #3e352e;
  --control-rule: #827366;
  --accent: #ff9e54;
  --accent-hover: #ffbb86;
  --accent-soft: #302217;
  --accent-ink: #211308;
  --success: #a6e5bb;
  --success-soft: #162d21;
  --success-rule: #406c51;
  --error: #ffc2b9;
  --error-soft: #38221f;
  --error-rule: #87534c;
  --shadow: 0 12px 32px #0004;
  font-family: 'Aptos', 'Segoe UI', system-ui, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
h1, h2, h3, h4 { line-height: 1.15; }
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.045em; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.85rem); letter-spacing: -0.025em; }
h3 { font-size: 1.25rem; letter-spacing: -0.018em; }
h4 { font-size: 1rem; }
a { color: var(--accent); text-underline-offset: 0.22em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button, input, select { font: inherit; }
button, .button {
  min-height: 43px; display: inline-flex; align-items: center; justify-content: center;
  width: fit-content; padding: 0.55rem 0.95rem; border: 1px solid transparent; border-radius: 8px;
  color: var(--accent-ink); background: var(--accent); font-weight: 700; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: var(--accent-hover); color: var(--accent-ink); }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border-color: var(--control-rule); }
button.secondary:hover, .button.secondary:hover { background: var(--raised); }
button.small { min-height: 34px; padding: 0.28rem 0.56rem; font-size: 0.875rem; }
code { font-family: 'Cascadia Mono', ui-monospace, Consolas, monospace; font-size: 0.91em; background: var(--raised); padding: 0.1rem 0.3rem; border-radius: 4px; overflow-wrap: anywhere; }
input:not([type=checkbox]):not([type=radio]), select { display: block; width: 100%; min-height: 43px; border: 1px solid var(--control-rule); border-radius: 7px; padding: 0.55rem 0.65rem; color: var(--ink); background: var(--paper); }
input[type=checkbox], input[type=radio] { margin: 0.22rem 0 0; width: 1.04rem; height: 1.04rem; flex: none; accent-color: var(--accent); }
input[readonly] { background: var(--raised) !important; }
fieldset { margin: 0; padding: 1rem; border: 1px solid var(--rule); border-radius: 9px; display: grid; gap: 0.7rem; }
legend { padding: 0 0.28rem; font-weight: 650; }
label { display: grid; gap: 0.29rem; font-size: 0.93rem; font-weight: 650; }
label.choice { display: flex; gap: 0.55rem; align-items: flex-start; font-weight: 500; min-height: 28px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 0.63rem 1.2rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
th { color: var(--copy); background: var(--raised); font-weight: 650; font-size: 0.85rem; }
td { font-size: 0.96rem; }
tbody tr:last-child td { border-bottom: 0; }
.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrap { width: min(1080px, calc(100% - 3rem)); margin-inline: auto; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 15px; box-shadow: var(--shadow); }
.skip { position: absolute; z-index: 2; top: 0.5rem; left: 0.5rem; padding: 0.6rem; background: var(--surface); transform: translateY(-180%); }
.skip:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.masthead {
  background: radial-gradient(ellipse at 92% 92%, #402719, transparent 58%), linear-gradient(120deg, #14100e, #201813 82%);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.main-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.main-nav a { color: var(--copy); font-size: 0.9rem; text-decoration: none; }
.main-nav a:hover { text-decoration: underline; }
.wordmark { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 720; white-space: nowrap; }
.mark { width: 24px; height: 24px; display: inline-block; border-radius: 7px; flex: none; background: url('/assets/logo.png') center / contain no-repeat; }
.hero { padding: 1.75rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.hero-identity { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.hero-identity .mark { width: clamp(32px, 5vw, 50px); height: clamp(32px, 5vw, 50px); }
.hero-tools { display: grid; justify-items: end; gap: 0.55rem; flex: none; }
.eyebrow { color: var(--accent); font-weight: 700; letter-spacing: 0.065em; font-size: 0.86rem; text-transform: uppercase; }
.hero h1 { font-size: clamp(2rem, 5.4vw, 3.55rem); letter-spacing: -0.06em; }
.hero-date { margin-top: 0.32rem; color: var(--copy); font-size: 0.92rem; }
.hero-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; flex: none; }
.status-pill { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.38rem 0.75rem; border-radius: 99px; background: var(--raised); color: var(--copy); border: 1px solid var(--control-rule); font-size: 0.88rem; font-weight: 650; }
.status-pill > span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.status-open { background: var(--success-soft); color: var(--success); border-color: var(--success-rule); }
.status-open > span { background: var(--success); }
.status-pill.sample { background: var(--accent-soft); }
.public-main { padding: 1.65rem 0 3rem; display: grid; gap: 2.15rem; }
.question-section { padding: 0.75rem 1.55rem; }
.questions > div { display: grid; grid-template-columns: minmax(12rem, 0.86fr) 2fr; gap: 1.0rem; padding: 0.67rem 0; border-top: 1px solid var(--rule); }
.questions > div:first-child { border-top: 0; }
.questions dt, #number-method h3 { font-weight: 800; color: var(--accent); }
.questions dd { color: var(--copy); font-size: 0.96rem; }
.questions strong { color: var(--ink); }
.section-head { display: flex; justify-content: space-between; gap: 0.85rem; align-items: baseline; margin-bottom: 0.72rem; }
.section-head p, .muted { color: var(--muted); font-size: 0.9rem; }
.ledger { overflow: hidden; }
.ledger-summary { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); }
.pool-total { padding: 1.18rem 1.45rem; display: grid; align-content: start; background: var(--accent-soft); }
.pool-total > span, .ledger-metrics dt, .quote-summary dt, .label { font-size: 0.86rem; color: var(--muted); font-weight: 650; }
.pool-total strong { font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.19; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.pool-total small { font-size: 0.82rem; color: var(--muted); }
progress { display: block; width: 100%; height: 6px; margin: 0.55rem 0 0.38rem; border: 0; background: var(--control-rule); border-radius: 999px; overflow: hidden; color: var(--accent); }
progress::-webkit-progress-bar { background: var(--control-rule); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.ledger-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 1.5rem 0; align-items: center; }
.ledger-metrics > div { padding: 0.3rem 1.15rem; border-left: 1px solid var(--rule); }
.ledger-metrics > div:first-child { border-left: 0; }
.ledger-metrics dd { font-size: clamp(1.05rem, 2.1vw, 1.43rem); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.ledger .table-scroll { max-height: 352px; overflow: auto; }
.ledger thead { position: sticky; top: 0; z-index: 1; }
.masked-name { font-weight: 670; color: var(--ink); letter-spacing: 0.045em; }
.empty-row { color: var(--muted); padding-block: 1.25rem; }
.ledger-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 0.85rem; padding: 0.62rem 1.2rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.88rem; }
.details-section { display: grid; gap: 0.95rem; }
.detail { padding: 1.35rem 1.5rem; display: grid; gap: 0.82rem; }
.detail header h3 { margin-bottom: 0.38rem; }
.detail p { color: var(--copy); }
.quote-panel { padding: 0.95rem 1.15rem; border-radius: 11px; background: var(--raised); border: 1px solid var(--rule); }
.quote-panel header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.6rem; }
.quote-panel header > div > strong { font-size: 1.72rem; display: inline-block; font-variant-numeric: tabular-nums; color: var(--ink); }
.quote-table th, .quote-table td { padding: 0.45rem 0.4rem; background: transparent; }
.quote-summary { display: flex; flex-wrap: wrap; gap: 0.7rem 1.25rem; margin-top: 0.75rem; padding-top: 0.6rem; border-top: 1px solid var(--rule); }
.quote-summary dd { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.source-links { list-style: none; display: flex; flex-wrap: wrap; gap: 0.42rem 0.9rem; padding: 0; margin: 0; }
.source-links, .sources { font-size: 0.87rem; }
.formula-scroll { border: 1px solid var(--rule); border-radius: 9px; }
.formula-scroll th, .formula-scroll td { padding: 0.45rem 0.8rem; }
.record { background: var(--raised); padding: 1rem; border-radius: 8px; }
.record h4, .record .label { margin: 0.3rem 0; }
.ball-numbers { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.detail .completed { padding: 0.65rem 0.8rem; background: var(--success-soft); color: var(--success); border-radius: 7px; }
.footer { padding: 1.15rem 0 2rem; color: var(--muted); font-size: 0.87rem; display: flex; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--rule); }
.policy { max-width: 800px; margin-inline: auto; }
.policy > header, .policy > section { display: grid; gap: 0.5rem; }
.policy > section + section { border-top: 1px solid var(--rule); padding-top: 0.9rem; }
.policy ul { margin: 0; padding-left: 1.3rem; }

.sub-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.sub-nav { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sub-nav a { color: inherit; text-decoration: none; }
.sub-main { padding: 1.8rem 0 3rem; }
.narrow { max-width: 640px; margin-inline: auto; }
.form-panel { padding: 1.6rem; display: grid; gap: 1rem; }
.form-stack { display: grid; gap: 0.8rem; }
.form-stack.compact { gap: 0.32rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.64rem 0.95rem; }
.form-row, .action-row { display: flex; align-items: end; gap: 0.6rem; flex-wrap: wrap; }
.admin-title { align-items: center; }
.admin-title .eyebrow { margin-bottom: 0.3rem; }
.admin-title h1 { margin-bottom: 0.35rem; }
.admin-links { display: flex; gap: 0.75rem 1.15rem; flex-wrap: wrap; margin: 0.7rem 0 1.15rem; }
.admin-section { display: grid; gap: 0.85rem; padding: 1.3rem 1.55rem; margin-bottom: 1rem; }
.admin-section > p, .sub-main .form-panel > p { color: var(--muted); }
.admin-table { min-width: 665px; }
.admin-table th, .admin-table td { padding: 0.52rem 0.65rem; }
.admin-table td { vertical-align: top; }
.admin-table small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.notice { padding: 0.68rem 0.9rem; border: 1px solid var(--control-rule); border-radius: 8px; background: var(--raised); }
.notice.success { color: var(--success); background: var(--success-soft); border-color: var(--success-rule); }
.notice.error { color: var(--error); background: var(--error-soft); border-color: var(--error-rule); }
.invite-card { display: flex; align-items: end; gap: 0.6rem; }
.invite-card label { flex: 1; min-width: 0; }
.stage-action { border-top: 1px solid var(--rule); padding-top: 0.8rem; }
.workflow { border: 1px solid var(--rule); border-radius: 8px; padding: 0.65rem 0.9rem; }
.workflow summary { font-weight: 650; cursor: pointer; }
.workflow[open] summary { padding-bottom: 0.7rem; }
.purchase-list { padding: 0.6rem 0.85rem; border-radius: 8px; background: var(--raised); }
.purchase-list p { display: flex; flex-wrap: wrap; gap: 0.1rem 1rem; padding-block: 0.18rem; }
.payment-details > div { padding: 0.68rem 0; border-top: 1px solid var(--rule); }
.payment-details dt { color: var(--muted); font-size: 0.89rem; }
.payment-details dd { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
[hidden] { display: none !important; }

@media (max-width: 650px) {
  .wrap { width: calc(100% - 1.5rem); }
  .sub-nav { min-height: 57px; }
  .main-nav { gap: 0.4rem 0.8rem; }
  .main-nav a { font-size: 0.82rem; }
  .wordmark { font-size: 0.91rem; }
  .hero { align-items: start; flex-direction: column; gap: 0.85rem; padding: 1.1rem 0; }
  .hero-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; width: 100%; }
  .public-main { gap: 1.7rem; padding-top: 1rem; }
  .questions > div { grid-template-columns: 1fr; gap: 0.22rem; }
  .question-section, .detail, .admin-section, .form-panel { padding: 1rem; }
  .section-head { align-items: start; flex-direction: column; gap: 0.15rem; }
  .ledger-summary { grid-template-columns: 1fr; }
  .pool-total { padding: 0.83rem 1rem; }
  .ledger-metrics { padding: 0.68rem 0; }
  .ledger-metrics > div { padding: 0.2rem 0.65rem; }
  .ledger-metrics dt { font-size: 0.78rem; }
  th, td { padding-inline: 0.65rem; }
  th { font-size: 0.78rem; }
  .ledger-foot { padding-inline: 0.65rem; }
  .field-grid { grid-template-columns: 1fr; }
  .admin-title form { margin-top: 0.5rem; }
}

@media (max-width: 365px) {
  .mark { width: 20px; height: 20px; }
  .quote-panel { padding: 0.78rem; }
  .ledger-metrics dd { font-size: 1rem; }
}
