:root {
  --page: #f6f7fb; --card: #ffffff; --ink: #172033; --ink-2: #475467; --muted: #6b7489; --line: #e6e9f0; --soft: #f3f5f9;
  --accent: #2a78d6; --accent-ink: #1b5aa8; --accent-soft: #eaf2fd;
  --good: #188a4a; --good-soft: #e8f6ee; --warn: #9a5b00; --warn-soft: #fff5e3; --bad: #b42318; --bad-soft: #fdeceb;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
a { color: var(--accent-ink); text-decoration: none; } a:hover { text-decoration: underline; }

/* ------------------------------------------------------------ top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand b { display: block; font-size: 16px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
#tabs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
#tabs .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
#tabs button { border: 0; background: none; padding: 7px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 500; }
#tabs button:hover { background: var(--soft); color: var(--ink); }
#tabs button.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

main { padding: 20px 24px 40px; max-width: 1560px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ cards and forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.sub { color: var(--muted); font-size: 13px; margin: 2px 0 12px; }
.intro h2 { font-size: 20px; } .intro p { color: var(--ink-2); margin: 4px 0 0; }
.intro.page { margin-bottom: 14px; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 12px; }
label .opt { color: var(--muted); font-weight: 400; }
select, input[type=number], input[type=search], .picker input, .askbar input {
  width: 100%; margin-top: 5px; padding: 8px 11px; border: 1px solid #d5dae4; border-radius: 10px; font: inherit; font-size: 14px;
  color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
select { appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%236b7489' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center; }
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42, 120, 214, .15); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); font-weight: 400; }
label.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
button { font: inherit; font-weight: 500; cursor: pointer; padding: 8px 14px; border-radius: 10px; border: 1px solid #d5dae4;
  background: #fff; color: var(--ink); transition: background .15s, border-color .15s; white-space: nowrap; }
button:hover { background: var(--soft); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-ink); }
button.ghost { background: transparent; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.btns button { flex: 1; font-size: 13px; padding: 7px 10px; }
.note { font-size: 12.5px; color: var(--muted); margin: 0; }
.row { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.row label { min-width: 170px; margin-bottom: 0; }
.row label.grow { flex: 1; min-width: 240px; }
.row label.check { padding-bottom: 9px; }
.row + .row { margin-top: 14px; }
.toolbar { margin-bottom: 18px; }
.toolbar .intro { margin-bottom: 16px; }

/* typeahead */
.picker { position: relative; }
.picker ul { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 340px; overflow: auto; margin: 0;
  padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); }
.picker li { padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); font-size: 13.5px; }
.picker li small { display: block; color: var(--muted); font-size: 11.5px; }
.picker li:hover, .picker li[aria-selected="true"] { background: var(--accent-soft); }
.picker li.picker-message { color: var(--muted); cursor: default; }

