:root {
  --ink: #10161c;
  --panel: #171e27;
  --panel-2: #1f2833;
  --line: #2c3642;
  --text: #e8edf3;
  --muted: #9aa7b5;
  --gold: #e0b15a;
  --map-pad: 0;
  --sans: "Noto Sans TC", "PingFang TC", "Hiragino Sans CNS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
}

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  grid-template-rows: auto 1fr auto;
  height: 100%;
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr auto;
  align-items: end;
  gap: 16px 24px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #141b23, #1a2430 55%, #132018);
  z-index: 5;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.04em;
  font-weight: 900;
  white-space: nowrap;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.county-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(30, 41, 59, 0.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23facc15' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
  color: #f8fafc;
  border: 1.5px solid var(--gold);
  border-radius: 8px;
  padding: 4px 28px 4px 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.county-select:hover {
  background-color: rgba(51, 65, 85, 0.95);
  border-color: #fde047;
}

.county-select:focus {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.35);
}

.county-select optgroup {
  font-weight: 700;
  color: var(--gold);
  background: #0f172a;
}

.county-select option {
  font-weight: 500;
  color: #f8fafc;
  background: #1e293b;
}

.kicker {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.dates {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  max-width: 440px;
}

.stats div {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  min-width: 58px;
}

.stats dt {
  color: var(--muted);
  font-size: 11px;
}

.stats dd {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
}

.panel {
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px 14px 28px;
  scroll-behavior: smooth;
}

.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--panel);
  padding-bottom: 8px;
}

.mode {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mode:hover {
  border-color: #4b5a6c;
}

.mode.is-active {
  background: #c9a227;
  color: #16120a;
  border-color: #e0b15a;
  font-weight: 700;
}

.search {
  display: block;
  margin: 0 0 12px;
}

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

.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f141a;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  transition: border-color 0.15s ease;
}

.search input:focus {
  outline: none;
  border-color: var(--gold);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.swatch i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid #0006;
}

.hits {
  margin-bottom: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.hit {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.hit:hover {
  background: rgba(255, 255, 255, 0.05);
}

.hit b {
  color: var(--gold);
}

.detail,
.list {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.detail h2,
.list h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.meta-line {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.card .who {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.party {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  color: #fff;
}

.sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  font: inherit;
  padding: 8px 4px;
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.row span:last-child {
  white-space: nowrap;
  flex-shrink: 0;
}

.row.is-on {
  color: var(--gold);
}

.map-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#map {
  height: 100%;
  background: #d5dde4;
}

/* Smooth GPU-accelerated Leaflet transitions */
.leaflet-zoom-anim .leaflet-zoom-animated {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1) !important;
  will-change: transform;
}

.leaflet-pan-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-map-pane {
  will-change: transform;
}

/* Real-time GIS Progress HUD */
.gis-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 650;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gis-progress.is-hidden {
  opacity: 0;
  transform: translateY(-8px);
}

.gis-progress-bar {
  height: 3px;
  width: 100%;
  background: rgba(16, 22, 28, 0.35);
  overflow: hidden;
}

.gis-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #e0b15a, #10b981);
  transition: width 0.18s ease-out;
}

.gis-progress-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 56px 0 0 12px;
  padding: 6px 12px;
  background: rgba(16, 22, 28, 0.88);
  backdrop-filter: blur(8px);
  color: var(--text);
  border: 1px solid rgba(224, 177, 90, 0.45);
  border-radius: 999px;
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.gis-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulseDot 1s infinite ease-in-out;
}

.gis-progress-meta strong {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* Zoom & LOD Status HUD */
.zoom-hud {
  position: absolute;
  z-index: 500;
  left: 12px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  font-size: 12px;
}

.zoom-badge,
.lod-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(16, 22, 28, 0.84);
  backdrop-filter: blur(6px);
  color: #e8edf3;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  font-variant-numeric: tabular-nums;
}

.zoom-badge {
  color: var(--gold);
  font-weight: 700;
}

.map-tools {
  position: absolute;
  z-index: 500;
  left: 12px;
  top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: calc(100% - 64px);
}

.toggle,
.map-tools button,
.map-tools select {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(4px);
  color: #1b2430;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.map-tools button:hover,
.map-tools select:hover,
.toggle:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.26);
}

.map-tools select:focus,
.map-tools button:focus,
.toggle:focus-within {
  outline: 2px solid var(--gold);
}

.notes {
  grid-column: 1 / -1;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.leaflet-popup-content-wrapper {
  border-radius: 10px;
  font-family: var(--sans);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Tier 1: District Summary Cluster Pill (Zoom < 11.75) */
.poi-district-cluster {
  background: transparent !important;
  border: 0 !important;
}

.poi-district-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  border: 1.5px solid rgba(96, 165, 250, 0.85);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.poi-district-pill:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: #1e3a8a;
  border-color: #93c5fd;
  z-index: 900;
}

.poi-district-pill.has-change {
  border-color: #f59e0b;
}

.poi-district-pill .cnt {
  background: #2563eb;
  color: #fff;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.poi-district-pill.has-change .cnt {
  background: #d97706;
}

/* Tier 2: Spatial Grid Cluster Bubble (11.75 <= Zoom < 13.75) */
.poi-spatial-cluster {
  background: transparent !important;
  border: 0 !important;
}

.poi-cluster-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3b82f6, #1d4ed8);
  color: #fff;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.28), 0 3px 10px rgba(0, 0, 0, 0.45);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.05;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.poi-cluster-bubble:hover {
  transform: scale(1.16);
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.42), 0 4px 12px rgba(0, 0, 0, 0.55);
}

