:root {
  --navy: #142158;
  --navy-2: #1d2d70;
  --paper: #ffffff;
  --ink: #000000;
  --red: #d7282f;
  --blue: #2457d6;
  --violet: #7a4cc2;
  --rule: #c9cedd;
  --muted: #4b5470;
  --on-navy: #ffffff;
  --on-navy-muted: #c7cdea;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--navy);
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1.4px);
  background-size: 22px 22px;
  color: var(--on-navy);
  font: 400 17px/1.55 var(--body);
  min-height: 100vh;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }

/* red/white/blue pennant bunting */
.bunting {
  height: 22px;
  background:
    linear-gradient(135deg, transparent 50%, var(--navy) 50%) 0 0 / 22px 22px,
    linear-gradient(225deg, transparent 50%, var(--navy) 50%) 0 0 / 22px 22px,
    repeating-linear-gradient(90deg, var(--red) 0 22px, var(--paper) 22px 44px, var(--blue) 44px 66px);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1040px; margin: 0 auto; padding: 14px 16px 0;
}
.wordmark {
  font: 900 26px/1 var(--display); text-decoration: none; letter-spacing: .01em;
}
.countdown {
  font-size: 14px; font-weight: 600; text-decoration: none; text-align: right;
  background: var(--red); color: var(--paper); padding: 6px 12px; border-radius: 999px;
}
.countdown:hover { background: #b51f25; }

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; outline: none; }

/* ---------- home ---------- */
.hero { padding: 40px 0 28px; max-width: 760px; }
.hero h1 {
  font: 900 clamp(46px, 11vw, 104px)/.9 var(--display);
  margin: 0 0 18px; letter-spacing: -.005em; text-wrap: balance;
}
.hero p { font-size: 19px; color: var(--on-navy-muted); margin: 0; max-width: 60ch; }
.hero .stat { margin-top: 14px; font-size: 15px; color: var(--on-navy-muted); }

.modes {
  display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 12px 0 40px;
}
/* each mode is a vote-by-mail envelope: airmail chevron border */
.envelope {
  position: relative; background: var(--paper); color: var(--ink);
  padding: 22px 20px 20px; border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 10px;
}
.envelope::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none;
  padding: 7px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 12px, var(--paper) 12px 20px, var(--blue) 20px 32px, var(--paper) 32px 40px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.envelope h2 { font: 900 34px/1 var(--display); margin: 6px 0 0; }
