:root {
  --navy: #14213d;
  --navy2: #1f3158;
  --D: #2166ac;
  --R: #c0392b;
  --I: #8e44ad;
  --O: #0f7d67;
  --V: #9e9e9e;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e3e6ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --gold: #f5b700;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, select, input { font: inherit; }

/* header */
.top {
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: .3px; white-space: nowrap; }
.logo { display: inline-flex; gap: 2px; }
.logo i { width: 10px; height: 18px; display: block; border-radius: 2px; }
.logo .d { background: var(--D); } .logo .r { background: var(--R); }
.asof { color: #b8c2d9; font-size: 12px; }
.controls { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.controls select {
  background: #fff; color: var(--ink); border: 0; border-radius: 6px;
  padding: 6px 10px; font-weight: 600; min-width: 170px; cursor: pointer;
}
.flipsToggle { font-size: 13px; color: #dfe5f2; display: flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }

/* summary bar */
.summary {
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; gap: 14px; padding: 10px 16px; flex-wrap: wrap; align-items: stretch;
}
.sumBlock { flex: 1 1 200px; min-width: 180px; }
.sumHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sumHead .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }
.sumHead .chg { font-size: 12px; font-weight: 700; white-space: nowrap; }
.sumNums { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.sumNums .n { margin-right: 8px; }
.sumNums .sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #eee; margin-top: 4px; position: relative; }
.bar span { display: block; height: 100%; }
.bar .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: #111; opacity: .5; }
.sumNote { flex: 1 1 100%; font-size: 12px; color: var(--muted); }

/* layout */
.main { display: flex; align-items: flex-start; gap: 0; }
.mapWrap { position: relative; flex: 1 1 auto; min-width: 0; background: #fff; }
#map { width: 100%; height: auto; display: block; max-height: calc(100vh - 130px); }
.panel {
  flex: 0 0 380px; max-width: 380px; background: var(--card); border-left: 1px solid var(--line);
  max-height: calc(100vh - 120px); overflow-y: auto; padding: 14px 16px 24px;
}
.panel:empty { display: none; }

.back {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  background: var(--navy); color: #fff; border: 0; border-radius: 6px; padding: 7px 12px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.back:hover { background: var(--navy2); }
.crumb { position: absolute; top: 14px; right: 14px; z-index: 2; font-weight: 700; color: var(--muted); font-size: 13px; }

/* map */
#map path { vector-effect: non-scaling-stroke; }
.state { stroke: #fff; stroke-width: 0.9; cursor: pointer; transition: fill-opacity .2s; }
.state:hover { stroke: #111; stroke-width: 1.6; }
.state.faded { fill-opacity: .18; }
.state.bg { cursor: pointer; }
.flipOutline { fill: none; stroke: #111; stroke-width: 2.2; pointer-events: none; }
.hatch { pointer-events: none; }
.district { stroke: #fff; stroke-width: 1; cursor: pointer; }
.district:hover { stroke: #111; stroke-width: 2; }
.district.sel { stroke: var(--gold); stroke-width: 3; }
.district.faded { fill-opacity: .18; }
.stateEdge { fill: none; stroke: #222; stroke-width: 1.4; pointer-events: none; }
.dlabel { font-weight: 800; fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.45); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.chip { cursor: pointer; }
.chip rect.bgc { fill: #fff; fill-opacity: .9; stroke: rgba(0,0,0,.25); stroke-width: .6; }
.chip.changed rect.bgc { fill: #fff4c2; fill-opacity: .97; stroke: #b38600; stroke-width: 1; }
.chip.faded { opacity: .25; }
.chip text { font-size: 10px; font-weight: 800; dominant-baseline: central; }
.chip .abbr { fill: #333; font-weight: 700; }
.leader { stroke: #6b7280; stroke-width: .8; fill: none; }
.sen { stroke: #fff; stroke-width: 1; }
.sen.flip { stroke: var(--gold); stroke-width: 2.2; }
.sen.up { stroke: #111; stroke-width: 1.1; stroke-dasharray: 2 1.4; }

/* legend */
.legend {
  position: absolute; right: 10px; bottom: 10px; background: rgba(255,255,255,.95);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; max-width: 250px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.legend.below { position: static; max-width: none; margin: 6px 10px 10px; box-shadow: none; display: flex; flex-wrap: wrap; gap: 2px 16px; align-items: center; }
.legend.below h4 { margin: 0; flex: 0 0 auto; }
.legend h4 { margin: 4px 0 3px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.legend h4:first-child { margin-top: 0; }
.legend .row { display: flex; align-items: center; gap: 4px 10px; margin: 3px 0; flex-wrap: wrap; }
.legend .it { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend .scale { justify-content: space-between; font-size: 10.5px; color: var(--muted); max-width: 120px; gap: 4px; }
.legend .hint { font-size: 10.5px; color: var(--muted); margin-top: 0; }
.legend .sw { width: 14px; height: 12px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.legend .tally { font-weight: 800; font-size: 11px; background: #fff; border: 1px solid #ccc; border-radius: 3px; padding: 0 3px; }
.legend .tally.chg { background: #fff4c2; border-color: #b38600; }
.legend .swrow { display: flex; gap: 2px; }
.legend summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.notice { position: absolute; left: 12px; bottom: 8px; font-size: 12px; color: var(--muted); max-width: 40%; }
.person .strip { margin-top: 4px; }
.seat .strip { margin-top: 2px; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 20; pointer-events: none; background: #fff; color: var(--ink);
  border: 1px solid #cfd5df; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-width: 320px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.tooltip h3 { margin: 0 0 4px; font-size: 14px; }
.tooltip .tl { display: flex; gap: 6px; align-items: baseline; margin: 2px 0; }
.tooltip .k { color: var(--muted); min-width: 64px; font-size: 11.5px; }

/* panel */
.panel h2 { margin: 0 0 2px; font-size: 20px; }
.panel h3 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.panel .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.pill { display: inline-block; font-size: 11px; font-weight: 800; color: #fff; border-radius: 3px; padding: 0 5px; line-height: 17px; vertical-align: 1px; }
.pill.D { background: var(--D); } .pill.R { background: var(--R); } .pill.I { background: var(--I); } .pill.O { background: var(--O); }
.pill.V, .pill.T, .pill.U { background: var(--V); }
.flipTag { display: inline-block; font-size: 10.5px; font-weight: 800; background: #fff4c2; color: #6b5200; border: 1px solid #e0b100; border-radius: 3px; padding: 0 4px; white-space: nowrap; }
.person { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0f2f5; }
.person .nm { font-weight: 650; }
.person .meta { color: var(--muted); font-size: 12px; }
.person .grow { flex: 1 1 auto; min-width: 0; }
.seatList { list-style: none; margin: 0; padding: 0; }
.seat { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid #f0f2f5; cursor: pointer; border-radius: 4px; }
.seat:hover, .seat.sel { background: #f3f6fb; }
.seat .num { font-weight: 800; color: #555; text-align: center; font-size: 12px; }
.seat .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .mg { font-size: 11.5px; color: var(--muted); white-space: nowrap; text-align: right; }
.seat .strip { grid-column: 2 / 4; }
.seat.dim { opacity: .35; }
.strip { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.strip .sq { width: 11px; height: 11px; border-radius: 2px; display: inline-block; position: relative; }
.strip .sq.half { display: inline-flex; flex-direction: column; overflow: hidden; }
.strip .sq.half i { flex: 1; display: block; }
.strip .sq.cur { outline: 2px solid #111; outline-offset: 1px; }
.strip .sq.none { background: repeating-linear-gradient(45deg, #eee 0 2px, #fff 2px 4px); border: 1px solid #ddd; }
.strip .gap { width: 2px; height: 13px; background: #999; margin: 0 1px; }
.strip .flips { font-size: 10.5px; color: #6b5200; font-weight: 700; margin-left: 4px; }
.strip.big .sq { width: 22px; height: 18px; }
.strip.dense { gap: 1px; }
.strip.dense .sq { width: 8px; height: 11px; border-radius: 1px; }
.strip.dense .sq.cur { outline-width: 1.5px; }
.strip.big.dense .sq { width: 15px; height: 16px; }
.strip.big.dense .yr { font-size: 8.5px; }
.strip.big.dense .cell { width: 15px; }
.strip.big .yr { font-size: 9.5px; color: var(--muted); text-align: center; }
.strip.big .cell { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 6px 0; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.linkish { background: none; border: 0; color: var(--D); padding: 0; cursor: pointer; font-weight: 600; }
.linkish:hover { text-decoration: underline; }
.ratings { display: flex; gap: 6px; flex-wrap: wrap; }
.rating { border-radius: 4px; padding: 2px 7px; font-size: 12px; font-weight: 700; border: 1px solid rgba(0,0,0,.12); }
.rating small { font-weight: 500; opacity: .8; margin-right: 4px; }
.rating.sm { font-size: 10.5px; padding: 1px 5px; font-weight: 600; }
.avgbar { display: flex; height: 20px; border-radius: 4px; overflow: hidden; font-size: 11.5px; font-weight: 800; color: #fff; margin: 4px 0; }
.avgbar span { display: flex; align-items: center; padding: 0 6px; white-space: nowrap; }
.avgbar .rest { background: #ddd; color: #555; justify-content: center; }
table.polls { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.polls th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); padding: 4px 4px; }
table.polls td { border-bottom: 1px solid #f0f2f5; padding: 5px 4px; vertical-align: top; }
table.polls .res { white-space: nowrap; font-weight: 700; }
.empty { color: var(--muted); font-style: italic; padding: 6px 0; }
.result { border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 6px 0; }
.result.called { border-color: #111; }
.chgList { list-style: none; margin: 0; padding: 0; }
.chgList li { padding: 4px 2px; border-bottom: 1px solid #f0f2f5; cursor: pointer; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chgList li:hover { background: #f3f6fb; }
.chgList .st { font-weight: 800; min-width: 44px; }
.chgList .who { color: var(--muted); font-size: 12px; }
.arrow { color: var(--muted); }
.raceRow { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.raceRow:hover { background: #f3f6fb; }
.cardsFallback { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; padding: 12px; }
.cardsFallback .c { color: #fff; border-radius: 6px; padding: 6px; font-weight: 800; cursor: pointer; }
.cardsFallback .c small { display: block; font-weight: 500; opacity: .9; }
.msg { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- patriotic theme ---------- */
:root {
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='36' viewBox='0 0 40 36'%3E%3Cg fill='%23fff'%3E%3Cpath d='M10 3l1.9 4.6 5 .4-3.8 3.3 1.2 4.9L10 13.6l-4.3 2.6 1.2-4.9L3.1 8l5-.4z'/%3E%3Cpath d='M30 21l1.9 4.6 5 .4-3.8 3.3 1.2 4.9-4.3-2.6-4.3 2.6 1.2-4.9L23.1 26l5-.4z'/%3E%3C/g%3E%3C/svg%3E");
  --oldglory-red: #b22234;
  --oldglory-blue: #0a1f44;
}
body {
  background: linear-gradient(rgba(10,31,68,.78), rgba(10,31,68,.78)), var(--oldglory-blue) var(--star) repeat;
  background-size: auto, 40px 36px;
  background-attachment: fixed;
}
.top {
  position: relative;
  background:
    linear-gradient(90deg, rgba(10,31,68,.96) 0%, rgba(20,33,61,.88) 55%, rgba(10,31,68,.96) 100%),
    var(--oldglory-blue) var(--star) repeat;
  background-size: auto, 40px 36px;
  padding-bottom: 16px;
}
.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: repeating-linear-gradient(90deg, var(--oldglory-red) 0 28px, #fff 28px 56px);
  background-size: 200% 100%;
  animation: stripeMarch 40s linear infinite;
}
@keyframes stripeMarch { to { background-position: -56px 0; } }
@media (prefers-reduced-motion: reduce) { .top::after { animation: none; } }
.brand h1 {
  font-family: "Oswald", system-ui, sans-serif; font-weight: 700; font-size: 22px;
  letter-spacing: 1.5px; text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.brand h1 .star { color: #f5c542; font-size: .8em; vertical-align: 2px; }
.summary {
  background: linear-gradient(180deg, #ffffff, #f7f3ea);
  border-bottom: 3px solid var(--oldglory-blue);
}
.sumHead .lbl, .panel h3, .legend h4 { font-family: "Oswald", system-ui, sans-serif; font-weight: 500; letter-spacing: 1.2px; }

/* the flag behind the map: cream field, faint 13 stripes, starry canton, light center so states stay readable */
.mapWrap {
  isolation: isolate;
  background:
    radial-gradient(ellipse 70% 65% at 55% 52%, rgba(251,248,241,.92) 0%, rgba(251,248,241,.55) 60%, rgba(251,248,241,0) 100%),
    repeating-linear-gradient(180deg, rgba(178,34,52,.16) 0 calc(100% / 13), rgba(255,255,255,0) calc(100% / 13) calc(200% / 13)),
    #fbf8f1;
}
.mapWrap::before {
  content: ""; position: absolute; left: 0; top: 0; width: 38%; height: calc(700% / 13);
  background: var(--oldglory-blue) var(--star) repeat; background-size: 40px 36px;
  opacity: .14; z-index: -1; pointer-events: none;
  -webkit-mask-image: linear-gradient(135deg, #000 40%, transparent 100%);
          mask-image: linear-gradient(135deg, #000 40%, transparent 100%);
}
#map { position: relative; }
#map .state { stroke: #fbf8f1; filter: drop-shadow(0 1px 1px rgba(10,31,68,.18)); }
.legend { z-index: 2; border-top: 3px solid var(--oldglory-red); }
.panel { background: linear-gradient(90deg, var(--oldglory-red) 33%, #fff 33% 66%, var(--oldglory-blue) 66%) top / 100% 4px no-repeat, var(--card); }
.back { background: var(--oldglory-red); }
.back:hover { background: #8f1b2a; }
.controls select { border: 2px solid #f5c542; }

/* ---------- phase 2: color-by, state toolbar, legislature, places ---------- */
[hidden] { display: none !important; }
.colorBy { font-size: 13px; color: #dfe5f2; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.controls .colorBy select { min-width: 0; padding: 5px 8px; }
.mapTools {
  position: absolute; top: 10px; left: 10px; right: 150px; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; pointer-events: none;
}
.mapTools > * { pointer-events: auto; }
.mapTools .back { position: static; }
.stateBar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.seg { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--oldglory-blue); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.seg button { border: 0; background: #fff; color: var(--oldglory-blue); padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.seg button + button { border-left: 1px solid #c9d0de; }
.seg button.on { background: var(--oldglory-blue); color: #fff; }
.seg button:not(.on):hover { background: #eef2f8; }
.tog { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.94); border: 1px solid #c9d0de; border-radius: 6px; padding: 5px 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.tog input { margin: 0; }
.district.sld { stroke-width: .6; }
.district.sld:hover { stroke-width: 2; }
.district.sld.sel { stroke-width: 3; }
.flot { fill: none; stroke: #111; stroke-width: 1.6; stroke-dasharray: 5 3; pointer-events: stroke; cursor: pointer; }
.flot:hover { stroke: #000; stroke-width: 3; }
.flot.sel { stroke: var(--gold); stroke-width: 3.5; stroke-dasharray: none; }
.countyLine { fill: none; stroke: rgba(20,33,61,.42); stroke-width: .7; pointer-events: none; }
.countyNames text { fill: rgba(25,30,45,.72); font-style: italic; font-weight: 600; text-anchor: middle; dominant-baseline: central;
  paint-order: stroke; stroke: rgba(255,255,255,.6); stroke-linejoin: round; pointer-events: none; letter-spacing: .02em; }
.cities circle { fill: #1d2433; stroke: #fff; stroke-width: 1; }
.cities .capital path { fill: #f5c542; stroke: #3b2f00; stroke-width: 1; }
.cities text { fill: #111; font-weight: 650; dominant-baseline: central; paint-order: stroke; stroke: rgba(255,255,255,.88); stroke-linejoin: round; }
.cities .big text { font-weight: 800; }
.cities .capital text { font-weight: 800; }
.cities .city { cursor: default; }
.tooltip .meta { color: var(--muted); font-size: 11.5px; }
.tooltip .nickT { font-weight: 500; color: var(--muted); font-size: 12px; }
.nick2 { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }
.seat .nick { grid-column: 2 / 4; font-size: 11.5px; color: var(--muted); margin-top: -2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.sld { grid-template-columns: 34px 1fr auto; }
.seat.sld .nm { white-space: normal; }
.seat.sld.named { grid-template-columns: 1fr; gap: 1px; }
.seat.sld.named .dn { font-weight: 800; font-size: 12px; color: #444; }
.person .ttl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 800; color: #fff; border-radius: 4px; padding: 2px 8px; }
.badge.tri { background: #fff; border: 2px solid; padding: 0 7px; }
.badge.div { background: #ececec; color: #444; border: 1px solid #ccc; }
.chamber { margin: 8px 0 10px; }
.chHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.chName { font-weight: 700; }
.chNums { font-size: 13px; }
.bar.seatbar { height: 12px; margin: 3px 0 2px; }
.panel .chamber .meta, .panel > .meta { color: var(--muted); font-size: 12px; }

@media (max-width: 860px) {
  .mapTools { position: static; padding: 8px 10px 2px; }
  .controls { flex-wrap: wrap; gap: 8px 12px; }
  .seg button { padding: 5px 8px; font-size: 12px; }
  .colorBy { font-size: 12px; }
  .main { flex-direction: column; align-items: stretch; }
  .panel { flex: 1 1 auto; max-width: none; width: 100%; max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  #map { max-height: none; }
  .notice { position: static; max-width: none; text-align: left; padding: 0 12px 8px; }
  .crumb { display: none; }
  .controls { width: 100%; justify-content: space-between; margin-left: 0; }
  .controls select { min-width: 0; flex: 0 1 200px; }
  .summary { gap: 10px; }
  .sumBlock { flex: 1 1 100%; }
  .sumNums { font-size: 17px; }
}

/* page tabs (Map / 2026 races) */
.tabs { display: flex; gap: 6px; margin-left: auto; }
.tabs a { color: #dfe5f2; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-weight: 700; font-size: 13px; border: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { background: rgba(255,255,255,.12); }
.tabs a.on { border-color: #f5c542; color: #fff; }
.top .tabs + .controls { margin-left: 0; }
@media (max-width: 640px) { .tabs { width: 100%; margin-left: 0; } .tabs a { flex: 1; text-align: center; } }

/* phones: nothing may be wider than the screen */
html, body { max-width: 100%; overflow-x: hidden; }
@media (max-width: 640px) {
  .top { padding: 8px 10px; gap: 6px; }
  .brand { flex-wrap: wrap; gap: 2px 8px; width: 100%; }
  .brand h1 { font-size: 16px; white-space: normal; }
  .asof { flex: 1 1 100%; font-size: 11px; }
  .tabs a { padding: 6px 4px; font-size: 12.5px; }
  .controls { gap: 6px 10px; }
  .controls select { flex: 1 1 140px; }
  .sumBlock, .rsum .blk { min-width: 0; flex-basis: 100%; }
  .legend.below { margin: 6px 8px 10px; }
}

/* phone state picker */
.stateGrid { display: none; }
@media (max-width: 860px) {
  .stateGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; padding: 10px 10px 12px; background: #fff; }
  .stateGrid[hidden] { display: none; }
  .stateGrid .sgHead { grid-column: 1 / -1; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
  .stateGrid button { border: 0; border-radius: 7px; min-height: 44px; font-weight: 800; font-size: 14px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
  .stateGrid button:active { transform: scale(.96); }
}

/* DSA tag (neutral marker, not a party; data/tags/dsa.json - delete the file and this never renders) */
.dsaTag { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .4px; background: #2b2f3a; color: #fff; border-radius: 3px; padding: 0 4px; line-height: 15px; vertical-align: 1px; cursor: help; white-space: nowrap; }
.dsaTag.end { background: #fff; color: #2b2f3a; box-shadow: inset 0 0 0 1px #2b2f3a; }
.district.dsahl { stroke: #111; stroke-width: 2.6; }
.tog.dsaTog { border-color: #2b2f3a; }
.tog .dsaCount { font-weight: 800; color: #2b2f3a; }