/* ============================================================
   Coalitiebouwer — Tweede Kamer, peiling De Hond
   ============================================================ */

:root {
  --paper: #f3efe4;
  --paper-2: #fbf9f3;
  --paper-3: #ebe5d6;
  --ink: #121469;
  --ink-soft: #2b2c68;
  --muted: #5f5c6b;
  --line: #d7d0be;
  --line-dark: rgba(18, 20, 105, 0.24);
  --red: #c8102e;
  --red-dark: #9b0b23;
  --amber: #d8892b;
  --amber-light: #f0b35a;
  --green: #1c7a4d;
  --green-bright: #2e9e67;
  --white: #fffdf8;
  --font: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 28px 70px -48px rgba(18, 20, 105, 0.6);
  --radius: 3px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[id] {
  scroll-margin-top: 94px;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(18, 20, 105, 0.045) 0.55px, transparent 0.55px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 420px);
  background-size: 20px 20px, auto;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.alarm-open {
  overflow: hidden;
}

::selection {
  background: var(--red);
  color: var(--white);
}

h1, h2, h3, p, ul {
  margin: 0;
}

button, input {
  font: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

.wrap {
  width: min(1240px, calc(100% - 64px));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 300;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.noscript {
  width: min(1240px, calc(100% - 64px));
  margin: 16px auto 0;
  padding: 12px 14px;
  border-left: 3px solid var(--red);
  background: rgba(200, 16, 46, 0.06);
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---------- typography ---------- */

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.eyebrow-light {
  color: rgba(255, 253, 248, 0.54);
}

h1, h2, h3 {
  font-weight: 800;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  border-bottom: 1px solid var(--line-dark);
  background: rgba(243, 239, 228, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
}

.brand-mark svg {
  width: 31px;
  height: 31px;
}

.brand-text {
  display: block;
}

.brand-text strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.13em;
  line-height: 1.1;
  text-transform: uppercase;
}

.brand-text small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.poll-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.poll-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.header-seats {
  padding-left: 20px;
  border-left: 1px solid var(--line-dark);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-seats strong {
  margin-right: 2px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 64px;
  align-items: end;
  padding: 76px 0 46px;
}

.hero-copy {
  max-width: 800px;
}

.hero h1 {
  margin: 16px 0 22px;
  font-size: clamp(3.2rem, 7.4vw, 6.5rem);
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 0.88;
}

.hl {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 0.075em;
  text-underline-offset: 0.06em;
}

.lede {
  max-width: 610px;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.4vw, 1.16rem);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 13px 19px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.075em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.button-primary {
  background: var(--ink);
  color: var(--paper);
}

.button-primary:hover {
  background: #1c1f8d;
  transform: translateY(-1px);
}

.button-quiet {
  border-color: var(--line-dark);
  background: transparent;
}

.button-quiet:hover {
  border-color: var(--ink);
  background: rgba(18, 20, 105, 0.04);
}

.button-danger {
  background: var(--red);
  color: var(--white);
}

.button-danger:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.hero-note {
  padding-top: 18px;
  border-top: 3px solid var(--ink);
}

.hero-number {
  margin: 10px 0 6px;
  font-size: clamp(3.4rem, 5vw, 4.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: -0.07em;
  line-height: 0.85;
}

.hero-number span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.28em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-note-copy {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.hero-note-copy strong {
  font-weight: 800;
}

.hero-rule {
  width: 44px;
  height: 2px;
  margin: 18px 0 12px;
  background: var(--red);
}

.hero-source {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.hero-source a {
  text-decoration-color: var(--line-dark);
  text-underline-offset: 2px;
}

/* ---------- meter ---------- */

.meter-card {
  position: relative;
  overflow: hidden;
  padding: 38px 42px 32px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.meter-glow {
  position: absolute;
  top: -330px;
  right: -150px;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.07), transparent 66%);
  pointer-events: none;
}

.meter-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 108px;
  height: 3px;
  background: var(--red);
  content: "";
}

.meter-top {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.meter-count {
  min-width: 0;
}

.count-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 10px 0 19px;
}

#seatCount {
  font-size: clamp(4.2rem, 8.6vw, 7.2rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.76;
}

.count-total {
  color: rgba(255, 253, 248, 0.38);
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.meter-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 253, 248, 0.26);
  border-radius: 999px;
  color: rgba(255, 253, 248, 0.75);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.status-pill.is-minority {
  border-color: rgba(240, 179, 90, 0.55);
  color: var(--amber-light);
}

.status-pill.is-majority {
  border-color: var(--green-bright);
  background: var(--green-bright);
  color: #fff;
}

.status-hint {
  color: rgba(255, 253, 248, 0.64);
  font-size: 12px;
  font-weight: 500;
}

.meter-side {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 5px;
  color: rgba(255, 253, 248, 0.45);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.meter-side-rule {
  width: 18px;
  height: 1px;
  background: rgba(255, 253, 248, 0.25);
}

.progress {
  position: relative;
  margin-top: 32px;
  padding-top: 20px;
}

.progress-track {
  position: relative;
  height: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 253, 248, 0.13);
  background: rgba(255, 253, 248, 0.09);
}

.progress-ticks {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(6.6667% - 1px),
    rgba(255, 253, 248, 0.11) calc(6.6667% - 1px),
    rgba(255, 253, 248, 0.11) 6.6667%
  );
}

.progress-fill {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 2px;
  width: 0;
  height: 100%;
  transition: width 0.55s cubic-bezier(0.22, 0.75, 0.22, 1);
}

.progress-segment {
  height: 100%;
  min-width: 1px;
  background: var(--party);
  transition: flex-grow 0.4s ease;
}

.progress-marker {
  position: absolute;
  top: 20px;
  bottom: 0;
  left: 50.6667%;
  z-index: 3;
  width: 2px;
  margin-left: -1px;
  background: var(--paper);
}

.marker-flag {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  padding: 2px 6px;
  border-radius: 1px;
  background: var(--paper);
  color: var(--ink);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.35;
  transform: translateX(-50%);
  transition: background 0.25s ease, color 0.25s ease;
}

.meter-card.is-majority .progress-marker {
  background: var(--green-bright);
}

.meter-card.is-majority .marker-flag {
  background: var(--green-bright);
  color: #fff;
}

.meter-card.just-majority {
  animation: majorityPulse 1.15s ease-out;
}

.progress-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  color: rgba(255, 253, 248, 0.4);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scale-majority {
  color: var(--amber-light);
}

#progressA11y {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- dashboard ---------- */

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(320px, 0.88fr);
  gap: 20px;
  align-items: start;
  margin-top: 20px;
}

.chamber-card,
.coalition-card {
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.chamber-card {
  min-width: 0;
  padding: 26px 28px 16px;
}

.coalition-card {
  padding: 26px 24px 24px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.card-head h2 {
  margin-top: 5px;
}

.chamber-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 4px;
}

.chamber-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: rgba(18, 20, 105, 0.13);
}

.legend-dot-full {
  border-color: var(--ink);
  background: var(--ink);
}

.hemicycle {
  margin: 8px auto 0;
  max-width: 720px;
}

.hemicycle svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.seat {
  cursor: pointer;
  opacity: 0.24;
  stroke: var(--paper-2);
  stroke-width: 1.15;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), stroke 0.35s ease;
}

.seat:hover {
  opacity: 0.55;
}

.seat.is-coalition {
  opacity: 1;
  stroke: rgba(255, 253, 248, 0.78);
  transform: scale(1.08);
}

.seat.is-coalition:hover {
  transform: scale(1.2);
}

.seat.is-cordon.is-coalition {
  stroke: #ffd9de;
}

.baseline {
  stroke: var(--line-dark);
  stroke-width: 1;
}

.axis-label {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.chamber-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 2px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chamber-note {
  color: var(--ink);
  opacity: 0.55;
}

/* ---------- selected coalition ---------- */

.text-btn {
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid var(--line-dark);
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.text-btn:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--red);
}

.text-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.selection-warning {
  margin-top: 14px;
  padding: 8px 10px;
  border-left: 3px solid var(--red);
  background: rgba(200, 16, 46, 0.05);
  color: var(--red);
  font-size: 9.5px;
  line-height: 1.45;
}

.selection-warning strong {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.selected-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.selection-warning[hidden] {
  display: none;
}

.selected-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 26px;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 7px 7px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--party);
  background: #fff;
}

.selected-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.selected-name strong {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.selected-name span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.selected-cordon {
  flex: 0 0 auto;
  padding: 1px 4px;
  border: 1px solid rgba(200, 16, 46, 0.35);
  color: var(--red);
  font-size: 6.5px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

.selected-seats {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.s-remove {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.s-remove svg {
  width: 10px;
  height: 10px;
}

.s-remove:hover {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.coalition-tip {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px dashed var(--line-dark);
  background: rgba(18, 20, 105, 0.025);
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.5;
}

.coalition-tip strong {
  font-weight: 800;
}

.coalition-tip[hidden] {
  display: none;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 22px 16px;
  border: 1px dashed var(--line-dark);
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-mark {
  color: var(--line-dark);
}

.empty-mark svg {
  width: 44px;
  height: 30px;
}

.empty-state p {
  font-size: 11px;
  line-height: 1.55;
}

.empty-state strong {
  color: var(--ink);
  font-weight: 700;
}

.presets {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 11px;
}

.preset {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.preset:hover {
  border-color: var(--ink);
  background: #fff;
}

.preset.is-active {
  border-color: var(--ink);
  background: rgba(18, 20, 105, 0.055);
  box-shadow: inset 3px 0 0 var(--ink);
}

.preset-copy strong {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.preset-copy small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.preset-seats {
  flex: 0 0 auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--ink);
  border-radius: 1px;
  background: transparent;
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.share-btn svg {
  width: 14px;
  height: 14px;
}

.share-btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.share-btn.is-copied {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

/* ---------- parties ---------- */

.parties {
  margin-top: 76px;
  padding-top: 42px;
  border-top: 1px solid var(--line-dark);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 36px;
  align-items: end;
}

.section-head h2 {
  margin-top: 7px;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  letter-spacing: -0.05em;
}

.section-lede {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.spectrum {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 30px 0 10px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.spectrum-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), var(--line-dark) 50%, var(--line));
}

.party-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.party-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 132px;
  padding: 14px 14px 12px 18px;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  background: var(--paper-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.party-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--party);
  content: "";
}

.party-card:hover {
  z-index: 2;
  border-color: var(--party);
  background: #fff;
  box-shadow: 0 16px 30px -24px rgba(18, 20, 105, 0.55);
  transform: translateY(-2px);
}

.party-card[aria-pressed="true"] {
  border-color: var(--party);
  background: color-mix(in srgb, var(--party) 8%, #fff);
  box-shadow: inset 0 0 0 1px var(--party);
}

.party-card.is-cordon::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
  background: linear-gradient(225deg, rgba(200, 16, 46, 0.9) 0 50%, transparent 50%);
  content: "";
}

.party-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.party-abbr {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1;
}

.party-seats {
  display: flex;
  align-items: baseline;
  gap: 3px;
  padding-top: 1px;
  font-variant-numeric: tabular-nums;
}

.party-seats strong {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1;
}

.party-seats span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.party-full {
  display: block;
  min-height: 25px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.35;
}

.party-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.delta {
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.delta-up {
  color: var(--green);
}

.delta-down {
  color: var(--red);
}

.delta-flat {
  color: var(--muted);
}

.cordon-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--red);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cordon-tag::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
  content: "";
}

.party-toggle {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.party-card[aria-pressed="true"] .party-toggle {
  border-color: var(--party);
  background: var(--party);
  color: #fff;
  font-size: 0;
}

.party-card[aria-pressed="true"] .party-toggle::before {
  width: 7px;
  height: 4px;
  border-bottom: 1.8px solid #fff;
  border-left: 1.8px solid #fff;
  content: "";
  transform: rotate(-45deg) translateY(-1px);
}

.cordon-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 11px 14px;
  border-left: 3px solid var(--red);
  background: rgba(200, 16, 46, 0.045);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.cordon-note strong {
  color: var(--ink);
  font-weight: 800;
}

.cordon-icon {
  flex: 0 0 auto;
  color: var(--red);
}

.cordon-icon svg {
  width: 16px;
  height: 16px;
}

/* ---------- how ---------- */

.how {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 48px;
  margin-top: 76px;
  padding: 42px 0 0;
  border-top: 1px solid var(--line-dark);
}

.how-head h2 {
  margin-top: 7px;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.how-grid article {
  padding-top: 12px;
  border-top: 2px solid var(--ink);
}

.how-num {
  color: var(--red);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.how-grid h3 {
  margin: 9px 0 7px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.how-grid p {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 76px;
  padding: 42px 0 46px;
  background: var(--ink);
  color: var(--paper);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr) auto;
  gap: 48px;
  align-items: start;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.brand-mark-small {
  width: 34px;
  height: 34px;
}

.brand-mark-small svg {
  width: 25px;
  height: 25px;
}

.footer-brand strong {
  display: block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.footer-brand p {
  margin-top: 5px;
  color: rgba(243, 239, 228, 0.55);
  font-size: 10px;
}

.footer-copy p {
  color: rgba(243, 239, 228, 0.6);
  font-size: 10.5px;
  line-height: 1.65;
}

.footer-copy p + p {
  margin-top: 10px;
}

.footer-copy a {
  color: rgba(243, 239, 228, 0.88);
  text-decoration-color: rgba(243, 239, 228, 0.35);
  text-underline-offset: 2px;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: rgba(243, 239, 228, 0.45);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: right;
  text-transform: uppercase;
}

/* ---------- alarm ---------- */

.alarm {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.alarm[hidden] {
  display: none;
}

.alarm-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(200, 16, 46, 0.34), transparent 52%),
    rgba(8, 9, 38, 0.84);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  animation: backdropIn 0.2s ease both;
}

.alarm-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border: 1px solid rgba(200, 16, 46, 0.75);
  background: var(--paper-2);
  box-shadow:
    0 40px 110px rgba(0, 0, 0, 0.5),
    0 0 0 9px rgba(200, 16, 46, 0.14),
    0 0 90px rgba(200, 16, 46, 0.35);
  animation: alarmIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.alarm-dialog.is-shaking {
  animation: alarmIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both, alarmShake 0.42s 0.3s ease-in-out;
}

.alarm-hazard {
  height: 13px;
  background: repeating-linear-gradient(45deg, var(--red) 0 13px, var(--ink) 13px 26px);
}

.alarm-x {
  position: absolute;
  top: 27px;
  right: 14px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-dark);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.alarm-x svg {
  width: 14px;
  height: 14px;
}

.alarm-x:hover {
  background: var(--ink);
  color: var(--paper);
}

.alarm-body {
  padding: 30px 42px 24px;
  text-align: center;
}

.alarm-siren {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: 0 auto 14px;
}

.siren-core {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 0 7px rgba(200, 16, 46, 0.12);
}

.siren-core svg {
  width: 36px;
  height: 36px;
}

.siren-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(200, 16, 46, 0.4);
  border-radius: 50%;
  animation: sirenPulse 1.9s ease-out infinite;
}

.siren-ring-2 {
  animation-delay: 0.55s;
}

.alarm-kicker {
  color: var(--red);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
  line-height: 1.3;
  text-transform: uppercase;
}

.alarm-title {
  margin: 10px 0 12px;
  color: var(--ink);
  font-size: clamp(2.35rem, 5.8vw, 4.15rem);
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 0.9;
  text-transform: uppercase;
}

.alarm-text {
  max-width: 500px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.alarm-party {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 18px 0 14px;
}

.alarm-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--party);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.alarm-chip i {
  width: 9px;
  height: 9px;
  background: var(--party);
}

.alarm-chip small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.alarm-line {
  margin: 0 0 19px;
  color: var(--red);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.alarm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.alarm-sound {
  margin-top: 14px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line-dark);
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.6;
  text-transform: uppercase;
  cursor: pointer;
}

.alarm-sound:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ---------- animation ---------- */

@keyframes majorityPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 158, 103, 0.55), var(--shadow);
  }
  55% {
    box-shadow: 0 0 0 10px rgba(46, 158, 103, 0), var(--shadow);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 158, 103, 0), var(--shadow);
  }
}

@keyframes sirenPulse {
  0% {
    opacity: 0.8;
    transform: scale(0.78);
  }
  75%,
  100% {
    opacity: 0;
    transform: scale(1.42);
  }
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes alarmIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes alarmShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 44px;
  }

  .dashboard {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  }

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

  .footer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  }

  .footer-meta {
    display: none;
  }
}

@media (max-width: 960px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .coalition-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 28px;
  }

  .coalition-card .card-head,
  .coalition-card .selected-list,
  .coalition-card .empty-state,
  .coalition-card .share-btn {
    grid-column: 1;
  }

  .coalition-card .presets {
    grid-column: 2;
    grid-row: 1 / span 4;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .coalition-card .share-btn {
    align-self: end;
    margin-top: 14px;
  }

  .how {
    grid-template-columns: 1fr;
    gap: 26px;
  }

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

@media (max-width: 800px) {
  .wrap {
    width: calc(100% - 40px);
  }

  .header-inner {
    min-height: 68px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-mark svg {
    width: 27px;
    height: 27px;
  }

  .brand-text strong {
    font-size: 11px;
  }

  .brand-text small {
    font-size: 9px;
  }

  .poll-pill {
    display: none;
  }

  .header-seats {
    padding-left: 0;
    border-left: 0;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 54px 0 34px;
  }

  .hero h1 {
    font-size: clamp(3.2rem, 13vw, 5.4rem);
  }

  .hero-note {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 20px;
    align-items: start;
    padding-top: 14px;
  }

  .hero-note .eyebrow {
    grid-column: 1 / -1;
  }

  .hero-number {
    margin: 8px 0 0;
    font-size: 3.1rem;
  }

  .hero-note-copy {
    align-self: center;
    max-width: 260px;
  }

  .hero-rule,
  .hero-source {
    grid-column: 1 / -1;
  }

  .hero-rule {
    margin: 14px 0 10px;
  }

  .meter-card {
    padding: 28px 22px 24px;
  }

  .meter-top {
    display: block;
  }

  .meter-side {
    display: none;
  }

  #seatCount {
    font-size: clamp(4rem, 18vw, 6rem);
  }

  .progress {
    margin-top: 26px;
  }

  .dashboard {
    margin-top: 14px;
  }

  .chamber-card {
    padding: 20px 14px 14px;
  }

  .chamber-legend {
    display: none;
  }

  .chamber-foot {
    font-size: 8px;
  }

  .coalition-card {
    display: block;
    padding: 22px 18px;
  }

  .coalition-card .presets {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  .parties {
    margin-top: 56px;
    padding-top: 32px;
  }

  .section-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section-lede {
    max-width: 500px;
  }

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

  .party-card {
    min-height: 124px;
    padding: 13px 12px 11px 16px;
  }

  .party-abbr {
    font-size: 1.25rem;
  }

  .party-seats strong {
    font-size: 1.4rem;
  }

  .party-full {
    min-height: 24px;
    font-size: 8px;
  }

  .how {
    margin-top: 56px;
    padding-top: 32px;
  }

  .how-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .site-footer {
    margin-top: 56px;
    padding: 34px 0 38px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .alarm {
    padding: 14px;
  }

  .alarm-dialog {
    max-height: calc(100dvh - 28px);
  }

  .alarm-body {
    padding: 24px 20px 20px;
  }

  .alarm-title {
    font-size: clamp(2.1rem, 9.5vw, 3.2rem);
  }

  .alarm-x {
    top: 24px;
    right: 10px;
  }
}

@media (max-width: 440px) {
  .header-seats {
    font-size: 8px;
  }

  .header-seats strong {
    font-size: 14px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button {
    width: 100%;
  }

  .meter-status {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .chamber-note {
    display: none;
  }

  .alarm-actions {
    flex-direction: column-reverse;
  }

  .alarm-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .site-header,
  .hero-actions,
  .share-btn,
  .presets,
  .alarm,
  .site-footer {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .meter-card {
    color: #000;
    background: #fff;
    border: 1px solid #000;
    box-shadow: none;
  }
}
