/* After the specials — shared styles */
:root {
  color-scheme: light;
  --page: #f6f5f1;
  --card: #fdfdfb;
  --ink: #141413;
  --ink-2: #55534e;
  --muted: #66635c;        /* text: 4.5:1 or better on cards and every tint */
  --chip-oth: #8a877f;     /* fill for grey chips (white text) */
  --line: #e3e1d9;
  --line-strong: #cfccc2;
  --accent: #1f5f8b;
  --accent-soft: #e6eff6;
  --caveat-bg: #fdf3d8;
  --caveat-ink: #6b5310;
  --soon-bg: #efede6;
  --tint-1: #f1f6fb; --tint-2: #e3eef8; --tint-3: #cfe2f3;   /* closeness, one hue */
  /* party colours (always paired with a text label) */
  --nat: #1f5fa8; --lab: #d8352f; --grn: #138a3e; --act: #f2c300;
  --nzf: #3a3a3a; --top: #2bb5a3; --tpm: #9b1c25;
  --right: #1f5fa8; --left: #d8352f;
  --c-nz: #2f6fa3; --c-os: #d08a2c; --c-dis: #7a766c;   /* special-vote charts */
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #121211; --card: #1b1b1a; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a4a199; --chip-oth: #8f8c84;
    --line: #2d2d2b; --line-strong: #3d3d3a; --accent: #6aa6d6; --accent-soft: #1d2a35;
    --caveat-bg: #2e2712; --caveat-ink: #e9d08a; --soon-bg: #262624;
    --tint-1: #1b232b; --tint-2: #1f2c39; --tint-3: #26384a;
    --nat: #4a86cf; --lab: #e5534d; --grn: #2aa65a; --nzf: #8d8d8d; --tpm: #c24a52;
    --right: #4a86cf; --left: #e5534d;
    --c-nz: #5d9bd0; --c-os: #d6953f; --c-dis: #8f8b81;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121211; --card: #1b1b1a; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a4a199; --chip-oth: #8f8c84;
  --line: #2d2d2b; --line-strong: #3d3d3a; --accent: #6aa6d6; --accent-soft: #1d2a35;
  --caveat-bg: #2e2712; --caveat-ink: #e9d08a; --soon-bg: #262624;
  --tint-1: #1b232b; --tint-2: #1f2c39; --tint-3: #26384a;
  --nat: #4a86cf; --lab: #e5534d; --grn: #2aa65a; --nzf: #8d8d8d; --tpm: #c24a52;
  --right: #4a86cf; --left: #e5534d;
  --c-nz: #5d9bd0; --c-os: #d6953f; --c-dis: #8f8b81;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  font-size: 13px; color: var(--ink-2); text-decoration: none;
  padding: 4px 9px; border-radius: 6px;
}
.nav a:hover { background: var(--soon-bg); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.caveat {
  background: var(--caveat-bg); color: var(--caveat-ink);
  font-size: 13px; border-bottom: 1px solid var(--line);
}
.caveat p { max-width: 1120px; margin: 0 auto; padding: 7px 16px; }

/* layout */
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
.lede h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.015em; }
.lede p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.section-label {
  font-size: 16px; font-weight: 650; letter-spacing: -0.005em;
  color: var(--ink); margin: 28px 0 10px;
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.card h2 { font-size: 15px; margin: 0; }
.card .sub { font-size: 13px; color: var(--muted); margin: 2px 0 12px; }

/* stat tiles */
.tiles {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  overflow: hidden;
}
.tile { padding: 12px 14px; border-left: 1px solid var(--line); }
.tile:first-child { border-left: 0; }
.tile .k { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tile .v { font-size: 28px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.tile .v small { font-size: 15px; color: var(--muted); font-weight: 500; }
.tile .c { font-size: 12.5px; color: var(--ink-2); }

/* two-column overview */
.grid-2 { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }

/* party bars */
.bars { display: grid; grid-template-columns: 44px 1fr auto; gap: 6px 10px; align-items: center; font-size: 13px; }
.chip {
  display: inline-block; min-width: 38px; text-align: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  padding: 2px 5px; border-radius: 4px; color: #fff; background: var(--chip-oth);
}
.chip.act { color: #141413; }
.c-nat { background: var(--nat); } .c-lab { background: var(--lab); } .c-grn { background: var(--grn); }
.c-act { background: var(--act); } .c-nzf { background: var(--nzf); } .c-top { background: var(--top); }
.c-tpm { background: var(--tpm); }
.bar-track { position: relative; height: 14px; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; }
.bar-val { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-val b { color: var(--ink); font-weight: 600; }
.threshold { position: absolute; top: -4px; bottom: -4px; border-left: 1px dashed var(--muted); }

.bloc { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.bloc-row { display: grid; grid-template-columns: 104px 1fr 30px; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.bloc-row .name b { display: block; font-size: 13px; }
.bloc-row .name span { font-size: 11.5px; color: var(--muted); }
.bloc-track { position: relative; height: 12px; background: var(--soon-bg); border-radius: 3px; }
.bloc-fill { height: 100%; border-radius: 3px; }
.majority-mark { position: absolute; top: -4px; bottom: -4px; border-left: 2px solid var(--ink); }
.bloc-row .num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.note { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

/* page links */
.links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.link-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; transition: border-color .15s, transform .15s;
}
.link-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.link-card .q { font-weight: 650; font-size: 15px; color: var(--ink); }
.link-card .d { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.link-card .meta { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--soon-bg); color: var(--ink-2); }
.placeholder {
  border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted);
  font-size: 13px; padding: 28px 16px; text-align: center; background: var(--page);
}

footer { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 14px; font-size: 12.5px; color: var(--muted); }
footer ul { margin: 6px 0 0; padding-left: 18px; }

/* tooltip */
.tip {
  position: fixed; pointer-events: none; z-index: 50; display: none;
  background: var(--ink); color: var(--page); font-size: 12px; line-height: 1.4;
  padding: 6px 8px; border-radius: 6px; max-width: 280px;
}

/* ---------- shared: section heads, tables, flags, controls ---------- */
.jump { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.jump a { text-decoration: none; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); background: var(--card); }
.jump a:hover { border-color: var(--line-strong); color: var(--ink); }
.section { margin-top: 30px; scroll-margin-top: 70px; }
.section > h2 { font-size: 22px; margin: 0 0 10px; letter-spacing: -0.015em; }
.section > h2 + .sub { margin-top: -6px; }
.section > .sub { color: var(--ink-2); font-size: 14px; margin: 3px 0 12px; max-width: 75ch; }
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h3 { font-size: 16px; margin: 0; letter-spacing: -0.005em; }
.card-head .sub { margin: 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 13px; font-weight: 650;
  color: var(--ink); padding: 6px 10px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-main { font-weight: 650; font-variant-numeric: tabular-nums; }
table.data.party { table-layout: fixed; }
table.data.party th:first-child { width: 21%; }
table.data.party th:nth-child(2) { width: 11%; }
.cell-big { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.cell-big .delta { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-left: 4px; }
.cell-sub { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-sub .arrow { color: var(--muted); }
.party-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.party-cell .nm { font-weight: 600; }
td.move { min-width: 150px; }
td.tint-1 { background: var(--tint-1); } td.tint-2 { background: var(--tint-2); } td.tint-3 { background: var(--tint-3); }
td.na { color: var(--muted); font-size: 12.5px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line); }
.swatch.s3 { background: var(--tint-3); } .swatch.s2 { background: var(--tint-2); } .swatch.s1 { background: var(--tint-1); } .swatch.s0 { background: var(--card); }
.count { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cell-sub.wrap { white-space: normal; }

/* screen-reader only (tooltip descriptions, charts.js) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* info icons, past-election tooltips, quota "vs", change pills (Party Vote Seats) */
.info { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--muted); color: var(--muted); font-size: 10px; font-weight: 700; font-style: normal;
  line-height: 1; vertical-align: 1px; margin-left: 4px; cursor: help; }
.count.has-tip { cursor: help; display: inline-block; }
.count.has-tip:hover, .count.has-tip:focus-visible { color: var(--ink-2); }
.info-g { cursor: help; }
.info:focus-visible, .count.has-tip:focus-visible, .info-g:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tip-t { border-collapse: collapse; margin: 4px 0; font-variant-numeric: tabular-nums; }
.tip-t th, .tip-t td { padding: 1px 6px 1px 0; text-align: left; font-weight: 400; }
.tip-t th { opacity: .7; font-size: 11px; }
.tip-t .r { text-align: right; }
.tip-n { display: block; opacity: .75; font-size: 11px; }
.tip:has(.tip-t) { max-width: 340px; }
.q-l { color: var(--left); } .q-r { color: var(--right); }
.vs { font-size: 12px; font-weight: 400; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chip.pill { font-size: 11px; padding: 2px 6px; white-space: nowrap; }
.chip.pill.out { background: transparent; color: var(--pc); border: 1.5px solid var(--pc); padding: 1px 5px; }
.chip.pill.out.c-act, .chip.pill.out[style*="--act"] { color: var(--ink-2); }
.tip-t tr.need td { font-weight: 700; border-bottom: 1px solid rgba(128,128,128,.5); padding-bottom: 2px; }
.pills { align-items: flex-start; }
.pcol { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.pcol.lt { min-width: 52px; }
.pills .chip { margin: 0; vertical-align: middle; line-height: 1.3; }
.th-sub { font-size: 11px; font-weight: 500; color: var(--muted); }

/* special-vote assumption bar (Party Vote Seats) */
.model-bar { margin: 4px 0 18px; }
.controls.stacked { flex-direction: column; align-items: flex-start; gap: 8px; margin: 8px 0 4px; }
.ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctl-k { min-width: 104px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.seg { flex-wrap: wrap; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

.flag { display: inline-block; font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 4px; margin: 3px 4px 0 0; white-space: nowrap; }
.flag.reach { background: var(--caveat-bg); color: var(--caveat-ink); }
.flag.from { background: var(--soon-bg); color: var(--ink-2); }
.flag.quota { background: var(--soon-bg); color: var(--ink-2); border: 1px dashed var(--line-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.legend .flag { margin: 0 4px 0 0; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 12.5px; border: 0; background: var(--card); color: var(--ink-2);
  padding: 4px 10px; cursor: pointer; border-left: 1px solid var(--line);
}
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.controls label { display: flex; align-items: center; gap: 8px; }

.btn {
  font: inherit; font-size: 13px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: 5px 12px; cursor: pointer;
}
.btn:hover { background: var(--soon-bg); }

tr.cutoff td { border-bottom: 2px solid var(--ink); }
tr.last-in td, tr.first-out td { background: var(--tint-2); }
.group-row td { background: var(--page); font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 5px 10px; }

.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.step .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; margin-right: 6px; }
.step h3 { font-size: 14.5px; margin: 0 0 6px; display: flex; align-items: center; }
.step p { font-size: 13.5px; color: var(--ink-2); margin: 0 0 8px; }
table.mini { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.mini th, table.mini td { padding: 3px 8px; text-align: right; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--ink-2); font-weight: 650; font-size: 12px; }
table.mini td.won { background: var(--tint-2); font-weight: 650; }
table.mini td:first-child, table.mini th:first-child { text-align: left; }

/* History page */
.chart-pair { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
.chart-pair .card + .card { margin-top: 0; }
.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart text { font-family: var(--font); }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.key.nz { background: var(--c-nz); } .key.os { background: var(--c-os); } .key.dis { background: var(--c-dis); }
.key.est { background: repeating-linear-gradient(135deg, var(--c-nz) 0 2px, transparent 2px 5px); border: 1px solid var(--c-nz); }
tr.est td { background: var(--page); }
.est-tag { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }

@media (max-width: 860px) {
  .chart-pair { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* stacked tables: each row becomes a small card */
  table.stack thead { display: none; }
  table.stack tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); padding: 4px 0; }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 6px 8px; }
  table.stack td:first-child { grid-column: 1 / -1; }
  table.stack td.num { text-align: left; }
  table.stack td[data-label]::before {
    content: attr(data-label); display: block; font-size: 12.5px; font-weight: 650;
    color: var(--ink-2); margin-bottom: 2px;
  }
  .controls label { flex-wrap: wrap; }
  table.stack td.move .cell-sub { white-space: normal; }
}
.steps > .step { min-width: 0; overflow-x: auto; }
#ruler text { paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }

@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile:nth-child(3) { border-left: 0; }
  .tile:nth-child(n+3) { border-top: 1px solid var(--line); }
  .links { grid-template-columns: 1fr; }
  .nav { margin-left: 0; }
}

/* ---------- forecast page ---------- */
:root {
  /* outcomes, Right to Left: a diverging pair (the bloc colours) with TOP's teal at the middle */
  --o-r: #1f5fa8; --o-rt: #a9c6e6; --o-k: #2bb5a3; --o-lt: #f0b0aa; --o-l: #d8352f; --o-h: #8a877f;
  --nat-ink: #fff; --lab-ink: #fff; --grn-ink: #fff; --act-ink: #141413; --nzf-ink: #fff; --top-ink: #141413; --tpm-ink: #fff;   /* text on party colours */
  --o-r-ink: #fff; --o-rt-ink: #141413; --o-k-ink: #141413; --o-lt-ink: #141413; --o-l-ink: #fff; --o-h-ink: #fff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --o-r: #4a86cf; --o-rt: #2c4a6b; --o-k: #23998a; --o-lt: #6e3431; --o-l: #e5534d; --o-h: #6b6962;
    --nat-ink: #121211; --lab-ink: #121211; --grn-ink: #121211; --act-ink: #141413; --nzf-ink: #121211; --top-ink: #121211; --tpm-ink: #fff;
    --o-r-ink: #121211; --o-rt-ink: #f0efec; --o-k-ink: #121211; --o-lt-ink: #f0efec; --o-l-ink: #121211; --o-h-ink: #f0efec;
  }
}
:root[data-theme="dark"] {
  --o-r: #4a86cf; --o-rt: #2c4a6b; --o-k: #23998a; --o-lt: #6e3431; --o-l: #e5534d; --o-h: #6b6962;
  --nat-ink: #121211; --lab-ink: #121211; --grn-ink: #121211; --act-ink: #141413; --nzf-ink: #121211; --top-ink: #121211; --tpm-ink: #fff;
  --o-r-ink: #121211; --o-rt-ink: #f0efec; --o-k-ink: #121211; --o-lt-ink: #f0efec; --o-l-ink: #121211; --o-h-ink: #f0efec;
}
.controls.wide .ctl-k { min-width: 176px; }
.muted { color: var(--muted); font-weight: 400; }
.o-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px 24px; margin-bottom: 14px; }
.o-head { border-left: 4px solid var(--line-strong); padding-left: 12px; }
.o-r-edge { border-left-color: var(--o-r); } .o-rt-edge { border-left-color: var(--o-rt); } .o-k-edge { border-left-color: var(--o-k); }
.o-lt-edge { border-left-color: var(--o-lt); } .o-l-edge { border-left-color: var(--o-l); } .o-h-edge { border-left-color: var(--o-h); }
.o-lab { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.o-name { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.o-desc { color: var(--ink-2); font-size: 13.5px; margin: 2px 0 8px; }
.o-seats { font-size: 15px; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.o-past .o-lab { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink-2); }
.o-tally { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.o-tally .o-pill { min-width: 108px; text-align: center; }
.o-past .cell-sub { margin-top: 6px; color: var(--muted); }
.o-pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.o-pill.o-r, .swatch.o-r { background: var(--o-r); color: var(--o-r-ink); }
.o-pill.o-rt, .swatch.o-rt { background: var(--o-rt); color: var(--o-rt-ink); }
.o-pill.o-k, .swatch.o-k { background: var(--o-k); color: var(--o-k-ink); }
.o-pill.o-lt, .swatch.o-lt { background: var(--o-lt); color: var(--o-lt-ink); }
.o-pill.o-l, .swatch.o-l { background: var(--o-l); color: var(--o-l-ink); }
.o-pill.o-h, .swatch.o-h { background: var(--o-h); color: var(--o-h-ink); }
.swatch[class*=" o-"] { border: 0; }
.legend .o-off { opacity: 0.45; }
#strip text, .seatbar text { paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
#strip rect + text, .seatbar rect + text { stroke: none; }
#strip rect[data-tip], .seatbar rect[data-tip] { cursor: default; outline: none; }
#strip rect[data-tip]:focus, .seatbar rect[data-tip]:focus { stroke: var(--ink); stroke-width: 2; }
@media (max-width: 640px) {
  .o-grid { grid-template-columns: 1fr; }
  .o-name { font-size: 21px; }
  .controls.wide .ctl-k { min-width: 0; }
}
details.fold { margin-top: 12px; }
details.fold > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); width: max-content; }
details.fold[open] > summary { margin-bottom: 8px; }
#strip g[data-tip] { cursor: default; outline: none; }
#strip g[data-tip]:focus circle { stroke: var(--ink); stroke-width: 2; }
.o-spread { margin-top: 5px; line-height: 1.7; }
.o-spread .o-pill { font-size: 11px; padding: 1px 7px; }
#strip g.spread-g { outline: none; }
#strip g.spread-g:focus path { stroke: var(--ink); stroke-width: 2.5; }
/* how the special votes split (forecast page) */
table.split { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.split th { font-weight: 600; color: var(--muted); font-size: 11.5px; text-align: left; padding: 4px 10px 6px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.split td { padding: 6px 10px; vertical-align: middle; }
table.split .r { text-align: right; }
table.split tr.grp td { border-top: 1px solid var(--line); padding-top: 9px; padding-bottom: 7px; font-weight: 700; }
table.split tbody tr.grp:first-child td { border-top: 0; }
table.split tr.sub td { padding-top: 3px; padding-bottom: 3px; color: var(--ink-2); }
table.split tr.sub td.who { padding-left: 22px; white-space: nowrap; }
table.split .nm { margin-left: 8px; }
table.split .chip.pill { min-width: 34px; }
.chip.c-oth { background: var(--chip-oth); }
.bloc-k { display: inline-block; padding-left: 9px; border-left: 4px solid var(--bc); font-size: 14px; line-height: 1.1; }
table.split td.sp { width: 52%; }
.sp-cell { display: flex; align-items: center; gap: 10px; }
.sbar { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--soon-bg); min-width: 60px; }
.sbar.big { height: 12px; border-radius: 6px; }
.sbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.sbar .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.sp-v { min-width: 44px; text-align: right; font-weight: 700; color: var(--ink); }
tr.sub .sp-v { font-weight: 600; }
.sp-l { min-width: 38px; text-align: right; font-size: 11.5px; color: var(--muted); font-weight: 400; }
table.split td.fin { white-space: nowrap; }
table.split .chg { color: var(--muted); font-size: 11.5px; font-weight: 400; margin-left: 6px; display: inline-block; min-width: 32px; text-align: right; }
.th-k { font-weight: 400; margin-left: 10px; white-space: nowrap; }
.th-k .k-fill { display: inline-block; width: 14px; height: 8px; border-radius: 4px; background: var(--muted); vertical-align: 0; margin-right: 4px; }
.th-k .k-tick { display: inline-block; width: 2px; height: 12px; background: var(--ink); vertical-align: -2px; margin: 0 4px 0 8px; }
@media (max-width: 640px) {
  table.split { font-size: 12.5px; }
  table.split th, table.split td { padding-left: 4px; padding-right: 4px; }
  table.split .pre, table.split .nm, .th-k { display: none; }
  table.split tr.sub td.who { padding-left: 12px; }
  .sp-cell { gap: 6px; }
  .sp-l { display: none; }
  table.split .chg { display: block; margin-left: 0; }
}
/* party pills: text colour per party, so light and dark mode both read */
.chip.c-nat { color: var(--nat-ink); } .chip.c-lab { color: var(--lab-ink); } .chip.c-grn { color: var(--grn-ink); }
.chip.c-act { color: var(--act-ink); } .chip.c-nzf { color: var(--nzf-ink); } .chip.c-top { color: var(--top-ink); } .chip.c-tpm { color: var(--tpm-ink); }
.chip.pill.out { color: var(--pc); }
/* split section: settings summary and Left + TOP total */
.set-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 12px; }
.set-k { font-weight: 700; color: var(--ink-2); margin-right: 2px; }
.set-b { padding: 2px 8px; border-radius: 999px; background: var(--soon-bg); color: var(--ink); }
.set-a { margin-left: auto; font-weight: 600; color: var(--accent); text-decoration: none; }
.set-a:hover { text-decoration: underline; }
.lt-total { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-strong); font-size: 13.5px; color: var(--ink); }
.lt-total .bloc-k { font-weight: 700; margin-right: 4px; }
.muted2 { color: var(--ink-2); }
.o-name { margin-top: 2px; }
.o-past .o-lab { color: var(--ink); font-weight: 600; }
.o-head .cell-sub { color: var(--ink-2); }
/* split table: one column per figure (8 Nov) */
table.split th.bar { text-align: left; }
table.split td.bar { width: 40%; padding-right: 2px; }
table.split td.sp-v { font-weight: 700; color: var(--ink); min-width: 0; }
table.split tr.sub td.sp-v { font-weight: 600; }
table.split td.sp-l, table.split td.chg { color: var(--ink-2); font-size: 12px; font-weight: 400; }
table.split td.chg, table.split th.chg { display: table-cell; margin: 0; min-width: 0; }
table.split td.fin { font-weight: 600; }
table.split tr.grp td.fin { font-weight: 700; }
@media (max-width: 640px) {
  table.split .sp-l { display: none; }
  table.split td.chg, table.split th.chg { display: table-cell; }
  table.split td.bar { width: auto; }
  table.split th.chg { font-size: 0; } table.split th.chg::after { content: "±"; font-size: 11.5px; }
}
.lt-total { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.o-head { display: flex; flex-direction: column; justify-content: center; }   /* text centred against the coloured line */
/* seat split in the outcome and past-election tables: each bloc alone and with TOP */
.ss { display: grid; gap: 3px; font-variant-numeric: tabular-nums; }
.ss-r { display: flex; align-items: center; flex-wrap: wrap; gap: 0 5px; font-size: 13px; color: var(--ink); }
.ss-r b { font-size: 17px; font-weight: 700; }
.ss-n { font-weight: 700; min-width: 40px; }
.ss-w { color: var(--ink-2); font-weight: 500; }
.ss-s { color: var(--ink-2); font-weight: 700; font-size: 12px; }
.ss-g { width: 10px; }
.tk { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--ink); color: var(--card); font-size: 11px; font-weight: 800; line-height: 1; }
.ss .cell-sub { margin-top: 2px; }
.ss-p { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; margin-right: 14px; }
@media (max-width: 640px) {
  table.stack td[data-label="Seats"] { grid-column: 1 / -1; }
  .ss-r { gap: 2px 4px; }
  .ss-p { margin-right: 10px; }
}
.lt-total .bloc-k { margin-left: 6px; margin-right: 2px; }   /* room between the text and the red edge */
/* seat split inside the (inverted) tooltip */
.tip:has(.ss) { max-width: 330px; }
.tip .ss-r, .tip .ss-w, .tip .ss-s, .tip .cell-sub { color: inherit; }
.tip .ss-w, .tip .ss-s, .tip .cell-sub { opacity: .8; }
.tip .ss-r b { font-size: 15px; }
.tip .tk { background: var(--page); color: var(--ink); }
.o-chg { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.o-arr { color: var(--ink-2); font-weight: 700; }
.strip-hit { cursor: crosshair; }
@media (max-width: 640px) {
  table.stack td[data-label="Seats from here"] { grid-column: 1 / -1; }
}
#strip text.bl { stroke: none; }   /* labels inside the bands: no halo */
#headline.o-grid { grid-template-columns: 1fr; margin-bottom: 18px; }   /* outcome only; past elections moved to the Outcomes table */
#t-steps td.move .count { margin-top: 6px; }
/* Party Vote Seats bloc chart: quota-seat bands, neutral at 60 v 60, redder as Left + TOP gains (sequential) */
:root { --qs0: #e7e5df; --qs1: #f6d3d0; --qs2: #eda8a3; --qs3: #e07b74; --qs4: #c9443c;
  --qs0-ink: #141413; --qs1-ink: #141413; --qs2-ink: #141413; --qs3-ink: #141413; --qs4-ink: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --qs0: #2d2d2b; --qs1: #4a2725; --qs2: #6e3431; --qs3: #94403b; --qs4: #c24a45;
  --qs0-ink: #f0efec; --qs1-ink: #f0efec; --qs2-ink: #f0efec; --qs3-ink: #f0efec; --qs4-ink: #fff; } }
:root[data-theme="dark"] { --qs0: #2d2d2b; --qs1: #4a2725; --qs2: #6e3431; --qs3: #94403b; --qs4: #c24a45;
  --qs0-ink: #f0efec; --qs1-ink: #f0efec; --qs2-ink: #f0efec; --qs3-ink: #f0efec; --qs4-ink: #fff; }
#ruler text.bl { stroke: none; }
#ruler g[data-tip] { outline: none; }
#ruler g[data-tip]:focus circle { stroke: var(--ink); stroke-width: 2; }
.steps.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .steps.three { grid-template-columns: 1fr; } }

/* Forecast: Expected result first, then the Assumptions section with a line in the result card naming them */
.set-sum.exp-set { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
#top-controls .model-bar { margin: 0; }

/* ---------- History page ---------- */
/* kinds of special vote: three blues for New Zealand (darkest = on polling day), the overseas orange */
:root { --mx-before: #8db4d6; --mx-on: #2f6fa3; --mx-po: #c9dcec;
  --mx-before-ink: #141413; --mx-on-ink: #fff; --mx-po-ink: #141413; --mx-os-ink: #141413; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --mx-before: #3f6f98; --mx-on: #5d9bd0; --mx-po: #2b4a66;
  --mx-before-ink: #f0efec; --mx-on-ink: #121211; --mx-po-ink: #f0efec; --mx-os-ink: #121211; } }
:root[data-theme="dark"] { --mx-before: #3f6f98; --mx-on: #5d9bd0; --mx-po: #2b4a66;
  --mx-before-ink: #f0efec; --mx-on-ink: #121211; --mx-po-ink: #f0efec; --mx-os-ink: #121211; }
#c-lean text, #c-bloc text, #c-os text, #c-osshare text { paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
#c-lean text.bl, #c-bloc text.bl, #c-os text.bl, #c-mix text.bl { stroke: none; }
.chart g.dot, .chart rect[data-tip] { outline: none; cursor: default; }
.chart g.dot:focus circle, .chart g.dot:focus path, .chart g.dot:focus rect { stroke: var(--ink); stroke-width: 2; }
.card-head .seg { font-size: 12.5px; }
table.data tr.avg td { background: var(--page); border-top: 1px solid var(--line-strong); }
table.win td.def, table.win th.def { background: var(--tint-1); }
table.win .party-cell .nm { font-weight: 600; }
.flip { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 13px; margin: 2px 0; }
.fl-n { font-weight: 600; min-width: 0; }
.tie { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; border: 1px dashed var(--line-strong); color: var(--ink-2); }
table.seats .has-tip { cursor: help; display: inline-block; }
table.seats td { vertical-align: top; }
table.seats td:nth-child(2) { min-width: 230px; }
.pills.sc { flex-wrap: nowrap; gap: 6px; }
.pills.sc .pcol { width: 76px; }
.pills.sc .pcol:last-child { width: auto; min-width: 76px; }
.pills.sc + .cell-sub { margin-top: 5px; }
@media (max-width: 640px) {
  table.seats.stack td:nth-child(3) { grid-column: 1 / -1; }
  table.seats td:nth-child(2) { min-width: 0; }
  table.win .nm { display: none; }
  table.win td, table.win th { padding-left: 6px; padding-right: 6px; }
  .card-head .seg { width: 100%; }
}