.envelope p { margin: 0; color: var(--muted); font-size: 16px; }
.envelope .count { font-weight: 600; color: var(--ink); font-size: 15px; }
.envelope .actions { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.districts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.districts label { font-size: 14px; font-weight: 600; display: grid; gap: 4px; }
select {
  font: inherit; font-size: 16px; padding: 9px 10px; border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.hint { font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius); cursor: pointer; text-decoration: none;
  font-weight: 800; font-size: 17px; padding: 12px 18px; min-height: 48px;
}
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #2a2a2a; }
.btn-red { background: var(--red); color: var(--paper); }
.btn-red:hover { background: #b51f25; }
.btn-line { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.section-title { font: 900 40px/1 var(--display); margin: 0 0 14px; }

/* ---------- leaderboard ---------- */
.board { background: var(--navy-2); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 36px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  background: transparent; border: 2px solid var(--on-navy-muted); color: var(--on-navy);
  border-radius: 999px; padding: 6px clamp(8px, 2.6vw, 14px); font-weight: 600; font-size: clamp(13px, 3.6vw, 15px);
  white-space: nowrap; cursor: pointer;
}
.tab .short { display: none; }
@media (max-width: 429px) { .tab .long { display: none; } .tab .short { display: inline; } }
.tab[aria-selected="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.12); }
th { color: var(--on-navy-muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.board .summary { color: var(--on-navy-muted); font-size: 14px; margin: 10px 0 0; }

/* ---------- vote box ---------- */
.votebox {
  background: var(--red); color: var(--paper); border-radius: var(--radius); padding: 24px 20px; margin-bottom: 36px;
}
.votebox h2 { font: 900 clamp(36px, 7vw, 54px)/.95 var(--display); margin: 0 0 10px; }
.votebox ul { margin: 0 0 16px; padding-left: 20px; }
.votebox li { margin: 4px 0; }
.votebox .links { display: flex; flex-wrap: wrap; gap: 10px; }
.votebox .btn { background: var(--paper); color: var(--ink); }
.votebox .btn:hover { background: #ffe6e7; }

/* ---------- quiz ballot ---------- */
.ballot {
  background: var(--paper); color: var(--ink); max-width: 520px; margin: 24px auto 0;
  border-radius: var(--radius); overflow: hidden;
}
.ballot-head {
  background: var(--ink); color: var(--paper); padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px;
}
.ballot-head strong { font: 900 22px/1 var(--display); letter-spacing: .01em; }
.ticks { display: flex; gap: 3px; padding: 10px 16px 0; }
.ticks span { flex: 1; height: 6px; background: var(--rule); border-radius: 2px; }
.ticks span.done { background: var(--ink); }
.ticks span.now { background: var(--red); }
.portrait {
  margin: 14px 16px 0; aspect-ratio: 4 / 5; background: #eef0f6; border: 2px solid var(--ink);
  border-radius: 4px; overflow: hidden; display: grid; place-items: center;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .loading { color: var(--muted); font-size: 15px; }
.instruct { margin: 14px 16px 6px; font-size: 14px; color: var(--muted); }
.choices { list-style: none; margin: 0; padding: 0 16px 8px; }
.choice {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  background: none; border: 0; border-top: 1px solid var(--rule); padding: 14px 4px; cursor: pointer;
  font-size: 20px; font-weight: 800; -webkit-tap-highlight-color: transparent;
}
.choice:first-child { border-top: 0; }
.choice small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); }
/* Mouse only: on touch screens :hover sticks to whatever lands under the finger, so the next
   question's oval would look pre-filled. */
@media (hover: hover) and (pointer: fine) { .choice:hover .oval { box-shadow: inset 0 0 0 2px var(--ink); } }
.oval {
  flex: none; width: 46px; height: 26px; border: 2.5px solid var(--ink); border-radius: 50%;
  position: relative; overflow: hidden; background: var(--paper);
}
.oval::after {
  content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--ink);
  transform: scaleX(0); transform-origin: left center; transition: transform .28s ease-out;
}
.choice[aria-pressed="true"] .oval::after { transform: scaleX(1); }
.ballot-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px 16px; gap: 10px; }
.linkbtn { background: none; border: 0; padding: 8px 0; text-decoration: underline; cursor: pointer; font-size: 15px; color: var(--muted); }
.linkbtn[disabled] { visibility: hidden; }

/* ---------- results ---------- */
.result-top { display: grid; gap: 28px; align-items: center; padding: 32px 0 28px; }
@media (min-width: 780px) { .result-top { grid-template-columns: 300px 1fr; } }

/* the "I Voted"-style sticker */
.sticker {
  width: min(300px, 80vw); aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  background: var(--paper); color: var(--ink); display: grid; place-items: center; text-align: center;
  box-shadow: 0 0 0 10px var(--paper), 0 0 0 16px var(--red), 0 0 0 22px var(--paper), 0 0 0 28px var(--blue);
  padding: 30px; transform: rotate(-4deg);
}
.sticker .s-top { font: 900 24px/1 var(--display); color: var(--red); }
.sticker .s-score { font: 900 92px/.9 var(--display); }
.sticker .s-title { font: 900 26px/1 var(--display); color: var(--blue); text-wrap: balance; }
@media (prefers-reduced-motion: no-preference) {
  .sticker.stamp { animation: stamp .5s cubic-bezier(.2, 1.4, .4, 1) both; }
  @keyframes stamp { from { transform: rotate(-14deg) scale(1.6); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: 1; } }
}
.result-copy h1 { font: 900 clamp(40px, 8vw, 72px)/.92 var(--display); margin: 0 0 12px; text-wrap: balance; }
.result-copy p { margin: 0 0 12px; color: var(--on-navy-muted); font-size: 18px; }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; }
.share-row .btn-line { color: var(--paper); }

.lesson {
  background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 24px 20px; margin: 8px 0 36px;
  border-left: 12px solid var(--red);
}
.lesson h2 { font: 900 clamp(36px, 7vw, 56px)/.95 var(--display); margin: 0 0 12px; text-wrap: balance; }
.lesson p { margin: 0 0 12px; max-width: 64ch; }
.lesson .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.lesson .deadline { font-weight: 600; }

.reveal-list { display: grid; gap: 14px; margin-bottom: 36px; }
.row {
  background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 14px;
  display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start;
}
@media (min-width: 640px) { .row { grid-template-columns: 132px 1fr; padding: 16px; } }
.row img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; border: 2px solid var(--ink); background: #eef0f6; }
.row h3 { font: 900 30px/1 var(--display); margin: 0 0 6px; }
.row .office { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.row .verdict { font-weight: 800; margin: 0 0 8px; }
.row .blurb { margin: 0 0 8px; font-size: 16px; }
.row .crowd { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.row .row-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 15px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px; color: var(--paper); }
.chip.D { background: var(--blue); }
.chip.R { background: var(--red); }
.chip.O { background: var(--violet); }
.chip.guess { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); font-weight: 600; }
.mark { font-weight: 900; }
.mark.right { color: #157a3d; }
.mark.wrong { color: var(--red); }
.note { font-size: 14px; background: #f1f3fa; border-radius: 4px; padding: 8px 10px; margin: 0 0 8px; }

.again { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 36px; }

.panel { background: var(--navy-2); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 36px; }
.panel > p { color: var(--on-navy-muted); margin: 0 0 12px; }
.misjudged { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.misjudged figure { margin: 0; background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 8px; }
.misjudged img { aspect-ratio: 4 / 5; width: 100%; object-fit: cover; border-radius: 4px; }
.misjudged figcaption { font-size: 14px; padding-top: 6px; }
.misjudged strong { display: block; font: 900 20px/1.05 var(--display); }

.center { text-align: center; }
.error {
  background: var(--paper); color: var(--ink); border-left: 8px solid var(--red);
  padding: 14px 16px; border-radius: var(--radius); margin: 24px auto; max-width: 520px;
}
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-weight: 600; z-index: 9;
}

.footer {
  max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; font-size: 14px; color: var(--on-navy-muted);
  border-top: 1px solid rgba(255,255,255,.15);
}
.footer p { max-width: 80ch; }

@media (max-width: 420px) {
  .wordmark { font-size: 22px; }
  .countdown { font-size: 12px; padding: 5px 10px; }
  .choice { font-size: 18px; }
}

/* ---------- icons + Washington graphics ---------- */
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; fill: currentColor; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.countdown { display: inline-flex; align-items: center; gap: 6px; }
.section-title .icon { color: #ffd23f; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; }
.row-links a { display: inline-flex; align-items: center; gap: 4px; }
.row-links .icon { width: .95em; height: .95em; }
.chip .mark .icon { width: 1.25em; height: 1.25em; vertical-align: -0.3em; }

.mode-icon {
  position: absolute; top: 18px; right: 18px; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; background: var(--navy); color: var(--paper);
}
.mode-icon .icon { width: 28px; height: 28px; }
.envelope h2 { padding-right: 64px; }

.hero { display: grid; gap: 8px 32px; grid-template-columns: 1fr; max-width: none; }
.hero > * { max-width: 760px; }
.wa-flag { width: 150px; height: auto; order: -1; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr) 320px; align-items: center; }
  .hero h1, .hero p { grid-column: 1; }
  .wa-flag { grid-column: 2; grid-row: 1 / span 3; width: 100%; order: 0; transform: rotate(-4deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .wa-flag { animation: wave 1.2s .2s cubic-bezier(.2, 1.3, .4, 1) both; }
  @keyframes wave { from { opacity: 0; transform: translateY(16px) rotate(-10deg); } to { opacity: 1; } }
}

.s-wa { width: 64px; height: auto; margin: 0 auto 6px; fill: var(--blue); }

/* ---------- fit the whole ballot on one phone screen ---------- */
.portrait { width: min(calc(100% - 32px), calc(40svh * .8)); margin: 12px auto 0; }
.choice { padding: 11px 4px; }
.instruct { margin: 10px 16px 2px; }
.ballot { margin-top: 14px; }
.countdown .short { display: none; }
@media (max-width: 520px) {
  .countdown .long { display: none; }
  .countdown .short { display: inline; }
  .ballot-head strong { font-size: 19px; }
  .ballot-head { font-size: 13px; }
}

/* sticker type: keep score and title from colliding on narrow screens */
.sticker { padding: 40px; }
.sticker .s-score { font-size: clamp(60px, 17vw, 92px); line-height: 1; margin: 2px 0 8px; }
.sticker .s-title { font-size: clamp(20px, 5.4vw, 26px); }
.s-wa { width: clamp(44px, 12vw, 64px); }
#app:focus, #app:focus-visible { outline: none; }
.districts { align-items: end; }

/* ---------- election results ---------- */
.comeback { border-left-color: var(--blue); }
.comeback .fine { font-size: 14px; color: var(--muted); }
.chip.outcome.win { background: #157a3d; }
.chip.outcome.lose { background: var(--muted); }
.chip.outcome.close { background: #8a5300; }

/* results page: the vote box sits right under the score, so make it the loudest thing there */
.votebox-big { margin-top: 8px; padding: 28px 22px; box-shadow: 0 0 0 4px var(--paper), 0 10px 0 4px rgba(0,0,0,.25); }
.votebox-big .kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 800; font-size: 15px; }
.votebox-big h2 { font-size: clamp(42px, 9vw, 64px); }
.votebox-big .lede { font-size: 18px; margin: 0 0 12px; max-width: 60ch; }
.votebox-big .btn { font-size: 17px; padding-block: 14px; }
#candidates { scroll-margin-top: 16px; }
#candidates:focus { outline: none; }

/* X and Facebook buttons for mouse users only; on phones "Challenge your friends" opens the share sheet */
.desktop-only { display: none; }
@media (hover: hover) and (pointer: fine) { .btn.desktop-only { display: inline-flex; } }

/* state picker (facetheballot.com) */
.hub-note { color: var(--on-navy-muted); margin: -20px 0 36px; }
.votebox > p { margin: 0 0 16px; max-width: 60ch; }
.states { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
