:root {
  --ink: #172026;
  --muted: #5c6764;
  --line: rgba(23, 32, 38, 0.1);
  --panel: #f4f4f2;
  --panel-2: #f4f5f4;
  --await: #8a6230;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--panel);
  color: var(--ink);
  font-family: "Source Sans 3", sans-serif;
}

.app {
  display: flex;
  gap: 12px;
  height: 100%;
  height: 100dvh;
  padding: 12px;
  background: #f4f4f2;
}

.ticker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  align-items: stretch;
  height: 36px;
  background: #bb1919;
  color: #fff;
  overflow: hidden;
}

.ticker[hidden] { display: none; }

.ticker-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex: none;
  margin: 0;
  padding: 0 14px;
  background: #9e1212;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

.ticker-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 18px), transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-run linear infinite;
  animation-duration: var(--ticker-time, 28s);
}

.ticker-track span {
  flex: none;
  padding-right: 2.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

@keyframes ticker-run {
  from { transform: translateX(0); }
  to { transform: translateX(calc(var(--shift, 50%) * -1)); }
}

html.has-ticker,
html.has-ticker body {
  height: 100dvh;
  overflow: hidden;
}

html.has-ticker body {
  padding-top: 36px;
}

html.has-ticker .app {
  height: 100%;
  margin-top: 0;
}

.panel {
  --ink: #172026;
  --muted: #5c6764;
  --line: rgba(23, 32, 38, 0.1);
  --panel-2: #f4f5f4;
  --await: #8a6230;
  position: relative;
  z-index: 1;
  flex: 0 0 min(268px, calc(100% - 320px));
  width: min(268px, calc(100% - 320px));
  height: 100%;
  display: flex;
  flex-direction: column;
  max-height: none;
  overflow: hidden;
  transition: flex-basis 0.55s cubic-bezier(0.4, 0, 0.2, 1), width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 12px 12px 8px;
  border: 1px solid rgba(23, 32, 38, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 12px 36px rgba(23, 32, 38, 0.12);
}

.mast {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--await);
}

h1 {
  margin: 4px 0 0;
  font-family: Fraunces, serif;
  font-size: 1.32rem;
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.when {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  order: 4;
  margin: 8px 0 0;
  padding: 3px 8px;
  border: 1px solid rgba(138, 98, 48, 0.35);
  border-radius: 999px;
  color: var(--await);
  font-size: 0.78rem;
  font-weight: 700;
}

.status.is-flowing {
  order: -1;
  width: 100%;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: rgba(138, 98, 48, 0.1);
  font-size: 0.95rem;
}

.status.is-flowing::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--await);
  box-shadow: 0 0 0 0 rgba(138, 98, 48, 0.4);
  animation: status-live 2.4s ease-out infinite;
}

#status-meta {
  margin-left: auto;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.status-meter {
  flex: 1 0 100%;
  height: 5px;
  margin-top: 8px;
  border-radius: 99px;
  background: rgba(138, 98, 48, 0.16);
  overflow: hidden;
}

