:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #66726f;
  --paper: #f7f3e8;
  --panel: #fffdf6;
  --line: #d8d0bd;
  --coal: #17211f;
  --mint: #1f9f78;
  --marigold: #df9b20;
  --rose: #c44536;
  --blue: #2368a2;
  --shadow: 0 22px 60px rgba(54, 42, 23, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(23, 33, 31, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, #f8f1df 0%, #f0eadf 42%, #eef3ef 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", Verdana, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1500px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.masthead {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 24px;
  align-items: stretch;
  padding: 30px;
  color: #fff8e8;
  background:
    linear-gradient(135deg, rgba(23, 33, 31, 0.96), rgba(21, 73, 64, 0.92)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.masthead::after {
  content: "";
  position: absolute;
  inset: auto 30px 24px auto;
  width: 168px;
  height: 168px;
  border: 1px solid rgba(255, 248, 232, 0.32);
  background:
    linear-gradient(90deg, rgba(255, 248, 232, 0.18) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(180deg, rgba(255, 248, 232, 0.18) 1px, transparent 1px) 0 0 / 24px 24px;
  transform: rotate(-8deg);
}

.masthead__copy,
.masthead__status {
  position: relative;
  z-index: 1;
}

.kicker,
.eyebrow,
.label {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.kicker {
  color: #f0bc4f;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  max-width: 900px;
  margin-top: 10px;
  font-size: clamp(2.7rem, 7vw, 7.6rem);
  line-height: 0.92;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.1;
}

.subtitle {
  max-width: 760px;
  margin: 18px 0 0;
  color: rgba(255, 248, 232, 0.78);
  font-size: 1.08rem;
}

.masthead__status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-self: end;
  padding: 16px;
  background: rgba(255, 248, 232, 0.1);
  border: 1px solid rgba(255, 248, 232, 0.24);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.masthead__status div {
  grid-column: 1;
}

.label {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 248, 232, 0.58);
}

.masthead__status strong {
  display: block;
  font-size: 1rem;
}

.icon-button {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 248, 232, 0.34);
  border-radius: 50%;
  background: #f0bc4f;
  color: #17211f;
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.icon-button:hover {
  transform: rotate(18deg) scale(1.04);
  background: #ffd36a;
}

.jump-link {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(255, 248, 232, 0.28);
  border-radius: 999px;
  background: rgba(255, 248, 232, 0.12);
  color: #fff8e8;
  font-weight: 900;
  text-decoration: none;
}

.scoreboard,
.leader-grid,
.estimator-grid,
.map-grid,
.workbench {
  margin-top: 18px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.score-tile,
.panel {
  background: rgba(255, 253, 246, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.score-tile {
  min-height: 108px;
  padding: 20px;
  display: grid;
  align-content: space-between;
}

.score-tile span {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.score-tile strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3rem;
  line-height: 1;
}

.leader-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
}

.estimator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  scroll-margin-top: 18px;
}

.map-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
  scroll-margin-top: 18px;
}

.panel {
  padding: 20px;
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel__head--wrap {
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--rose);
}

.panel__head a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.party-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 12px;
}

.party-card {
  min-height: 136px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--party-color) 48%, transparent);
  border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--party-color) 16%, #fffdf6), #fffdf6 68%);
}

.party-card__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.party-card b {
  font-size: 1.15rem;
}

.party-card small {
  color: var(--muted);
  font-weight: 800;
}

.party-card strong {
  display: block;
  margin-top: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.2rem;
  line-height: 0.9;
}

.party-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #44504d;
  background: #f5ecd9;
  font-size: 0.82rem;
}

.alliance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.alliance-card {
  min-height: 128px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--alliance-color) 52%, #d8d0bd);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--alliance-color) 18%, #fffdf6), #fffdf6 72%);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.alliance-card:hover,
.alliance-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--alliance-color);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--alliance-color) 22%, transparent);
  outline: none;
}

.alliance-card strong,
.alliance-card span,
.alliance-card small,
.alliance-card em {
  display: block;
}

.alliance-card strong {
  font-size: 1.15rem;
}

