@font-face {
  font-family: Cinzel;
  src: url("../fonts/cinzel-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url("../fonts/outfit-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #070b14;
  --ink: #f4f0e6;
  --muted: #c9d0dc;
  --gold: #e6c56a;
  --gold-2: #f8e7b0;
  --gold-deep: #a7843a;
  --line: rgba(214, 176, 92, 0.42);
  --line-soft: rgba(214, 176, 92, 0.2);
  --panel: rgba(12, 22, 40, 0.82);
  --sticky-h: 148px;
  --alp: #e23a3a;
  --lib: #3b78e0;
  --nat: #0d6a48;
  --grn: #2fbf64;
  --ind: #6eb6b2;
  --oth: #8d95a6;
  --serif: Cinzel, "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(56, 92, 150, 0.28), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(180, 140, 60, 0.08), transparent 45%),
    linear-gradient(180deg, #101a2e 0%, #070b14 38%, #05070d 100%);
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.38) 100%);
}

.page { position: relative; z-index: 1; }

img, svg { max-width: 100%; }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

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

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: #111;
  color: var(--gold-2);
  padding: 8px 12px;
  z-index: 80;
}

.skip:focus { top: 8px; }

.sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 11, 20, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}

.demo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 8px 12px;
  background: linear-gradient(90deg, #3a2a08, #6a5214 40%, #3a2a08);
  color: #fff6d8;
  text-align: center;
}

.demo-banner p {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.demo-controls { display: flex; gap: 8px; }

.demo-controls button,
.zoom button,
.nav a,
.chip,
.seat-row,
.break__plaque,
.selected-strip {
  min-height: 44px;
}

.demo-controls button,
.zoom button {
  border-radius: 999px;
  border: 1px solid rgba(255, 236, 190, 0.45);
  background: rgba(0, 0, 0, 0.25);
  padding: 0 14px;
}

.hero {
  width: min(1180px, calc(100% - 20px));
  margin: 0 auto;
  padding: 12px 0 8px;
  display: grid;
  gap: 10px;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.45rem, 7vw, 2.85rem);
  letter-spacing: 0.045em;
  text-transform: uppercase;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff6d4 0%, #e7c56a 46%, #b1843a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.hero__row, .live-cluster, .countdown {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ff5d5d, #c10818 70%);
  color: white;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  box-shadow: 0 0 16px rgba(255, 40, 50, 0.45);
}

.live-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  animation: blink 1.4s ease-in-out infinite;
}

.counted { margin: 0; color: var(--muted); }

.counted strong {
  color: var(--ink);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.count-track {
  display: block;
  width: min(180px, 40vw);
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.count-track i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #a7843a, #f3e2b0);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.countdown {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(16, 28, 52, 0.65);
}

.countdown__label, .countdown__when {
  color: var(--muted);
  font-size: 0.78rem;
}

.countdown strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  color: var(--gold-2);
}

.nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 10px 10px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
}

.nav a[aria-current="true"] {
  color: var(--gold-2);
  border-color: var(--line);
  background: rgba(230, 197, 106, 0.08);
}

.wrap {
  width: min(1180px, calc(100% - 20px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.section { padding-top: 18px; scroll-margin-top: var(--sticky-h); }

.panel {
  background: linear-gradient(180deg, rgba(18, 32, 58, 0.9), rgba(8, 14, 26, 0.92));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 236, 190, 0.14);
  padding: 14px;
}

.panel h2, .panel h3 {
  font-family: var(--serif);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-2);
  margin: 0;
}

.panel h2 { font-size: 1rem; }
.panel h3 { font-size: 0.92rem; margin-top: 14px; }

.panel__head, .map-toolbar, .list-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  align-items: end;
  margin-bottom: 10px;
}

.panel__kicker, .sim-clock, .fine {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.map-stage {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(420px 220px at 58% 48%, rgba(48, 92, 140, 0.28), transparent 70%),
    linear-gradient(180deg, #0c1c32, #07111e);
  min-height: 240px;
}

#district-map { display: block; width: 100%; height: auto; }

.seat {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  touch-action: manipulation;
}

.seat__fill {
  stroke: #071018;
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

.seat__gold {
  fill: #f2c14a;
  stroke: #ffe7a8;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.seat.is-selected { transform: translateY(-8px); }
.seat.is-selected .seat__gold { opacity: 1; }
.seat.is-doubt .seat__fill { stroke: #e6c56a; stroke-width: 1.8; }

.seat.is-changed .seat__fill { animation: seatflash 0.55s ease; }

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--gold-2);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  list-style: none;
  padding: 10px 2px 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.legend li { display: inline-flex; align-items: center; gap: 6px; }

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--swatch, #888);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.zoom { display: flex; gap: 8px; }

.zoom button[aria-pressed="true"] {
  background: rgba(230, 197, 106, 0.18);
  color: var(--gold-2);
  border-color: var(--gold);
}

.selected-strip {
  width: 100%;
  margin-top: 10px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
}

.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.92);
  border: 1px solid var(--line);
  color: var(--gold-2);
  font-size: 0.82rem;
  transform: translate(var(--x, 0), var(--y, 0));
}

.detail-panel { overflow: auto; }

#detail-body {
  transition: opacity 0.28s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

#detail-body.is-swap {
  opacity: 0;
  transform: translateX(18px);
}

#hemicycle circle {
  transform-box: fill-box;
  transform-origin: center;
}

