:root {
  color-scheme: light;
  --paper: #f3efe6;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #1c1915;
  --posted: #1f6b4a;
  --posted-soft: #e5f2eb;
  --waiting: #f7f4ee;
  --bar: #1c1915;
  --bar-2: #8d6840;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
}

.top, .controls, footer, .status {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.top { padding: 40px 0 8px; }

.kicker, label span, .result-note, footer, .chip small, .days button {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.lede {
  max-width: 42rem;
  margin: 14px 0 0;
  font-size: 1.2rem;
  line-height: 1.45;
}

.controls {
  display: grid;
  gap: 14px;
  padding: 22px 0 18px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

select, .days button, .chip {
  border: 1px solid var(--line);
  background: #fffdf8;
  color: inherit;
  font: inherit;
}

select {
  width: min(100%, 42rem);
  padding: 10px 12px;
  font-family: system-ui, sans-serif;
  font-size: 1rem;
}

.days { display: flex; flex-wrap: wrap; gap: 8px; }

.days button, .chip {
  cursor: pointer;
}

.days button {
  padding: 8px 10px;
  font-size: 0.85rem;
}

.days button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 28px;
  border: 2px solid var(--line);
  min-height: 70vh;
}

.pane {
  padding: 22px;
  min-width: 0;
}

.pane + .pane { border-left: 2px solid var(--line); }

h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.race-name {
  margin: 0 0 18px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  line-height: 1.4;
}

.candidate { margin: 0 0 16px; }

.candidate header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.candidate strong { font-size: 1.35rem; letter-spacing: -0.03em; }

.candidate .votes {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
}

.party, .delta, .chip small, .result-note, footer {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.track {
  height: 14px;
  margin-top: 6px;
  background: #e4ddd0;
}

.track span {
  display: block;
  height: 100%;
  background: var(--bar);
}

.candidate:nth-child(2) .track span { background: var(--bar-2); }

.columns { display: grid; gap: 18px; }

h3 {
  margin: 0 0 8px;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }

.chip {
  display: flex;
  flex: 1 1 140px;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 72px;
  padding: 10px;
  text-align: left;
}

.chip.posted { background: var(--posted-soft); border-color: var(--posted); }

.chip.waiting { background: var(--waiting); border-style: dashed; }

.chip b { font-size: 1rem; }

.chip[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }

.result-note { margin: 16px 0 0; }

.status { min-height: 1.4em; }

footer {
  padding: 0 0 40px;
}

a { color: inherit; }

@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 2px solid var(--line); }
  .split { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