.alliance-card span,
.alliance-card small,
.alliance-card em {
  color: var(--muted);
  font-weight: 850;
}

.alliance-card b {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  line-height: 0.9;
}

.alliance-card small,
.alliance-breakdown {
  grid-column: 1 / -1;
  font-size: 0.92rem;
  color: #17211f;
}

.alliance-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 900;
}

.alliance-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}

.alliance-chip:hover,
.alliance-chip:focus-visible {
  border-color: color-mix(in srgb, var(--alliance-color) 70%, #17211f);
  background: #fffdf6;
  color: #17211f;
  outline: none;
}

.alliance-card em {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 0.84rem;
}

.estimator-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.estimator-card {
  min-height: 236px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(52px, auto) auto minmax(64px, auto);
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--party-color) 48%, transparent);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--party-color) 18%, #fffdf6), #fffdf6 72%);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.estimator-card:hover,
.estimator-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--party-color);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--party-color) 22%, transparent);
  outline: none;
}

.estimator-card strong,
.estimator-card span,
.estimator-card small {
  display: block;
}

.estimator-card__main strong {
  font-size: 1.1rem;
}

.estimator-card > div > span,
.estimator-card small {
  color: var(--muted);
  font-weight: 750;
}

.estimator-card__main {
  grid-row: 1;
  max-width: 100%;
}

.estimator-card__main span {
  line-height: 1.22;
}

.estimator-card__metrics {
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.estimator-card__metrics div {
  min-width: 0;
  min-height: 92px;
  display: grid;
  align-content: space-between;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--party-color) 44%, #d8d0bd);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.76);
}

.estimator-card__metrics span {
  color: var(--muted);
  font-size: clamp(0.58rem, 1.2vw, 0.72rem);
  font-weight: 950;
  text-transform: uppercase;
  line-height: 1.15;
}

.estimator-card__metrics b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.45rem, 4.7vw, 3.7rem);
  line-height: 0.9;
  max-width: 100%;
}

.estimator-card small,
.estimator-breakdown {
  grid-row: 3;
  align-self: end;
}

.estimator-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: clamp(0.78rem, 1vw, 0.86rem);
  font-weight: 900;
}

.breakdown-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}

.breakdown-chip:hover,
.breakdown-chip:focus-visible {
  border-color: color-mix(in srgb, var(--party-color) 70%, #17211f);
  background: #fffdf6;
  color: #17211f;
  outline: none;
}

.panel--estimator {
  position: relative;
  overflow: visible;
  border-color: #1f9f78;
  box-shadow: 0 24px 70px rgba(31, 159, 120, 0.18);
}

.estimator-ribbon {
  display: inline-flex;
  border: 0;
  margin-bottom: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #17211f;
  color: #fffdf6;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.estimator-ribbon::after {
  content: " +";
}

.estimator-ribbon[aria-expanded="true"]::after {
  content: " −";
}

.estimator-info {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #b6d8ca;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 159, 120, 0.08) 1px, transparent 1px) 0 0 / 22px 22px,
    #f3fbf6;
}

.estimator-info[hidden] {
  display: none;
}

.estimator-info__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr);
  gap: 18px;
}

.estimator-info h3 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
}

.estimator-info p {
  margin: 0;
  color: #44504d;
  line-height: 1.5;
}

.formula-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cfe3d9;
  border-radius: 8px;
  background: #fffdf6;
}

.formula-box span,
.formula-box strong {
  display: block;
}

.formula-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.formula-box strong {
  margin-top: 4px;
  font-size: 0.92rem;
}

.definition-list {
  margin: 0;
  display: grid;
  gap: 8px;
}

.definition-list div {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d8eadf;
}

.definition-list dt {
  font-weight: 950;
}

.definition-list dd {
  margin: 0;
  color: #44504d;
}

.estimator-info__calls {
  margin-top: 16px;
}

.estimator-info__calls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.text-button {
  border: 1px solid #b6d8ca;
  border-radius: 999px;
  background: #fffdf6;
  color: #13523f;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 7px 10px;
  cursor: pointer;
}

