:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #62707f;
  --line: #d7dee7;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --green: #266d4d;
  --green-soft: #d9eadf;
  --blue: #2364aa;
  --blue-soft: #dce9f8;
  --gold: #a76f16;
  --gold-soft: #f2dfbc;
  --red: #9d3d36;
  --red-soft: #f0d7d4;
  --shadow: 0 18px 50px rgba(25, 37, 52, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  min-height: 40px;
  padding: 0 14px;
  background: var(--ink);
  color: white;
  cursor: pointer;
}

button:hover {
  background: #2c3847;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(215, 222, 231, 0.85);
  background: rgba(247, 248, 245, 0.92);
  backdrop-filter: blur(16px);
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: 1.1rem;
}

nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 0.93rem;
}

main {
  display: grid;
  gap: 28px;
  padding: 28px clamp(18px, 4vw, 48px) 56px;
}

.intro {
  min-height: 64vh;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(24px, 4vw, 46px) 0;
}

.intro-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.intro h2 {
  max-width: 850px;
  margin-bottom: 18px;
  font-size: clamp(2.15rem, 5.2vw, 5.3rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.intro p:not(.eyebrow) {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.08rem;
}

.state-map {
  min-height: 430px;
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 1fr));
  grid-auto-rows: minmax(72px, 1fr);
  gap: 10px;
  align-content: center;
}

.map-card {
  display: grid;
  place-items: center;
  border: 1px solid rgba(24, 32, 42, 0.1);
  border-radius: 8px;
  color: white;
  font-weight: 850;
  font-size: clamp(1.1rem, 2vw, 1.8rem);
  box-shadow: var(--shadow);
}

.map-card:nth-child(1),
.map-card:nth-child(4),
.map-card:nth-child(7) {
  transform: translateY(24px);
}

.map-card.west {
  background: var(--blue);
}

.map-card.south {
  background: var(--green);
}

.map-card.midwest {
  background: var(--gold);
}

.map-card.east {
  background: var(--red);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metrics article,
.controls,
.results,
.compare,
.details,
.method {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metrics article {
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--ink);
  font-size: 2.15rem;
  font-weight: 850;
  line-height: 1;
}

.metrics p {
  margin: 8px 0 0;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.controls {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.controls h2,
.results h2,
.compare h2,
.details h2,
.method h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

label,
legend {
  color: #344152;
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

.check input {
  width: 16px;
  min-height: 16px;
}

.results {
  min-height: 520px;
  padding: 18px;
}

.results-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.state-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.state-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-top h3 {
  margin-bottom: 2px;
  font-size: 1.2rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #164e86;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.tag.green {
  background: var(--green-soft);
  color: #195437;
}

.tag.gold {
  background: var(--gold-soft);
  color: #714800;
}

.tag.red {
  background: var(--red-soft);
  color: #79302a;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.signal {
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.signal strong {
  display: block;
  font-size: 1.15rem;
}

.signal span {
  color: var(--muted);
  font-size: 0.77rem;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.agency-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agency-list li {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
}

.compare,
.details,
.method {
  padding: 22px;
}

.compare-chart {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.compare-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
}

.compare-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
  margin-top: 18px;
}

.detail-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.detail-block h3 {
  margin-bottom: 10px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 0 0 14px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 800;
}

.source-link:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

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

.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail-list span {
  color: var(--muted);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.method-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.method-grid p,
.state-card p,
.detail-block p {
  color: var(--muted);
}

@media (max-width: 920px) {
  .intro,
  .workspace,
  .detail-panel {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
  }

  .metrics,
  .method-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
    justify-content: space-between;
  }

  main {
    padding-inline: 14px;
  }

  .intro {
    min-height: auto;
    padding-top: 16px;
  }

  .state-map {
    min-height: 280px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics,
  .method-grid,
  .signal-grid {
    grid-template-columns: 1fr;
  }

  .compare-row {
    grid-template-columns: 88px minmax(0, 1fr) 52px;
  }
}
