:root {
  --ink: #111317;
  --muted: #626872;
  --paper: #f6f5f1;
  --white: #ffffff;
  --line: #dcdedb;
  --spotlight-blue: #0b4d78;
  --spotlight-blue-dark: #07344f;
  --dem: #1769aa;
  --rep: #c43d38;
  --shadow: 0 13px 34px rgba(20, 31, 41, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Barlow", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}
button, a { font: inherit; }
a { color: var(--spotlight-blue); }
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: #fff; color: #000; padding: 10px 14px; }
.skip-link:focus { top: 12px; }

.site-header { background: var(--white); color: var(--ink); border-bottom: 4px solid #e7b82e; }
.header-inner { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: block; flex: 0 1 auto; text-decoration: none; }
.brand-logo { display: block; width: 190px; max-width: 100%; height: auto; }
.election-center-link { color: var(--spotlight-blue); text-decoration: none; border: 1px solid rgba(11,77,120,.38); border-radius: 999px; padding: 9px 14px; font-weight: 700; white-space: nowrap; }
.election-center-link:hover { background: #edf6fb; border-color: var(--spotlight-blue); }

.hero { color: #fff; background: linear-gradient(120deg, var(--spotlight-blue-dark), var(--spotlight-blue) 62%, #17688e); padding: 64px 0 58px; overflow: hidden; position: relative; }
.hero::after { content: ""; position: absolute; width: 420px; height: 420px; right: -180px; top: -220px; border: 70px solid rgba(255,255,255,.055); border-radius: 50%; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); align-items: end; gap: 70px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 11px; color: #f3c947; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1 { max-width: 820px; margin: 0; font: 800 clamp(42px, 7vw, 78px)/.97 "Montserrat", sans-serif; letter-spacing: -.045em; }
.dek { max-width: 720px; margin: 24px 0 0; color: rgba(255,255,255,.86); font-size: 20px; line-height: 1.5; }
.statewide-card { background: rgba(5,28,44,.46); border: 1px solid rgba(255,255,255,.2); border-radius: 16px; padding: 22px; backdrop-filter: blur(7px); }
.statewide-topline { display: flex; justify-content: space-between; gap: 15px; color: rgba(255,255,255,.72); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.big-percent { font: 800 52px/1 "Montserrat", sans-serif; margin: 16px 0 11px; }
.meter { height: 8px; background: rgba(255,255,255,.19); border-radius: 10px; overflow: hidden; }
.meter span { display: block; width: 0; height: 100%; background: #f3c947; border-radius: inherit; transition: width .5s ease; }
.statewide-card p { margin: 11px 0 0; color: rgba(255,255,255,.76); font-size: 14px; }

.status-strip { background: #fff; border-bottom: 1px solid var(--line); }
.status-inner { min-height: 62px; display: flex; align-items: center; gap: 16px; }
.live-state { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: .08em; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #9ba0a6; }
.pulse.live { background: #d4362f; box-shadow: 0 0 0 6px rgba(212,54,47,.13); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(212,54,47,0); } }
.status-inner p { color: var(--muted); margin: 0; flex: 1; font-size: 15px; }
.refresh-button { border: 1px solid #b9bec4; border-radius: 7px; background: #fff; color: var(--ink); padding: 7px 12px; font-weight: 600; cursor: pointer; }
.refresh-button:hover { background: #f1f3f4; }
.refresh-button:disabled { opacity: .55; cursor: wait; }

.race-nav { position: sticky; top: 0; z-index: 20; background: rgba(246,245,241,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.nav-scroll { display: flex; gap: 8px; padding-top: 12px; padding-bottom: 12px; overflow-x: auto; scrollbar-width: thin; }
.nav-scroll a { flex: 0 0 auto; color: #31363d; background: #fff; border: 1px solid #d5d8d9; border-radius: 999px; padding: 7px 12px; text-decoration: none; font-size: 14px; font-weight: 600; }
.nav-scroll a:hover { border-color: var(--spotlight-blue); color: var(--spotlight-blue); }

.notice { margin-top: 26px; padding: 13px 16px; border: 1px solid #efca65; border-radius: 9px; background: #fff8df; color: #55420e; }
.notice.error { border-color: #e4aaa7; background: #fff1f0; color: #7d2924; }
.results-shell { padding: 32px 0 72px; }
.race-group { margin: 0 0 46px; }
.race-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; align-items: start; margin: 0 0 46px; }
.race-pair .race-group { min-width: 0; margin: 0; }
.race-pair .race-grid { grid-template-columns: minmax(0, 1fr); }
.race-pair .group-title { font-size: clamp(24px, 3vw, 31px); }
.group-title { display: flex; align-items: center; gap: 16px; margin: 0 0 18px; font: 800 clamp(25px, 4vw, 36px)/1.1 "Montserrat", sans-serif; letter-spacing: -.025em; }
.group-title::after { content: ""; height: 1px; background: #ccd0d1; flex: 1; }
.race-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; align-items: start; }
.race-card { scroll-margin-top: 78px; background: #fff; border: 1px solid #e0e2df; border-top: 5px solid var(--party-color); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.race-card.democratic { --party-color: var(--dem); }
.race-card.republican { --party-color: var(--rep); }
.card-head { padding: 19px 21px 15px; border-bottom: 1px solid #e9eae8; }
.card-kicker { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.party-pill { color: var(--party-color); background: color-mix(in srgb, var(--party-color) 11%, white); border-radius: 999px; padding: 4px 9px; font-weight: 700; }
.reporting-mini { white-space: nowrap; }
.card-head h3 { margin: 10px 0 0; font: 800 23px/1.12 "Montserrat", sans-serif; letter-spacing: -.025em; }
.share-bar { display: flex; height: 13px; background: #e7e9e9; overflow: hidden; }
.share-segment { width: 0; height: 100%; min-width: 0; transition: width .6s ease; }
.share-segment + .share-segment { box-shadow: inset 2px 0 0 rgba(255,255,255,.9); }
.candidate-list { margin: 0; padding: 6px 21px 12px; list-style: none; }
.candidate { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-height: 82px; border-bottom: 1px solid #eceeec; }
.candidate:last-child { border-bottom: 0; }
.portrait { width: 52px; height: 52px; position: relative; overflow: hidden; border-radius: 50%; background: #e5e8e8; color: #3c4850; display: grid; place-items: center; font: 700 15px/1 "Montserrat", sans-serif; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd3d4; }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.candidate-name { font-weight: 700; line-height: 1.15; }
.candidate-votes { margin-top: 4px; color: var(--muted); font-size: 14px; }
.candidate-share { min-width: 62px; text-align: right; font: 800 21px/1 "Montserrat", sans-serif; letter-spacing: -.03em; }
.awaiting .candidate-share { color: #92979b; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f7f8f7; border-top: 1px solid #e9eae8; padding: 9px 21px; color: var(--muted); font-size: 12px; }

.results-footer { background: #e9ebe8; border-top: 1px solid #d5d8d4; padding: 34px 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 50px; }
.footer-grid strong { font-family: "Montserrat", sans-serif; }
.footer-grid p { margin: 7px 0 0; color: #565d63; font-size: 15px; }
noscript { display: block; padding: 20px; text-align: center; background: #fff1c8; }

@media (max-width: 820px) {
  .hero { padding: 45px 0; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .statewide-card { max-width: 470px; }
  .race-pair { grid-template-columns: 1fr; gap: 38px; margin-bottom: 46px; }
  .race-pair .group-title { font-size: 25px; }
  .race-grid { grid-template-columns: 1fr; }
  .status-inner { padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .status-inner p { order: 3; flex-basis: 100%; }
  .refresh-button { margin-left: auto; }
}

@media (max-width: 520px) {
  .wrap { width: min(100% - 24px, 1180px); }
  .site-header { border-bottom-width: 3px; }
  .header-inner { min-height: 68px; }
  .header-inner { gap: 10px; }
  .brand-logo { width: 145px; }
  .election-center-link { font-size: 12.5px; padding: 7px 8px; }
  .hero { padding: 38px 0; }
  .dek { font-size: 18px; }
  .race-group { margin-bottom: 38px; }
  .group-title { font-size: 25px; }
  .card-head { padding: 17px 16px 14px; }
  .card-head h3 { font-size: 21px; }
  .candidate-list { padding-left: 16px; padding-right: 16px; }
  .candidate { grid-template-columns: 51px minmax(0, 1fr) auto; gap: 10px; }
  .portrait { width: 46px; height: 46px; }
  .candidate-share { min-width: 54px; font-size: 18px; }
  .card-foot { padding-left: 16px; padding-right: 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