.text-button:hover {
  border-color: var(--mint);
}

.mini-call-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.mini-call {
  min-height: 86px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 11px;
  border: 1px solid #cfe3d9;
  border-radius: 8px;
  background: #fffdf6;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mini-call:hover {
  border-color: var(--mint);
  box-shadow: 0 8px 24px rgba(31, 159, 120, 0.12);
}

.mini-call span,
.mini-call small {
  display: block;
}

.mini-call b {
  align-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: #17211f;
  color: #fffdf6;
  font-size: 0.78rem;
}

.mini-call > small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

.estimator-seat-detail {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #b6d8ca;
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: 0 14px 34px rgba(31, 159, 120, 0.12);
}

.estimator-seat-detail[hidden] {
  display: none;
}

.seat-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.seat-detail-head h3 {
  margin: 2px 0 0;
  font-size: clamp(1.25rem, 4vw, 1.85rem);
}

.seat-detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.seat-detail-metrics div {
  min-height: 76px;
  display: grid;
  align-content: space-between;
  padding: 10px;
  border: 1px solid #e5dcc9;
  border-radius: 8px;
  background: #f7efe0;
}

.seat-detail-metrics span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.seat-detail-metrics strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 5vw, 2rem);
  line-height: 1;
}

.seat-candidate-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.seat-candidate {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e5dcc9;
  border-radius: 8px;
  background: #fffaf0;
}

.seat-candidate--lead {
  border-color: #1f9f78;
  background: #eef8f2;
}

.seat-candidate strong,
.seat-candidate span,
.seat-candidate b {
  display: block;
}

.seat-candidate span {
  color: var(--muted);
}

.seat-candidate b {
  text-align: right;
  font-size: 1.12rem;
}

.party-detail-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--party-color) 52%, #b6d8ca);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--party-color) 18%, #fffdf6), #fffdf6 76%);
}

.party-detail-head h3 {
  margin: 2px 0 0;
  font-size: clamp(1.25rem, 4vw, 2rem);
}

.party-detail-head strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 13vw, 5.5rem);
  line-height: 0.9;
}

.party-detail-head small {
  grid-column: 1 / -1;
  color: #44504d;
  font-size: 0.95rem;
  font-weight: 950;
}

.party-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.party-metric {
  min-height: 86px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border: 1px solid #cfe3d9;
  border-radius: 8px;
  background: #fffdf6;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.party-metric:hover {
  border-color: var(--mint);
  box-shadow: 0 8px 24px rgba(31, 159, 120, 0.12);
}

.party-metric span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.party-metric strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
  line-height: 1;
}

.call-board {
  display: grid;
  gap: 10px;
}

.call-board__row {
  min-height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  background: #f7efe0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.call-board__row:hover {
  border-color: var(--mint);
  background: #eef8f2;
  box-shadow: 0 8px 24px rgba(31, 159, 120, 0.12);
}

.call-board__row strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
}

.majority-track {
  margin-top: 22px;
  position: relative;
  padding-top: 22px;
}

.majority-track__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 10px;
}

.seat-bar {
  height: 34px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ede4d2;
}

.seat-bar span {
  min-width: 2px;
}

.majority-pin {
  position: absolute;
  top: 6px;
  bottom: 0;
  width: 1px;
  background: var(--coal);
}

.majority-pin span {
  position: absolute;
  top: -18px;
  left: 8px;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--coal);
}

.panel--chart {
  display: grid;
  justify-items: center;
}

.panel--map {
  background:
    linear-gradient(90deg, rgba(35, 104, 162, 0.06) 1px, transparent 1px) 0 0 / 24px 24px,
    rgba(255, 253, 246, 0.94);
}

.map-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5ecd9;
}

.map-mode {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #44504d;
  font-size: 0.82rem;
  font-weight: 950;
  cursor: pointer;
}

.map-mode:hover,
.map-mode:focus-visible,
.map-mode.active {
  background: #17211f;
  color: #fffdf6;
  outline: none;
}

