:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #142238;
  --muted: #465366;
  --line: #cdd5e0;
  --control-line: #68788f;
  --accent: #d00000;
  --accent-ink: #ffffff;
  --left: #d00000;
  --left-bg: #fff5f5;
  --flag: #142238;
  --flag-bg: #eef0f4;
  --head: #b80000;
  --head-ink: #ffffff;
  --edition-rule: #f08a8a;
  --group: #002868;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #040914; --surface: #080f1c; --text: #ffffff; --muted: #aab8cc;
    --line: #34445d; --control-line: #788ba6; --accent: #ff4545; --accent-ink: #080f1c;
    --left: #ff4545; --left-bg: #101827; --flag: #e6eaf0; --flag-bg: #1a2233;
    --head: #9a0000; --head-ink: #ffffff; --edition-rule: #f08a8a; --group: #002868;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #040914; --surface: #080f1c; --text: #ffffff; --muted: #aab8cc;
  --line: #34445d; --control-line: #788ba6; --accent: #ff4545; --accent-ink: #080f1c;
  --left: #ff4545; --left-bg: #101827; --flag: #e6eaf0; --flag-bg: #1a2233;
  --head: #9a0000; --head-ink: #ffffff; --edition-rule: #f08a8a; --group: #002868;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 28px; }
