/* Isobar. Night-chart navy for the controls, recorder paper for the forecast, violet recorder ink. */
@font-face {
  font-family: "B612";
  src: url("../vendor/fonts/b612-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "B612";
  src: url("../vendor/fonts/b612-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --night: #13233a;
  --night-glass: rgb(19 35 58 / 0.92);
  --night-line: #2c4562;
  --mist: #9dbdd3;
  --snow: #eaf2f7;
  --lamp: #ffc247;
  --coral: #ffa598;
  --paper: #e4edf1;
  --paper-grid: #b5cbd8;
  --ink: #17263a;
  --ink-soft: #46596e;
  --trace: #5b2a9d;
  --rain: #2f7fc1;
  --strip-height: 0px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--night);
  color: var(--snow);
  font: 14px/1.45 "B612", system-ui, sans-serif;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }

#map:focus-visible { outline-offset: -4px; }

#map {
  position: fixed;
  inset: 0;
  background: var(--night);
  font: inherit;
}

/* Satellite: cloud tops glow and the land stays dark, so the map still reads underneath. */
#map .leaflet-satelliteWorld-pane {
  filter: brightness(0.62) contrast(2.3);
  mix-blend-mode: screen;
}
/* GOES images run brighter than the world mosaic for the same scene. The first two steps match
   them (fitted on both images of one scene: world = 1.31 x GOES - 70), so the seam stays subtle. */
#map .leaflet-satelliteGoes-pane {
  filter: brightness(0.845) contrast(1.545) brightness(0.62) contrast(2.3);
  mix-blend-mode: screen;
}

/* Layer rail */
#rail {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  width: 244px;
  max-height: calc(100dvh - var(--strip-height) - 24px);
  padding: 8px 6px 6px;
  overflow-y: auto;
  background: var(--night-glass);
  border-radius: 6px;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 6px;
}

h1 { font-size: 21px; font-weight: 700; }

.rail-tools { display: flex; align-items: center; gap: 6px; }

.units { display: flex; }
.units button {
  width: 32px;
  height: 26px;
  padding: 0;
  background: none;
  border: 1px solid var(--night-line);
  color: var(--mist);
  font-size: 12px;
  cursor: pointer;
}
.units button:first-child { border-radius: 4px 0 0 4px; border-right: 0; }
.units button:last-child { border-radius: 0 4px 4px 0; }
.units button[aria-pressed="true"] { background: var(--night-line); color: var(--snow); }

.quiet-button {
  height: 26px;
  padding: 0 7px;
  background: none;
  border: 0;
  color: var(--mist);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}
.quiet-button:hover { color: var(--snow); }

.layer-toggle {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: 9px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: 0;
  border-radius: 4px;
  color: var(--mist);
  text-align: left;
  cursor: pointer;
}
.layer-toggle:hover { background: rgb(234 242 247 / 0.07); }

.lamp {
  width: 11px;
  height: 11px;
  margin-top: 6px;
  border: 1.5px solid var(--mist);
  border-radius: 50%;
}
.layer-toggle[aria-pressed="true"] .lamp {
  background: var(--lamp);
  border-color: var(--lamp);
  box-shadow: 0 0 7px rgb(255 194 71 / 0.75);
}

.layer-name { font-size: 16px; font-weight: 700; }
.layer-toggle[aria-pressed="true"] .layer-name { color: var(--snow); }

.layer-status { grid-column: 2; font-size: 12px; }
.layer-status:empty { display: none; }
.tone-warn { color: var(--lamp); }
.tone-error { color: var(--coral); }

.legend { display: none; grid-column: 2; margin-top: 5px; }
.layer-toggle[aria-pressed="true"] .legend { display: block; }
.legend-bar { display: block; height: 6px; border-radius: 1px; }
.legend-ends { display: flex; justify-content: space-between; margin-top: 1px; font-size: 12px; }
.legend-note { display: block; font-size: 12px; }

/* Small messages on the map */
#hint, #readout, #notice {
  position: fixed;
  z-index: 900;
  padding: 5px 10px;
  background: var(--night-glass);
  border-radius: 4px;
}
#hint {
  left: 50%;
  bottom: calc(var(--strip-height) + 34px);
  transform: translateX(-50%);
  white-space: nowrap;
}
#readout {
  left: 12px;
  bottom: calc(var(--strip-height) + 12px);
  pointer-events: none;
}
#notice {
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  color: var(--coral);
}
[hidden] { display: none !important; }