.map-stage {
  position: relative;
  min-height: 560px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid #d8d0bd;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 246, 0.88), rgba(238, 243, 239, 0.86)),
    #eef3ef;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.map-stage.dragging {
  cursor: grabbing;
}

.map-stage__controls {
  position: absolute;
  inset: 12px 12px auto auto;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(23, 33, 31, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.92);
  box-shadow: 0 10px 28px rgba(54, 42, 23, 0.12);
  backdrop-filter: blur(12px);
}

.map-control {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8d0bd;
  border-radius: 999px;
  background: #fffaf0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.map-control:hover,
.map-control:focus-visible {
  background: #17211f;
  color: #fffdf6;
  outline: none;
}

.map-control:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.map-street-toggle {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid #d8d0bd;
  border-radius: 999px;
  background: #fffaf0;
  color: #44504d;
  font-size: 0.74rem;
  font-weight: 950;
  cursor: pointer;
}

.map-street-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
}

.map-attribution {
  position: absolute;
  inset: auto 12px 10px auto;
  z-index: 2;
  display: none;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 253, 246, 0.82);
  color: #44504d;
  font-size: 0.64rem;
  font-weight: 800;
}

.map-stage.streets-on .map-attribution {
  display: block;
}

.constituency-map {
  width: min(100%, 760px);
  height: min(74vh, 760px);
  min-height: 520px;
  display: block;
  position: relative;
  z-index: 1;
  transform-origin: center center;
  transition: transform 120ms ease;
}

.map-stage.dragging .constituency-map {
  transition: none;
}

.map-streets,
.map-street-tile {
  pointer-events: none;
}

.map-street-tile {
  opacity: 0.82;
}

.map-seat {
  stroke: rgba(23, 33, 31, 0.52);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: opacity 140ms ease, filter 140ms ease, stroke-width 140ms ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.constituency-map.streets-on .map-seat {
  fill-opacity: 0.22;
  stroke: rgba(23, 33, 31, 0.74);
  stroke-width: max(0.11px, calc(1px / var(--map-zoom, 1)));
}

.map-seat:hover,
.map-seat:focus-visible {
  filter: brightness(1.06) saturate(1.1);
  stroke: #17211f;
  stroke-width: max(0.18px, calc(1.5px / var(--map-zoom, 1)));
  outline: none;
}

.map-seat.dimmed {
  opacity: 0.18;
}

.map-seat.selected {
  stroke: #17211f;
  stroke-width: max(0.22px, calc(2px / var(--map-zoom, 1)));
  opacity: 1;
}

.constituency-map.streets-on .map-seat.selected {
  fill-opacity: 0.14;
  stroke: rgba(23, 33, 31, 0.68);
  stroke-width: max(0.14px, calc(1.15px / var(--map-zoom, 1)));
}

.map-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.map-footer strong,
.map-footer span {
  display: block;
}

.map-footer span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.map-footer a {
  color: var(--blue);
  text-decoration: none;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.map-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf0;
  color: #44504d;
  font-size: 0.78rem;
  font-weight: 900;
}

.map-legend__item--button {
  appearance: none;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.map-legend__item--button:hover,
.map-legend__item--button:focus-visible,
.map-legend__item--button.active {
  border-color: var(--swatch);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--swatch) 20%, transparent);
  outline: none;
  transform: translateY(-1px);
}

.map-legend__item--button.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--swatch) 12%, #fffdf6), #fffaf0);
}

.map-legend__label {
  display: grid;
  gap: 1px;
  line-height: 1.05;
}

.map-legend__item small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.map-legend__swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.map-detail {
  display: grid;
  gap: 12px;
}

.map-detail__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--seat-color) 44%, #d8d0bd);
  border-radius: 8px;
  background: #fffaf0;
}

.map-detail__cell {
  min-width: 0;
  min-height: 82px;
  display: grid;
  align-content: space-between;
  gap: 6px;
  padding: 10px;
  border-right: 1px solid #e5dcc9;
  border-bottom: 1px solid #e5dcc9;
  background: rgba(255, 253, 246, 0.72);
}

.map-detail__cell:nth-child(2n) {
  border-right: 0;
}

