:root {
  --ink: #1a1a1a;
  --muted: #6d675f;
  --faint: #9a948c;
  --line: #e4ddd4;
  --paper: #ffffff;
  --wash: #faf7f3;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --low: #8FCB6B;
  --caution: #F2C14E;
  --extreme: #F3923A;
  --danger: #E25B55;
  --severe: #E25B55;
}

* { box-sizing: border-box; }

html {
  margin: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body { padding: 0; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  overflow-x: clip;
}

button, input { font-family: inherit; color: inherit; }

button { cursor: pointer; }

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 28px) 16px;
  padding-left: max(clamp(14px, 3vw, 28px), env(safe-area-inset-left));
  padding-right: max(clamp(14px, 3vw, 28px), env(safe-area-inset-right));
}

.kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 550;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.title-side {
  text-align: right;
  padding-bottom: 4px;
  flex: none;
}

#updated {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

#refresh {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#refresh:disabled { color: var(--faint); cursor: default; }

.dek {
  max-width: 640px;
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

.lede {
  margin: 8px 0 0;
  font-size: 15px;
}

.lede button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.summary { margin-top: 16px; }

.summary-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.meter {
  display: flex;
  height: 18px;
  width: 100%;
  background: #eeeae4;
  gap: 2px;
}

.meter span { display: block; height: 100%; min-width: 2px; }

.meter-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 8px;
  font-size: 13px;
}

.meter-key b { font-weight: 650; font-variant-numeric: tabular-nums; }

.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  vertical-align: -1px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(min(100%, 260px), 400px);
  gap: clamp(16px, 2vw, 28px);
  align-items: stretch;
  margin-top: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  min-height: 34px;
}

.spacer { flex: 1; }

#back, #locate, #stations, .modes button, .filters button, .sorts button {
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 13px;
  color: var(--muted);
  touch-action: manipulation;
}

#locate, #stations { color: var(--ink); font-weight: 600; }

#stations.on { border-bottom-color: var(--ink); }

#locate:disabled { color: var(--faint); cursor: default; }

#back { color: var(--ink); font-weight: 600; }

.modes button.on, .filters button.on, .sorts button.on {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

#crumb {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modes { display: flex; flex-wrap: wrap; gap: 4px 14px; }

.map-col { min-width: 0; }

#stage {
  position: relative;
  height: min(760px, calc(100dvh - 292px));
  min-height: 320px;
  margin-top: 2px;
  touch-action: none;
}

#stage.is-compact .place-label { display: none; }

#stage.is-compact .region-label { font-size: 9px; letter-spacing: 0.04em; }

#stage.is-tiny .region-label,
#stage.is-tiny .place-label { display: none; }

#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }

#stage.is-panning,
#stage.is-panning #map,
#stage.is-panning .area { cursor: grabbing; }

.zoom-controls {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #ddd6cc;
}

.zoom-controls button {
  width: 36px;
  height: 34px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #eeeae4;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  touch-action: manipulation;
}

