:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #64727d;
  --line: #d9e0e5;
  --panel: #ffffff;
  --page: #eef2f1;
  --yes-strong: #0b5d37;
  --yes-light: #2f8f5b;
  --no-light: #99d6ad;
  --no-strong: #ddf2e3;
  --empty: #9aa4aa;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
  min-height: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}

.summary {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.current-note {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.tab-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9f8;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tab-button[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
  overflow-wrap: anywhere;
}

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

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  color: var(--muted);
  font-size: 14px;
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.swatch.no-strong { background: var(--no-strong); }
.swatch.no-light { background: var(--no-light); }
.swatch.yes-light { background: var(--yes-light); }
.swatch.yes-strong { background: var(--yes-strong); }
.swatch.no-votes { background: var(--empty); }

.source-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-note a {
  color: var(--ink);
  text-underline-offset: 2px;
}

.mapboxgl-popup-content span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.mapboxgl-popup-content strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.mapboxgl-popup-content p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.candidate-list {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.candidate-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.mapboxgl-popup-content {
  max-width: 280px;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 12px 34px rgba(23, 32, 38, 0.22);
}

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

#map {
  position: absolute;
  inset: 0;
}

.map-notice {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  box-shadow: 0 12px 40px rgba(23, 32, 38, 0.12);
  z-index: 2;
}

@media (max-width: 800px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 12px;
    padding: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 11px;
  }

  .summary {
    margin-top: 6px;
    line-height: 1.35;
  }

  .current-note {
    margin: 0;
    font-size: 12px;
  }

  .tabs {
    gap: 4px;
  }

  .tab-button {
    min-height: 34px;
    font-size: 12px;
  }

  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .metric-grid div {
    padding: 8px;
  }

  .metric-grid span {
    font-size: 10px;
  }

  .metric-grid strong {
    margin-top: 4px;
    font-size: 17px;
  }

  .legend {
    padding-top: 8px;
  }

  .legend-row {
    min-height: 22px;
    font-size: 12px;
  }

  .swatch {
    width: 14px;
    height: 14px;
  }

  .source-note {
    margin-top: 8px;
    font-size: 11px;
  }

  .map-wrap {
    height: 100%;
    min-height: 0;
  }
}
