:root {
  --ink: #20221f;
  --muted: #6a7067;
  --paper: #f7f4ec;
  --panel: #fffdf8;
  --line: #d8d1c3;
  --visited: #c75238;
  --visited-dark: #8e3528;
  --land: #e3ddcf;
  --land-hover: #d8cdbc;
  --water: #6f8ea0;
  --focus: #1b6a75;
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button {
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--panel);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
  padding: 0 14px;
}

button:hover,
button:focus-visible {
  background: var(--visited-dark);
  border-color: var(--visited-dark);
}

button:focus-visible,
.county-toggle:focus-visible,
.county-shape:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  min-height: 100vh;
}

.map-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(22px, 4vw, 56px);
}

.masthead {
  max-width: 760px;
}

.kicker {
  color: var(--visited-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: 0;
  margin: 0;
  max-width: 820px;
}

.intro {
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.22rem);
  line-height: 1.55;
  margin: 20px 0 0;
  max-width: 640px;
}

.progress-wrap {
  margin-top: clamp(24px, 4vw, 44px);
  max-width: 760px;
}

.progress-copy {
  align-items: center;
  display: flex;
  font-weight: 800;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-track {
  background: #e8e1d3;
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, var(--visited), #d88746);
  height: 100%;
  transform-origin: left center;
  transition: width 180ms ease;
  width: 0;
}

.map-stage {
  align-items: center;
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 420px;
  padding-top: clamp(18px, 3vw, 34px);
  position: relative;
}

#county-map {
  display: block;
  height: min(68vh, 720px);
  max-height: 760px;
  max-width: 100%;
  width: min(920px, 100%);
}

.county-shape {
  cursor: pointer;
  fill: var(--land);
  stroke: var(--paper);
  stroke-linejoin: round;
  stroke-width: 1.4;
  transition: fill 140ms ease, filter 140ms ease, transform 140ms ease;
}

.county-shape:hover {
  fill: var(--land-hover);
  filter: drop-shadow(0 2px 3px rgb(32 34 31 / 0.16));
}

.county-shape.is-visited {
  fill: var(--visited);
}

.county-shape.is-visited:hover {
  fill: var(--visited-dark);
}

.county-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 800;
  paint-order: stroke;
  pointer-events: none;
  stroke: var(--panel);
  stroke-linejoin: round;
  stroke-width: 4px;
  text-anchor: middle;
}

.tooltip {
  background: var(--ink);
  border-radius: 6px;
  color: var(--panel);
  font-size: 0.9rem;
  font-weight: 800;
  left: 0;
  padding: 7px 9px;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: translate(-50%, calc(-100% - 12px));
  white-space: nowrap;
  z-index: 3;
}

.side-panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding: clamp(18px, 3vw, 30px);
}

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

.control-row button {
  font-size: 0.86rem;
  padding-inline: 8px;
}

.status-box {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.status-label,
#status-copy {
  margin: 0;
}

.status-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

#status-copy {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.35;
}

.county-list-wrap {
  min-height: 0;
}

h2 {
  font-size: 0.92rem;
  letter-spacing: 0;
  margin: 0 0 10px;
}

.county-list {
  display: grid;
  gap: 6px;
}

.county-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  min-height: 38px;
  padding: 7px 8px;
  text-align: left;
  width: 100%;
}

.county-toggle:hover {
  background: #f1eadc;
  border-color: #f1eadc;
  color: var(--ink);
}

.county-toggle::before {
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 50%;
  content: "";
  flex: 0 0 13px;
  height: 13px;
  width: 13px;
}

.county-toggle.is-visited {
  color: var(--visited-dark);
}

.county-toggle.is-visited::before {
  background: var(--visited);
  border-color: var(--visited);
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .map-panel {
    min-height: auto;
    padding-bottom: 20px;
  }

  .map-stage {
    min-height: 330px;
  }

  #county-map {
    height: auto;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .control-row {
    grid-template-columns: 1fr;
  }

  .county-label {
    font-size: 9px;
  }
}
