/* Dark by default: this gets read on a boat at 0500 and on a phone in a bunk,
   and a white chart at night ruins your night vision for twenty minutes. */

:root {
  --bg: #070b11;
  --panel: rgba(13, 19, 28, 0.94);
  --panel-solid: #0d131c;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);
  --ink: #e8eef6;
  --ink-dim: #93a3b8;
  --ink-faint: #5f7285;
  --accent: #45c8ff;
  --accent-ink: #05141d;
  --warn: #ffb454;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --appbar-h: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 14px/1.45 ui-sans-serif, -apple-system, "SF Pro Text", Inter, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#map { position: absolute; inset: 0; }

/* --- global reeltemps bar (persists over every region/map view) ---------- */
#appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: calc(var(--appbar-h) + var(--safe-t));
  display: flex; align-items: center; gap: 16px;
  padding: var(--safe-t) 14px 0;
  background: linear-gradient(180deg, rgba(7,11,17,0.98), rgba(7,11,17,0.90));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
/* Everything else lives in #stage, offset below the bar. All the map's
   absolute UI is positioned relative to this box, so it just shifts down. */
#stage { position: absolute; inset: 0; top: calc(var(--appbar-h) + var(--safe-t)); }

.ab-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.ab-logo { height: 42px; width: auto; display: block; }
.ab-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: conic-gradient(from 210deg, #1b3f6b, #45c8ff, #37e0b8, #ffd166, #ff8a5b, #1b3f6b);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.14);
}
.ab-word { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.ab-word b { color: var(--accent); font-weight: 800; }
.ab-nav { display: flex; gap: 2px; }
.ab-nav a {
  color: var(--ink-dim); text-decoration: none; font-weight: 600; font-size: 13.5px;
  padding: 7px 12px; border-radius: 9px;
}
.ab-nav a:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
.ab-nav a.on { color: var(--accent-ink); background: var(--accent); }
.ab-avatar {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; text-decoration: none;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  color: var(--ink); font-weight: 700; font-size: 12px;
}
@media (max-width: 760px) {
  :root { --appbar-h: 46px; }
  .ab-nav a.ab-wide { display: none; }   /* keep All Regions as the back path */
}
.maplibregl-ctrl-attrib { display: none; }

/* --- top bar -------------------------------------------------------------- */

#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  background: linear-gradient(180deg, rgba(7, 11, 17, 0.92), rgba(7, 11, 17, 0));
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; letter-spacing: 0.02em; }
.brand strong { font-size: 15px; }
.brand .sub { color: var(--ink-faint); font-size: 12px; }
.status {
  margin-left: auto; font-variant-numeric: tabular-nums;
  font-size: 12px; color: var(--ink-dim); text-align: right; max-width: 46vw;
}
.status.warn { color: var(--warn); }

.icon-btn {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn .bars, .icon-btn .bars::before, .icon-btn .bars::after {
  display: block; width: 16px; height: 2px; background: var(--ink);
  border-radius: 2px; content: ''; position: relative;
}
.icon-btn .bars::before { position: absolute; top: -5px; }
.icon-btn .bars::after { position: absolute; top: 5px; }

/* --- simulated-data badge ------------------------------------------------
   If the map is showing a simulation, it says so, permanently and on the map
   itself. A plausible-looking chart that is quietly invented is the worst
   thing this tool could be. */

.sim-badge {
  position: absolute; z-index: 18; top: calc(46px + var(--safe-t)); left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 13px; border-radius: 999px;
  background: rgba(120, 62, 0, 0.92); border: 1px solid rgba(255, 180, 84, 0.55);
  color: #ffe2b8; pointer-events: none; max-width: 92vw;
}
.sim-badge[hidden] { display: none; }
.sim-badge strong { font-size: 11px; letter-spacing: 0.1em; font-weight: 700; }
.sim-badge span { font-size: 10.5px; color: #f0c48a; }

@media (max-width: 720px) {
  .sim-badge { top: calc(40px + var(--safe-t)); padding: 4px 10px; }
  .sim-badge span { display: none; }
}

/* --- readout -------------------------------------------------------------- */

.readout {
  position: absolute; z-index: 15; left: 12px; bottom: calc(70px + var(--safe-b));
  min-width: 232px; padding: 11px 13px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(12px);
  font-variant-numeric: tabular-nums;
}
.readout .ddm { font-size: 13.5px; letter-spacing: 0.01em; }
.readout .dd { font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.readout .temp {
  font-size: 34px; font-weight: 600; line-height: 1.05; margin: 7px 0 2px;
  letter-spacing: -0.02em;
}
.readout .temp .unit {
  font-size: 15px; font-weight: 400; color: var(--ink-dim); margin-left: 3px;
}
.readout .prov { font-size: 11.5px; color: var(--ink-dim); }
/* Water no satellite saw: the painted estimate, a shade dimmer, with "≈". */
.readout .temp.est { color: var(--ink-dim); }
.readout .temp .approx { font-size: 0.62em; font-weight: 500; margin-right: 2px; vertical-align: 0.18em; }
.readout .prov .stale { color: var(--warn); }
.rd-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.readout .hint { font-size: 10.5px; color: var(--ink-faint); }
.mark-btn {
  margin-left: auto; padding: 4px 10px; font: inherit; font-size: 11px; font-weight: 600;
  color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: 999px; cursor: pointer;
}
.mark-btn[hidden] { display: none; }

.crosshair {
  width: 22px; height: 22px; pointer-events: none;
  background:
    linear-gradient(#fff, #fff) center/1.5px 22px no-repeat,
    linear-gradient(#fff, #fff) center/22px 1.5px no-repeat;
  opacity: 0.85;
  filter: drop-shadow(0 0 2px #000);
}

/* --- legend --------------------------------------------------------------- */

.legend {
  position: absolute; z-index: 15; left: 12px; bottom: calc(12px + var(--safe-b));
  width: 232px; padding: 7px 9px 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  backdrop-filter: blur(12px);
}
.legend canvas {
  display: block; width: 100%; height: 10px; border-radius: 3px;
  border: 1px solid var(--line);
}
.legend-labels {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10.5px; color: var(--ink-dim); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.legend-span { color: var(--ink-faint); font-size: 10px; }

/* --- control panel -------------------------------------------------------- */

/* The open panel must not cover its own toggle: on a wide screen the top bar
   steps aside by the panel's width instead. */
body.panel-open #topbar { padding-right: 342px; }

.panel {
  position: absolute; z-index: 25; top: 0; right: 0; bottom: 0; width: 330px;
  background: var(--panel); border-left: 1px solid var(--line);
  backdrop-filter: blur(16px);
  transform: translateX(100%); transition: transform 0.22s ease;
  display: flex; flex-direction: column;
}
.panel.open { transform: none; }
.panel-grip { display: none; }
.panel-scroll {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(54px + var(--safe-t)) 14px calc(20px + var(--safe-b));
}

.group { padding: 13px 0; border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
.group-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.group h2 {
  margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-faint);
}
.group-head .val {
  margin-left: auto; font-size: 11px; color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

.note { margin: 8px 0 0; font-size: 11px; line-height: 1.45; color: var(--ink-faint); }

.seg { display: flex; gap: 4px; }
.seg.wrap { flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto; min-width: 0; padding: 7px 6px;
  font: inherit; font-size: 11.5px; white-space: nowrap;
  color: var(--ink-dim); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.seg button:hover { background: rgba(255, 255, 255, 0.08); }
.seg button.on {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); font-weight: 600;
}
.seg button[disabled] { opacity: 0.35; cursor: default; }

.row { display: flex; align-items: center; gap: 10px; margin-top: 9px; font-size: 12px; }
.row > span { color: var(--ink-dim); width: 62px; flex: none; }
.row select, .row input[type=range] { flex: 1; min-width: 0; }

.compress-row {
  display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px;
}
.compress-row > span { width: 28px; color: var(--ink-dim); flex: none; }
.compress-row[hidden] { display: none; }

.time-slider { width: 100%; margin: 2px 0 4px; }
.time-row { display: flex; align-items: center; gap: 6px; }
.time-label {
  flex: 1; min-width: 0; text-align: center;
  font-variant-numeric: tabular-nums; font-size: 12px; line-height: 1.25;
}
.time-label .sub { font-size: 10.5px; color: var(--ink-faint); }
.tbtn {
  width: 30px; height: 28px; flex: none; padding: 0;
  font: inherit; font-size: 11px; color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
}
.tbtn.wide { width: auto; padding: 0 10px; }
.tbtn:hover { background: rgba(255, 255, 255, 0.1); }
.group-head .val.past { color: var(--warn); }

.range-rows { margin-top: 10px; display: grid; gap: 8px; }
.range-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.range-row > span { width: 28px; color: var(--ink-dim); flex: none; }
.range-row input[type=range] { flex: 1; min-width: 0; }
.range-row input[type=number] {
  width: 62px; flex: none; padding: 5px 6px; font: inherit; font-size: 12px;
  color: var(--ink); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

select {
  padding: 5px 7px; font: inherit; font-size: 12px; color: var(--ink);
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 6px;
}

input[type=range] {
  -webkit-appearance: none; appearance: none; height: 22px; background: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px; background: var(--line-strong);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; margin-top: -7px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--panel-solid);
  cursor: pointer;
}
input[type=range]::-moz-range-track {
  height: 3px; border-radius: 2px; background: var(--line-strong);
}
input[type=range]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel-solid); cursor: pointer;
}

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 12px; }
.checks[hidden] { display: none; }   /* author display:grid otherwise beats [hidden] */
.checks label { display: flex; align-items: center; gap: 6px; color: var(--ink-dim); cursor: pointer; }
.checks input { accent-color: var(--accent); }

.btn-row { display: flex; gap: 6px; }
.btn {
  flex: 1; padding: 8px; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px; cursor: pointer;
}
.btn.ghost {
  background: transparent; color: var(--ink-dim);
  border-color: var(--line); font-weight: 400;
}
.btn[disabled] { opacity: 0.4; cursor: default; }

.mark-list { list-style: none; margin: 9px 0 0; padding: 0; max-height: 168px; overflow-y: auto; }
.mark-list li {
  display: flex; align-items: baseline; gap: 8px; padding: 5px 0;
  border-top: 1px solid var(--line); font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.mark-list .m-temp { font-weight: 600; width: 46px; flex: none; }
.mark-list .m-pos { color: var(--ink-faint); font-size: 10.5px; flex: 1; min-width: 0; }
.mark-list .m-del {
  border: 0; background: none; color: var(--ink-faint); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 2px;
}

.prov-list { font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.prov-list .p-row { display: flex; gap: 7px; padding: 2px 0; }
.prov-list .p-row span:first-child { color: var(--ink-faint); width: 82px; flex: none; }

/* --- toast ---------------------------------------------------------------- */

.toast {
  position: absolute; z-index: 40; left: 50%; bottom: calc(24px + var(--safe-b));
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 8px 14px; font-size: 12.5px;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 999px; transition: opacity 0.18s, transform 0.18s;
  max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- map markers ----------------------------------------------------------
   HTML markers rather than symbol layers: MapLibre text needs a glyph server,
   and this map has to work with no network at all. */

.wp, .buoy, .mark {
  display: flex; align-items: center; gap: 5px;
  font: 500 11px/1 ui-sans-serif, system-ui, sans-serif;
  white-space: nowrap; pointer-events: none; user-select: none;
}
.wp i, .buoy i, .mark i {
  width: 6px; height: 6px; flex: none; border-radius: 50%;
  background: #cfe0f0; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.6);
  position: relative;
}

/* The marker itself stays transparent to the mouse so a drag that starts on a
   label still pans the map; the dot and the name take events, so hovering a
   spot opens its card. The dot is 6 px, which is not a hover target, so it
   carries an invisible 18 px one. */
.wp i, .wp b, .buoy i, .buoy b, .mark i, .mark b {
  pointer-events: auto; cursor: pointer;
}
.wp i::after, .buoy i::after, .mark i::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
}
.wp.hide-label b { pointer-events: none; }
.wp b {
  font-weight: 500; color: #dbe7f4;
  text-shadow: 0 0 3px #000, 0 0 6px #000, 0 1px 2px #000;
  transition: opacity 0.12s;
}
.wp.hide-label b { opacity: 0; }

.wp-seamount i, .wp-bank i { background: #ffd479; width: 7px; height: 7px; }
.wp-canyon i { background: #9fb6ff; }
.wp-island i, .wp-headland i { background: #b9c6d4; }
.wp-port i { background: #7fe2a6; }
.wp-reef i { background: #ffb454; }
.wp-vernacular i { background: #ff8fb3; width: 7px; height: 7px; }
.wp-vernacular b { color: #ffd6e3; }

/* Land landmarks (USGS GNIS) -- coastal towns and points that orient the map.
   A town reads as a settlement (warm square); a point/cape as a sandy dot. */
.wp-town i { background: #f3efe4; width: 5px; height: 5px; border-radius: 1.5px;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.72); }
.wp-town b { color: #f5f1e7; font-weight: 600; letter-spacing: 0.01em; }
.wp-point i { background: #dcc78d; }
.wp-point b { color: #eaddba; }
.wp-feature i { background: #a9b8c8; width: 5px; height: 5px; }

/* The fleet's own names sit slightly forward of the charted ones. */
.wp-fleet b { color: #ffe9f0; font-weight: 600; }
.wp-fleet i { box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.75); }

/* Breaks in a swell. Worth more than a color. */
.wp-breaks u {
  text-decoration: none; color: #ff9f43; font-size: 8px;
  margin-left: 3px; vertical-align: 1px;
}

.buoy i {
  width: 11px; height: 11px; background: #ffd21e;
  border-radius: 50% 50% 50% 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.7), 0 0 6px rgba(255,210,30,0.5);
}
.buoy b {
  font-weight: 700; color: #dff2ff;
  text-shadow: 0 0 3px #000, 0 0 6px #000;
  font-variant-numeric: tabular-nums;
}
.buoy em { font-style: normal; color: #9fd8f5; font-weight: 400; margin-left: 3px; }

.mark i {
  width: 11px; height: 11px; background: transparent;
  border: 2px solid #ff5f6d; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.7);
}
.mark b {
  font-weight: 700; color: #ffd9dc;
  text-shadow: 0 0 3px #000, 0 0 6px #000;
  font-variant-numeric: tabular-nums;
}

.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button span { filter: invert(1) brightness(1.6); }
.maplibregl-ctrl-scale {
  background: var(--panel) !important; border-color: var(--line-strong) !important;
  color: var(--ink-dim) !important; font-size: 10px !important;
}

/* --- phone ---------------------------------------------------------------- */

@media (max-width: 720px) {
  body.panel-open #topbar { padding-right: 12px; }
  /* The Controls panel covers the map, so hide the product/layer chooser row
     while it's open — otherwise the panel's top (with the Route button) collides
     with the Composite / Single Pass / SST tabs. The hamburger stays. */
  body.panel-open .brand { display: none; }
  /* The top bar's dark fade (there for text over the map) lay over the top of
     the open Settings sheet and dimmed its most important row, Composite /
     Single Pass. With the sheet up there is no map under the bar to fade. */
  body.panel-open #topbar { background: none; }

  /* Product/layer chooser + its menus live inside the Controls panel on phones
     (moved there by placeMobileControls). Render them inline, full-width,
     instead of as absolutely-positioned top-bar popups. */
  .panel-scroll > #topStack.in-panel {
    position: static; transform: none; top: auto; left: auto;
    display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin: 2px 0 10px;
  }
  .panel-scroll > .in-panel.blend-menu,
  .panel-scroll > .in-panel.layer-menu {
    position: static; transform: none; top: auto; left: auto;
    width: 100%; min-width: 0; margin: 0 0 12px;
  }

  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: 82vh; border-left: 0; border-top: 1px solid var(--line-strong);
    border-radius: 16px 16px 0 0; transform: translateY(100%);
  }
  .panel.open { transform: none; }
  .panel-grip {
    display: block; width: 38px; height: 4px; border-radius: 2px;
    background: var(--line-strong); margin: 9px auto 3px; flex: none;
  }
  .panel-scroll { padding: 4px 15px calc(24px + var(--safe-b)); }

  .readout {
    left: 8px; right: 8px; bottom: calc(66px + var(--safe-b));
    min-width: 0; display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "coords temp" "prov temp" "actions actions";
    column-gap: 12px; align-items: center;
  }
  .brand .sub { display: none; }
  .rd-coords { grid-area: coords; }
  .readout .temp { grid-area: temp; margin: 0; font-size: 30px; }
  .readout .prov { grid-area: prov; }
  .rd-actions { grid-area: actions; }

  .legend { left: 8px; right: 8px; width: auto; bottom: calc(10px + var(--safe-b)); }
  .maplibregl-ctrl-bottom-right { bottom: calc(56px + var(--safe-b)); }
  .status { font-size: 11px; max-width: 40vw; }
}

@media (max-width: 380px) {
  .readout .temp { font-size: 26px; }
  .seg button { font-size: 11px; padding: 7px 4px; }
}

/* Mark list: the name leads, the temperature follows. */
.m-name { font-weight: 600; margin-right: .5em; }

/* GPS view: hide the analysis chrome, keep position and marks. */
body.gps-view #legend, body.gps-view #readout { display: none; }

/* Depth under the cursor, beneath the temperature. */
.depth { opacity: .75; font-variant-numeric: tabular-nums; }

/* --- snapshot navigation --------------------------------------------------- */

.scene-nav {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
}
.scene-nav[hidden] { display: none; }
.scene-label {
  flex: 1; min-width: 0;
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.scene-label .sub {
  font-family: inherit; font-weight: 400; font-size: 10.5px;
  color: var(--ink-faint); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.sub-head { margin-top: 12px; }

/* --- hover card -----------------------------------------------------------
   A real element rather than a `title` tooltip: it appears at once, it can be
   read, and you can click the buttons in it without it disappearing. */

.hovercard {
  position: absolute; z-index: 30; width: 208px;
  padding: 9px 11px 10px;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  font-size: 12px; line-height: 1.35; pointer-events: auto;
}
.hovercard h4 {
  margin: 0 0 5px; font-size: 12.5px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hovercard .hc-pos {
  font: 600 11.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink); letter-spacing: -0.2px;
}
.hovercard .hc-dd {
  font: 400 10.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-faint); margin-bottom: 6px;
}
.hovercard .hc-row {
  display: flex; align-items: baseline; gap: 7px;
  padding-top: 4px; border-top: 1px solid var(--line);
}
.hovercard .hc-row b { font-size: 14px; font-weight: 650; }
.hovercard .hc-row b.est { color: var(--ink-faint); }
.hovercard .hc-row span {
  font-size: 10.5px; color: var(--ink-faint); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hovercard .hc-note {
  margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--ink-faint);
}
.hovercard .hc-actions {
  display: flex; gap: 5px; margin-top: 8px;
}
.hovercard .hc-actions button {
  flex: 1; padding: 4px 0; font-size: 10.5px; cursor: pointer;
  color: var(--ink); background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line-strong); border-radius: 6px;
}
.hovercard .hc-actions button:hover { background: rgba(255, 255, 255, 0.16); }
.hovercard .hc-actions button.ghost { background: transparent; }

/* --- time slider ticks ----------------------------------------------------
   The archive is not evenly filled. Seeing where the passes actually are, and
   which of them are VIIRS, is worth more than a smooth slider. */

.slider-stack { display: flex; flex-direction: column; gap: 1px; }
.time-ticks { display: block; width: 100%; height: 9px; }

/* --- true-color source note --------------------------------------------- */

.tc-note b { color: var(--ink); font-weight: 600; }
.tc-note.warn {
  border-left: 2px solid #ffb454; padding-left: 7px;
}
.tc-note[hidden] { display: none; }

/* ==========================================================================
   Phase 1 redesign: product tabs, day strip, compare, peek, Advanced drawer.
   The engine below the UI did not change; this is the control surface
   catching up to it.
   ========================================================================== */

/* --- map panes ------------------------------------------------------------ */

#maps { position: absolute; inset: 0; display: flex; }
#maps #map { position: relative; inset: auto; flex: 1; min-width: 0; }
#map2 {
  position: relative; flex: 1; min-width: 0;
  border-left: 1px solid var(--line-strong);
}
#map2[hidden] { display: none; }
.pane-label {
  position: absolute; z-index: 12; top: calc(96px + var(--safe-t)); left: 10px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
  pointer-events: none; max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- product tabs --------------------------------------------------------- */

.tabs {
  display: flex; gap: 2px; padding: 3px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line);
}
.tabs button {
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-dim);
  padding: 6px 14px; border: 0; border-radius: 8px; background: transparent;
  cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: var(--accent); color: var(--accent-ink); }
.tabs button:disabled { color: var(--ink-faint); cursor: default; opacity: 0.55; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.badge {
  font: inherit; font-size: 11.5px; font-variant-numeric: tabular-nums;
  color: var(--ink-dim); padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer;
  white-space: nowrap;
}
.badge.stale { color: var(--warn); border-color: rgba(255, 180, 84, 0.4); }
.icon-btn.wide-only, .compare-on #compareBtn {
  width: auto; padding: 0 12px; font: inherit; font-size: 12px; color: var(--ink-dim);
}
#compareBtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.status.floating {
  position: absolute; z-index: 14; right: 12px;
  bottom: calc(10px + var(--safe-b));
  margin: 0; max-width: 60vw;
}

/* --- day strip ------------------------------------------------------------ */

#timebar {
  position: absolute; z-index: 22; left: 0; right: 0;
  top: calc(52px + var(--safe-t));
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none;
}
.day-strip, .pass-row {
  display: flex; gap: 5px; max-width: min(94vw, 900px);
  overflow-x: auto; scrollbar-width: none; padding: 0 10px;
  pointer-events: auto;
}
.day-strip::-webkit-scrollbar, .pass-row::-webkit-scrollbar { display: none; }

.day-chip {
  font: inherit; flex: none; cursor: pointer; text-align: center;
  padding: 5px 10px 4px; border-radius: 10px; min-width: 52px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
}
.day-chip b { display: block; font-size: 12px; font-weight: 600; color: var(--ink); }
.day-chip small { display: block; font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.day-chip .pip {
  display: block; height: 3px; border-radius: 2px; margin-top: 3px;
  background: var(--line-strong);
}
.day-chip.on { border-color: var(--accent); background: rgba(69, 200, 255, 0.14); }
.day-chip.on b { color: var(--accent); }

.pass-chip {
  font: inherit; flex: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 11.5px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.pass-chip .dn { font-size: 12px; }
.pass-chip b { font-weight: 600; color: var(--ink); }
.pass-chip small { color: var(--ink-faint); font-size: 10px; }
.pass-chip.on { border-color: var(--accent); background: rgba(69, 200, 255, 0.14); }
.pass-chip.on b { color: var(--accent); }
.pass-chip.night { opacity: 0.75; }

/* --- peek ----------------------------------------------------------------- */

.peek-btn {
  position: absolute; z-index: 16; left: 50%; transform: translateX(-50%);
  bottom: calc(46px + var(--safe-b));
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink);
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-strong);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.peek-btn:active { background: var(--accent); color: var(--accent-ink); }
.peek-btn[hidden] { display: none; }

/* --- advanced drawer ------------------------------------------------------ */

.advanced { border-top: 1px solid var(--line); margin-top: 6px; }
.advanced summary {
  cursor: pointer; list-style: none; padding: 12px 2px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: ' ▸'; }
.advanced[open] summary::after { content: ' ▾'; }
.note-inline { font-weight: 400; font-size: 11px; color: var(--ink-faint); }

/* --- compare layout ------------------------------------------------------- */

body.compare-on .readout { bottom: calc(70px + var(--safe-b)); }
body.compare-on .peek-btn { display: none; }

@media (max-width: 1000px) {
  .wide-only { display: none; }
}
@media (max-width: 860px) {
  .tabs button { padding: 6px 9px; font-size: 11.5px; }
  .brand .sub { display: none; }
  .badge { display: none; }
  #timebar { top: calc(48px + var(--safe-t)); }
}

/* GPS view is the stripped-back running screen: no time controls, no peek. */
body.gps-view #timebar, body.gps-view .peek-btn { display: none; }
/* display:flex on the class beats the UA [hidden] rule; restate it. */
.pass-row[hidden], .day-strip[hidden] { display: none; }

/* Cloud-Free is a single complete grid: no passes to step through, so the day
   strip is hidden. The blend menu (with Cloud-Free as its last item) and its
   caret stay, so the reader can switch back to a dated composite. */
body.is-cloudfree .day-strip-row,
body.is-cloudfree .pass-row { display: none; }

.blend-menu .bm-head {
  font-size: 11px; opacity: 0.6; padding: 2px 8px 5px; line-height: 1.3;
  max-width: 190px;
}
.blend-menu .bm-sep {
  height: 1px; margin: 5px 6px; background: rgba(255,255,255,0.12);
}
.blend-menu button em { opacity: 0.6; font-style: normal; font-size: 11px; }

/* ==========================================================================
   Round 2: Composite tab menu, 5-day strip, legend tick, compare modes,
   crosshair, fixed readout.
   ========================================================================== */

.tabs button em { font-style: normal; font-weight: 500; color: inherit; opacity: 0.75; }
.tabs button .caret { font-style: normal; font-size: 10px; opacity: 0.7; }
.blend-menu {
  position: absolute; z-index: 40; top: calc(50px + var(--safe-t));
  left: 50%; transform: translateX(-92px);
  display: flex; flex-direction: column; min-width: 96px;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 4px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}
.blend-menu[hidden] { display: none; }
.blend-menu button {
  font: inherit; font-size: 12.5px; color: var(--ink-dim); text-align: left;
  padding: 7px 12px; border: 0; border-radius: 7px; background: none; cursor: pointer;
}
.blend-menu button:hover { background: rgba(255, 255, 255, 0.07); }
.blend-menu button.on { color: var(--accent); font-weight: 600; }

/* Five recent days on screen; the rest scroll in behind the older button. */
.day-strip-row { display: flex; align-items: stretch; gap: 5px; pointer-events: auto; }
.day-strip { max-width: min(72vw, 330px); scroll-behavior: smooth; }
.older-btn {
  flex: none; width: 26px; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 10px; color: var(--ink-dim);
  background: var(--panel); border: 1px solid var(--line);
}
.older-btn:disabled { opacity: 0.3; cursor: default; }

/* A bigger crosshair than the OS default. The native one is 12 px and gets
   lost over a busy chart; this is 28 px with a black casing so it reads over
   both the dark blue and the red ends of the ramp, with a hole in the middle
   so it never hides the pixel it is pointing at. */
#map .maplibregl-canvas-container,
#map2 .maplibregl-canvas-container {
  cursor: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'>\
<g stroke='%23000' stroke-opacity='.65' stroke-width='3.5' stroke-linecap='round'>\
<path d='M14 2v8M14 18v8M2 14h8M18 14h8'/></g>\
<g stroke='%23fff' stroke-width='1.5' stroke-linecap='round'>\
<path d='M14 2v8M14 18v8M2 14h8M18 14h8'/></g>\
<circle cx='14' cy='14' r='1.25' fill='%23fff'/></svg>") 14 14, crosshair;
}

/* The readout card must not breathe as the cursor moves: reserve the space
   its tallest state needs, and a two-line provenance clamps instead of
   growing. */
.readout { height: 180px; width: 248px; overflow: hidden; }
.readout .prov {
  min-height: 32px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.readout .depth { min-height: 18px; }

/* Phones: one slim strip across the bottom, not the desktop card. (The fixed
   248 x 180 card above used to win here and stacked the coordinates four lines
   deep, covering a third of the map.) Temperature leads; coordinates and the
   mark button share its row; age and depth sit under them; a forecast
   readout runs as one wrapped line. */
@media (max-width: 720px) {
  .readout {
    width: auto; height: auto; padding: 7px 8px 7px 12px; border-radius: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "temp coords coords actions" "temp prov depth actions" "fc fc fc fc";
    column-gap: 10px; row-gap: 0;
  }
  .readout .temp { font-size: 26px; }
  .rd-coords { min-width: 0; }
  .readout .ddm { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .readout .dd, .readout .hint { display: none; }
  .readout .prov { min-height: 0; -webkit-line-clamp: 1; font-size: 11px; }
  .readout .depth { grid-area: depth; min-height: 0; font-size: 11px; color: var(--ink-dim); white-space: nowrap; }
  .rd-actions { margin: 0; }
}

/* On a machine with a real pointer, the mark button is unreachable by
   definition -- moving to it means no longer hovering the spot. Click drops
   the mark. Touch keeps the button: it is the only commit gesture there. */
@media (pointer: fine) {
  .mark-btn { display: none; }
}

/* Legend cursor tick */
.legend-bar { position: relative; }
.legend-tick {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: #fff; border: 1px solid rgba(0, 0, 0, 0.75); border-radius: 2px;
  pointer-events: none; transform: translateX(-1px);
}
.legend-tick[hidden] { display: none; }

/* Compare pane header */
.pane-head {
  position: absolute; z-index: 13; top: calc(56px + var(--safe-t)); left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pane-head .seg { background: var(--panel-solid); border-radius: 9px; }
.cmp-day {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: 999px;
  background: var(--panel-solid); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600;
}
.cmp-day[hidden] { display: none; }
#map2 .pane-label { top: auto; bottom: calc(12px + var(--safe-b)); }

/* Hide the floating status once the chart is healthy; it comes back for
   loading and errors only. */
.status.floating.quiet { display: none; }
.hovercard .hc-rename {
  width: 100%; font: inherit; font-size: 12.5px; font-weight: 650;
  color: var(--ink); background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--accent); border-radius: 5px; padding: 2px 6px;
  outline: none;
}

/* ==========================================================================
   Round 3: centred product tabs, region headline, pass dropdown, twin panes.
   ========================================================================== */

/* Brand: the region is what a user identifies the chart by, so it leads and
   the product name shrinks to a label above it. */
.brand { flex-direction: column; align-items: flex-start; gap: 0; }
.brand .app {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-faint); line-height: 1.2;
}
.brand .home-link {
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-decoration: none;
  color: var(--ink-dim); padding: 4px 10px 4px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); white-space: nowrap;
}
.brand .home-link:hover { color: var(--ink); border-color: var(--line-strong); }
.brand .region {
  font-size: 15px; font-weight: 650; letter-spacing: -0.01em;
  line-height: 1.15; white-space: nowrap;
}

/* Product tabs and the layer picker are one centred horizontal stack: they
   answer the two halves of the same question -- which chart, and of what. */
.topstack {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(8px + var(--safe-t));
  display: flex; align-items: center; gap: 8px;
}
.blend-menu { transform: translateX(-50%); left: 50%; }

/* A pass picker that does not grow with the number of passes. */
.pass-row { align-items: center; }
.pass-pick {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px 4px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
}
.pass-pick > span {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.time-sel, .mini-sel {
  font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--panel-solid);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 8px; cursor: pointer; max-width: 260px;
}
.time-sel:focus, .mini-sel:focus { outline: 1px solid var(--accent); }
.mini-sel { font-size: 11.5px; padding: 3px 6px; max-width: 150px; }
.mini-sel[hidden] { display: none; }

/* Twin panes: the right one carries the same controls as the left. */
.tabs.small button { padding: 4px 10px; font-size: 11.5px; }
.pane-selects { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
#map { position: relative; }
#map1Label { top: calc(96px + var(--safe-t)); left: 10px; }
#map1Label[hidden], #map2Label[hidden] { display: none; }
body.compare-on #map1Label { display: block; }

/* In compare, each pane owns its controls. The left pane gets the same cluster
   the right one has, and the top bar's product/layer tabs and the day strip --
   all of which silently drove "the left pane" -- step aside so nothing is
   ambiguous about which side a control affects. They return on exit. */
#cmp1Head[hidden] { display: none; }
body.compare-on #cmp1Head { display: flex; }
body.compare-on #productTabs,
body.compare-on #layerTabs,
body.compare-on #blendMenu,
body.compare-on .day-strip-row,
body.compare-on .pass-row { display: none; }

/* The legend cursor: a real handle, not a hairline. */
.legend-bar { position: relative; padding: 3px 0; }
.legend-tick {
  position: absolute; top: -4px; bottom: -4px; width: 4px;
  background: #fff; border: 1.5px solid rgba(0, 0, 0, 0.85);
  border-radius: 3px; pointer-events: none; transform: translateX(-2px);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}
.legend-tick::after {
  content: ''; position: absolute; left: 50%; top: -5px;
  transform: translateX(-50%);
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid #fff;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9));
}

@media (max-width: 1100px) {
  #productTabs { position: static; transform: none; }
  .brand .region { font-size: 13px; }
}

/* --- layer switcher ------------------------------------------------------- */

.layer-tabs { flex: none; }
.layer-tabs button { color: var(--ink); }
.layer-menu {
  position: absolute; z-index: 40; top: calc(50px + var(--safe-t));
  left: 50%; transform: translateX(60px);
  min-width: 210px; padding: 6px;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}
.layer-menu[hidden] { display: none; }
.lm-head {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 7px 9px 4px;
}
.layer-menu button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 12.5px;
  color: var(--ink-dim); padding: 7px 10px; border: 0; border-radius: 7px;
  background: none; cursor: pointer;
}
.layer-menu button:hover { background: rgba(255, 255, 255, 0.07); }
.layer-menu button.on { color: var(--accent); font-weight: 600; }
.layer-menu button:disabled { opacity: 0.4; cursor: default; }
.layer-menu label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 12.5px; color: var(--ink-dim); padding: 6px 10px; border-radius: 7px;
}
.layer-menu label:hover { background: rgba(255, 255, 255, 0.05); }

/* --- new-waypoint dialog --------------------------------------------------
   Anchored to the app, not the browser. A click used to store a mark outright,
   which turned every stray click into clutter. */

.mark-dialog {
  position: absolute; z-index: 45; left: 50%; top: 50%;
  transform: translate(-50%, -50%); width: 300px; padding: 16px 16px 14px;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 13px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.62);
}
.mark-dialog[hidden] { display: none; }
.mark-dialog h3 { margin: 0 0 11px; font-size: 14px; font-weight: 650; }
.md-row { display: flex; flex-direction: column; gap: 5px; }
.md-row > span {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.md-row input {
  font: inherit; font-size: 14px; color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 10px; outline: none;
}
.md-row input:focus { border-color: var(--accent); }
.md-facts {
  display: flex; gap: 10px; margin: 12px 0 14px;
  padding-top: 11px; border-top: 1px solid var(--line);
}
.md-facts > div { flex: 1; min-width: 0; }
.md-facts b {
  display: block; font-size: 11px; font-weight: 600; line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.md-facts > div:first-child { flex: 1.35; }
.md-facts span {
  display: block; font-size: 9.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 2px;
}
.md-actions { display: flex; gap: 8px; }
.md-actions .btn { flex: 1; }

/* Chlorophyll publishes days behind SST; the strip says so rather than
   letting an empty day imply a quiet ocean. */
.var-note {
  pointer-events: auto; padding: 3px 11px; border-radius: 999px;
  font-size: 11px; color: #ffd9a0;
  background: rgba(120, 62, 0, 0.85); border: 1px solid rgba(255, 180, 84, 0.4);
}
.var-note[hidden] { display: none; }

/* Socked in: the satellites keep passing but see only cloud. One line that
   says how old the newest clear look is, and the way out. */
.cloud-note {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 12px; border-radius: 999px; max-width: 100%;
  font-size: 12px; color: #d8e6f5;
  background: rgba(20, 34, 52, 0.92); border: 1px solid rgba(140, 180, 220, 0.35);
}
.cloud-note button {
  flex: none; padding: 4px 11px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 600; color: #04121f; background: #5cc8ff; cursor: pointer;
}
.cloud-note button:hover { background: #8fdaff; }
.cloud-note[hidden], body.is-cloudfree .cloud-note,
body.compare-on .cloud-note { display: none; }
@media (max-width: 720px) {
  .cloud-note { font-size: 11px; gap: 8px; }
}

/* Log legend: decade ticks on the bar + evenly-spaced decade labels, the
   ocean-color convention (0.01 0.1 1 10 100). Decades are evenly spaced
   because the ramp is linear in log space. */
.legend-ticks { position: absolute; inset: 0; pointer-events: none; }
.legend-ticks span {
  position: absolute; top: -1px; bottom: -1px; width: 1px;
  background: rgba(255, 255, 255, 0.45); transform: translateX(-0.5px);
}
.legend-ticks[hidden] { display: none; }
.legend-decades { justify-content: space-between; }
.legend-decades span { font-size: 9.5px; }
.legend-labels[hidden] { display: none; }

/* --- route / distance tool ------------------------------------------------
   A ruler for the run: drop points from the launch ramp out to the marks and
   read great-circle miles per leg and for the round trip. The line and its
   leg labels are drawn on a pinned canvas (routeCanvas); this is the button
   state, the crosshair cursor, and the floating tally panel. */
#routeBtn svg { color: var(--ink); display: block; }
#routeBtn[aria-pressed="true"] {
  background: var(--accent); border-color: transparent;
}
#routeBtn[aria-pressed="true"] svg { color: var(--accent-ink); }
#map.routing, #map.routing .maplibregl-canvas { cursor: crosshair; }

.route-panel {
  position: absolute; z-index: 24; left: 12px;
  bottom: calc(12px + var(--safe-b));
  width: 232px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  color: var(--ink); font-size: 12px; overflow: hidden;
  backdrop-filter: blur(8px);
}
.rp-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-bottom: 1px solid var(--line);
}
.rp-title { font-weight: 600; letter-spacing: 0.02em; margin-right: auto; }
.rp-units { display: flex; gap: 2px; background: rgba(0,0,0,0.25);
  border-radius: 8px; padding: 2px; }
.rp-units button {
  font: inherit; font-size: 11px; cursor: pointer; border: 0;
  background: transparent; color: var(--ink-dim);
  padding: 2px 7px; border-radius: 6px;
}
.rp-units button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.rp-x {
  border: 0; background: transparent; color: var(--ink-dim);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 4px;
}
.rp-x:hover { color: var(--ink); }

.rp-legs { max-height: 34vh; overflow-y: auto; padding: 4px 0; }
.rp-legs:empty { display: none; }
.rp-leg {
  display: grid; grid-template-columns: 20px 1fr auto; align-items: center;
  gap: 8px; padding: 4px 11px;
}
.rp-leg .rp-num {
  width: 18px; height: 18px; border-radius: 50%; display: grid;
  place-items: center; font-size: 10px; font-weight: 700;
  background: var(--line-strong); color: var(--ink);
}
.rp-leg.launch .rp-num { background: #34d17a; color: #04140b; }
.rp-leg .rp-name { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-leg .rp-dist { font-variant-numeric: tabular-nums; color: var(--ink); }
.rp-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 11px; border-top: 1px solid var(--line);
}
.rp-total { display: flex; align-items: baseline; gap: 7px; }
.rp-total span { color: var(--ink-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.rp-total b { font-size: 15px; font-variant-numeric: tabular-nums; }
.rp-actions { display: flex; gap: 6px; }
.rp-btn {
  font: inherit; font-size: 11px; cursor: pointer; color: var(--ink-dim);
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 9px;
}
.rp-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.rp-hint { margin: 0; padding: 0 11px 10px; color: var(--ink-faint); font-size: 10.5px; line-height: 1.35; }
.rp-legs:not(:empty) ~ .rp-hint { display: none; }

/* While measuring a route, the map markers must not swallow the click that is
   meant to drop a route point (and no info card should pop). The route line is
   on a canvas, so only the maplibre HTML markers need muting. */
#map.routing .maplibregl-marker,
#map.routing .maplibregl-marker * { pointer-events: none !important; }

/* Route button carries a visible label next to its icon so it is not lost in
   the toolbar. Icon + word, sizing like the compare button. */
.route-btn {
  width: auto; gap: 6px; padding: 0 12px; font-size: 12px; color: var(--ink-dim);
  display: inline-flex; align-items: center; justify-content: center;
}
.route-btn svg { color: var(--ink); }
.route-btn span { font-weight: 500; }
#routeBtn[aria-pressed="true"] span { color: var(--accent-ink); }

/* --- prominent on/off toggle (Calibrate) + settings rows ------------------
   A real switch reads as a setting you flip, not a tick you might miss. */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px; cursor: pointer; position: relative;
}
.switch-text { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.switch-row .switch { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.switch-track {
  flex: none; width: 42px; height: 24px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid var(--line);
  transition: background .15s; position: relative;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch:checked ~ .switch-track { background: var(--accent); border-color: transparent; }
.switch:checked ~ .switch-track::after { transform: translateX(18px); }
.switch:focus-visible ~ .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* GPS / temperature / distance pickers in Account settings. */
.row.seg-row { align-items: center; flex-wrap: wrap; }
.row.seg-row > span { width: auto; min-width: 84px; color: var(--ink); }
.row.seg-row .seg { flex: 1; flex-wrap: wrap; justify-content: flex-end; }
.note-faint { color: var(--ink-faint); opacity: 0.75; }

/* Armed state for the two-step "Clear marks" button. */
.btn.armed { color: var(--warn); border-color: rgba(255, 180, 84, 0.55);
  background: rgba(255, 180, 84, 0.08); }

/* ---- Public demo bar (demo.html) --------------------------------------- */
/* Same height and brand as the portal appbar, but no gated nav: a frozen-data
   badge and a single subscribe CTA. Keeps the map full-bleed underneath. */
.demo-bar { justify-content: flex-start; gap: 14px; }
.demo-badge {
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  color: #ffd479; background: rgba(255, 180, 60, 0.12);
  border: 1px solid rgba(255, 180, 60, 0.35); border-radius: 999px;
  padding: 4px 11px; white-space: nowrap;
}
.demo-bar .ab-cta {
  margin-left: auto; text-decoration: none; white-space: nowrap;
  color: var(--accent-ink); background: var(--accent);
  font-weight: 800; font-size: 13px; letter-spacing: 0.01em;
  padding: 8px 15px; border-radius: 9px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 6px 18px rgba(69,200,255,0.25);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.demo-bar .ab-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.demo-bar .ab-cta:active { transform: translateY(0); }
/* On phones the demo badge eats the row and pushes the Unlock CTA off-screen;
   the CTA already tells you it's a demo, so drop the badge on small widths. */
@media (max-width: 700px) { .demo-badge { display: none; } }
@media (max-width: 560px) {
  .demo-badge { font-size: 11px; padding: 3px 8px; }
  .demo-bar .ab-cta { font-size: 12px; padding: 7px 11px; }
}
/* ---- Branded loading spinner (fishing hook) ---- */
.rt-spinner {
  display: inline-block; width: 34px; height: 34px; color: var(--accent);
  vertical-align: middle; flex: none;
  background-color: currentColor;
  -webkit-mask: url("../assets/brand/hook-spinner.png") center / contain no-repeat;
          mask: url("../assets/brand/hook-spinner.png") center / contain no-repeat;
  transform-origin: 50% 50%; animation: rt-spin .9s linear infinite;
}
.rt-spinner.sm { width: 17px; height: 17px; }
@keyframes rt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rt-spinner { animation-duration: 2.6s; } }

/* ---- Chart loading overlay: centered branded loader over the map while a
   region's data comes in. Removed once the first field paints. ---- */
#chartLoader {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(60% 60% at 50% 45%, rgba(10,16,23,0.72), rgba(7,11,17,0.92));
  backdrop-filter: blur(2px); transition: opacity .35s ease;
}
#chartLoader .rt-spinner { width: 46px; height: 46px; color: var(--accent); }
#chartLoader .cl-text { color: var(--ink-dim); font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
#chartLoader.gone { opacity: 0; pointer-events: none; }

/* Route control relocated into the Controls panel on phones (see app.js). */
.route-btn.in-panel {
  width: 100%; justify-content: flex-start; gap: 10px;
  padding: 12px 14px; margin: 2px 0 12px; font-size: 15px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink);
}
.route-btn.in-panel span { font-weight: 600; color: var(--ink); }
.route-btn.in-panel[aria-pressed="true"] { background: var(--accent); border-color: transparent; }
.route-btn.in-panel[aria-pressed="true"] span, .route-btn.in-panel[aria-pressed="true"] svg { color: var(--accent-ink); }

/* True color picked as the layer: the picture alone, no temperature scale. */
body.tc-only #legend { display: none; }
/* One picture is always one moment: blend/composite choices do not apply. The
   day strip and pass picker still choose which moment you are looking at. */
body.tc-only #productTabs, body.tc-only #blendMenu { display: none; }
