:root {
  --bg: #f6f4ef; --ink: #1d1f24; --muted: #5d6270; --line: #dcd8cf; --card: #ffffff;
  --d: #2160b8; --d2: #8fb3e6; --r: #c23a2f; --r2: #ec9f97; --i: #7a5bb5; --mid: #ece9e2;
  --accent: #0f7b6c; --warn: #a15c00;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 700; margin: 0; }
button { font: inherit; cursor: pointer; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand h1 { font-size: 30px; letter-spacing: -0.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.tally { min-width: 320px; flex: 1; max-width: 560px; }
.tally .bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: var(--mid); position: relative; }
.tally .bar span { display: block; height: 100%; }
.tally .bar .mid { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.tally .nums { display: flex; justify-content: space-between; font-size: 13px; margin-top: 4px; color: var(--muted); }
.tally .nums b { color: var(--ink); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: calc(100vh - 78px); min-height: 560px; }
.mapwrap { position: relative; }
#map { position: absolute; inset: 0; }
.mapbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; pointer-events: none; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px; pointer-events: auto; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.zoomhint { background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted); }
.legend { position: absolute; left: 12px; bottom: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.08); max-width: 300px; }
.legend .ramp { display: flex; height: 10px; border-radius: 3px; overflow: hidden; margin: 6px 0 3px; }
.legend .ramp span { flex: 1; }
.legend .ends { display: flex; justify-content: space-between; color: var(--muted); }
.scan { position: absolute; right: 12px; bottom: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 12px; max-width: 280px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.scan b { color: var(--accent); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 7px 9px; border-radius: 6px; max-width: 260px; z-index: 5; line-height: 1.4; }
.tip .k { color: #b9bdc8; }

.panel { border-left: 1px solid var(--line); overflow-y: auto; background: var(--bg); }
#panel-body { padding: 16px 18px 40px; }
.panel h2 { font-size: 22px; }
.sub { color: var(--muted); font-size: 13px; margin: 2px 0 12px; }
.lock { font-size: 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 6px 8px; margin: 8px 0 14px; }
.howlink { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; font-size: 13px; text-decoration: underline; }

.races { display: flex; flex-direction: column; gap: 6px; }
.race { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; text-align: left; width: 100%; }
.race:hover { border-color: var(--ink); }
.race .po { font-weight: 700; font-size: 13px; }
.race .who { font-size: 13px; line-height: 1.25; }
.race .who small { color: var(--muted); display: block; }
.race .call { font-weight: 700; font-size: 13px; text-align: right; }
.flag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 10px; background: #fff2dc; color: var(--warn); margin-left: 4px; }
.D { color: var(--d); } .R { color: var(--r); } .I { color: var(--i); }
.grouphead { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.card h3 { font-size: 15px; margin-bottom: 6px; }
.verdict .head { font-family: Fraunces, Georgia, serif; font-size: 20px; font-weight: 700; }
.verdict p { margin: 6px 0 0; font-size: 14px; line-height: 1.45; }
.verdict .by { font-size: 11px; color: var(--muted); margin-top: 8px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.meter { position: relative; height: 26px; background: var(--mid); border-radius: 4px; margin: 8px 0 2px; }
.meter .z { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--ink); opacity: .5; }
.meter .pt { position: absolute; top: 3px; width: 12px; height: 20px; margin-left: -6px; border-radius: 3px; }
.meter .pt.poll { background: var(--ink); }
.meter .pt.base { background: transparent; border: 2px solid var(--muted); }
.meter .pt.fin { background: var(--accent); }
.meter-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.keys { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 6px; }
.keys i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.counties { width: 100%; border-collapse: collapse; font-size: 13px; }
.counties td, .counties th { padding: 4px 6px 4px 0; border-top: 1px solid var(--line); text-align: left; }
.counties th { font-weight: 500; color: var(--muted); font-size: 12px; border-top: 0; }
.counties button { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-align: left; }
.polls { width: 100%; border-collapse: collapse; font-size: 12px; }
.polls th { text-align: left; color: var(--muted); font-weight: 500; }
.polls td, .polls th { padding: 3px 4px 3px 0; border-top: 1px solid var(--line); }
.back { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.45; }

dialog { max-width: 680px; width: calc(100% - 32px); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(20,20,25,.45); }
dialog .x { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 26px; color: var(--muted); }
dialog h2 { font-size: 24px; margin-bottom: 8px; }
dialog h3 { font-size: 16px; margin: 16px 0 4px; }
dialog p, dialog li { font-size: 14px; line-height: 1.5; }
dialog table { border-collapse: collapse; font-size: 13px; width: 100%; }
dialog td, dialog th { border-top: 1px solid var(--line); padding: 4px 6px 4px 0; text-align: left; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .mapwrap { height: 62vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .tally { min-width: 0; width: 100%; max-width: none; }
  .zoomhint { display: none; }
}

/* office switch + header buttons */
.office { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.office button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.office button[aria-checked="true"] { background: var(--accent); color: #fff; }
.topbtns { display: flex; gap: 6px; }
.tbtn { border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; }
.tbtn.ghost { background: transparent; color: var(--ink); }
.cmp { pointer-events: auto; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.cmp[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.lnk { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; font: inherit; text-align: left; }
.polls a { color: var(--accent); }

/* 2026 vs 2024 / polls vs Qloo swipe: always above every map overlay */
#map24 { position: absolute; inset: 0; pointer-events: none; z-index: 1; transition: opacity .5s ease; }
#swipe { position: absolute; top: 0; bottom: 0; width: 28px; margin-left: -14px; z-index: 7; cursor: ew-resize; touch-action: none; transition: opacity .5s ease; }
.story #swipe { z-index: 4; pointer-events: auto; } /* above the scrolling text while the story is open */
#swipe .bar { position: absolute; top: 0; bottom: 0; left: 12px; width: 4px; background: #fff; box-shadow: 0 0 0 1px rgba(29,31,36,.55), 0 0 8px rgba(0,0,0,.25); }
#swipe .grip { position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid var(--ink); background: #fff; color: var(--ink); display: grid; place-items: center; padding: 0; cursor: ew-resize;
  box-shadow: 0 3px 12px rgba(0,0,0,.3); transition: transform .12s; }
#swipe .grip:hover, #swipe.drag .grip { transform: translate(-50%, -50%) scale(1.08); }
#swipe .grip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#swipe .lab { position: absolute; top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 6px; pointer-events: none; transition: opacity .15s; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
#swipe .lab.l { right: calc(50% + 30px); }
#swipe .lab.r { left: calc(50% + 30px); }
#swipe .lab.off { opacity: 0; }
.mapbar, .legend, .scan, .tip { z-index: 4; }

/* welcome */
dialog.welcome { max-width: 640px; }
.welcome .lede { font-size: 16px; }
.welcome ol, .welcome ul { padding-left: 20px; }
.welcome li { margin: 4px 0; }
.wfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; color: var(--muted); }
.wfoot .go { border: 0; background: var(--accent); color: #fff; border-radius: 8px; padding: 9px 18px; font-weight: 600; font-size: 14px; }
@media (max-width: 900px) { .office, .topbtns { order: 3; } }

/* keep the main map controls above the compare map */
#map .maplibregl-ctrl-top-right, #map .maplibregl-ctrl-bottom-right { z-index: 5; }

/* place search */
.search { position: relative; pointer-events: auto; }
.search input { width: 220px; max-width: 60vw; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 13px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.sugg { position: absolute; top: calc(100% + 4px); left: 0; min-width: 260px; margin: 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 6; }
.sugg li { padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.sugg li small { color: var(--muted); }
.sugg li[aria-selected="true"], .sugg li:hover { background: var(--mid); }
.pin { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.4); }

/* phones */
@media (max-width: 640px) {
  .top { padding: 10px 14px; gap: 10px; }
  .brand h1 { font-size: 26px; }
  .brand p { font-size: 13px; }
  .office { order: 2; }
  .topbtns { order: 3; margin-left: auto; }
  .tally { order: 4; flex: 1 1 100%; }
  .tally .nums span:nth-child(2) { display: none; }
  .mapbar { top: 8px; left: 8px; right: 56px; gap: 6px; flex-wrap: nowrap; overflow-x: auto; pointer-events: auto; scrollbar-width: none; padding-bottom: 2px; }
  .mapbar::-webkit-scrollbar { display: none; }
  .mapbar > * { flex: none; }
  .seg button { padding: 5px 9px; font-size: 12px; }
  .cmp { padding: 6px 9px; font-size: 12px; }
  .search input { width: 150px; }
  .legend { max-width: 220px; padding: 6px 8px; bottom: 30px; }
  .legend .note { display: none; }
  .scan { left: 8px; right: 8px; bottom: 30px; max-width: none; }
  #swipe .lab { font-size: 11px; padding: 4px 7px; }
  #swipe .lab.l { right: calc(50% + 27px); } #swipe .lab.r { left: calc(50% + 27px); }
}

/* charts section below the map */
.charts { border-top: 1px solid var(--line); background: var(--bg); padding-block: 32px 48px; }
.charts-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.charts h2 { font-size: 28px; }
.chart { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin: 16px 0; }
.chart h3 { font-size: 17px; margin-bottom: 4px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-pair .chart { margin: 0; }
.plot { width: 100%; overflow-x: auto; }
.plot svg { display: block; font-family: Inter, system-ui, sans-serif; }
.seg.small button { padding: 4px 10px; font-size: 12px; }
.ctip { position: absolute; z-index: 20; }
.wfoot .tourbtn { border: 1px solid var(--accent); background: transparent; color: var(--accent); border-radius: 8px; padding: 9px 16px; font-weight: 600; font-size: 14px; }
@media (max-width: 900px) { .chart-pair { grid-template-columns: 1fr; } }

/* ---------- story mode: newspaper-style scrollytelling over a full-screen map ---------- */
body.story-on { overflow: hidden; }
body.story-on .mapwrap { position: fixed; inset: 0; z-index: 50; height: auto !important; }
body.story-on .mapbar, body.story-on .legend, body.story-on .scan, body.story-on .tip, body.story-on #map .maplibregl-ctrl-top-right { display: none; }

.story { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.story-progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgba(0,0,0,.06); z-index: 3; }
.story-progress i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }
.story-close { position: absolute; top: 16px; right: 18px; z-index: 3; pointer-events: auto; border: 1px solid var(--ink); background: rgba(255,255,255,.92);
  border-radius: 999px; padding: 7px 14px; font: 600 13px Inter, system-ui, sans-serif; color: var(--ink); backdrop-filter: blur(6px); }
.story-close span { margin-left: 4px; font-size: 16px; }
.story-scroll { position: absolute; inset: 0; overflow-y: auto; pointer-events: auto; scroll-behavior: smooth; overscroll-behavior: contain;
  scrollbar-width: none; }
.story-scroll::-webkit-scrollbar { display: none; }
.story-hero { min-height: 100vh; display: flex; align-items: center; padding: 0 clamp(16px, 5vw, 72px);
  background: linear-gradient(90deg, rgba(246,244,239,.97) 0%, rgba(246,244,239,.9) 38%, rgba(246,244,239,0) 70%); }
.story-step { min-height: 100vh; display: flex; align-items: center; padding: 0 clamp(16px, 5vw, 72px); }
.story-step:last-of-type { min-height: 110vh; }
.story-end { min-height: 90vh; display: flex; align-items: center; padding: 0 clamp(16px, 5vw, 72px);
  background: linear-gradient(90deg, rgba(246,244,239,.97) 0%, rgba(246,244,239,.85) 45%, rgba(246,244,239,.3) 100%); }
.story-card { width: min(430px, 100%); background: #fff; border-top: 3px solid var(--ink); padding: 22px 26px 24px; box-shadow: 0 18px 50px rgba(20,22,28,.14);
  font-family: "Source Serif 4", Georgia, serif; color: var(--ink); opacity: .35; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.story-step.on .story-card, .story-card.hero, .story-end .story-card { opacity: 1; transform: none; }
.story-card.hero { width: min(620px, 100%); background: transparent; box-shadow: none; border-top: 0; padding: 0; }
.story .kicker { font: 700 11px/1.2 Inter, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.story h1 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: clamp(34px, 4.6vw, 58px); line-height: 1.04; letter-spacing: -.015em; margin: 0 0 16px; }
.story h2 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 25px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.005em; }
.story p { font-size: 17.5px; line-height: 1.58; margin: 0; }
.story .dek { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.45; color: #3c4049; max-width: 560px; }
.story .byline { font: 13px/1.4 Inter, system-ui, sans-serif; color: var(--muted); margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); max-width: 560px; }
.story .byline b { color: var(--ink); }
.scrollcue { margin-top: 42px; font: 600 11px Inter, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.scrollcue i { width: 1px; height: 34px; background: var(--muted); transform-origin: top; animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }
.pty { font-weight: 600; white-space: nowrap; }
.pty::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; vertical-align: 1px; }
.pty.d::before { background: var(--d); } .pty.r::before { background: var(--r); }
.story-cta { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.story-cta button { font: 600 14px Inter, system-ui, sans-serif; border-radius: 999px; padding: 10px 18px; }
.story-cta .go { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.story-cta .ghost { background: #fff; color: var(--ink); border: 1px solid var(--ink); }
/* map callouts: dot, hairline leader, label (draw in) */
.callout { position: relative; width: 0; height: 0; pointer-events: none; }
.callout .cdot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px #fff;
  animation: pop .35s ease-out both; animation-delay: inherit; }
.callout .cline { position: absolute; left: 0; bottom: 4px; width: 1px; height: 54px; background: var(--ink); transform-origin: bottom; animation: draw .5s .25s ease-out both; }
.callout .clab { position: absolute; bottom: 56px; left: 0; white-space: nowrap; background: #fff; border-left: 3px solid var(--ink); padding: 6px 10px 7px;
  font: 13px/1.3 "Source Serif 4", Georgia, serif; box-shadow: 0 6px 18px rgba(0,0,0,.16); animation: rise .45s .6s ease-out both; }
.callout.left .clab { left: auto; right: 0; border-left: 0; border-right: 3px solid var(--ink); text-align: right; }
.callout .clab b { display: block; font-weight: 600; font-size: 14px; }
.callout .clab span { display: block; color: var(--muted); font-family: Inter, system-ui, sans-serif; font-size: 12px; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .story-hero { align-items: flex-end; padding-bottom: 12vh; background: linear-gradient(0deg, rgba(246,244,239,.98) 0%, rgba(246,244,239,.9) 55%, rgba(246,244,239,0) 85%); }
  .story-step { align-items: flex-end; padding-bottom: 6vh; }
  .story-card { width: 100%; padding: 18px 18px 20px; }
  .story p { font-size: 16px; }
  .story h2 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .story-card { transition: none; } .callout * { animation: none !important; } .scrollcue i { animation: none; } .story-scroll { scroll-behavior: auto; }
}
.callout { transition: opacity .3s ease; } .callout.out { opacity: 0; }

/* ---------- slimmer chrome: brand, one menu, one layers dropdown, slide-in panel ---------- */
.top { padding: 10px 18px; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand h1 { font-size: 26px; }
.powered { font: 500 12px Inter, system-ui, sans-serif; color: var(--muted); letter-spacing: .02em; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; }
.powered b { color: var(--ink); font-weight: 700; }
.layout { grid-template-columns: 1fr; height: calc(100vh - 60px); position: relative; }
.menu, .layers { position: relative; }
.tbtn svg { vertical-align: -3px; margin-right: 4px; }
.pop { position: absolute; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.16); padding: 6px; z-index: 30; min-width: 280px; }
.menu .pop { right: 0; }
.layers .pop { left: 0; }
.pop > button, .vlist button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px 8px 30px; border-radius: 7px; font: 600 13px Inter, system-ui, sans-serif; color: var(--ink); position: relative; }
.pop > button { padding-left: 10px; }
.pop button small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 1px; }
.pop button:hover, .pop button:focus-visible { background: var(--mid); outline: none; }
.vlist button[aria-checked="true"]::before, .vlist button[aria-pressed="true"]::before { content: ""; position: absolute; left: 10px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.vlist button[aria-checked="false"]::before, .vlist button[aria-pressed="false"]::before { content: ""; position: absolute; left: 10px; top: 12px; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--muted); }
.layers-pop .seg, .pop .seg { display: block; background: none; border: 0; box-shadow: none; padding: 0; }
.pop .seg button[aria-checked="true"] { background: none; color: var(--ink); }
.pop .seg button { color: var(--ink); }
.pop-h { font: 700 11px Inter, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.layers-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 7px 11px; font: 600 13px Inter, system-ui, sans-serif; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); pointer-events: auto; }
.layers-btn .chev { opacity: .6; }
.search input { width: 240px; }
/* the race panel slides in over the map and is closed by default */
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 100%); z-index: 9; border-left: 1px solid var(--line); box-shadow: -12px 0 30px rgba(0,0,0,.08);
  transform: translateX(105%); transition: transform .35s cubic-bezier(.2,.7,.2,1); visibility: hidden; }
.panel.open { transform: none; visibility: visible; }
#panel-body { padding: 14px 16px 40px; }
.pclose { position: sticky; top: 8px; float: right; margin: 8px 10px 0 0; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 18px; line-height: 1; color: var(--muted); z-index: 2; }
.panel h2 { font-size: 20px; }
.race { padding: 7px 9px; }
body.story-on .panel { display: none; }
@media (max-width: 900px) {
  .layout { height: auto; }
  .mapwrap { height: 70vh; }
  .panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 72vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
    transform: translateY(105%); box-shadow: 0 -12px 30px rgba(0,0,0,.15); overflow-y: auto; }
  .panel.open { transform: none; }
}
@media (max-width: 640px) {
  .powered { font-size: 11px; padding: 2px 7px; }
  .search input { width: 170px; }
  .menu .pop { right: -4px; min-width: 250px; }
}

/* predictions table */
.preds { border-top: 1px solid var(--line); background: var(--bg); padding-block: 32px 8px; }
.preds h2 { font-size: 28px; }
.ptable-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 14px 0 8px; }
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
.ptable th, .ptable td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
.ptable thead th { border-top: 0; background: #faf9f6; position: sticky; top: 0; }
.ptable thead button { border: 0; background: none; padding: 0; font: 700 11px Inter, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.ptable thead th:nth-child(2) { font: 700 11px Inter, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:hover, .ptable tbody tr:focus-visible { background: #f4f1ea; outline: none; }
.ptable tbody th { font-weight: 600; white-space: nowrap; }
.ptable small { color: var(--muted); font-weight: 400; }
.ptable .vs { color: var(--muted); font-size: 12px; }
.ptable .ours b { font-weight: 700; }
.ptable .pc { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.pbar { display: inline-block; width: 64px; height: 5px; border-radius: 3px; background: var(--mid); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.ptable a { color: var(--accent); }
.muted { color: var(--muted); }
.ptable .ok { color: var(--accent); font-weight: 600; font-size: 13px; }
.ptable .dis { color: var(--warn); font-weight: 600; font-size: 13px; }
.charts { padding-top: 16px; }
.counties .prof { display: block; font-size: 11px; }
.card.culture { border-color: #b9dcd5; background: #f7fbfa; }
.card.culture h3 .by { font: 600 11px Inter, system-ui, sans-serif; color: var(--accent); margin-left: 6px; letter-spacing: .04em; text-transform: uppercase; }
.card.culture .ch { font-family: "Source Serif 4", Georgia, serif; font-size: 16px; font-weight: 600; margin: 2px 0 6px; }
.card.culture p { font-size: 13.5px; line-height: 1.5; margin: 0 0 8px; }
.card.culture .watch { font-size: 13px; border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 5px; }
.card.culture .watch button { background: none; border: 0; padding: 0; font-weight: 700; text-decoration: underline; color: var(--ink); font-size: 13px; }
.ptable { min-width: 980px; }
.callout .clab span.cr { font-family: "Source Serif 4", Georgia, serif; font-style: italic; color: var(--ink); max-width: 260px; white-space: normal; margin-top: 2px; }
.callout.down .cline { bottom: auto; top: 4px; transform-origin: top; }
.callout.down .clab { bottom: auto; top: 58px; }

/* campaign strategist */
.tbtn.strat { background: var(--accent); border-color: var(--accent); }
.sform { display: grid; gap: 8px; margin: 10px 0; }
.sform label { display: grid; gap: 3px; font: 600 12px Inter, system-ui, sans-serif; color: var(--muted); }
.sform select, .sform input { font: 14px Inter, system-ui, sans-serif; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); }
.sform .go, .go.stratlink { border: 0; background: var(--accent); color: #fff; border-radius: 8px; padding: 10px 14px; font: 600 14px Inter, system-ui, sans-serif; }
.go.stratlink { width: 100%; margin: 4px 0 10px; }
.sform .go:disabled { opacity: .5; }
.sex { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sex button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.ssteps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; font-size: 13px; }
.ssteps li { border-left: 3px solid var(--accent); padding: 4px 8px; background: var(--card); border-radius: 0 6px 6px 0; }
.ssteps li b { color: var(--accent); margin-right: 4px; }
.ssteps li small { color: var(--muted); }
.ssteps li.think { border-left-color: var(--line); color: var(--muted); font-style: italic; }
.ssteps li.think::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.card.plan .pk { font: 700 11px Inter, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.card.plan h3 { font-family: "Source Serif 4", Georgia, serif; font-size: 18px; margin: 4px 0 6px; }
.card.plan p { font-size: 13.5px; line-height: 1.5; }
.seg-card { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.seg-card.turnout { border-left-color: var(--d); }
.seg-card .sh { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.seg-card .goal { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-left: auto; margin-right: 8px; }
.seg-card .zl { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.seg-card .zl span { background: var(--mid); border-radius: 5px; padding: 2px 6px; font-size: 12px; }
.seg-card .ch { font-size: 12px; margin-bottom: 4px; } .seg-card .ch .k { color: var(--muted); font-weight: 600; }
.seg-card .msg { font-family: "Source Serif 4", Georgia, serif; font-style: italic; }
.pbtns .go { border: 0; background: var(--ink); color: #fff; border-radius: 8px; padding: 9px 14px; font: 600 13px Inter, system-ui, sans-serif; }
.pbtns { display: flex; flex-wrap: wrap; gap: 8px; }
.pbtns .over { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 9px 14px; font: 600 13px Inter, system-ui, sans-serif; }
@media (max-width: 640px) { .tbtn.strat { order: 3; } }

/* strategist selection menu + coach mark */
.sform2 { display: grid; gap: 8px; margin: 8px 0 4px; }
.sstep { display: flex; align-items: center; gap: 8px; font: 700 13px Inter, system-ui, sans-serif; margin-top: 6px; }
.sstep .n { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; }
.sstep small { font-weight: 400; color: var(--muted); }
.offsw { justify-self: start; }
.rgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rc { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 4px; display: grid; gap: 1px; text-align: center; font-size: 12px; }
.rc b { font-size: 12.5px; } .rc span { font-weight: 700; font-size: 11.5px; }
.rc.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; background: #f3faf8; }
#s-more, #s-note, #s-budget { font: 13px Inter, system-ui, sans-serif; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); }
.cands { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cand { border: 1px solid var(--line); border-top: 4px solid var(--i); background: var(--card); border-radius: 9px; padding: 8px 10px; text-align: left; display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.cand.D { border-top-color: var(--d); } .cand.R { border-top-color: var(--r); }
.cand b { font-size: 14px; color: var(--ink); } .cand small { font-weight: 600; color: var(--ink); }
.cand.on { box-shadow: 0 0 0 2px var(--ink) inset; background: #fbfaf7; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 11px; font: 600 12.5px Inter, system-ui, sans-serif; color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#s-budget { width: 120px; }
.runwrap { position: relative; margin-top: 8px; }
#s-run { width: 100%; border: 0; background: var(--accent); color: #fff; border-radius: 9px; padding: 12px 14px; font: 700 15px Inter, system-ui, sans-serif; }
#s-run.pulse { animation: ring 1.6s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(15,123,108,.55); } 100% { box-shadow: 0 0 0 14px rgba(15,123,108,0); } }
.coach { position: relative; margin-top: 12px; background: var(--ink); color: #fff; border-radius: 9px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.coach::before { content: ""; position: absolute; top: -7px; left: 50%; margin-left: -7px; border: 7px solid transparent; border-top: 0; border-bottom-color: var(--ink); }


/* story: results scorecard slide */
.sc-tally { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 12px; }
.sc-tally th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: 4px 8px 4px 0; }
.sc-tally td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.sc-tally tr.sc-best td { font-weight: 600; }
.sc-tally td:nth-child(2) { white-space: nowrap; }
.sc-label { font-size: 11px !important; line-height: 1.3 !important; font-family: Inter, system-ui, sans-serif; font-weight: 600; color: var(--muted); margin: 0 0 6px !important; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.sc-chips span { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: #efece5; color: var(--ink); }
.sc-chips span.hit { background: var(--ink); color: #fff; }
.sc-note { font-size: 13px !important; line-height: 1.45; color: var(--muted); margin: 0 0 12px !important; }
.sc-note b { color: var(--ink); }
.sc-link { display: inline-block; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: underline; }
.model-stats { margin-top: 20px; }
.ms-wrap { overflow-x: auto; margin: 10px 0; }
.ms-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ms-table th, .ms-table td { padding: 7px 10px; border-top: 1px solid var(--line); text-align: right; font-weight: 400; }
.ms-table thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: 12px; vertical-align: bottom; }
.ms-table th:first-child { text-align: left; }
.ms-table tbody th { color: var(--ink); }
.ms-table td b { font-weight: 700; }
.cmsgs { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.cmsgs:empty { display: none; }
.cmsg { font-size: 13px; line-height: 1.45; padding: 8px 11px; border-radius: 10px; max-width: 92%; overflow-wrap: anywhere; white-space: pre-wrap; }
.cmsg.me { align-self: flex-end; background: var(--ink); color: #fff; }
.cmsg.ai { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.cmsg.wait, .cmsg.step { align-self: flex-start; color: var(--muted); font-size: 12px; padding: 2px 2px; }
.cmsg.err { align-self: flex-start; color: #a12c22; font-size: 12px; padding: 2px 2px; }
.cprop { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.cprop .k { font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.cprop ul { margin: 0 0 6px; padding-left: 18px; }
.cprop li { margin: 2px 0; overflow-wrap: anywhere; }
.cprop .pbtns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.cprop .pbtns .go, .cprop .pbtns .over { width: auto; flex: 0 1 auto; }
.cideas { margin: 8px 0; }
.cform { display: flex; gap: 8px; margin-top: 8px; }
.cform input { flex: 1 1 auto; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; }
.cform .go { width: auto; flex: 0 0 auto; }
/* Campaign Strategist: expand button, and the chat docked to the bottom of the panel */
.pexpand { display: none; position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--card); font-size: 12px; font-weight: 600; color: var(--ink); z-index: 2; }
#panel:has(#sform) .pexpand { display: block; }
.panel { transition: transform .3s ease, width .25s ease; }
#panel.expanded:has(#sform) { width: min(760px, 62vw); }
#schat:not(:empty) { position: sticky; bottom: 0; z-index: 3; margin: 14px -16px -40px; }
.chatbox { margin: 0; border-width: 1px 0 0; border-radius: 0; padding: 10px 16px 12px; box-shadow: 0 -8px 20px rgba(0,0,0,.07); }
.chead h3 { margin: 0 0 1px; font-size: 14px; }
.chead .note { margin: 0; font-size: 12px; }
.cmsgs { max-height: min(40vh, 380px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.cideas { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.cideas .chip { flex: 0 0 auto; white-space: nowrap; }
.cform { margin-top: 6px; }
@media (max-width: 900px) {
  #panel.expanded:has(#sform) { width: 100%; height: 94vh; }
  .panel { transition: transform .3s ease, height .25s ease; }
  .cmsgs { max-height: 30vh; }
}
.cideas[hidden] { display: none; }
.cform .go { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 0 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.cform .go:disabled { opacity: .55; cursor: default; }
/* a solid bar behind the Expand and close buttons, so they never sit on top of the plan */
#panel:has(#sform)::before { content: ""; display: block; position: sticky; top: 0; height: 46px; margin-bottom: -46px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 1; }
#panel:has(#sform) #panel-body { padding-top: 54px; }
.lens-top { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin: 10px 0; background: var(--bg); }
.lens-top .k { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.lens-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lens-row span { flex: 1 1 70px; }
.lens-row small { display: block; color: var(--muted); font-size: 11px; }
.lens-row b { font-size: 15px; font-variant-numeric: tabular-nums; }
.lens-top .note { margin: 7px 0 0; font-size: 11.5px; }
.lens { margin: 5px 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.lens span { display: block; }
.lens b { color: var(--ink); font-weight: 600; }
.lens em { font-style: normal; color: var(--accent); font-weight: 600; }