#hemicycle circle.pop { animation: dotin 0.55s ease; }

.detail-kicker {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.detail h3 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 4px 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-2);
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }

.badge {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 9px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge--gain { color: #1a1203; background: linear-gradient(180deg, #ffe7a8, #e6c56a); border-color: transparent; }
.badge--doubt { color: #ffe7a8; border-color: #e6c56a; }
.badge--called { color: white; background: rgba(226, 58, 58, 0.25); }

.cand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 30%, #3a4d6e, #172033);
  box-shadow: 0 0 0 3px var(--ring, var(--gold));
}

.avatar svg { width: 28px; height: 28px; fill: #d5deea; }

.cand small { display: block; color: var(--muted); }

.cand b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.bar, .split {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 6px;
}

.bar > i, .split i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.split { height: 16px; }
.split i { position: absolute; top: 0; left: 0; }
.split .is-right { transform-origin: right center; }

.others { margin: 4px 0 8px; }
.others li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.tcp-label, .swing-line, .last-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
}

.swing-line strong { color: var(--gold-2); font-size: 1.15rem; }

.booths {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.booths li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.booths li.is-wait { color: var(--muted); }

.grid-stats, .grid-main { display: grid; gap: 14px; }

.stat-figure {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6vw, 3.3rem);
  line-height: 0.95;
  margin: 6px 0;
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}

.spark { width: 100%; height: 36px; display: block; }
.spark path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tally-legend, .tpp-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.tpp-readout { justify-content: space-between; }
.tpp-readout strong {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

#swingometer { width: 100%; height: auto; display: block; }

.needle { transition: none; }

.search {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  padding: 0 14px;
  font-size: 16px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.chip {
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: transparent;
  padding: 0 14px;
}

.chip[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(230, 197, 106, 0.14);
  color: var(--gold-2);
}

.seat-list { display: grid; gap: 8px; }

.seat-row {
  width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(8, 14, 28, 0.72);
  padding: 8px 12px;
}

.seat-row.is-selected { border-color: var(--gold); }

.seat-row b { display: block; font-weight: 600; }
.seat-row span { color: var(--muted); font-size: 0.85rem; }

.mini {
  width: 72px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mini i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: var(--row, var(--gold));
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.empty, .detail-wait, .feed-error {
  color: var(--muted);
  padding: 12px 0;
}

.notes h2 { font-family: var(--serif); color: var(--gold-2); letter-spacing: 0.06em; }
.notes a { color: var(--gold-2); }
.notes ul { padding-left: 1.1rem; }
.notes li { margin: 6px 0; }

.foot {
  width: min(1180px, calc(100% - 20px));
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 0.8rem;
}

.break {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--sticky-h) + 8px);
  z-index: 45;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-14px);
}

.break.is-on {
  opacity: 1;
  transform: none;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.break__frame {
  pointer-events: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
  max-width: min(720px, 100%);
}

.break__plaque {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  border: 0;
  color: var(--gold-2);
  background:
    linear-gradient(180deg, rgba(22, 34, 58, 0.96), rgba(10, 16, 30, 0.96)) padding-box,
    linear-gradient(90deg, #8a6a2e, #fff0c2, #8a6a2e) border-box;
  border: 1px solid transparent;
  padding: 10px 28px;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--serif);
  font-size: clamp(0.78rem, 2.6vw, 1rem);
}

.break__shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 244, 210, 0.55) 50%, transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
}

.break.is-on .break__shimmer { animation: sweep 1.5s ease 0.15s 1; }

.fatal { margin-top: 18px; }

@media (hover: hover) and (pointer: fine) {
  .seat:hover { transform: translateY(-6px); }
  .seat:hover .seat__gold { opacity: 0.72; }
  .seat.is-selected:hover { transform: translateY(-8px); }
  .seat.is-selected:hover .seat__gold { opacity: 1; }
}

@media (max-width: 719px) {
  .hero { padding: 6px 0 2px; gap: 6px; }
  .hero h1 { font-size: 1.35rem; letter-spacing: 0.03em; }
  .eyebrow { margin-bottom: 2px; }
  .countdown { padding: 6px 10px; }
  .countdown__when { display: none; }
  .demo-banner { padding: 6px 8px; }
  .nav { padding-bottom: 6px; }
  .map-stage { min-height: 0; }
}

@media (min-width: 720px) {
  .hero { grid-template-columns: 1fr auto; align-items: end; }
  .countdown { justify-content: flex-end; text-align: right; }
  .hero h1 { letter-spacing: 0.08em; }
}

@media (min-width: 980px) {
  .grid-main { grid-template-columns: 1.35fr 0.9fr; align-items: start; }
  .grid-stats { grid-template-columns: 0.86fr 1.15fr 1fr; }
  .detail-panel {
    position: sticky;
    top: calc(var(--sticky-h) + 12px);
    max-height: calc(100vh - var(--sticky-h) - 24px);
  }
  .map-stage { min-height: 520px; }
}

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(22px);
  }
  .js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes sweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

@keyframes seatflash {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@keyframes dotin {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
