:root {
  --ink: #14212b;
  --ink-soft: #243542;
  --paper: #f3efe6;
  --panel: rgba(19, 32, 41, 0.92);
  --line: rgba(243, 239, 230, 0.14);
  --muted: #9aafb8;
  --text: #f3efe6;
  --amber: #f0a202;
  --amber-deep: #c47a00;
  --teal: #1f7a6c;
  --warn: #f0b7a4;
  --ok: #8fd0b0;
  --shadow: 0 24px 60px rgba(8, 14, 18, 0.45);
  --font-sans: "Instrument Sans", "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  background:
    radial-gradient(1200px 700px at 10% -10%, #2a4a52 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #3a2a12 0%, transparent 50%),
    linear-gradient(160deg, #0d171d 0%, #15262f 45%, #1a3038 100%);
}

a {
  color: var(--amber);
}

.shell {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  height: 100%;
  min-height: 100dvh;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--panel);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(10px);
  overflow: auto;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 2.8vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search {
  display: grid;
  gap: 0.4rem;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.search-form input {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(243, 239, 230, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  min-width: 0;
}

.search-form input::placeholder {
  color: #7f96a0;
}

.search-form input:focus {
  outline: 2px solid rgba(240, 162, 2, 0.55);
  outline-offset: 1px;
}

.search-go {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffe3a1;
  background: rgba(240, 162, 2, 0.16);
  border: 1px solid rgba(240, 162, 2, 0.45);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.search-go:hover {
  background: rgba(240, 162, 2, 0.24);
}

.search-go:disabled {
  opacity: 0.55;
  cursor: wait;
}

.place-results {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 14, 18, 0.55);
  max-height: 12rem;
  overflow: auto;
}

.place-results[hidden] {
  display: none;
}

.place-results li button {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text);
  background: transparent;
  border: 0;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}

.place-results li button:hover,
.place-results li button:focus-visible {
  background: rgba(240, 162, 2, 0.14);
  outline: none;
}

.place-results .place-empty {
  margin: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--text);
  background: rgba(243, 239, 230, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.preset:hover,
.preset.primary:hover {
  background: rgba(240, 162, 2, 0.14);
  border-color: rgba(240, 162, 2, 0.5);
  transform: translateY(-1px);
}

.preset.primary {
  background: rgba(240, 162, 2, 0.16);
  border-color: rgba(240, 162, 2, 0.45);
  color: #ffe3a1;
}

.preset:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.controls {
  display: grid;
  gap: 0.85rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hero-metric {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(240, 162, 2, 0.18), rgba(31, 122, 108, 0.14));
  border: 1px solid rgba(240, 162, 2, 0.28);
}

.hero-metric strong {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffe3a1;
}

.hero-metric small {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.lede strong {
  color: #ffe3a1;
  font-weight: 600;
}

.hover-line:empty {
  display: none;
}

.hover-line {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
}

.field {
  display: grid;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.field input:not([type="range"]),
.field select,
.ghost {
  font: inherit;
  color: var(--text);
  background: rgba(243, 239, 230, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.field input:not([type="range"]):focus,
.field select:focus,
.ghost:focus {
  outline: 2px solid rgba(240, 162, 2, 0.55);
  outline-offset: 1px;
}

.slider-field {
  gap: 0.45rem;
}

.slider-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.slider-label strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffe3a1;
  font-variant-numeric: tabular-nums;
}

.field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.35rem;
  margin: 0.35rem 0 0.15rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(240, 162, 2, 0.55),
    rgba(31, 122, 108, 0.55)
  );
  outline: none;
  cursor: pointer;
}

.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #f3efe6;
  border: 2px solid #f0a202;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.field input[type="range"]::-moz-range-thumb {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #f3efe6;
  border: 2px solid #f0a202;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.field input[type="range"]:focus-visible {
  outline: 2px solid rgba(240, 162, 2, 0.55);
  outline-offset: 3px;
}

.ghost {
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ghost:hover {
  background: rgba(240, 162, 2, 0.12);
  border-color: rgba(240, 162, 2, 0.45);
  transform: translateY(-1px);
}

.readouts {
  display: grid;
  gap: 0.75rem;
}

.readout {
  display: grid;
  gap: 0.2rem;
}

.readout span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta {
  margin-top: auto;
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}

#status[data-kind="ok"] {
  color: var(--ok);
}

#status[data-kind="warn"] {
  color: var(--warn);
}

.dataset {
  margin: 0;
  color: #7f96a0;
}

.credit {
  margin: 0;
  line-height: 1.4;
}

.map-pane {
  position: relative;
  min-height: 50vh;
  min-height: 50dvh;
}

#map {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  background: #d9e2e0;
}

.map-hint {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: min(92vw, 28rem);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(20, 33, 43, 0.82);
  color: var(--paper);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-align: center;
  pointer-events: none;
  box-shadow: var(--shadow);
  animation: hint-in 700ms ease both;
}

.map-hint[hidden] {
  display: none;
}

.map-hint[data-kind="warn"] {
  background: rgba(90, 40, 28, 0.9);
  color: #ffe0d4;
}

.map-hint[data-kind="ok"] {
  background: rgba(20, 33, 43, 0.82);
}

@keyframes hint-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.leaflet-container {
  font: inherit;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(55vh, 1fr);
    grid-template-rows: auto minmax(55dvh, 1fr);
    height: 100dvh;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 42dvh;
  }

  .map-pane {
    min-height: 55dvh;
    height: 100%;
  }

  .brand h1 {
    font-size: 1.9rem;
  }
}