/* ------------------------------------------------------------ map views */
#view-map.active, #view-neighborhoods.active, #view-leaders.active { display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.controls { position: sticky; top: 76px; }
.mapwrap h2 { font-size: 18px; line-height: 1.35; margin-bottom: 6px; }
#map, #n-map, #l-map, #c-map { width: 100%; height: auto; display: block; }
.compare-map { margin-top: 18px; }
#map path { stroke: #fff; stroke-width: .5; cursor: pointer; transition: opacity .15s; }
#map path.nodata { fill: url(#nodata-hatch); }
#n-map path.tract.nodata { fill: #aeb9c6; }
#map path:hover { stroke: var(--ink); stroke-width: 1.2; }
#map path.selected { stroke: var(--ink); stroke-width: 2; }
#map .states-outline { fill: none; stroke: #fff; stroke-width: 1.2; pointer-events: none; }
#n-map path.tract { stroke: #fff; stroke-width: .25; cursor: crosshair; }
#n-map path.tract.faded { opacity: .35; }
#n-map path.tract:hover { stroke: var(--ink); stroke-width: 1; }
#n-map path.nb-close { stroke: none; pointer-events: none; }
#n-map path.county-line { fill: none; stroke: #7a8396; stroke-width: .8; pointer-events: none; }
#view-evolution.active { display: grid; gap: 18px; }
.evolution-controls .row { align-items: end; }
.evolution-controls .row label { min-width: 0; }
.evolution-controls input[type=range] { width: 100%; }
.evolution-controls button:disabled { opacity: .45; cursor: not-allowed; }
.evolution-figure { min-width: 0; overflow: hidden; }
#e-map svg { display: block; width: 100%; height: auto; }
#e-map path { cursor: pointer; }
#e-mobile-list { display: none; }
@media (max-width: 600px) {
  .evolution-controls .row label { flex: 1 1 100%; }
  #e-mobile-list { display: block; }
  #e-mobile-list h3 { margin: 14px 0 8px; }
  .evolution-mobile-scale { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
  .evolution-mobile-scale i { width: 90px; height: 10px; background: linear-gradient(90deg,#f7fbff,#08306b); border-radius: 2px; }
  .evolution-mobile-scale i.missing { width: 12px; height: 12px; background: #e7ebf1; border: 1px solid #c7ced7; }
  .evolution-mobile-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .evolution-mobile-row strong { color: #286fc2; text-align: right; }
  .evolution-mobile-row small { display: block; color: var(--muted); font-weight: 400; }
}
.legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend svg { display: block; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.legend .key { max-width: 100%; }
.legend .key i { flex: none; }
.key i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #dfe3ea; display: inline-block; }
.key i.hatch { background: repeating-linear-gradient(45deg, #fff 0 3px, #c9ced8 3px 4.5px); }
.source { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.panel { max-height: calc(100vh - 100px); overflow: auto; position: sticky; top: 76px; }
.panel .empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.panel .empty b { color: var(--ink); font-size: 15px; }
.panel h3 { font-size: 18px; margin-bottom: 2px; }
.panel h4 { margin: 18px 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.match-head { padding: 4px 0 14px; border-bottom: 1px solid var(--line); }
.match-kicker { display: block; margin-bottom: 5px; color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.match-head h3 { font-size: 20px; line-height: 1.25; }
.match-head p { margin: 6px 0 0; color: var(--ink-2); font-size: 12.5px; }
.match-summary, .match-hint, .match-empty { color: var(--muted); font-size: 12px; line-height: 1.5; }
.match-summary { margin: 12px 0 16px; }
.match-list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.match-list-head span { color: var(--muted); text-align: right; font-size: 11px; }
.match-list { display: grid; gap: 7px; }
.match-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 3px 8px; width: 100%; padding: 11px 12px; text-align: left; white-space: normal; border: 1px solid #e5ebf3; border-radius: 10px; background: #f9fbfe; }
.match-row:hover, .match-row:focus-visible { border-color: #a9c9ee; background: #eef5fd; }
.match-place { overflow-wrap: anywhere; color: var(--ink); font-size: 12.5px; font-weight: 600; }
.match-value { color: var(--accent-ink); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.match-value small { color: #667a92; font-size: 11px; font-weight: 500; }
.match-pop, .match-margin { grid-column: 1 / -1; color: var(--ink-2); font-size: 11.5px; font-weight: 400; }
.match-margin { color: var(--muted); font-size: 11px; }
.match-hint { margin: 12px 0 0; }
.match-back { margin: 0 0 12px; padding: 5px 9px; color: var(--accent-ink); font-size: 12px; }
.match-detail-pop { margin: 12px 0 8px; color: var(--ink); font-size: 12px; font-weight: 600; }
.match-detail-pop small { color: var(--muted); font-weight: 400; }
.stat { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat .n { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .u { color: var(--muted); }
.callout { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.callout .label { font-size: 12px; color: var(--accent-ink); font-weight: 600; }

/* bar list (profile sections, home charts) */
.bars { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 13px; }
.bars .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 6px; position: relative; isolation: isolate; border-radius: 5px; }
.bars .lab i { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 5px; background: var(--accent-soft); z-index: -1; }
.bars .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); padding: 3px 0; white-space: nowrap; }
.bars .val small { color: var(--muted); margin-left: 6px; }

/* idx (neighborhood indices) */
.idx { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 13px; align-items: baseline; }
.idx span small { display: block; color: var(--muted); font-size: 11.5px; }
.idx b { font-variant-numeric: tabular-nums; font-size: 15px; }
.gauge { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--soft); position: relative; margin: -4px 0 4px; }
.gauge i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }

/* ------------------------------------------------------------ tables */
.table-card { padding: 0; overflow: hidden; }
.table-card .head { padding: 16px 20px 12px; }
.table-scroll { overflow: auto; max-height: 72vh; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { position: sticky; top: 0; background: #fafbfd; color: var(--muted); font-weight: 600; font-size: 12px; z-index: 1; }
tbody tr:hover td { background: #f8faff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.rank { color: var(--muted); width: 40px; }
td small, .na { color: #9aa3b5; }
.cellbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); opacity: .8; margin-right: 8px; vertical-align: middle; }
.rank-visual { margin: 16px 0; }
.rank-visual-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rank-visual-head h2 { margin-bottom: 4px; }
.rank-map-wrap { width: 100%; margin: 8px 0 12px; }
.rank-map-wrap svg { display: block; width: 100%; height: auto; }
.rank-map-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 8px 18px; }
.rank-map-item { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 7px 4px; border-bottom: 1px solid #edf1f5; }
.rank-map-item > span { min-width: 0; flex: 1; }
.rank-map-item small { display: block; color: var(--muted); font-size: 11px; }
.rank-map-value { color: #246cc1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-visual-list { display: grid; gap: 15px; margin: 18px 0; }
.rank-visual-row { min-width: 0; }
.rank-visual-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; }
.rank-visual-label > span { min-width: 0; overflow-wrap: anywhere; }
.rank-visual-label strong { color: #246cc1; flex: none; font-size: 17px; font-variant-numeric: tabular-nums; }
.rank-visual-label strong.negative { color: #b43734; }
.rank-number { display: inline-grid; place-items: center; background: #e3eefc; color: #174a8a; border-radius: 50%; width: 26px; height: 26px; margin-right: 3px; font-size: 12px; }
.rank-track { position: relative; height: 10px; margin-top: 7px; border-radius: 8px; background: #eef2f6; }
.rank-fill { position: absolute; height: 100%; border-radius: 8px; background: #2a78d6; }
.rank-fill.negative { background: #e34948; }
.rank-zero { position: absolute; top: -3px; bottom: -3px; border-left: 1px solid #657284; }
.rank-moe { margin-top: 4px; font-size: 12px; color: var(--muted); }
table.origins th[data-k] { cursor: pointer; user-select: none; }
table.origins th[data-k]:hover { color: var(--ink); }
table.origins tr.sub td { background: #f7f9fc; font-weight: 600; }
table.origins td.oname { min-width: 300px; }
button.mini { font-size: 11px; padding: 1px 8px; margin-left: 8px; border-radius: 999px; color: var(--accent-ink); border-color: #cfe0f6;
  background: var(--accent-soft); opacity: 0; transition: opacity .15s; }
tr:hover button.mini { opacity: 1; }
td.more { font-weight: 600; color: var(--accent-ink); }
td.more-no_significant_difference, td.more-not_comparable, td.more-equal { color: var(--muted); font-weight: 400; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 999px;
  background: var(--soft); color: var(--ink-2); max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.chip::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.ok { background: var(--good-soft); color: var(--good); }
.chip.caution { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.plain::before { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }

/* technical details (sources, variables, methods): available, never in the way */
details.tech { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
details.tech summary { cursor: pointer; color: var(--muted); font-weight: 500; list-style: none; }
details.tech summary::before { content: "▸ "; } details.tech[open] summary::before { content: "▾ "; }
details.tech summary:hover { color: var(--ink); }
details.tech > *:not(summary) { margin: 8px 0 0; }
details.tech code { font-size: 11.5px; background: var(--soft); padding: 1px 5px; border-radius: 5px; }
details.tech ul { padding-left: 18px; }

/* messages */
.warn, .info { margin-top: 10px; padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.warn { background: var(--warn-soft); color: #6b4200; }
.info { background: var(--soft); color: var(--ink-2); }
.err { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); }
.hint { color: var(--muted); }

/* ------------------------------------------------------------ home */
.hero { background: linear-gradient(135deg, #1b4f96 0%, #2a78d6 60%, #4b9be8 100%); color: #fff; border-radius: 20px; padding: 40px 44px;
  margin-bottom: 18px; box-shadow: var(--shadow); }
.hero h1 { font-size: 34px; letter-spacing: -.025em; }
.hero p { max-width: 720px; font-size: 16px; opacity: .92; margin: 10px 0 20px; }
.askbar { display: flex; gap: 8px; max-width: 760px; }
.askbar input { margin-top: 0; font-size: 15px; padding: 11px 14px; }
.hero .askbar input { border: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.hero .askbar button { background: #0f2f5c; border-color: #0f2f5c; padding: 0 22px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tile .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12.5px; color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 26px; }
.hbar { cursor: pointer; }
.hbar rect.bar { fill: var(--accent); }
.hbar:hover rect.bar { fill: var(--accent-ink); }
.hbar text { font-size: 12.5px; fill: var(--ink); }
.hbar text.v { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.section-title { font-size: 18px; margin: 0 0 12px; }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tool { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow); white-space: normal; }
.tool:hover { border-color: #bcd3f2; background: #fbfdff; }
.tool .ic { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; }
.tool .ic svg { width: 20px; height: 20px; stroke: var(--accent-ink); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool b { display: block; font-size: 15px; }
.tool span { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.foot { color: var(--muted); font-size: 12.5px; margin-top: 24px; }

/* ------------------------------------------------------------ compare */
.sentence h2 { margin-bottom: 14px; }
.compare-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.compare-input { border: 1px solid var(--line); background: #f8faff; border-radius: 12px; padding: 15px; min-width: 0; }
.compare-input.compare-b { background: #fff9f5; }
.compare-input h3 { margin-bottom: 10px; }
.compare-input h3 span { display: inline-grid; place-items: center; color: #fff; background: #2a78d6; border-radius: 7px; width: 25px; height: 25px; margin-right: 5px; }
.compare-input.compare-b h3 span { background: #eb6834; }
.compare-extra .extra-row { display: flex; align-items: start; gap: 6px; margin: 7px 0; min-width: 0; }
.compare-extra .picker { flex: 1; min-width: 0; }
.compare-extra .remove-extra { flex: none; padding: 8px 10px; }
.compare-add { margin: 3px 0 12px; font-size: 13px; }
.compare-input label:last-child { margin-bottom: 0; }
.duel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.duel-side { border: 1px solid var(--line); border-top: 4px solid #2a78d6; border-radius: 12px; padding: 16px; min-width: 0; }
.duel-side.b { border-top-color: #eb6834; }
.duel-side .duel-label { color: var(--ink-2); font-size: 14px; }
.duel-side .duel-number { font-size: clamp(25px, 3vw, 36px); font-weight: 700; overflow-wrap: anywhere; }
.duel-side .duel-track { background: var(--soft); height: 9px; border-radius: 8px; margin: 10px 0 8px; }
.duel-side .duel-track i { display: block; height: 100%; border-radius: inherit; background: #2a78d6; }
.duel-side.b .duel-track i { background: #eb6834; }
.duel-verdict { margin: 12px 0 0; font-size: 15px; }
.compare-split { margin: 14px 0 8px; }
.compare-split-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 700; color: #2a78d6; }
.compare-split-label span:last-child { color: #c34e21; text-align: right; }
.compare-split-bar { display: flex; height: 32px; overflow: hidden; border-radius: 5px; margin: 5px 0; }
.compare-split-bar i { display: flex; align-items: center; justify-content: center; overflow: hidden; background: #2a78d6; color: white; font-size: 13px; font-style: normal; font-weight: 700; white-space: nowrap; }
.compare-split-bar i:last-child { background: #eb6834; }
.sentence .sent { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.sentence .sent label { margin-bottom: 0; min-width: 220px; }
.sentence .sent label.grow { flex: 1; min-width: 240px; }
.sentence .w { font-size: 18px; font-weight: 600; padding-bottom: 8px; color: var(--ink); }
.sentence .actions { align-items: center; margin-top: 4px; }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; }
.seg label { margin: 0; min-width: 0 !important; }
.seg input { display: none; }
.seg span { display: inline-block; padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); font-weight: 600; }
.sentence button:disabled, .sentence .seg input:disabled + span { opacity: .45; cursor: not-allowed; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.examples button, #c-examples button { font-size: 12.5px; font-weight: 400; background: var(--soft); border: 0; padding: 5px 11px; border-radius: 999px; color: var(--ink-2); max-width: 100%; white-space: normal; text-align: left; }
#c-examples button { max-width: 100%; white-space: normal; text-align: left; }
.examples button:hover, #c-examples button:hover { background: var(--accent-soft); color: var(--accent-ink); }
#c-examples { display: contents; }
.ex-label { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.result { margin-top: 18px; }
.answer { font-size: 18px; line-height: 1.5; padding: 16px 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid var(--accent); box-shadow: var(--shadow); margin: 14px 0; }
.answer b { color: var(--accent-ink); }
.answer.no b { color: var(--ink); }
.cmp-out { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.side .who { font-size: 13px; color: var(--muted); }
.side h3 { font-size: 16px; margin: 2px 0 10px; }
.side .big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.side .facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin-top: 10px; color: var(--ink-2); }
.side .facts b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.side .tag-a, .side .tag-b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.figure { margin-top: 16px; }
.figure svg { width: 100%; height: auto; max-width: 820px; }

/* origins */
.summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; }
.summary .pill { background: var(--soft); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.summary .pill b { font-size: 16px; display: block; }

/* insights */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filters button { border-radius: 999px; font-size: 13px; padding: 6px 12px; }
.filters button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.findings { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 14px; }
.finding { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.finding .k { font-size: 11.5px; text-transform: uppercase; color: var(--accent-ink); letter-spacing: .06em; font-weight: 600; }
.finding p { font-size: 15px; margin: 6px 0 4px; line-height: 1.45; }

/* about the data */
.about { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin: 14px 0 22px; }
.src { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.src b { display: block; font-size: 14px; margin-bottom: 4px; }
.src p { color: var(--ink-2); font-size: 12.5px; margin: 6px 0 0; }
.checks { display: flex; gap: 14px; align-items: center; margin: 10px 0; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.downloads a { background: var(--soft); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ink-2); }

/* charts in panels */
svg.ts { width: 100%; height: auto; overflow: visible; }
svg.ts .tick text { fill: var(--muted); font-size: 10px; }
svg.ts .domain { stroke: var(--line); }
svg.ts .grid { stroke: #eef0f4; }
svg.ts .ts-label { font-size: 10px; fill: var(--ink); }
.ts-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); }
.ts-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

#tooltip { position: fixed; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px;
  font-size: 12.5px; line-height: 1.45; box-shadow: 0 10px 28px rgba(16, 24, 40, .16); z-index: 60; max-width: 300px; }
#tooltip b { font-size: 13px; }
.nb-pop { min-width: 230px; max-width: min(360px, calc(100vw - 42px)); }
.nb-pop-title { display: block; color: #17233b; padding: 3px 2px 8px; }
.nb-pop-list { display: grid; gap: 3px; }
.nb-pop-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; background: #f5f7fb; }
.nb-pop-row span { overflow-wrap: anywhere; }
.nb-pop-row b { font-variant-numeric: tabular-nums; }
.nb-pop-color { width: 11px; height: 11px; border-radius: 3px; }

@media (max-width: 1200px) {
  #view-map.active, #view-neighborhoods.active, #view-leaders.active { grid-template-columns: minmax(0, 1fr); }
  .controls, .panel { position: static; max-height: none; min-width: 0; }
  .tiles { grid-template-columns: repeat(2, 1fr); } .grid2, .tools, .cmp-out { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 14px 16px 30px; } .topbar { padding: 10px 16px; } .hero { padding: 26px 22px; } .hero h1 { font-size: 26px; }
  .tiles { grid-template-columns: 1fr; } .askbar { flex-direction: column; }
  .compare-inputs, .duel { grid-template-columns: 1fr; }
  #tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  #tabs button { flex: none; min-height: 44px; }
  #tabs .sep { flex: none; }
}

#f-map { display: block; width: 100%; height: auto; }
#f-map path { stroke: white; stroke-width: 1; cursor: pointer; }
#f-map path:hover, #f-map path:focus { stroke: #172033; stroke-width: 2; outline: none; }
.fertility-card .btns { margin-top: 14px; }
.fertility-card #f-table { max-height: 460px; overflow: auto; }
.fertility-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fertility-card th, .fertility-card td { padding: 7px; border-bottom: 1px solid var(--line); text-align: left; }

/* ------------------------------------------------------------ largest-group (categorical) maps */
.mapwrap .sub { color: var(--muted); font-size: 13px; margin: -2px 0 8px; }
#l-map path.area { stroke: #fff; stroke-width: .5; cursor: pointer; transition: opacity .15s; }
#l-map path.area.tract { stroke-width: .2; }
#l-map path.area.nodata { fill: url(#nodata-hatch); }
#l-map path.area:hover { stroke: var(--ink); stroke-width: 1.2; }
#l-map path.area.selected { stroke: var(--ink); stroke-width: 2; }
#l-map path.close { fill: url(#close-stripes); pointer-events: none; }
#l-map .outline { fill: none; stroke: #fff; stroke-width: 1.3; pointer-events: none; }
#l-map .outline.dark { stroke: #7a8396; stroke-width: .8; }
#l-map.focus path.area:not(.on), #l-map.focus path.close:not(.on) { opacity: .12; }
.catlegend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.catlegend button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 4px 11px 4px 7px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer;
  max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.catlegend button:hover, .catlegend button.on { border-color: var(--ink-2); background: var(--soft); }
.catlegend button small { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; white-space: nowrap; }
.catlegend i, .lead-list i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.catlegend .keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; width: 100%; font-size: 12px; color: var(--muted); margin-top: 4px; }
.catlegend .keys .ramp { display: inline-flex; gap: 2px; align-items: center; }
.catlegend .keys .ramp i { width: 18px; border-radius: 2px; }
.catlegend .keys i.stripes { background: repeating-linear-gradient(45deg, #8a93a6 0 2.5px, #fff 2.5px 5px); }
.catlegend .keys i.none { background: #f4f6fa; border: 1px solid #dfe3ea; }
.catlegend .keys i.hatch { background: repeating-linear-gradient(45deg, #fff 0 3px, #c9ced8 3px 4.5px); border: 1px solid #dfe3ea; }
.lead-list { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; font-size: 13px; align-items: center; }
.lead-list .lab { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lead-list .lab span { display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-list .bar { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.lead-list .bar b { display: block; height: 100%; border-radius: 3px; }
.lead-list .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.lead-list .val small { display: block; color: var(--muted); font-size: 11px; }
.lead-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.lead-head i { width: 16px; height: 16px; border-radius: 4px; }
.lead-head b { font-size: 20px; }
.panel .btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.feature { margin-bottom: 26px; }
.feature-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
#h-map { width: 100%; max-width: 980px; height: auto; display: block; margin: 6px auto 0; }
#h-map path { stroke: #fff; stroke-width: .4; }
#h-map .outline { fill: none; stroke: #fff; stroke-width: 1.2; }
#h-map-legend { justify-content: center; }
#h-map-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); margin: 0 6px; }
#h-map-legend span i { width: 12px; height: 12px; border-radius: 3px; }
.tools { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .tools { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .tools { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ zoom, filters, signature */
.ctl-sub { margin: 16px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600;
  border-top: 1px solid var(--line); padding-top: 12px; }
.mapbox { position: relative; }
.mapbox svg { touch-action: none; }
.mapbox svg.zoomed { cursor: grab; }
.neighborhood-zoom-preview { position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.neighborhood-zoom-preview canvas { display:block; width:100%; height:100%; transform-origin:0 0; will-change:transform; }
.voting-view.active { display:grid; gap:18px; }
.voting-card, .voting-intro { min-width:0; }
.voting-turnout { display:grid; gap:12px; margin:18px 0; }
.voting-turnout-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; align-items:center; }
.voting-turnout-row strong { font-variant-numeric:tabular-nums; color:var(--accent-ink); }
.voting-turnout-track { grid-column:1 / -1; height:9px; border-radius:8px; background:#e9eef5; overflow:hidden; }
.voting-turnout-track i { display:block; height:100%; background:#2a78d6; border-radius:8px; }
.voting-choice { display:grid; gap:17px; margin:18px 0; }
.voting-choice-group { display:grid; gap:6px; min-width:0; }
.voting-choice-group > strong { color:var(--ink); }
.voting-choice-bar { display:grid; grid-template-columns:58px minmax(0,1fr) auto; gap:8px; align-items:center; font-size:13px; }
.voting-choice-bar .track { height:10px; background:#e9eef5; border-radius:8px; overflow:hidden; }
.voting-choice-bar .track i { display:block; height:100%; background:#2a78d6; border-radius:8px; }
.voting-choice-bar.trump .track i { background:#c63b43; }
.voting-choice-bar b { white-space:nowrap; font-variant-numeric:tabular-nums; }
#v-scatter, #s-map { display:block; width:100%; height:auto; max-height:680px; }
#v-table { overflow-x:auto; }
#v-table table { width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
#v-table th, #v-table td { text-align:left; padding:7px 10px; border-bottom:1px solid var(--line); }
#map path, #l-map path, #n-map path { vector-effect: non-scaling-stroke; }
#n-map path.tract.selected { stroke: #172033; stroke-width: 2.5; }
#n-address-matches button { display: block; width: 100%; margin: 6px 0; text-align: left; white-space: normal; }
.zoombar { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.zoombar button { width: 34px; height: 32px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink);
  font: 600 17px/1 Inter, system-ui, sans-serif; cursor: pointer; padding: 0; }
.zoombar button:last-child { border-bottom: 0; font-size: 14px; }
.zoombar button:hover { background: var(--soft); }
.zoomhint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(23, 32, 51, .82); color: #fff;
  font-size: 12.5px; padding: 6px 12px; border-radius: 999px; pointer-events: none; opacity: 0; transition: opacity .2s; }
.zoomhint.show { opacity: 1; }
.mapsig { position: absolute; right: 10px; bottom: 6px; font-size: 11.5px; font-weight: 700; color: #007e8d; opacity: .75; pointer-events: none; }
.key i.filtered { background: #e9ecf2; }
.sig { font-style: normal; font-weight: 600; color: #007e8d; }
.site-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; max-width: 1560px; margin: 0 auto; padding: 18px 24px 28px;
  font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.site-foot .sig-foot { font-weight: 700; color: #007e8d; }

/* ---------------------------------------------------------------- hot takes */
#tabs button.hot { color: #b54708; }
#tabs button.hot.active { color: #b54708; background: #fff1e6; }
.takes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 540px), 1fr)); gap: 16px; align-items: start; }
.take { display: flex; flex-direction: column; gap: 10px; }
.take-k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: #b54708; }
.take h3, .hot-teaser h2 { font-size: 20px; line-height: 1.25; letter-spacing: -.01em; margin: 0; }
.take .lede, .hot-teaser .lede { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); margin: 0; }
.take-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.take-stats > div { background: var(--soft); border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; }
.take-stats b { font-size: 21px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.take-stats small { font-size: 11px; color: var(--muted); }
.take-stats span { font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.take-stats em { font-size: 11.5px; color: var(--muted); font-style: normal; margin-top: 2px; }
.take-chart h4 { font-size: 13px; margin: 4px 0 4px; }
.take-chart svg { width: 100%; height: auto; display: block; }
.take-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.take-leg span { display: inline-flex; align-items: center; gap: 6px; }
.take-leg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.take-leg .whisk { color: var(--muted); }
.take-catch { background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; }
.take-catch b { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--warn); }
.take-catch p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.take .source { margin: 0; }
.take .btn-row, .hot-teaser .btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.hot-teaser { margin: 18px 0 4px; display: flex; flex-direction: column; gap: 10px; border-left: 4px solid #e8590c; }
.share-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.share-row small { color: var(--muted, #5b6578); }
.compare-preview { margin-top: .75rem; padding: .7rem .85rem; border-radius: .6rem; background: #f5f8fc; color: #344054; }
.compare-preview:empty { display: none; }
.compare-preview strong { display: block; font-size: 1.35rem; line-height: 1.25; color: #1f5fae; }
.compare-b .compare-preview strong { color: #b94720; }
.compare-preview small { display: block; color: #526079; }
.nv-mobile { display: none; }
@media (max-width: 600px) {
  #nv-chart { display: none; }
  .nv-mobile { display: grid; gap: 12px; margin: 18px 0; }
  .nv-row-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14px; }
  .nv-row-label strong { color: #2165bd; white-space: nowrap; }
  .nv-track { height: 8px; background: #edf1f6; border-radius: 5px; margin-top: 5px; }
  .nv-bar { height: 100%; background: #2a78d6; border-radius: 5px; }
}

@media (max-width: 600px) { #bc-chart { display: none; } }

/* Consistent release controls: allow labels to wrap and keep touch targets usable. */
.mobile-section,.home-mobile-bars { display:none; }
.brand .brand-logo { width:180px; height:60px; object-fit:contain; flex:none; }
.brand small { line-height:1.45; }
.controls button,.toolbar button,.sentence button,.btns button { white-space:normal; line-height:1.3; min-height:40px; max-width:100%; }
.btns { gap:8px; }
.btns button { flex:1 1 120px; }
.tract-actions { display:grid; gap:8px; margin:8px 0; }
.tract-actions > button { width:100%; }
.tech summary { cursor:pointer; padding:8px 0; }
.tech p { line-height:1.55; }
.row > label,.compare-input { min-width:0; }
button:focus-visible,select:focus-visible,input:focus-visible,summary:focus-visible { outline:3px solid #0796a9; outline-offset:2px; }
@media (max-width:600px) {
  #tabs { display:none; }
  .topbar { gap:8px; }
  .mobile-section { display:flex; align-items:center; gap:12px; width:100%; margin:0; padding:0; color:var(--muted); font-size:13px; }
  .mobile-section select { flex:1; min-height:44px; }
  #h-top > svg,#h-regions > svg { display:none; }
  .home-mobile-bars { display:grid; gap:6px; }
  .home-mobile-bars button { position:relative; display:grid; grid-template-columns:1fr auto; gap:8px; border:0; border-radius:0; background:none; padding:10px 0 16px; text-align:left; font-size:14px; font-weight:500; }
  .home-mobile-bars button strong { color:#2368bc; font-variant-numeric:tabular-nums; }
  .home-mobile-bars button i { position:absolute; height:5px; bottom:4px; left:0; background:#2a78d6; border-radius:3px; }
  .brand { gap:8px; }
  .brand .brand-logo { width:150px; height:50px; }
  .brand small { font-size:11px; }
  .view button,.view select,.view input:not([type=checkbox]):not([type=radio]):not([type=range]) { min-height:44px; }
  .controls,.toolbar,.sentence { padding:16px; }
  .row > label { flex:1 1 100%; }
  .examples button { text-align:left; }
}