.map-detail__cell:nth-last-child(-n + 1) {
  border-bottom: 0;
}

.map-detail__cell:nth-child(7) {
  grid-column: 1 / -1;
  border-right: 0;
}

.map-detail__cell--seat,
.map-detail__cell--lead {
  grid-column: 1 / -1;
}

.map-detail__cell--seat {
  min-height: 104px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--seat-color) 14%, transparent), transparent 72%),
    #fffdf6;
  border-left: 5px solid var(--seat-color);
}

.map-detail__cell span:first-child {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.map-detail__cell strong {
  display: block;
  min-width: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 4vw, 1.9rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.map-detail__cell--lead strong {
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.25;
}

.map-detail__cell small {
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.map-detail__brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--seat-color) 36%, #d8d0bd);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--seat-color) 10%, #fffdf6), #fffdf6 72%);
}

.map-detail__brand strong,
.map-detail__brand span:not(.party-logo) {
  display: block;
}

.map-detail__brand span:not(.party-logo) {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.map-party-spotlight {
  display: grid;
  gap: 12px;
}

.map-party-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--seat-color) 44%, #d8d0bd);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--seat-color) 17%, #fffdf6), #fffdf6 70%);
}

.map-party-hero span:not(.party-logo),
.map-party-hero small,
.map-party-hero__count span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.map-party-hero strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.05;
}

.map-party-hero small {
  display: block;
  margin-top: 2px;
  line-height: 1.25;
}

.map-party-hero__count {
  text-align: right;
}

.map-party-hero__count b {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 9vw, 4.7rem);
  line-height: 0.85;
}

.map-party-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.map-party-metrics div {
  min-height: 72px;
  padding: 10px;
  border: 1px solid #e5dcc9;
  border-radius: 8px;
  background: #fffaf0;
}

.map-party-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.map-party-metrics strong {
  display: block;
  margin-top: 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1;
}

.map-party-seat-list {
  max-height: 420px;
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 4px;
}

.map-party-seat {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  align-items: baseline;
  padding: 10px;
  border: 1px solid #e5dcc9;
  border-radius: 8px;
  background: #fffdf6;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.map-party-seat:hover,
.map-party-seat:focus-visible {
  border-color: var(--seat-color);
  box-shadow: inset 4px 0 0 var(--seat-color);
  outline: none;
}

.map-party-seat span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 950;
}

.map-party-seat strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.map-party-seat small {
  grid-column: 2;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

canvas {
  width: min(100%, 340px);
  height: auto;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(31, 159, 120, 0.18);
}

.table-wrap {
  max-height: 640px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #efe3ca;
  color: #35403d;
  text-align: left;
  text-transform: uppercase;
  font-size: 0.72rem;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e5dcc9;
  vertical-align: middle;
}

tbody tr {
  cursor: pointer;
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(31, 159, 120, 0.08);
}

.party-pill,
.status-pill,
.forecast-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--pill-bg);
  color: var(--pill-ink);
}

.party-pill--brand {
  gap: 6px;
  padding-left: 4px;
  border: 1px solid color-mix(in srgb, var(--pill-ring) 72%, transparent);
}

.party-pill__mark {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--pill-ring);
  color: var(--pill-mark-ink);
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
}

.party-logo {
  display: inline-grid !important;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 253, 246, 0.94);
  border-radius: 999px;
  background: var(--logo-bg);
  color: var(--logo-ink) !important;
  box-shadow:
    inset 0 0 0 1px rgba(23, 33, 31, 0.16),
    0 1px 3px rgba(23, 33, 31, 0.18);
  overflow: hidden;
}

.party-logo svg {
  width: 86%;
  height: 86%;
  display: block;
}

.party-logo svg * {
  vector-effect: non-scaling-stroke;
}

.party-logo .logo-detail {
  fill: var(--logo-detail);
}

.party-logo--pill {
  width: 24px;
  height: 24px;
  border-width: 1px;
}

.party-logo--legend {
  width: 32px;
  height: 32px;
}