.skip-link { position: absolute; left: 16px; top: 8px; z-index: 2; padding: 10px 16px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
p { margin: 0 0 12px; }
h1, h2, h3 { text-wrap: balance; }
h2 { font: 700 1.85rem/1.2 var(--serif); margin: 0 0 16px; letter-spacing: -0.025em; }
h3 { font-size: 1.08rem; line-height: 1.35; margin: 0 0 14px; }
header.site { background: var(--head); color: var(--head-ink); padding: 22px 0 30px; border-bottom: 6px solid #002868; box-shadow: 0 6px 0 #ffffff; }
.edition { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 13px; margin-bottom: 21px; border-bottom: 1px solid var(--edition-rule); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 650; }
header.site h1 { font: 700 clamp(2.4rem, 6.2vw, 4.3rem)/1.05 var(--serif); letter-spacing: -0.045em; margin: 0 0 18px; }
header.site .lede { max-width: 37em; font: 400 1.35rem/1.45 var(--serif); margin-bottom: 12px; }
.lede strong { font-weight: 700; }
header.site .tag { margin: 0; font-size: 0.85rem; letter-spacing: 0.015em; }
.fine { font-size: 0.82rem; color: var(--muted); line-height: 1.55; }
.msg { margin: 10px 0 0; font-size: 0.9rem; }
.msg:empty { display: none; }
.msg.err { color: var(--flag); }
.finder { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); padding: 24px 28px; margin-top: 28px; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; }
.step { color: var(--left); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.06em; padding-right: 12px; border-right: 1px solid var(--line); }
label { display: block; font-weight: 650; font-size: 0.85rem; min-width: 0; }
.row { display: flex; gap: 10px; margin-top: 7px; }
input[type=text], select { font: inherit; padding: 12px; border: 1px solid var(--control-line); border-radius: 3px; background: var(--surface); color: var(--text); min-width: 0; max-width: 100%; }
input::placeholder { color: var(--muted); opacity: 1; }
.row input { flex: 1; width: 0; }
select { width: 100%; text-overflow: ellipsis; }
button { font: inherit; font-weight: 650; padding: 12px 18px; border: 1px solid transparent; border-radius: 3px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:hover { filter: brightness(0.9); }
button span { margin-left: 12px; }
button.secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.privacy { font-size: 0.82rem; font-weight: 650; color: var(--left); margin: 13px 0 3px; }
#geocoder-note { margin-bottom: 0; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-weight: 650; font-size: 0.9rem; }
details[open] > summary { margin-bottom: 12px; }
#manual { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.grid select { margin-top: 5px; font-weight: 400; }
.mapnote { margin: 16px 0 32px; padding: 0 4px; }
.mapnote details { margin: 0; }
.mapnote summary { color: var(--muted); font-size: 0.82rem; }
.mapnote p { font-size: 0.88rem; max-width: 65em; margin: 10px 0 0; }
#ballot { margin-top: 36px; }
.ballot-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-top: 3px solid var(--text); padding-top: 22px; margin-bottom: 20px; }
.ballot-heading h2 { font-size: 2.25rem; margin-bottom: 8px; }
.eyebrow { color: var(--muted); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px; }
.districts { color: var(--muted); font-size: 0.82rem; margin: 0; }
.actions { display: flex; flex-shrink: 0; gap: 8px; flex-wrap: wrap; }
.actions button { font-size: 0.8rem; padding: 10px 12px; }
table.sheet { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); font-size: 0.9rem; line-height: 1.4; }
.sheet th, .sheet td { text-align: left; vertical-align: top; padding: 12px 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.sheet thead th { color: var(--muted); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; padding-top: 11px; padding-bottom: 11px; }
.sheet th:nth-child(1) { width: 4%; }
.sheet th:nth-child(2) { width: 35%; }
.sheet th:nth-child(3) { width: 24%; }
.sheet td.box { color: var(--muted); font-size: 1.05rem; padding-right: 0; }
.sheet td.contest { font-weight: 550; }
.sheet td.pick { font-weight: 750; color: var(--left); font-size: 0.96rem; }
.sheet td.why { font-size: 0.79rem; }
.why-m { display: none; font-size: 0.78rem; font-weight: 400; margin-top: 6px; }
.sheet .why.flagged, .sheet .why-m.flagged { color: var(--flag); }
.sheet .why.endorsed, .sheet .why-m.endorsed { color: var(--left); }
body.wide .wrap { max-width: 1440px; }
.allcards { display: none; }
@media (max-width: 900px) {
  .allcards { display: block; }
  table.allgrid { display: none; }
}
.sheet.allgrid th:nth-child(1) { width: 19%; }
.sheet.allgrid th:nth-child(2) { width: 16%; }
.sheet.allgrid th:nth-child(3) { width: 27%; }
.sheet.allgrid th:nth-child(4) { width: 14%; }
.sheet.allgrid th:nth-child(5) { width: 24%; }
.sheet.allgrid td.dem { font-weight: 650; }
.sheet.allgrid td.why { display: table-cell; }
.sheet tr.group th { background: var(--group); color: var(--head-ink); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 12px; font-weight: 650; }
#details { margin-top: 42px; }
#details > h2 { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); }
#details > h2:first-child { border-top: 3px solid var(--text); }
.race { background: var(--surface); border: 1px solid var(--line); padding: 22px 24px; margin: 14px 0; break-inside: avoid; min-width: 0; overflow-wrap: anywhere; }
.race > h3 { margin-bottom: 16px; }
.district-label { font: inherit; }
.race .meta { font-size: 0.8rem; color: var(--muted); margin: -8px 0 16px; }
.cand { padding: 16px 0; border-top: 1px solid var(--line); }
.cand:last-child { padding-bottom: 0; }
.candidate-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 9px; }
.cand .name { font-weight: 750; }
.candidate-notes { font-size: 0.88rem; margin-top: 7px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.badges:empty { display: none; }
.badge { display: inline-block; font-size: 0.69rem; line-height: 1.5; font-weight: 700; padding: 3px 7px; border-radius: 2px; }
.badge.left { background: var(--left-bg); color: var(--left); letter-spacing: 0.04em; }
.badge.flag { background: var(--flag-bg); color: var(--flag); }
.badge.end { background: var(--left-bg); color: var(--left); font-weight: 600; }
.flag-inline { color: var(--flag); font-weight: 700; }
.pick-label { color: var(--left); }
.record { margin: 8px 0 0; padding-left: 18px; }
.record li { margin: 0 0 6px; }
.record .status { display: inline-block; font-size: 0.66rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 6px; border-radius: 2px; background: var(--flag-bg); color: var(--flag); vertical-align: 1px; }
.record .src { font-size: 0.78rem; white-space: nowrap; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.vs .cand.dem { border-left: 1px solid var(--line); padding-left: 22px; }
.badge.also { background: var(--flag-bg); color: var(--muted); letter-spacing: 0.04em; }
.good-h { margin: 10px 0 0; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.record.good { margin-top: 4px; }
@media (max-width: 700px) {
  .vs { grid-template-columns: 1fr; }
  .vs .cand.dem { border-left: 0; padding-left: 0; }
}
.yn { font-size: 0.88rem; margin: 12px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.yn p { margin: 0; padding-left: 12px; border-left: 2px solid var(--line); }
.pickline { color: var(--left); padding: 12px 14px; background: var(--left-bg); margin: 14px 0; font-weight: 700; }
.pickline .fine { display: block; margin-top: 4px; color: var(--text); }
.race > p:last-child { margin-bottom: 0; }
.plain { font-weight: 400; }
.about { margin-top: 42px; padding-top: 24px; border-top: 3px solid var(--text); }
.about > p, .about details { max-width: 48em; }
.about p { font-size: 0.92rem; }
.about .disclaimer { font-size: 0.78rem; margin-top: 22px; }
footer.site { border-top: 1px solid var(--line); margin-top: 32px; padding: 30px 0 20px; }
.early { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
.early h2 { font-size: 1.85rem; }
.voting-info { font-size: 0.86rem; }
.updated { padding-top: 16px; margin: 12px 0 0; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .ballot-heading { flex-direction: column; gap: 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  header.site { padding: 17px 0 24px; }
  .edition { font-size: 0.58rem; letter-spacing: 0.045em; margin-bottom: 20px; }
  header.site h1 { font-size: 2.45rem; }
  header.site .lede { font-size: 1.16rem; }
  header.site .tag { font-size: 0.75rem; }
  h2 { font-size: 1.65rem; }
  .finder { padding: 20px 17px; margin-top: 20px; }
  .section-heading { margin-bottom: 18px; }
  .row { flex-direction: column; }
  .row input { flex: auto; width: 100%; font-size: 16px; }
  .row button { width: 100%; }
  .grid { gap: 12px 8px; }
  .grid select { font-size: 16px; padding: 10px 6px; }
  .privacy { font-size: 0.76rem; }
  .fine { font-size: 0.78rem; }
  .mapnote { margin-bottom: 26px; }
  .ballot-heading h2 { font-size: 2rem; }
  .sheet th, .sheet td { padding: 10px 7px; }
  .sheet th:nth-child(1) { width: 7%; }
  .sheet th:nth-child(2) { width: 53%; }
  .sheet th:nth-child(3) { width: 40%; }
  .sheet th.why, .sheet td.why { display: none; }
  .sheet td.pick { font-size: 0.91rem; }
  .sheet td.contest { font-size: 0.84rem; }
  .sheet tr.group th { font-size: 0.65rem; }
  .why-m { display: block; }
  .race { padding: 18px 16px; }
  .yn { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .early { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .early h2 br { display: none; }
}

@media print {
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --line: #bbb;
    --accent: #000; --left: #c00000; --flag: #000; --left-bg: #fff; --flag-bg: #fff;
  }
  body { background: #fff; color: #000; font-size: 10pt; }
  header.site { background: none; color: #000; padding: 0 0 4px; }
  header.site h1 { font-size: 16pt; margin: 0; }
  header.site .tag, header.site .lede, .edition, .skip-link,
  .mapnote, .finder, .actions, .about, footer.site, .noprint { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  #ballot { margin: 0; }
  .ballot-heading { display: block; border: 0; padding: 0; margin: 0 0 5px; }
  .ballot-heading h2 { font-size: 13pt; margin: 5px 0 3px; }
  .districts { font-size: 8pt; margin: 0 0 4px; }
  table.sheet { table-layout: fixed; line-height: 1.25; font-size: 9.2pt; }
  .sheet th.why, .sheet td.why { display: table-cell !important; }
  .why-m { display: none !important; }
  .sheet td, .sheet th, .sheet thead th, .sheet tr.group th { padding: 1px 6px; }
  .sheet th:nth-child(1) { width: 4%; }
  .sheet th:nth-child(2) { width: 38%; }
  .sheet th:nth-child(3) { width: 21%; }
  .sheet th:nth-child(4) { width: 37%; }
  .sheet td, .sheet td.contest, .sheet td.pick, .sheet td.box { font-size: 8.8pt; }
  .sheet td.why { font-size: 8.4pt; }
  .sheet thead th, .sheet tr.group th { font-size: 8pt; letter-spacing: 0; }
  .sheet tr.group th { background: #fff; color: #000; border-top: 1px solid #000; }
  .sheet tr { break-inside: avoid; }
  .race { border: 0; padding: 0; margin: 10px 0; }
  .cand { padding: 6px 0; }
  h2 { margin: 8px 0 4px; }
  #details { break-before: page; margin-top: 0; }
  #details > h2 { margin-top: 12px; padding-top: 8px; }
  a { color: inherit; text-decoration: none; }
  @page { size: letter; margin: 0.4in; }
}
