:root {
  color-scheme: light;
  --text: #14201b;
  --muted: #4c5e57;
  --panel: #ffffff;
  --panel-soft: #f5f7f3;
  --line: #cad4cf;
  --water: #156f96;
  --water-strong: #0c4f6e;
  --river: #2c8cbd;
  --mark: #e3b33d;
  --shadow: 0 14px 34px rgb(16 32 28 / 22%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --text: #edf5f2;
  --muted: #b2c2bb;
  --panel: #13201c;
  --panel-soft: #1c2b26;
  --line: #33443d;
  --water: #67b6d9;
  --water-strong: #9dd5ed;
  --river: #7dc8ed;
  --mark: #f2c94d;
  --shadow: 0 14px 34px rgb(0 0 0 / 36%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --text: #edf5f2;
    --muted: #b2c2bb;
    --panel: #13201c;
    --panel-soft: #1c2b26;
    --line: #33443d;
    --water: #67b6d9;
    --water-strong: #9dd5ed;
    --river: #7dc8ed;
    --mark: #f2c94d;
    --shadow: 0 14px 34px rgb(0 0 0 / 36%);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body,
button,
select {
  color: var(--text);
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 5;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--panel);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.map-shell {
  position: fixed;
  inset: 0;
  min-width: 320px;
  background: #d8e3dc;
}

.watershed-map {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #d8e3dc;
}

.map-overlay {
  position: absolute;
  z-index: 2;
  border: 1px solid color-mix(in srgb, var(--line), transparent 20%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel), transparent 4%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.map-overlay-primary {
  top: 1rem;
  left: 1rem;
  display: grid;
  gap: 0.85rem;
  width: min(31rem, calc(100vw - 2rem));
  padding: 0.95rem;
}

.map-overlay-tools {
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: end;
  gap: 0.7rem;
  padding: 0.75rem;
}

.brand-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.9rem;
}

.eyebrow,
h1,
.feature-count {
  margin: 0;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--water-strong);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1 {
  max-width: 18rem;
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.08;
}

.feature-count {
  display: grid;
  justify-items: end;
  gap: 0.1rem;
  min-width: 5.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.feature-count strong {
  color: var(--text);
  font-size: 1.65rem;
  line-height: 1;
}

.focus-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

.focus-button,
.map-link,
select {
  min-height: 2.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
}

.focus-button,
.map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.focus-button:hover,
.focus-button:focus-visible,
.focus-button[data-selected="true"],
.map-link:hover,
.map-link:focus-visible,
select:focus-visible {
  border-color: var(--water);
  outline: 3px solid color-mix(in srgb, var(--river), transparent 68%);
  outline-offset: 1px;
}

.focus-button[data-selected="true"] {
  background: var(--water);
  color: #ffffff;
}

.field {
  display: grid;
  gap: 0.25rem;
}

.field span,
.save-state {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

select {
  width: 8.2rem;
  padding: 0.45rem 0.65rem;
}

.save-state {
  min-width: 4.4rem;
  padding-bottom: 0.58rem;
}

@media (max-width: 760px) {
  .map-overlay-primary {
    top: 0.65rem;
    left: 0.65rem;
    width: calc(100vw - 1.3rem);
    padding: 0.75rem;
  }

  .map-overlay-tools {
    top: auto;
    right: 0.65rem;
    bottom: 0.65rem;
    left: 0.65rem;
    justify-content: space-between;
    padding: 0.65rem;
  }

  .focus-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 440px) {
  .brand-row,
  .map-overlay-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .feature-count {
    justify-items: start;
    text-align: left;
  }

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

  .map-link,
  select {
    width: 100%;
  }

  .save-state {
    padding-bottom: 0;
  }
}