.zoom-controls button:last-child {
  border-bottom: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@media (pointer: coarse) {
  .zoom-controls button { width: 44px; height: 44px; }
}

.area {
  stroke: #fff;
  stroke-width: 0.75px;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  cursor: pointer;
}

.area.dim { opacity: 0.28; }

.area.hot { stroke: #1a1a1a; stroke-width: 1.35px; }

.area.on { stroke: #111; stroke-width: 2px; }

.region-label, .place-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  fill: #2a2826;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3.5px;
  stroke-linejoin: round;
  pointer-events: none;
  text-anchor: middle;
  text-transform: uppercase;
}

.place-label { fill: #6d675f; font-size: 10px; letter-spacing: 0.08em; }

.band-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  fill: #1c1916;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.94);
  stroke-width: 3.5px;
  stroke-linejoin: round;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

#stage.is-compact .band-label { font-size: 9px; }

#stage.is-tiny .band-label { font-size: 8px; }

.band-word {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.station {
  fill: #1a1a1a;
  stroke: #fff;
  stroke-width: 1.25px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.station.stale { fill: #b7b1a8; }

.station.near { stroke: #1a1a1a; stroke-width: 3px; }

.you-dot {
  fill: #1a1a1a;
  stroke: #fff;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

.you-ring {
  fill: none;
  stroke: #1a1a1a;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

.you-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  fill: #1a1a1a;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
}

#inset {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 158px;
  background: #fff;
  border: 1px solid #ddd6cc;
  padding: 7px 8px 6px;
}

#inset.hidden { display: none; }

#inset p {
  margin: 0 0 2px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

#inset-svg { width: 100%; height: 150px; display: block; }

#tip {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  min-width: min(176px, calc(100% - 16px));
  max-width: min(250px, calc(100% - 16px));
  background: #fff;
  border: 1px solid #e5dfd6;
  box-shadow: 0 10px 28px rgba(28, 23, 18, 0.08);
  padding: 9px 11px 10px;
  pointer-events: none;
}

#tip[hidden] { display: none; }

.tip-kicker {
  margin: 0;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.tip-name {
  display: block;
  margin-top: 1px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 550;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.tip-cat { margin: 3px 0 0; font-size: 13px; font-weight: 650; }

.tip-hi {
  margin: 1px 0 0;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.tip-meta { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

.legend { margin-top: 8px; position: relative; }

.legend-bar {
  display: flex;
  height: 12px;
  gap: 3px;
  background: none;
}

.legend-bar span { flex: 1; display: block; }

.legend-ticks {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.legend-ticks span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.legend-ticks em { font-style: normal; }

.legend-ticks span:last-child { text-align: right; }

.status { min-height: 1.2em; margin: 8px 0 0; color: var(--danger); font-size: 13px; }
.status:empty { display: none; }

.notes { margin-top: 8px; max-width: min(720px, 100%); min-width: 0; }

.notes p, .notes summary { margin: 0 0 6px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }

.notes summary { cursor: pointer; max-width: 100%; }

.notes a {
  color: inherit;
  font-weight: 650;
  text-underline-offset: 2px;
}

.about {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  max-width: 980px;
}

.about h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 550;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.about-lead {
  margin: 0;
  max-width: 68ch;
  font-size: 17px;
  line-height: 1.4;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 40px;
  margin-top: 22px;
}

.about h3 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.about-credit {
  margin: 22px 0 0;
  font-size: 14px;
  font-weight: 650;
}

.rail {
  position: sticky;
  top: 12px;
  height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.here {
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.here h2 {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-weight: 550;
  font-size: clamp(22px, 4vw, 26px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.here p { margin: 5px 0 0; font-size: 13.5px; }

.here .source-label {
  margin: 8px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail {
  flex: 0 0 auto;
  padding-bottom: 10px;
}

.detail:empty { display: none; }

.detail-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail, .here { scroll-margin-top: 12px; }

.detail h2 {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-weight: 550;
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.detail-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 650;
}

.detail-num {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}

.detail-num strong {
  font-family: var(--serif);
  font-size: clamp(44px, 8vw, 58px);
  font-weight: 550;
  letter-spacing: -0.04em;
  line-height: 0.85;
}

.detail-num span { color: var(--muted); font-size: 13px; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 0;
  font-size: 13.5px;
}

.facts b { font-weight: 650; font-variant-numeric: tabular-nums; }

.advisory { margin: 8px 0 0; font-size: 14px; line-height: 1.35; }

.schools-line { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.sibling, .point-note { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }

.sibling button, .prompt button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prompt { margin: 0; color: var(--muted); font-size: 14px; }

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search {
  width: 100%;
  margin-top: 4px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
}

.search:focus { border-bottom-width: 2px; }

.filters, .sorts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; }

.sorts { margin-top: 0; }

.list {
  overflow: auto;
  min-height: min(320px, 50vh);
  flex: 1 1 auto;
  margin-top: 6px;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.region-h {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.region-h button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 3px;
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5c574f;
  text-align: left;
}

.region-h.on button { color: var(--ink); }

.region-sub {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.row {
  width: 100%;
  display: block;
  padding: 8px 0 9px;
  border: 0;
  border-bottom: 1px solid #efeae4;
  background: none;
  text-align: left;
}

.row.hot, .row.on { background: var(--wash); }

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

.row-name {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: clamp(16px, 2.4vw, 18px);
  font-weight: 550;
  letter-spacing: -0.015em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.row-hi {
  flex: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
}

.row-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.track {
  margin-top: 6px;
  height: 5px;
  background: #ece7e0;
}

.track i { display: block; height: 100%; }

.empty {
  margin: 18px 0;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 981px) and (min-height: 700px) {
  .page {
    min-height: 100dvh;
    height: auto;
    overflow: visible;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
  .layout { align-items: start; }
  .map-col { min-width: 0; }
  #stage { height: min(640px, calc(100dvh - 360px)); min-height: 280px; }
  .notes { max-width: 100%; }
  .rail {
    position: sticky;
    top: 18px;
    height: calc(100dvh - 36px);
    max-height: calc(100dvh - 36px);
    overflow: hidden;
  }
  .detail {
    max-height: min(280px, 38vh);
    overflow: auto;
    overscroll-behavior: contain;
  }
  .list { min-height: 180px; }
}

@media (min-width: 981px) and (max-height: 699px) {
  .page { height: auto; overflow: visible; }
  #stage { height: min(420px, 62dvh); min-height: 220px; }
  .rail {
    position: static;
    height: auto;
    max-height: none;
  }
  .list {
    flex: none;
    height: min(68dvh, 640px);
    min-height: 220px;
    max-height: min(68dvh, 640px);
  }
}

@media (max-width: 980px) {
  .page {
    height: auto;
    overflow: visible;
    padding: 14px 16px calc(28px + env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .title-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .title-side { text-align: left; }
  .dek { font-size: 15px; }
  .layout { grid-template-columns: 1fr; }
  .spacer { display: none; }
  .modes { flex: 1 0 100%; }
  .rail {
    position: static;
    height: auto;
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }
  .list {
    flex: none;
    height: min(70dvh, 720px);
    min-height: 240px;
    max-height: min(70dvh, 720px);
  }
  .about-grid { grid-template-columns: 1fr; gap: 18px; }
  .about-lead { font-size: 16px; }
  #stage { height: clamp(240px, 52dvh, 640px); min-height: 240px; }
  #back, #locate, #stations, .modes button, .filters button, .sorts button,
  .region-h button, .search {
    min-height: 44px;
  }
  .row { padding: 12px 0 13px; }
  #inset { width: 132px; }
  #inset-svg { height: 120px; }
  .legend-ticks em { display: none; }
}

@media (max-width: 980px) and (max-height: 500px) {
  .page { padding-top: 8px; }
  .dek, .lede { display: none; }
  .summary { margin-top: 8px; }
  .meter { height: 12px; }
  #stage { height: min(220px, 48dvh); min-height: 160px; }
  .notes > p { display: none; }
}

@media (min-width: 700px) and (max-height: 500px) {
  .page { padding-top: 8px; padding-bottom: 12px; }
  .dek, .lede, .notes > p { display: none; }
  .summary { margin-top: 6px; }
  .meter { height: 12px; }
  .layout {
    grid-template-columns: minmax(0, 1.3fr) minmax(220px, 300px);
    gap: 16px;
  }
  .spacer { display: block; }
  .modes { flex: none; }
  .toolbar { flex-wrap: nowrap; }
  #back, #locate, #stations, .modes button, .filters button, .sorts button,
  .region-h button, .search {
    min-height: 32px;
    padding: 4px 0;
  }
  #stage { height: calc(100dvh - 148px); min-height: 180px; }
  .rail {
    position: static;
    height: calc(100dvh - 108px);
    border-left: 1px solid var(--line);
    border-top: 0;
    padding: 0 0 0 14px;
  }
  .list {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
  }
  .legend-ticks em { display: none; }
}

@media (max-width: 420px) {
  .kicker { letter-spacing: 0.08em; }
  .detail-num { flex-wrap: wrap; }
  .facts { gap: 4px 10px; }
  #tip { min-width: 0; }
}

@media (pointer: coarse) {
  #back, #locate, #stations, .modes button, .filters button, .sorts button {
    min-height: 44px;
    padding: 10px 2px;
  }
  .row { padding: 12px 0 13px; }
  .search { min-height: 44px; }
  .region-h button { min-height: 44px; padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