/* Leaflet's own controls, moved above the strip when it is open */
#map .leaflet-bottom { bottom: var(--strip-height); }
#map .leaflet-control-attribution {
  padding: 2px 6px;
  background: rgb(19 35 58 / 0.78);
  color: var(--mist);
  font-size: 11px;
}
#map .leaflet-control-attribution a { color: var(--snow); }
#map .leaflet-control-zoom { border: 0; }
#map .leaflet-control-zoom a,
#map .leaflet-control-zoom a:hover {
  background: var(--night-glass);
  border-color: var(--night-line);
  color: var(--snow);
}
.spot-marker {
  border: 2px solid var(--lamp);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgb(7 16 28 / 0.75), inset 0 0 0 2px rgb(7 16 28 / 0.75);
}
.spot-marker::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 4px;
  height: 4px;
  background: var(--lamp);
  border-radius: 50%;
}

/* Forecast strip: a length of recorder paper pulled up over the map */
#strip {
  position: fixed;
  z-index: 1100;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 64vh;
  padding: 12px 18px calc(10px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -10px 34px rgb(5 12 22 / 0.6);
  color-scheme: light;
}
#strip:focus { outline: none; }
#strip :focus-visible { outline-color: var(--trace); }

.strip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.strip-title { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 16px; }
h2 { font-size: 21px; font-weight: 700; }
#strip-now { max-width: 78ch; }

#strip-close {
  flex: none;
  padding: 3px 12px;
  background: none;
  border: 1px solid var(--ink-soft);
  border-radius: 3px;
  cursor: pointer;
}
#strip-close:hover { background: rgb(23 38 58 / 0.08); }

.strip-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
  gap: 24px;
  align-items: start;
}