.poi-cluster-bubble.has-change {
  background: radial-gradient(circle at 30% 30%, #f59e0b, #b45309);
  border-color: #fef3c7;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.35), 0 3px 10px rgba(0, 0, 0, 0.5);
}

.poi-cluster-bubble small {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.92;
}

/* Tier 3 & 4: Individual Polling Station Marker + Smart Venue Label */
.poi-station-wrap {
  background: transparent !important;
  border: 0 !important;
}

.poi-station-pin {
  position: relative;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1d4ed8;
  color: #fff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.poi-station-pin:hover,
.poi-station-pin.is-active {
  transform: scale(1.28);
  background: #2563eb;
  z-index: 1000 !important;
}

.poi-station-pin.is-selected {
  transform: scale(1.32);
  background: #0ea5e9;
  border-color: #fff;
  box-shadow: 0 0 0 5px rgba(14, 165, 233, 0.45), 0 3px 10px rgba(0, 0, 0, 0.55);
  z-index: 1100 !important;
}

.poi-station-pin.has-change {
  background: #d97706;
  border-color: #fef3c7;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.45), 0 2px 6px rgba(0, 0, 0, 0.5);
}

.poi-station-pin.has-change:hover,
.poi-station-pin.has-change.is-active,
.poi-station-pin.has-change.is-selected {
  background: #b45309;
  transform: scale(1.32);
}

.poi-co-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  background: #0f172a;
  color: #fbbf24;
  border: 1px solid #fbbf24;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  padding: 0 3.5px;
  line-height: 12px;
}

.poi-station-label {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.poi-station-pin.has-change .poi-station-label {
  border-color: rgba(245, 158, 11, 0.7);
  color: #fef3c7;
}

/* Polling Station Tools & Toggle */
.toggle.toggle-warn {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.station-detail-card {
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.station-alert {
  margin: 10px 0;
  padding: 10px 12px;
  background: rgba(217, 119, 6, 0.16);
  border: 1px solid #d97706;
  border-radius: 6px;
  color: #fde68a;
  font-size: 12px;
  line-height: 1.5;
}

.station-alert strong {
  color: #fbbf24;
}

.station-btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 6px 0 10px;
  color: var(--gold);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.station-btn-nav:hover {
  text-decoration: underline;
}

.station-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}

.station-table th {
  text-align: left;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}

.station-table td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.station-tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  border-radius: 4px;
  background: #2563eb;
  color: #fff;
}

.btn-back {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.1);
}

.village-stations-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.village-stations-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.04em;
  font-weight: 700;
}

.station-item-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.station-item-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold);
}

.station-item-btn.has-change {
  border-left: 3px solid #d97706;
}

.badge-warn {
  display: inline-block;
  background: #d97706;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}

.hit.hit-station {
  border-left: 3px solid #2563eb;
}

.hit.hit-station.has-change {
  border-left: 3px solid #d97706;
}

.sibling-stations-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sibling-pill {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 4px;
  padding: 3px 8px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.sibling-pill.is-current {
  background: #2563eb;
  border-color: #60a5fa;
  color: #fff;
  font-weight: 700;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 55vh auto auto;
  }

  .panel {
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats {
    display: none;
  }
}

/* Wikipedia link + popup */
a.wiki-link {
  color: inherit;
  text-decoration: underline dotted var(--gold);
  text-underline-offset: 3px;
  cursor: pointer;
}
a.wiki-link:hover {
  color: var(--gold);
  text-decoration-style: solid;
}
.wiki-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
.wiki-modal[hidden] {
  display: none;
}
.wiki-box {
  position: relative;
  width: min(500px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 18px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
}
.wiki-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding-right: 28px;
}
.wiki-photo {
  width: 58px;
  height: 74px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1e2430;
  flex-shrink: 0;
}
.wiki-photo[hidden] {
  display: none;
}
.wiki-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.wiki-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
.wiki-badge-wiki {
  background: #1e3a8a;
  color: #93c5fd;
  border: 1px solid #2563eb;
}
.wiki-badge-kcc {
  background: #064e3b;
  color: #6ee7b7;
  border: 1px solid #059669;
}
.wiki-box h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  color: #fff;
  word-break: break-word;
}
.wiki-body {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  color: #cbd5e1;
  overflow-y: auto;
  max-height: 48vh;
  padding-right: 4px;
}
.wiki-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.wiki-links a {
  color: var(--gold);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wiki-links a:hover {
  text-decoration: underline;
}
.wiki-box small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.wiki-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.wiki-close:hover {
  color: #fff;
}

/* ---- Nationwide Overview & Scale Adaptive UI ---- */
.nationwide-intro-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(224, 177, 90, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.region-group-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.05em;
  padding: 8px 4px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 14px;
  margin-bottom: 8px;
}

.county-overview-card {
  background: #17202c;
  border: 1px solid #283749;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.18s ease-in-out;
}

.county-overview-card:hover {
  background: #1e2b3c;
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.county-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.county-name {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
}

.county-reg-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: #334155;
  color: #94a3b8;
  margin-left: 6px;
}

.btn-jump-county {
  appearance: none;
  background: rgba(224, 177, 90, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-jump-county:hover {
  background: var(--gold);
  color: #10161c;
}

.county-card-mayor {
  margin-top: 4px;
  font-size: 13px;
}

.race-title {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.cand-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cand-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.4;
}

.cand-chip small {
  font-weight: 400;
  opacity: 0.85;
}

.chip-kmt {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.45);
}

.chip-dpp {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.chip-tpp {
  background: rgba(20, 184, 166, 0.2);
  color: #5eead4;
  border: 1px solid rgba(20, 184, 166, 0.45);
}

.chip-ind {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.county-card-foot {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.custom-leaflet-tooltip {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid var(--gold) !important;
  color: #f8fafc !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}
.custom-leaflet-tooltip::before {
  border-top-color: var(--gold) !important;
}