.party-logo--detail {
  width: 58px;
  height: 58px;
}

.party-logo--hero {
  width: 62px;
  height: 62px;
}

.status-pill {
  --pill-bg: #eee7d8;
  --pill-ink: #49514f;
}

.status-pill.declared {
  --pill-bg: #d8efe6;
  --pill-ink: #116147;
}

.forecast-pill {
  --pill-bg: #eee7d8;
  --pill-ink: #49514f;
  border: 0;
  cursor: pointer;
}

.forecast-pill.official {
  --pill-bg: #d8efe6;
  --pill-ink: #116147;
}

.forecast-pill.locked {
  --pill-bg: #17211f;
  --pill-ink: #fffdf6;
}

.forecast-pill.manual {
  --pill-bg: #c44536;
  --pill-ink: #fffdf6;
}

.forecast-pill.strong {
  --pill-bg: #f0bc4f;
  --pill-ink: #17211f;
}

.forecast-pill.likely {
  --pill-bg: #dde8f2;
  --pill-ink: #1d5684;
}

.forecast-pill.open,
.forecast-pill.pending,
.forecast-pill.unknown {
  --pill-bg: #eee7d8;
  --pill-ink: #49514f;
}

.candidate-detail {
  display: grid;
  gap: 12px;
}

.candidate-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #e5dcc9;
}

.candidate-row:last-child {
  border-bottom: 0;
}

.candidate-row strong {
  display: block;
}

.candidate-row span,
.muted {
  color: var(--muted);
}

.candidate-votes {
  text-align: right;
  font-weight: 900;
}

.detail-meta {
  padding: 12px;
  background: #f5ecd9;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #44504d;
  font-weight: 800;
}

.detail-meta--estimate {
  background: #eaf5ef;
  border-color: #b6d8ca;
  color: #13523f;
}

.manual-lock-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.manual-lock-toggle {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #c44536;
  border-radius: 999px;
  background: #fffdf6;
  color: #9e3028;
  font-weight: 950;
  cursor: pointer;
}

.manual-lock-toggle:hover,
.manual-lock-toggle:focus-visible,
.manual-lock-toggle.active {
  background: #c44536;
  color: #fffdf6;
  outline: none;
}

.manual-lock-note {
  color: var(--muted);
  font-weight: 900;
}

.notice {
  min-height: 24px;
  margin: 16px 4px 0;
  color: var(--muted);
  font-weight: 800;
}

.loading {
  opacity: 0.68;
}

@media (max-width: 1040px) {
  .masthead,
  .leader-grid,
  .estimator-grid,
  .map-grid,
  .workbench {
    grid-template-columns: 1fr;
  }

  .masthead__status {
    align-self: stretch;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 18px, 1500px);
    padding-top: 9px;
  }

  .masthead {
    padding: 22px;
  }

  .scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-tile strong {
    font-size: 2.35rem;
  }

  .filters {
    width: 100%;
    justify-content: stretch;
  }

  .map-tools {
    width: 100%;
    border-radius: 8px;
  }

  .map-mode {
    flex: 1;
  }

  .map-stage {
    min-height: 430px;
    padding: 6px;
  }

  .map-stage__controls {
    inset: auto 8px 8px 8px;
    justify-content: center;
    border-radius: 8px;
    flex-wrap: wrap;
  }

  .map-attribution {
    inset: 8px auto auto 8px;
  }

  .constituency-map {
    height: 520px;
    min-height: 420px;
  }

  .map-footer {
    display: grid;
  }

  .map-legend {
    justify-content: flex-start;
  }

  .estimator-info__grid {
    grid-template-columns: 1fr;
  }

  .party-metrics {
    grid-template-columns: 1fr;
  }

  .estimator-card__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .estimator-card__metrics div {
    min-height: 82px;
  }

  .estimator-card__metrics b {
    font-size: clamp(2.2rem, 12vw, 3.25rem);
  }

  .seat-detail-head {
    display: grid;
  }

  .seat-detail-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  input,
  select {
    width: 100%;
  }

  th:nth-child(2),
  td:nth-child(2),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }
}
