:root {
  color-scheme: light;
  --d: #3479C4;
  --d-dark: #1F5A9E;
  --d-partial: #A9C7E8;
  --r: #E53935;
  --r-dark: #B71C1C;
  --r-partial: #F4ADAB;
  --none: #ececec;
  --ink: #121212;
  --ink-2: #4a4a4a;
  --muted: #727272;
  --rule: #dcdcdc;
  --bg: #ffffff;
  --panel: #f6f6f4;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Poppins", system-ui, sans-serif; font-size: 15px; line-height: 1.45; }
button, select { font: inherit; color: inherit; }

.page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; }

.kicker { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
h1 { margin: 4px 0 4px; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15; font-weight: 700; }
.updated { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.updated .muted { display: inline; font-weight: 400; }
.dek { margin: 0 0 16px; color: var(--ink-2); max-width: 70ch; }

.chamber-tabs { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; gap: 2px; }
.chamber-tabs button { border: 0; background: none; padding: 6px 16px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.chamber-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

/* Seat bar */
.seatbar { margin: 22px 0 8px; }
.seatbar-top { display: flex; justify-content: space-between; align-items: flex-end; }
.side .big { font-size: clamp(40px, 6vw, 60px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.side .party { font-weight: 600; font-size: 17px; }
.side.d { color: var(--d); }
.side.r { color: var(--r); text-align: right; }
.bar { position: relative; display: flex; height: 16px; margin: 8px 0 6px; gap: 2px; }
.bar .seg { height: 100%; transition: width .4s ease; }
.bar .seg.d { background: var(--d); border-radius: 2px 0 0 2px; }
.bar .seg.r { background: var(--r); border-radius: 0 2px 2px 0; }
.bar .seg.pending { background: var(--none); }
.bar .seg.uno { border-radius: 0; background-image: radial-gradient(rgba(255,255,255,.75) 1.1px, transparent 1.3px); background-size: 5px 5px; }
.uno-note { display: block; }
.bar .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.bar .tick span { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: 12px; white-space: nowrap; color: var(--ink-2); }
.seatbar-bottom { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; font-size: 13px; min-height: 40px; }
.seatbar-bottom .right { text-align: right; }
.seatbar-bottom .center { padding-top: 16px; }
.flip-note { display: block; font-weight: 600; }
.flip-note.d { color: var(--d-dark); }
.flip-note.r { color: var(--r-dark); }
.muted { color: var(--muted); display: block; }

/* Map area */
.mapwrap { display: grid; grid-template-columns: 170px 1fr; gap: 20px; margin-top: 18px; }
.controls { display: flex; flex-direction: column; gap: 18px; }
.modes { display: flex; flex-direction: column; gap: 12px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: var(--muted); }
.mode .thumb { width: 120px; height: 80px; border: 1px solid transparent; border-radius: 4px; opacity: .55; }
.mode[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.mode[aria-checked="true"] .thumb { opacity: 1; border-color: var(--rule); }
.mode:focus-visible .thumb { outline: 2px solid var(--d); outline-offset: 2px; }

.legend { font-size: 12px; color: var(--ink-2); }
.legend-grid { display: grid; grid-template-columns: auto 26px 26px; gap: 4px 6px; align-items: center; }
.legend-grid .lh { font-size: 11px; color: var(--muted); text-align: center; }
.legend .sw { width: 26px; height: 12px; display: block; }
.legend-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.legend-row .sw { width: 18px; }
.legend-note { margin: 10px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.legend-title { font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .05em; color: var(--ink); }
.arrow-key { width: 150px; height: 46px; margin-top: 4px; }
.arrow-key .ak { font-size: 10px; fill: var(--muted); }
.baseline { display: block; margin-top: 10px; }
.baseline select { display: block; width: 100%; margin-top: 4px; font-size: 12px; padding: 4px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; }

.map { position: relative; min-width: 0; }
#svg { width: 100%; height: auto; display: block; touch-action: none; }
.district { stroke: #fff; stroke-width: .6; cursor: pointer; }
.district:hover, .district.active { stroke: var(--ink); stroke-width: 1.6; }
.outline { fill: none; stroke: #ffffff; pointer-events: none; }
.outline.town-line { stroke: #ffffff; }
.outline.dist-line { stroke: #a8a8a8; }
.label { font-size: 10px; font-weight: 600; fill: #fff; text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: rgba(0,0,0,.25); stroke-width: 2px; }
.label.dark { fill: var(--ink); stroke: rgba(255,255,255,.8); }
.arrow { stroke-width: 1.6; stroke-linecap: round; fill: none; }
.arrow.d { stroke: var(--d); }
.arrow.r { stroke: var(--r); }
.arrowhead.d { fill: var(--d); }
.arrowhead.r { fill: var(--r); }
.shift-mode .district { fill: #ededed !important; }
.shift-mode .label { display: none; }

.zoom { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 4px; background: #fff; z-index: 2; }
.zoom button { width: 30px; height: 30px; border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--ink-2); }
.zoom button + button { border-top: 1px solid var(--rule); }
.zoom button:hover { background: var(--panel); }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.tooltip { position: absolute; z-index: 5; width: 290px; background: #fff; border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: 10px 12px; font-size: 13px; pointer-events: none; }
.tooltip h3 { margin: 0; font-size: 15px; }
.tooltip .sub { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.tooltip table { width: 100%; border-collapse: collapse; }
.tooltip td { padding: 3px 0; border-top: 1px solid #eee; vertical-align: top; }
.tooltip td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 8px; }
.tooltip .chip { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.tooltip .pbar { height: 4px; background: #eee; border-radius: 2px; margin-top: 3px; }
.tooltip .pbar i { display: block; height: 100%; border-radius: 2px; }
.tooltip .tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; margin-top: 6px; }
.tooltip .tag.d { background: #e3eefa; color: var(--d-dark); }
.tooltip .tag.r { background: #fde6e5; color: var(--r-dark); }
.tooltip .foot { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* Tables */
.tables { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 36px; }
.tables h2 { font-size: 17px; margin: 0 0 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--ink); padding: 4px 6px 4px 0; }
table.data td { border-bottom: 1px solid #eee; padding: 6px 6px 6px 0; vertical-align: top; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--panel); }
.pty { font-weight: 600; }
.pty.d { color: var(--d-dark); }
.pty.r { color: var(--r-dark); }
.small { font-size: 11.5px; color: var(--muted); }

.foot { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
  .mapwrap { grid-template-columns: 1fr; }
  .controls { flex-direction: row; flex-wrap: wrap; }
  .modes { flex-direction: row; }
  .mode .thumb { width: 96px; height: 64px; }
  .tables { grid-template-columns: 1fr; }
  .tooltip { width: 250px; }
}
