:root {
  color-scheme: dark;
  --bg: #0a0f12;
  --panel: #10171a;
  --panel-strong: #151f23;
  --line: rgba(228, 238, 238, 0.16);
  --text: #f4f7f4;
  --muted: #9facac;
  --dim: #708080;
  --ember: #ff6538;
  --ember-2: #f0442f;
  --gold: #ffc247;
  --cyan: #75e2db;
  --green: #8df2a6;
  --land: #1a2226;
  --land-low: #141a1d;
  --water: #070b0d;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 8%, rgba(255, 101, 56, 0.09), transparent 32rem),
    linear-gradient(180deg, #0e1417 0%, var(--bg) 38%, #070b0d 100%);
  color: var(--text);
}

a {
  color: var(--cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.app-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 0 2px 18px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 7px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
  letter-spacing: 0;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.national-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(106px, auto));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.national-stats div,
.state-stats div {
  padding: 14px 16px;
  background: rgba(16, 23, 26, 0.9);
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 800;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.72fr);
  gap: 16px;
  min-height: min(780px, calc(100vh - 190px));
}

.map-stage,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 16, 18, 0.82);
  box-shadow: var(--shadow);
}

.map-stage {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.map-topline,
.panel-header,
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.map-topline {
  padding: 18px 20px 8px;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: rgba(117, 226, 219, 0.7);
  outline: none;
}

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

#map {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--water);
  background-size: 44px 44px;
}

.state {
  stroke: rgba(239, 248, 248, 0.42);
  stroke-width: 0.75;
  cursor: pointer;
  transition:
    fill 180ms ease,
    stroke 180ms ease,
    stroke-width 180ms ease,
    filter 180ms ease;
}

.state:hover,
.state.is-active {
  stroke: #ffffff;
  stroke-width: 2.1;
  filter: drop-shadow(0 0 10px rgba(255, 101, 56, 0.38));
}

.state:focus-visible {
  outline: none;
  stroke: var(--cyan);
  stroke-width: 2.4;
}

.state-label {
  pointer-events: none;
  fill: rgba(244, 247, 244, 0.78);
  font-size: 10px;
  font-weight: 850;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5, 8, 10, 0.65);
  stroke-width: 3px;
}

.map-loading {
  position: absolute;
  inset: auto auto 20px 20px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 12, 14, 0.88);
  color: var(--muted);
  font-size: 0.82rem;
}

.map-loading.is-hidden {
  display: none;
}

.tooltip {
  position: fixed;
  z-index: 20;
  width: max-content;
  max-width: 230px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: rgba(8, 12, 14, 0.95);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.34);
  color: var(--text);
  pointer-events: none;
  transform: translate(14px, 14px);
}

.tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.tooltip[aria-hidden="true"] {
  display: none;
}

.legend {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px 16px;
  color: var(--muted);
  font-size: 0.78rem;
}

.legend i {
  display: block;
  width: 24px;
  height: 9px;
  border-radius: 999px;
  background: var(--step);
}

.detail-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px;
}

.panel-header {
  align-items: flex-start;
}

#pin-label {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.state-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.state-stats div {
  padding: 12px;
  background: var(--panel);
}

.fingerprint-shell {
  width: 100%;
  aspect-ratio: 1.18;
  min-height: 330px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 101, 56, 0.15), transparent 10rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
}

#fingerprint {
  display: block;
  width: 100%;
  height: 100%;
}

.fingerprint-axis {
  stroke: rgba(244, 247, 244, 0.26);
  stroke-width: 1;
  stroke-dasharray: 3 7;
}

.fingerprint-mark {
  stroke-linecap: round;
  animation: draw-in 420ms ease both;
}

.fingerprint-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fingerprint-small {
  fill: var(--dim);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.center-ring {
  fill: rgba(10, 15, 18, 0.96);
  stroke: rgba(255, 255, 255, 0.32);
  stroke-width: 1.2;
}

.center-code {
  fill: var(--text);
  font-size: 36px;
  font-weight: 900;
  text-anchor: middle;
}

.center-subtitle {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes draw-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.breakdown {
  margin-top: 16px;
}

.size-bars {
  display: grid;
  gap: 10px;
  margin-top: 11px;
}

.size-bar-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.size-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.size-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--ember));
}

.notes {
  margin-top: auto;
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.notes p {
  margin-bottom: 8px;
}

.notes p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1020px) {
  .masthead,
  .workbench {
    grid-template-columns: 1fr;
  }

  .national-stats {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .detail-panel {
    min-width: 0;
  }
}

@media (max-width: 660px) {
  .app-shell {
    width: min(100% - 18px, 1500px);
    padding-top: 12px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .national-stats,
  .state-stats {
    grid-template-columns: 1fr;
  }

  .map-topline,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-stage {
    grid-template-rows: auto minmax(360px, 62vh) auto;
  }

  #map {
    min-height: 360px;
  }

  .legend {
    flex-wrap: wrap;
  }

  .fingerprint-shell {
    min-height: 286px;
  }
}