.status-meter::before {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--share, 0) * 1%);
  border-radius: inherit;
  background: var(--await);
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes status-live {
  0% { box-shadow: 0 0 0 0 rgba(138, 98, 48, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(138, 98, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(138, 98, 48, 0); }
}

.sample {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #3a2a12;
  color: #f3d7a1;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.totals {
  display: flex;
  flex-direction: column;
  margin: 14px 0 12px;
  border: 1px solid rgba(138, 98, 48, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(138, 98, 48, 0.07), rgba(138, 98, 48, 0.02) 28px, #fff 28px);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.08);
  overflow: hidden;
}

.totals div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 11px;
  background: transparent;
  border-radius: 0;
}

.totals div + div {
  border-top: 1px solid rgba(23, 32, 38, 0.08);
}

.totals span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.totals strong {
  margin: 0;
  font-family: Fraunces, serif;
  font-size: 1.42rem;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: var(--ink);
}

.totals strong b {
  font-weight: inherit;
}

.totals strong em {
  margin-left: 1px;
  font-family: "Source Sans 3", sans-serif;
  font-style: normal;
  font-size: 0.58em;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--muted);
}

.count-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.count-line .progress-track {
  grid-column: 1 / -1;
  height: 6px;
  margin: 2px 0 0;
  border-radius: 99px;
  background: rgba(138, 98, 48, 0.14);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: #8a6230;
}

.search {
  display: block;
}

.search span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.search input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f8f7;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.search input:focus {
  outline: 2px solid rgba(215, 196, 163, 0.55);
  border-color: transparent;
}

.hits {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.hits button {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hits li:last-child button { border-bottom: 0; }

.hits button:hover,
.hits button:focus { background: #eef0ee; }

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

.candidates {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.candidate {
  padding: 5px 0 4px;
  border-top: 1px solid var(--line);
}

.candidate header {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateY(1px);
}

.candidate h2 {
  margin: 0;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate .count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.meta, .note {
  margin: 1px 0 0 18px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note { color: #8a5a12; }

.bar {
  height: 3px;
  margin: 4px 0 0 18px;
  border-radius: 99px;
  background: rgba(23, 32, 38, 0.08);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
}

.candidate.withdrawn { opacity: 0.72; }

#city-view,
#place-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
}

#city-view::-webkit-scrollbar,
#place-view::-webkit-scrollbar {
  display: none;
}

#city-view[hidden],
#place-view[hidden] { display: none; }

.panel.is-place {
  flex-basis: min(calc(220px + var(--place-cols, 1) * 128px), calc(100% - 280px));
  width: min(calc(220px + var(--place-cols, 1) * 128px), calc(100% - 280px));
}

.panel.is-place h1 {
  font-size: 1.15rem;
}

.panel.is-place .when,
.panel.is-place .status { margin-top: 4px; }

.place-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 14px;
}

.place-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 12px 0 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #172026;
  font: 700 1rem "Source Sans 3", sans-serif;
  cursor: pointer;
  transition: background 0.2s ease;
}

.place-back:hover { background: #f4f5f4; }

.place-back:focus-visible,
.sheet-close:focus-visible {
  outline: 2px solid #172026;
  outline-offset: 2px;
}

.rule, .sources {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.rule { margin: 4px 0 0; }

.sources { margin: 2px 0 0; }

.colophon {
  flex: none;
  margin: 10px 0 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.colophon-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 4px -4px 0;
  padding: 6px 6px 4px;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: background 0.2s ease;
}

.colophon-link:hover { background: var(--panel-2); }

.colophon-link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.colophon-link img {
  display: block;
  flex: none;
  width: 28px;
  height: 44px;
  object-fit: contain;
}

.colophon-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.colophon-kicker {
  color: var(--await);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.15;
  text-transform: uppercase;
}

.colophon-name {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: #f4f4f2;
}

.map-tools {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: min(280px, calc(100% - 28px));
  pointer-events: none;
}

.map-tools > * { pointer-events: auto; }

.map-switch {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.14);
}

.map-switch button {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.map-switch button[aria-pressed="true"] {
  background: #172026;
  color: #fff;
}

.district-menu[hidden] { display: none; }

.district-menu {
  width: min(260px, 70vw);
  max-height: min(220px, 32vh);
  overflow: auto;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(23, 32, 38, 0.16);
  scrollbar-width: none;
}

.district-menu::-webkit-scrollbar { display: none; }

.district-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 5px 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.district-menu button[aria-pressed="true"] { background: rgba(23, 32, 38, 0.06); }

.district-menu button span {
  width: 2.6rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.district-menu button strong {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 700;
}

.district-menu button i,
.map-legend i {
  flex: none;
  border-radius: 99px;
}

.district-menu button i {
  width: 9px;
  height: 9px;
}

.map-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 148px;
  padding: 8px 10px 7px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.12);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.map-legend i {
  width: 46px;
  height: 8px;
}

.legend-scale {
  display: flex;
  justify-content: space-between;
  margin: 0;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
}

#map {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: #f4f4f2;
}

.leaflet-container { font-family: "Source Sans 3", sans-serif; background: #f4f4f2; }

.leaflet-gl-layer { z-index: 1; }

.leaflet-overlay-pane svg path {
  transition: fill 0.18s ease, fill-opacity 0.18s ease, stroke 0.18s ease, stroke-width 0.18s ease, stroke-opacity 0.18s ease;
  cursor: pointer;
}

.pkw-chip {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(340px, calc(100% - 40px));
  padding: 18px 20px 16px 16px;
  border: 1px solid rgba(138, 98, 48, 0.22);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(23, 32, 38, 0.16);
  pointer-events: none;
}

.pkw-mark {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
}

.pkw-mark::before,
.pkw-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.pkw-mark::after {
  inset: 14px;
  background: var(--await);
}

.pkw-chip[data-state="awaiting"] .pkw-mark::before,
.pkw-chip[data-state="partial"] .pkw-mark::before,
.pkw-chip[data-state="sample"] .pkw-mark::before {
  inset: 0;
  background: transparent;
  border: 2px solid rgba(138, 98, 48, 0.5);
  animation: pkw-wait 2.4s ease-out infinite;
}

.pkw-chip[data-state="partial"] .pkw-mark {
  width: 58px;
  height: 58px;
}

.pkw-chip[data-state="partial"] .pkw-mark::before {
  display: none;
}

.pkw-chip[data-state="partial"] .pkw-mark::after {
  inset: 0;
  background:
    radial-gradient(circle at center, #fff 0 18px, transparent 19px),
    conic-gradient(from -90deg, var(--await) calc(var(--share) * 1%), rgba(138, 98, 48, 0.16) 0);
}

.pkw-chip[data-state="partial"] .pkw-copy strong,
.pkw-chip[data-state="full"] .pkw-copy strong {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--await);
}

.pkw-chip[data-state="partial"] #pkw-detail,
.pkw-chip[data-state="full"] #pkw-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.pkw-chip[data-state="partial"] #pkw-detail b,
.pkw-chip[data-state="full"] #pkw-detail b {
  font-family: Fraunces, serif;
  font-size: 2.6rem;
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--ink);
}

.pkw-chip[data-state="partial"] .pkw-track {
  height: 8px;
  margin-top: 8px;
}

.pkw-chip[data-state="full"] .pkw-mark::before { display: none; }

.pkw-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.pkw-copy strong {
  font-family: Fraunces, serif;
  font-size: 1.42rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

#pkw-detail {
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pkw-track {
  display: block;
  height: 5px;
  margin-top: 10px;
  border-radius: 99px;
  background: rgba(138, 98, 48, 0.14);
  overflow: hidden;
}

.pkw-track span {
  display: block;
  height: 100%;
  width: calc(var(--share) * 1%);
  border-radius: inherit;
  background: var(--await);
}

.pkw-chip[data-state="awaiting"] .pkw-track span,
.pkw-chip[data-state="sample"] .pkw-track span {
  width: 28%;
  animation: pkw-glide 2.2s ease-in-out infinite;
}

@keyframes pkw-wait {
  0% { transform: scale(0.55); opacity: 0.85; }
  70% { transform: scale(1); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes pkw-glide {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(380%); }
}

.runoff {
  position: absolute;
  z-index: 500;
  left: 50%;
  bottom: 22px;
  width: min(520px, calc(100% - 48px));
  padding: 16px 18px 14px;
  border: 1px solid rgba(23, 32, 38, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(23, 32, 38, 0.16);
  color: var(--ink);
  transform: translateX(-50%);
  animation: runoff-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.runoff-kicker {
  margin: 0;
  color: var(--await);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.runoff h2 {
  margin: 4px 0 0;
  font-family: Fraunces, serif;
  font-size: 1.7rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.runoff-when {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.runoff-places {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.runoff.is-elected .runoff-places { grid-template-columns: 1fr; }

.runoff-place {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-width: 0;
}

.runoff-mark {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.runoff-copy {
  min-width: 0;
}

.runoff-copy strong {
  display: block;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runoff-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.runoff-bar {
  grid-column: 2;
  height: 5px;
  border-radius: 99px;
  background: rgba(23, 32, 38, 0.08);
  overflow: hidden;
}

.runoff-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

@keyframes runoff-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 800;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -16px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% { opacity: 0; transform: translate3d(0, -8px, 0) rotate(0deg); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift), 108vh, 0) rotate(var(--spin)); }
}

@media (prefers-reduced-motion: reduce) {
  .runoff { animation: none; }
  .ticker-track { animation: none; }
  .confetti-piece { animation: none; display: none; }
  .panel { transition: none; }
  .status.is-flowing::before { animation: none; }
  .status-meter::before { transition: none; }
  .leaflet-overlay-pane svg path,
  .place-back,
  .sheet-close { transition: none; }
  .pkw-chip[data-state="awaiting"] .pkw-mark::before,
  .pkw-chip[data-state="partial"] .pkw-mark::before,
  .pkw-chip[data-state="sample"] .pkw-mark::before { animation: none; opacity: 0.55; transform: none; }
  .pkw-chip[data-state="awaiting"] .pkw-track span,
  .pkw-chip[data-state="sample"] .pkw-track span { animation: none; width: 0; }
}

@media (max-width: 860px) {
  .pkw-chip {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    width: auto;
    max-width: calc(100% - 72px);
    padding: 8px 12px 8px 8px;
    gap: 8px;
    border-radius: 16px;
  }

  .pkw-mark,
  .pkw-chip[data-state="partial"] .pkw-mark {
    width: 28px;
    height: 28px;
  }

  .pkw-mark::after { inset: 8px; }

  .pkw-chip[data-state="partial"] .pkw-mark::after {
    background:
      radial-gradient(circle at center, #fff 0 8px, transparent 9px),
      conic-gradient(from -90deg, var(--await) calc(var(--share) * 1%), rgba(138, 98, 48, 0.16) 0);
  }

  .pkw-chip[data-state="partial"] .pkw-copy strong,
  .pkw-chip[data-state="full"] .pkw-copy strong,
  .pkw-track { display: none; }

  .pkw-chip[data-state="partial"] #pkw-detail,
  .pkw-chip[data-state="full"] #pkw-detail {
    gap: 0;
  }

  .pkw-chip[data-state="partial"] #pkw-detail b,
  .pkw-chip[data-state="full"] #pkw-detail b {
    font-size: 1.7rem;
  }

  #pkw-detail { font-size: 0.84rem; }
}

.sheet-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #172026;
  cursor: pointer;
  transition: background 0.2s ease;
}

.sheet-close:hover { background: #e7e9e8; }

.popup-place {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  margin: 0 0 18px;
}

.popup-kicker {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--await);
}

.place-view h3,
#place-view h3 {
  margin: 2px 0 0;
  font-family: Fraunces, serif;
  font-size: 1.7rem;
  font-weight: 560;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

#place-view .place {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.3;
}

.obwod-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 4px;
}

.obwod-chip {
  min-height: 28px;
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: #f4f1ea;
  color: #172026;
  font: 700 0.75rem "Source Sans 3", sans-serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.obwod-chip:hover { background: #e7e2d6; }

.obwod-chip:focus-visible {
  outline: 2px solid #172026;
  outline-offset: 2px;
}

#place-view .totals { margin-top: 12px; }

#place-view .candidates { margin-top: 4px; }

.popup-blocks {
  min-width: 0;
  margin: 0;
  overflow-x: auto;
}

.result-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.result-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.result-table th,
.result-table td {
  padding: 7px 12px;
  font-size: 1rem;
  text-align: right;
  vertical-align: middle;
  border-bottom: 1px solid rgba(23, 32, 38, 0.06);
  white-space: nowrap;
}

.result-table thead th {
  padding: 0 12px 10px;
  text-align: center;
  vertical-align: bottom;
  border-bottom: 0;
}

.result-table .is-break th,
.result-table .is-break td {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(23, 32, 38, 0.16);
}

.result-table .is-empty {
  color: #8d9693;
  font-weight: 500;
}

.result-table tbody th,
.result-table .result-corner {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 11rem;
  background: #fff;
  text-align: left;
  font-weight: 600;
}

.result-table .is-stat th,
.result-table .is-stat td {
  padding-top: 3px;
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
}

.result-table .is-total { box-shadow: inset 1px 0 0 rgba(23, 32, 38, 0.08); }

.result-table .who {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-table .swatch {
  width: 10px;
  height: 10px;
  flex: none;
  transform: none;
}

.result-table .nums {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  font-size: 1rem;
}

.result-table .nums em {
  min-width: 3.2em;
  color: var(--muted);
  font-style: normal;
}

.result-table .meter {
  display: block;
  height: 3px;
  margin-top: 3px;
  border-radius: 99px;
  background: rgba(23, 32, 38, 0.1);
  overflow: hidden;
}

.result-table .meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.result-table .is-ahead .nums strong { font-weight: 700; }

.result-table .withdrawn-note {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.nr-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-table thead .nr-label { padding-bottom: 4px; }

.nr {
  display: block;
  font-family: Fraunces, serif;
  font-size: 1.45rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.nr-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.14) !important;
}

.leaflet-control-zoom a {
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  color: #172026 !important;
  background: rgba(255, 255, 255, 0.94) !important;
}

.leaflet-control-zoom a:hover { background: #fff !important; }

.leaflet-bar a:first-child { border-radius: 12px 12px 0 0 !important; }

.leaflet-bar a:last-child { border-radius: 0 0 12px 12px !important; }

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.88) !important;
  color: #3d4744 !important;
  border-radius: 8px;
  font-size: 11px;
}

.leaflet-control-attribution a { color: #172026 !important; }

@media (max-width: 860px) {
  .ticker {
    height: calc(34px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  .ticker-label { padding: 0 12px; font-size: 0.68rem; }

  .ticker-track span { font-size: 0.9rem; }

  html.has-ticker body {
    padding-top: calc(34px + env(safe-area-inset-top));
  }

  html.has-ticker .app {
    height: 100%;
    margin-top: 0;
  }

  .app {
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .stage {
    order: -1;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    border-radius: 0;
  }

  #map { min-height: 0; border-radius: 0; }

  .panel,
  .panel.is-place {
    flex: 0 0 auto;
    width: 100%;
    height: 58dvh;
    max-height: 58dvh;
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 36px rgba(23, 32, 38, 0.14);
    padding: 8px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .panel.is-place,
  .panel.is-district { height: 68dvh; max-height: 68dvh; }

  .panel::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    margin: 0 auto 6px;
    border-radius: 99px;
    background: rgba(23, 32, 38, 0.16);
  }

  .kicker,
  .when,
  .count-line,
  .rule,
  .sources,
  .candidate .note,
  .candidate .meta { display: none; }

  .colophon { margin-top: 6px; }

  .colophon-link {
    min-height: 40px;
    margin-top: 2px;
    padding-top: 4px;
    padding-bottom: 2px;
  }

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

  h1 {
    margin: 0 0 8px;
    font-size: 1.08rem;
    line-height: 1.15;
  }

  .status.is-flowing {
    margin-bottom: 8px;
    padding: 8px 12px;
    font-size: 0.95rem;
  }

  #status-meta { font-size: 0.95rem; }

  .status-meter { height: 5px; margin-top: 6px; }

  .totals { margin: 0 0 8px; }

  .totals div { padding: 11px 14px 10px; }

  .totals span { font-size: 0.7rem; }

  .totals strong { font-size: 1.85rem; }

  .candidates { margin-top: 6px; }

  .candidate { padding: 8px 0 7px; }

  .candidate header {
    grid-template-columns: 12px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .candidate .swatch {
    width: 12px;
    height: 12px;
  }

  .candidate h2 {
    font-size: 1.05rem;
    letter-spacing: -0.015em;
  }

  .candidate .count {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    font-size: 1rem;
    line-height: 1.05;
    white-space: nowrap;
  }

  .candidate .sep { display: none; }

  .candidate .share {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
  }

  .candidate.is-leader h2,
  .candidate.is-leader .count { font-weight: 800; }

  .bar {
    height: 7px;
    margin: 7px 0 0 22px;
  }

  .hits {
    max-height: 11rem;
    overflow: auto;
  }

  .search input {
    min-height: 44px;
    font-size: 1rem;
  }

  .place-view h3,
  #place-view h3 { font-size: 1.35rem; }

  .result-table tbody th,
  .result-table .result-corner { min-width: 7.6rem; }

  .result-table th,
  .result-table td {
    padding: 8px 8px;
    font-size: 0.95rem;
  }

  .result-table .nums {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    font-size: 0.95rem;
  }

  .result-table .nums em { min-width: 0; font-size: 0.75rem; }

  .nr { font-size: 1.2rem; }

  .leaflet-control-zoom { margin-top: 10px !important; margin-left: 10px !important; }

  .map-tools { top: 10px; left: 10px; }

  .map-switch button { padding: 8px 11px; }

  .district-menu { max-height: 34vh; }

  .runoff {
    bottom: 10px;
    width: min(420px, calc(100% - 20px));
    padding: 12px 12px 10px;
  }

  .runoff h2 { font-size: 1.35rem; }

  .runoff-places { gap: 8px; margin-top: 10px; }

  .runoff-copy strong { font-size: 0.84rem; }

  .runoff-copy span { font-size: 0.75rem; }

  html.has-ticker .panel {
    height: 48dvh;
    max-height: 48dvh;
  }

  html.has-ticker .panel.is-place,
  html.has-ticker .panel.is-district {
    height: 68dvh;
    max-height: 68dvh;
  }

  html.has-ticker h1 { display: none; }

  html.has-ticker .pkw-chip { display: none; }

  html.has-ticker .leaflet-control-zoom { margin-bottom: 96px !important; }

  html.has-ticker .runoff {
    bottom: 8px;
    width: calc(100% - 16px);
    padding: 8px 12px;
    border-radius: 16px;
  }

  html.has-ticker .runoff-kicker,
  html.has-ticker .runoff-when,
  html.has-ticker .runoff-bar { display: none; }

  html.has-ticker .runoff h2 {
    margin: 0;
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  html.has-ticker .runoff-places {
    gap: 8px;
    margin-top: 6px;
  }

  html.has-ticker .runoff-mark {
    width: 22px;
    height: 22px;
    font-size: 0.72rem;
  }

  html.has-ticker .runoff-copy strong { font-size: 0.78rem; }

  html.has-ticker .runoff-copy span { font-size: 0.7rem; }

  html.has-ticker .totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  html.has-ticker .totals div {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 8px 7px;
    border-top: 0;
    border-radius: 12px;
    background: #f7f4ef;
  }

  html.has-ticker .totals div + div { border-top: 0; }

  html.has-ticker .totals span {
    font-size: 0.58rem;
    letter-spacing: 0.06em;
  }

  html.has-ticker .totals strong { font-size: 1.02rem; }
}

@media (max-width: 860px) and (max-height: 700px) {
  h1 { display: none; }

  .status.is-flowing {
    margin-bottom: 6px;
    padding: 6px 10px;
  }

  .totals div { padding: 8px 12px 7px; }

  .totals strong { font-size: 1.5rem; }

  .candidate { padding: 6px 0 5px; }

  .bar { margin-top: 5px; }
}

@media (max-width: 860px) and (max-height: 520px) {
  .panel,
  .panel.is-place,
  .panel.is-district {
    height: 50dvh;
    max-height: 50dvh;
  }
}