.text-button {
  padding: 0;
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

/* Alerts */
#strip-alerts { margin-bottom: 8px; }
.alerts-note { color: var(--ink-soft); }
.alerts-failed { color: #9b1c12; font-weight: 700; }
.alert-list { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.alert { padding: 3px 0 3px 9px; border-left: 4px solid var(--ink-soft); }
.alert summary { cursor: pointer; }
.alert-extreme { border-left-color: #7a0019; }
.alert-severe { border-left-color: #c5221f; }
.alert-moderate { border-left-color: #c26a00; }
.alert-minor { border-left-color: #3f6f96; }
.alert-text { margin-top: 6px; white-space: pre-wrap; max-width: 70ch; }
.alert-area { margin-top: 6px; color: var(--ink-soft); font-size: 12px; }

/* Chart */
.strip-chart-box { min-width: 0; }
.chart-caption { position: relative; min-height: 21px; margin-bottom: 2px; font-size: 12px; color: var(--ink-soft); }
#chart-key { display: flex; flex-wrap: wrap; column-gap: 14px; }
#chart-key.is-covered { visibility: hidden; }
#chart-readout { position: absolute; inset: 0 0 auto; color: var(--ink); font-weight: 700; }
.key { display: inline-flex; align-items: center; gap: 5px; }
.key::before { content: ""; display: inline-block; }
.key-trace::before { width: 16px; height: 2px; background: var(--trace); }
.key-rain::before { width: 9px; height: 11px; background: var(--rain); opacity: 0.55; }
.key-wind::before {
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-top-width: 0;
  border-bottom: 10px solid var(--ink);
}

#strip-chart { overflow-x: auto; overscroll-behavior-x: contain; }
#strip-chart svg { display: block; touch-action: pan-x pan-y; }
.m-night { fill: rgb(23 38 58 / 0.075); }
.m-grid { stroke: var(--paper-grid); stroke-width: 1; }
.m-midnight { stroke: var(--ink-soft); stroke-width: 1; opacity: 0.55; }
.m-rain { fill: var(--rain); opacity: 0.55; }
.m-trace { fill: none; stroke: var(--trace); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.m-cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.m-arrow { fill: var(--ink); }
.m-tick { fill: var(--ink-soft); font-size: 12px; text-anchor: end; }
.m-day { fill: var(--ink); font-size: 12px; font-weight: 700; }
.m-hour { fill: var(--ink-soft); font-size: 12px; text-anchor: middle; }
.m-speed { fill: var(--ink); font-size: 12px; text-anchor: middle; }
.m-extreme { fill: var(--trace); font-size: 14px; font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }

/* Days */
.day {
  display: grid;
  grid-template-columns: 6.6em minmax(0, 1fr) 4.8em;
  column-gap: 8px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid var(--paper-grid);
}
.day:last-child { border-bottom: 0; }
.day-name { font-weight: 700; }
.day-summary { color: var(--ink-soft); font-size: 12px; line-height: 1.25; }
.day-temps { text-align: right; font-variant-numeric: tabular-nums; }

#strip-source { margin-top: 8px; color: var(--ink-soft); font-size: 12px; }

@media (prefers-reduced-motion: no-preference) {
  #strip.rising { animation: rise 170ms ease-out; }
  @keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
}

/* About */
#about {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 20px 22px;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  color-scheme: light;
}
#about-title:focus { outline: none; }
#about::backdrop { background: rgb(7 16 28 / 0.6); }
#about :focus-visible { outline-color: var(--trace); }
#about p { margin-top: 10px; max-width: 70ch; }
#about h3 { margin-top: 16px; font-size: 16px; }
#about dt { margin-top: 10px; font-weight: 700; }
#about-close {
  margin-top: 16px;
  padding: 4px 14px;
  background: none;
  border: 1px solid var(--ink-soft);
  border-radius: 3px;
  cursor: pointer;
}
#no-script { position: fixed; z-index: 2000; inset: 12px 12px auto; padding: 12px; background: var(--paper); color: var(--ink); }

/* Narrower screens: the days move under the chart */
@media (max-width: 960px) {
  .strip-grid { display: block; }
  #strip-days {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    column-gap: 22px;
    margin-top: 8px;
  }
}

/* Phones: the rail becomes a row across the top, and the strip scrolls */
@media (max-width: 640px) {
  #rail {
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    padding: max(6px, env(safe-area-inset-top)) 0 6px;
    border-radius: 0;
  }
  .rail-head { padding: 0 12px 4px; }
  h1 { font-size: 16px; }
  #layer-list {
    display: flex;
    gap: 2px;
    padding: 0 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #layer-list::-webkit-scrollbar { display: none; }
  .layer-item { flex: none; }
  .layer-toggle {
    width: auto;
    min-width: 92px;
    max-width: 150px;
    grid-template-columns: 11px minmax(0, 1fr);
    column-gap: 7px;
  }
  .layer-name { font-size: 14px; }
  .layer-toggle[aria-pressed="true"] .legend { display: none; }
  .layer-status { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  #notice { top: 92px; width: calc(100% - 24px); text-align: center; }
  #map .leaflet-control-zoom { display: none; }
  #map .leaflet-control-attribution { max-width: 100vw; font-size: 10px; }
  #strip { max-height: 68vh; padding-right: 12px; padding-left: 12px; }
  .strip-title { display: block; }
  #strip-days { display: block; }
}

/* ---- Search ---- */
.place-search { position: relative; display: flex; gap: 4px; padding: 0 8px 8px; }
.place-search input, #layer-filter {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  background: rgb(234 242 247 / 0.09);
  border: 1px solid var(--night-line);
  border-radius: 4px;
  color: var(--snow);
  font: inherit;
}
.place-search input::placeholder, #layer-filter::placeholder { color: var(--mist); }
#locate {
  flex: none;
  width: 32px;
  background: none;
  border: 1px solid var(--night-line);
  border-radius: 4px;
  color: var(--mist);
  cursor: pointer;
}
#locate:hover { color: var(--snow); }
#place-results {
  position: absolute;
  z-index: 20;
  top: calc(100% - 4px);
  right: 8px;
  left: 8px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--night);
  border: 1px solid var(--night-line);
  border-radius: 4px;
  box-shadow: 0 10px 28px rgb(5 12 22 / 0.6);
}
.place-title { padding: 6px 10px 2px; color: var(--mist); font-size: 12px; }
.place-empty { padding: 8px 10px; color: var(--mist); }
.place-option {
  display: block;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.place-option:hover, .place-option:focus-visible { background: rgb(234 242 247 / 0.09); }
.place-name { display: block; font-weight: 700; }
.place-detail { display: block; color: var(--mist); font-size: 12px; }

#layers-toggle { display: none; }

/* ---- Panel ---- */
#rail { width: 288px; }
.rail-title {
  margin: 10px 8px 2px;
  color: var(--mist);
  font-size: 12px;
  font-weight: 400;
}
.layer-item.is-on .row-extra { display: block; }
.row-extra { display: none; padding: 2px 8px 8px 28px; font-size: 12px; color: var(--mist); }
.mini-control { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 6px; margin-top: 3px; }
.mini-control select, .model-control select {
  width: 100%;
  padding: 2px 4px;
  background: var(--night);
  border: 1px solid var(--night-line);
  border-radius: 3px;
  color: var(--snow);
  font: inherit;
  font-size: 12px;
}
.mini-control input { width: 100%; accent-color: var(--lamp); }
.storm-list { display: grid; gap: 2px; justify-items: start; }
.storm-list .text-button { color: var(--snow); font-size: 12px; text-align: left; }

.model-control { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 6px; margin: 6px 8px; color: var(--mist); font-size: 12px; }
#layer-filter { display: block; width: calc(100% - 16px); margin: 0 8px 4px; }
.filter-empty { padding: 4px 8px; color: var(--mist); font-size: 12px; }

#fill-active {
  margin: 4px 8px 8px;
  padding: 8px;
  background: rgb(234 242 247 / 0.07);
  border-left: 3px solid var(--lamp);
}
.fill-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.fill-head strong { font-size: 14px; }
.fill-head .quiet-button { height: auto; padding: 0; flex: none; }
.fill-about { margin-top: 5px; color: var(--mist); font-size: 12px; line-height: 1.35; }
.legend-block { position: relative; margin-top: 6px; padding-bottom: 18px; }
.legend-ticks { position: absolute; right: 0; left: 0; display: block; height: 16px; margin-top: 1px; font-size: 11px; }
.legend-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.legend-ticks span:first-child { transform: none; }
.legend-ticks span:last-child { transform: translateX(-100%); }
.legend-unit { position: absolute; right: 0; bottom: -14px; color: var(--mist); font-size: 11px; }
.legend-block:has(.legend-unit) { margin-bottom: 12px; }
.legend-image { display: block; width: 100%; margin-top: 6px; padding: 3px; background: #dfe9ef; border-radius: 2px; }
.legend-swatches, .legend-categories { display: grid; gap: 2px; margin-top: 6px; font-size: 12px; }
.legend-swatches img { width: 14px; height: 14px; flex: none; }
.legend-category { display: flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 2px; }
.opacity-control { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 6px; margin-top: 6px; color: var(--mist); font-size: 12px; }
.opacity-control input { width: 100%; accent-color: var(--lamp); }

.fill-group summary {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 3px;
  color: var(--snow);
  cursor: pointer;
  list-style-position: inside;
}
.fill-group summary:hover { background: rgb(234 242 247 / 0.07); }
.fill-count { color: var(--mist); font-size: 12px; }
.fill-list { padding-bottom: 4px; }
.fill-row { display: flex; align-items: stretch; }
.fill-item {
  flex: 1;
  min-width: 0;
  padding: 3px 4px 3px 14px;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--mist);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.fill-item:hover { background: rgb(234 242 247 / 0.07); color: var(--snow); }
.fill-item[aria-pressed="true"] { color: var(--lamp); font-weight: 700; }
.pin-button { flex: none; width: 24px; background: none; border: 0; color: var(--night-line); cursor: pointer; font-size: 13px; }
.fill-row:hover .pin-button { color: var(--mist); }
.pin-button[aria-pressed="true"] { color: var(--lamp); }

/* ---- Time ---- */
#timeline {
  position: fixed;
  z-index: 950;
  bottom: calc(var(--strip-height) + 30px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, calc(100vw - 340px));
  padding: 6px 12px;
  background: var(--night-glass);
  border-radius: 6px;
  transform: translateX(-50%);
}
#timeline [data-action="play"] {
  flex: none;
  width: 56px;
  padding: 3px 0;
  background: none;
  border: 1px solid var(--night-line);
  border-radius: 4px;
  cursor: pointer;
}
#timeline input { flex: 1; min-width: 60px; accent-color: var(--lamp); }
#timeline output { flex: none; min-width: 60px; font-size: 12px; white-space: nowrap; }
#timeline .quiet-button { flex: none; }
body.has-timeline #hint { bottom: calc(var(--strip-height) + 78px); }

/* ---- Readouts and map marks ---- */
#readout { display: grid; gap: 1px; }
.pressure-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  font-size: 10px;
  line-height: 1.1;
  text-shadow: 0 0 3px #07101c, 0 0 3px #07101c;
}
.pressure-mark b { font-size: 18px; }
.pressure-H b { color: #7fc8ff; }
.pressure-L b { color: #ff8a7a; }
.cyclone-mark {
  border: 3px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle, #07101c 26%, #fff 28%, #fff 40%, transparent 42%);
  box-shadow: 0 0 0 2px rgb(7 16 28 / 0.7);
}
.cyclone-green { border-color: #7fd35a; }
.cyclone-orange { border-color: #f7963b; }
.cyclone-red { border-color: #e0342b; }
#map .leaflet-popup-content-wrapper, #map .leaflet-popup-tip { background: var(--paper); color: var(--ink); border-radius: 3px; }
#map .leaflet-popup-content { margin: 10px 12px; font: 13px/1.4 "B612", system-ui, sans-serif; color-scheme: light; }
#map .leaflet-popup-content p { margin: 3px 0 0; }
.map-popup .text-button { display: block; margin-top: 6px; color: var(--ink); }
.popup-row { display: flex; justify-content: space-between; gap: 14px; }
.popup-row span:first-child { color: var(--ink-soft); }
.map-popup .popup-raw { margin-top: 6px; color: var(--ink-soft); font-size: 11px; overflow-wrap: anywhere; }
.map-popup .popup-note { color: var(--ink-soft); font-size: 12px; }

/* ---- Strip tabs ---- */
.strip-title { row-gap: 2px; }
#strip-map-value { flex-basis: 100%; color: var(--trace); font-weight: 700; }
.strip-tools { display: flex; flex: none; align-items: center; gap: 12px; font-size: 12px; }
.strip-tabs { display: flex; gap: 2px; margin-bottom: 8px; overflow-x: auto; border-bottom: 1px solid var(--paper-grid); scrollbar-width: none; }
.strip-tabs::-webkit-scrollbar { display: none; }
.strip-tabs button {
  flex: none;
  padding: 3px 10px 5px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.strip-tabs button:hover { color: var(--ink); }
.strip-tabs button[aria-selected="true"] { border-bottom-color: var(--trace); color: var(--ink); font-weight: 700; }
#strip-tab-panel { min-height: 120px; }
.reading-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.reading-table th, .reading-table td { padding: 3px 12px 3px 0; border-bottom: 1px solid var(--paper-grid); text-align: left; white-space: nowrap; }
.reading-table thead th { color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.reading-table tbody th { font-weight: 700; white-space: normal; }
.reading-table td { font-variant-numeric: tabular-nums; }
.reading-note { margin: 6px 0; color: var(--ink-soft); font-size: 12px; }
.compare-chart { margin: 4px 0; overflow-x: auto; }

/* ---- Phones ---- */
@media (max-width: 640px) {
  #rail { max-height: 100dvh; }
  .place-search { padding: 0 8px 4px; }
  #layers-toggle {
    display: block;
    width: calc(100% - 16px);
    margin: 0 8px 4px;
    padding: 5px;
    background: rgb(234 242 247 / 0.09);
    border: 1px solid var(--night-line);
    border-radius: 4px;
    cursor: pointer;
  }
  #panel-body { display: none; }
  body.layers-open #panel-body { display: block; max-height: calc(100dvh - 130px); overflow-y: auto; }
  body.layers-open #layer-list { display: block; overflow: visible; padding: 0; }
  body.layers-open .layer-toggle { width: 100%; max-width: none; }
  body.layers-open .layer-toggle[aria-pressed="true"] .legend { display: block; }
  body.layers-open .layer-status { white-space: normal; }
  #timeline { width: calc(100vw - 16px); bottom: calc(var(--strip-height) + 24px); gap: 6px; padding: 5px 8px; }
  #timeline output { min-width: 44px; max-width: 110px; white-space: normal; font-size: 11px; line-height: 1.15; }
  .strip-head { flex-wrap: wrap; }
  .strip-tools { width: 100%; justify-content: space-between; }
  .reading-table td:last-child { white-space: normal; }
  #readout { display: none; }
}

/* ---- Layout fixes ---- */
.layer-toggle { padding: 4px 8px; }
.layer-name { font-size: 15px; }
.row-extra summary { cursor: pointer; }
.row-extra summary:hover { color: var(--snow); }
#readout { left: 312px; }
body.has-timeline #readout { bottom: calc(var(--strip-height) + 78px); }
#fill-active {
  position: fixed;
  z-index: 1000;
  top: 12px;
  right: 12px;
  width: 280px;
  margin: 0;
  padding: 10px 12px;
  background: var(--night-glass);
  border-radius: 6px;
  border-left: 3px solid var(--lamp);
}
@media (max-width: 640px) {
  #readout { left: 12px; }
  body.has-timeline #readout { bottom: calc(var(--strip-height) + var(--credit-height, 24px) + 46px); }
  #timeline { bottom: calc(var(--strip-height) + var(--credit-height, 24px) + 4px); }
  #fill-active {
    top: auto;
    right: 8px;
    left: 8px;
    bottom: calc(var(--strip-height) + var(--credit-height, 24px) + 46px);
    width: auto;
    padding: 6px 8px;
  }
  #fill-active .fill-about, #fill-active .opacity-control { display: none; }
  body.layers-open #fill-active { display: none; }
  body:not(.has-timeline) #fill-active { bottom: calc(var(--strip-height) + var(--credit-height, 24px) + 4px); }
  /* With a forecast open there's little map left, and it should stay visible. */
  body.strip-open #fill-active, body.strip-open #timeline { display: none; }
  .compare-table td { white-space: nowrap; }
  .compare-table td:last-child { white-space: nowrap; }
}
.text-button.row-extra { color: var(--snow); font-size: 12px; text-align: left; }
.layer-item:not(.is-on) .row-extra { display: none; }
.layer-item.is-on .storm-list { display: grid; }

/* NASA's keys come in two shapes, and the tall ones shouldn't push the rest of the card away. */
#fill-active .legend-image { max-height: 96px; object-fit: contain; }

/* ---- The 3D globe ---- */
#globe {
  position: fixed;
  inset: 0;
  background: #060d1a;
  font: inherit;
}
#globe .maplibregl-canvas { outline-offset: -4px; }
.globe-glow {
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 0 40px 8px rgb(120 180 255 / 0.35), 0 0 110px 28px rgb(80 140 230 / 0.14);
  pointer-events: none;
}
.globe-flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#globe .maplibregl-marker { z-index: 1; }
.globe-spot { width: 24px; height: 24px; pointer-events: none; }
.globe-mark { width: 44px; height: 36px; pointer-events: none; }
.globe-cyclone { width: 26px; height: 26px; padding: 0; cursor: pointer; }
#globe .maplibregl-ctrl-bottom-right { bottom: var(--strip-height); }
#globe .maplibregl-ctrl-group {
  background: var(--night-glass);
  box-shadow: 0 0 0 1px var(--night-line);
}
#globe .maplibregl-ctrl-group button + button { border-top-color: var(--night-line); }
#globe .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
.globe-credits {
  padding: 2px 6px;
  background: rgb(19 35 58 / 0.78);
  color: var(--mist);
  font-size: 11px;
  line-height: 1.4;
  text-align: right;
}
#globe .maplibregl-ctrl-bottom-right .globe-credits { max-width: min(100vw, 640px); margin: 0; }
.globe-credits a { color: var(--snow); text-decoration: none; }
.globe-credits a:hover { text-decoration: underline; }
#globe .maplibregl-popup-content {
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
  font: 13px/1.4 "B612", system-ui, sans-serif;
  color-scheme: light;
}
#globe .maplibregl-popup-content p { margin: 3px 0 0; }
#globe .maplibregl-popup-close-button { color: var(--ink); font-size: 16px; }
#globe .maplibregl-popup-tip { border-top-color: var(--paper); border-bottom-color: var(--paper); }
#globe .maplibregl-popup-anchor-left .maplibregl-popup-tip,
#globe .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-top-color: transparent; border-bottom-color: transparent; }
#globe .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--paper); }
#globe .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--paper); }
#view-toggle {
  position: fixed;
  z-index: 1000;
  right: 10px;
  bottom: calc(var(--strip-height) + var(--credit-height, 24px) + 76px);
  padding: 5px 10px;
  border: 1px solid var(--night-line);
  border-radius: 4px;
  background: var(--night-glass);
  color: var(--snow);
  font-size: 13px;
  cursor: pointer;
}
#view-toggle:hover { border-color: var(--mist); }
#view-toggle[disabled] { opacity: 0.6; cursor: progress; }
@media (max-width: 640px) {
  #globe .maplibregl-ctrl-group { display: none; }
  #globe .maplibregl-ctrl-bottom-right .globe-credits { max-width: 100vw; font-size: 10px; text-align: left; }
  #view-toggle { top: 12px; right: 8px; bottom: auto; padding: 5px 8px; font-size: 12px; }
}
