/* NALP public page. The page is a replica of the app's own console, so the
   tokens below are copied from css/base.css and docs/DESIGN.md rather than
   invented: navy / daylight chrome via light-dark(), content hues that never
   flip, Inter for prose, JetBrains Mono for data. No network fonts. */

@property --k {
  syntax: '<number>';
  inherits: true;
  initial-value: 1;
}

:root {
  color-scheme: light dark;

  --bg-base:        light-dark(#e7ecf1, #0d1117);
  --bg-sidebar:     light-dark(#f3f6f9, #111820);
  --bg-card:        light-dark(#ffffff, #161e2a);
  --bg-card-hover:  light-dark(#eef2f6, #1c2739);
  --border:         light-dark(#dbe2e9, #1f2f42);
  --border-bright:  light-dark(#c0cad4, #2a3f57);
  --text-primary:   light-dark(#141d27, #e8e4dc);
  --text-secondary: light-dark(#3c4a58, #c3cdd8);
  --text-muted:     light-dark(#566674, #93a3b4);
  --text-dim:       light-dark(#64717e, #7d8b9c);
  --skeleton:       light-dark(#dde4eb, #243244);
  --wash:           light-dark(rgba(20, 29, 39, 0.045), rgba(255, 255, 255, 0.035));

  /* Content hues: identical in both chromes (DESIGN.md §2 Theming). */
  --explore: #c8aa6e;
  --plan: #46c5b8;
  --activities: #a98cf0;
  --hike: #5fb87a;
  --bike: #e07a3c;
  --ski: #4a9eff;
  --transit: #315bcf;
  --green: #3dd68c;
  --blue: #4a9eff;
  --orange: #e07a3c;
  --steep-1: #efd649;
  --steep-2: #f5a02e;
  --steep-3: #e5342e;
  --steep-4: #a13dd6;
  --track: #ff5e3a;

  /* -ink forms: the hue made legible as chrome text on the current surface. */
  --explore-ink:    light-dark(#7d5f1d, #c8aa6e);
  --plan-ink:       light-dark(#0b6b61, #46c5b8);
  --activities-ink: light-dark(#6a4cc9, #a98cf0);
  --hike-ink:       light-dark(#2d7548, #5fb87a);
  --bike-ink:       light-dark(#a04f14, #e07a3c);
  --ski-ink:        light-dark(#1663c4, #4a9eff);
  --green-ink:      light-dark(#17754a, #3dd68c);
  --blue-ink:       light-dark(#1663c4, #4a9eff);
  --orange-ink:     light-dark(#a04f14, #e07a3c);
  --track-ink:      light-dark(#b8391c, #ff5e3a);

  --float-bg:     light-dark(rgba(255, 255, 255, 0.97), rgba(13, 17, 23, 0.97));
  --shadow-color: light-dark(rgba(21, 38, 59, 0.13), rgba(0, 0, 0, 0.6));
  --shadow-soft:  light-dark(rgba(21, 38, 59, 0.09), rgba(0, 0, 0, 0.45));
  --float-shadow: 0 12px 34px var(--shadow-color);
  --control-shadow: 0 1px 4px var(--shadow-soft);

  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--explore); color: #0d1117; }

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.data {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.label b { color: var(--text-primary); font-weight: 600; }
.label.dim { color: var(--text-dim); }
.push { margin-left: auto; }

/* ── Page frame ─────────────────────────────────────────────────────────── */

.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px 28px 20px;
}

.head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.brand-mark { display: block; width: 24px; height: 24px; }

.line {
  margin: 0;
  padding-left: 18px;
  border-left: 1px solid var(--border-bright);
  color: var(--text-muted);
  font-size: 13px;
}

.invite {
  margin-left: auto;
  padding: 5px 9px;
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--explore-ink);
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}

/* ── Console ────────────────────────────────────────────────────────────── */

.console {
  --accent: var(--explore-ink);
  --accent-hue: var(--explore);
  position: relative;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  grid-template-areas: 'side map';
  height: clamp(580px, calc(100vh - 128px), 860px);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-sidebar);
  box-shadow: var(--float-shadow);
}

.console[data-mode='plan'] { --accent: var(--plan-ink); --accent-hue: var(--plan); }
.console[data-mode='activities'] { --accent: var(--activities-ink); --accent-hue: var(--activities); }

.side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
}

/* Mode tabs */

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 11px 4px 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.16s ease-out, background-color 0.16s ease-out;
}

.tab .ic { font-size: 15px; }
.tab:hover { color: var(--text-primary); background: var(--wash); }

.tab::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.tab[aria-selected='true'] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-hue) 8%, transparent);
}

.tab[aria-selected='true']::after { transform: scaleX(1); }

/* While the preview tours the modes by itself, the active tab's rule fills up
   as a timer; the first click anywhere hands control back and stops it. */
.console.is-touring .tab[aria-selected='true']::after {
  animation: tour-fill var(--tour-ms, 7000ms) linear forwards;
}

.console.is-paused .tab[aria-selected='true']::after { animation-play-state: paused; }

@keyframes tour-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Panels */

.panels {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel {
  padding: 12px 12px 16px;
  animation: panel-in 0.28s var(--ease);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.bar {
  display: inline-block;
  height: 8px;
  border-radius: 2px;
  background: var(--skeleton);
  vertical-align: middle;
}

.bar.thin { height: 6px; }
.bar.title { height: 12px; border-radius: 2px; }
.w30 { width: 30%; } .w36 { width: 36%; } .w40 { width: 40%; } .w45 { width: 45%; }
.w48 { width: 48%; } .w55 { width: 55%; } .w62 { width: 62%; } .w66 { width: 66%; }
.w70 { width: 70%; }

.chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}

.chip {
  --hue: var(--hike);
  --ink: var(--hike-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 6px;
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.chip .ic { font-size: 13px; }
.chip.small { padding: 3px 7px; font-size: 10px; }
.chip.is-on {
  color: var(--ink);
  border-color: var(--ink);
  background: color-mix(in srgb, var(--hue) 12%, transparent);
}

.act-hike { --hue: var(--hike); --ink: var(--hike-ink); }
.act-bike { --hue: var(--bike); --ink: var(--bike-ink); }
.act-ski { --hue: var(--ski); --ink: var(--ski-ink); }

.reach {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.reach-from { flex: 1; display: flex; align-items: center; gap: 8px; }
.reach-from .bar { flex: 1; max-width: 90px; }

.badge-disc {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: var(--transit);
  font-size: 11px;
}

.badge-disc .ic { stroke-width: 2.2; }

.seg {
  display: inline-flex;
  border: 1px solid var(--border-bright);
  border-radius: 5px;
  overflow: hidden;
}

.seg span {
  padding: 4px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.seg span + span { border-left: 1px solid var(--border); }
.seg .is-on {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-hue) 12%, transparent);
}

.list-head {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 7px;
}

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 6px 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.row .data { grid-column: 1; color: var(--text-muted); font-size: 10.5px; }
.row .pill { grid-column: 2; grid-row: 1 / 3; }
.row.is-hot { border-color: color-mix(in srgb, var(--hike) 55%, var(--border)); }

.pill {
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.pill.t1 { color: var(--green-ink); }
.pill.t2 { color: var(--blue-ink); }
.pill.t3 { color: var(--orange-ink); }

/* Plan */

.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.doc {
  padding: 12px 12px 10px;
  border: 1px solid color-mix(in srgb, var(--plan) 50%, var(--border-bright));
  border-radius: 10px;
  background: var(--bg-card);
}

.doc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.doc .bar.title { display: block; height: 14px; margin-bottom: 14px; }

.readout {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.readout b {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.readout small { font-size: 14px; margin-right: 1px; }
.readout i { font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: 3px; }
.readout em {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.readout .r { text-align: right; }
.doc .sub { margin: 8px 0 0; color: var(--text-secondary); }

.disclosure {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 10px;
  margin: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
}

.disclosure .t { font-weight: 500; }

.stops {
  display: grid;
  grid-template-columns: 26px 1fr;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
  overflow: hidden;
}

.spine {
  padding-top: 10px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--plan-ink);
  background: color-mix(in srgb, var(--plan) 10%, transparent);
  border-right: 1px solid var(--border);
}

.stops ol { list-style: none; margin: 0; padding: 8px 10px 8px 12px; }

.stop {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 22px;
}

.stop .bar { flex: none; }
.dot {
  width: 11px;
  height: 11px;
  border: 2px solid var(--plan);
  border-radius: 50%;
  background: var(--bg-card);
}

.dot.start { border-color: var(--green); }
.dot.finish { border-color: var(--explore); }

.tag {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.leg {
  margin-left: 5px;
  padding: 3px 0 3px 15px;
  border-left: 1px dashed var(--border-bright);
  color: var(--text-muted);
  font-size: 10px;
}

/* Activities */

.track-head { display: flex; gap: 10px; margin: 4px 2px 18px; }

.badge-sq {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--hue) 45%, transparent);
  background: color-mix(in srgb, var(--hue) 12%, transparent);
  font-size: 15px;
}

.track-name { flex: 1; display: grid; gap: 7px; align-content: center; }
.track-name .meta { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; }
.track-name .meta .bar { width: 70px; }

.section { margin: 0 2px 6px; }

.kv { margin: 0 0 18px; }
.kv div {
  display: flex;
  justify-content: space-between;
  padding: 7px 2px;
  border-bottom: 1px solid var(--border);
}

.kv dt { color: var(--text-secondary); }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.switch {
  margin-left: auto;
  position: relative;
  width: 24px;
  height: 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--activities) 40%, var(--border-bright));
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--activities-ink);
}

/* ── Map ────────────────────────────────────────────────────────────────── */

.map {
  grid-area: map;
  position: relative;
  overflow: hidden;
  background: #e3e9d6;
  cursor: crosshair;
}

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 1000px;
  transform-origin: 0 0;
  will-change: transform;
}

.world.is-ready { transition: transform 1.1s var(--ease), --k 1.1s var(--ease); }

.world canvas,
.world svg {
  position: absolute;
  inset: 0;
  width: 1600px;
  height: 1000px;
}

.terrain { opacity: 0; transition: opacity 0.6s ease-out; }
.terrain.is-drawn { opacity: 1; }

.layer { opacity: 0; transition: opacity 0.4s ease-out; pointer-events: none; }
.console[data-mode='explore'] .layer-explore,
.console[data-mode='plan'] .layer-plan,
.console[data-mode='activities'] .layer-activities { opacity: 1; }

/* The isochrone settles in a beat after the camera, each time Explore opens. */
.console[data-mode='explore'] .iso { transition: opacity 0.9s ease-out 0.35s; }

/* Marks keep their pixel size while the camera moves: --k is 1/scale. */
.mk {
  transform: scale(var(--k));
  transform-box: fill-box;
  transform-origin: center;
}

.mk-pin { transform-origin: 50% 100%; }

.stroke-route { stroke-width: calc(4.5px * var(--k)); }
.stroke-route-case { stroke-width: calc(8px * var(--k)); }
.stroke-track { stroke-width: calc(4px * var(--k)); }
.stroke-track-case { stroke-width: calc(7.5px * var(--k)); }
.stroke-iso { stroke-width: calc(1.4px * var(--k)); }
.stroke-river { stroke-width: calc(1.6px * var(--k)); }
.stroke-trail { stroke-width: calc(3px * var(--k)); }
.stroke-trail-case { stroke-width: calc(5.5px * var(--k)); }

.draw-mask { stroke-width: calc(14px * var(--k)); stroke-dasharray: 1; stroke-dashoffset: 1; }
.console[data-mode='plan'] .draw-mask {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 2.4s cubic-bezier(0.45, 0.05, 0.25, 1) 0.5s;
}

.spot text,
.poi-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  fill: #4d4538;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.poi.is-dim { opacity: 0.38; }
.poi { transition: opacity 0.5s ease-out; }

/* Floating map controls: one material (DESIGN.md §4). */

.ctl {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-bright);
  border-radius: 9px;
  background: var(--float-bg);
  box-shadow: var(--control-shadow);
  color: var(--text-muted);
}

.ctl > span,
.ctl > button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  border-radius: 6px;
  font-size: 14px;
}

.ctl > .is-on { color: var(--text-primary); background: var(--wash); }
.ctl .act-hike.is-on { color: var(--hike-ink); background: color-mix(in srgb, var(--hike) 14%, transparent); }
.ctl .sep { width: 1px; height: 16px; margin: 0 3px; background: var(--border-bright); }
.theme-btn:hover { color: var(--text-primary); background: var(--wash); }

.ctl-style { top: 12px; left: 50%; transform: translateX(-50%); }
.ctl-right { top: 12px; right: 12px; }
.ctl-zoom {
  right: 12px;
  bottom: 12px;
  flex-direction: column;
  transition: bottom 0.4s var(--ease);
}

.coords {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 12px;
  display: grid;
  gap: 5px;
  justify-items: start;
  transition: bottom 0.4s var(--ease);
}

.coords > .data {
  padding: 4px 8px;
  border: 1px solid var(--border-bright);
  border-radius: 5px;
  background: var(--float-bg);
  color: var(--text-primary);
  font-size: 10.5px;
  white-space: pre;
}

.scale {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--float-bg);
  border: 1px solid var(--border-bright);
}

.scale i {
  display: block;
  width: var(--bar, 60px);
  height: 5px;
  border: 1.5px solid var(--text-primary);
  border-top: 0;
}

.scale .data { font-size: 10px; }

.console:not([data-mode='explore']) .coords,
.console:not([data-mode='explore']) .ctl-zoom { bottom: calc(var(--dock-h, 0px) + 12px); }

/* ── Dock ───────────────────────────────────────────────────────────────── */

.dock {
  grid-area: map;
  align-self: end;
  z-index: 3;
  border-top: 1px solid var(--border-bright);
  background: var(--bg-card);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.45s var(--ease), visibility 0s linear 0.45s;
}

.console:not([data-mode='explore']) .dock {
  transform: none;
  visibility: visible;
  transition: transform 0.45s var(--ease), visibility 0s;
}

.dock-plan,
.dock-activities { display: none; padding: 9px 14px 10px; }
.console[data-mode='plan'] .dock-plan,
.console[data-mode='activities'] .dock-activities { display: block; }

.dock-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.dock-bar .strong { color: var(--text-primary); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.sw { width: 8px; height: 8px; border-radius: 2px; }
.sw.calm { background: var(--blue); }
.sw.s1 { background: var(--steep-1); }
.sw.s2 { background: var(--steep-2); }
.sw.s3 { background: var(--steep-3); }
.sw.s4 { background: var(--steep-4); }

.chart { display: grid; grid-template-columns: 44px 1fr; height: 104px; }

.yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 6px 2px 0;
  text-align: right;
  font-size: 9.5px;
  color: var(--text-muted);
}

.profile { display: block; width: 100%; height: 100%; overflow: visible; }
.profile .grid-line { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.profile .area-plan { fill: color-mix(in srgb, var(--plan) 14%, transparent); }
.profile .area-act { fill: color-mix(in srgb, var(--blue) 14%, transparent); }
.profile .line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.profile .line-act { stroke: var(--blue); }
.profile .past { fill: color-mix(in srgb, var(--track) 12%, transparent); }

.xaxis {
  display: flex;
  justify-content: space-between;
  margin: 3px 0 0 44px;
  font-size: 9.5px;
  color: var(--text-muted);
}

.chart-plot { position: relative; }

.cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--p, 0) * 100%);
  width: 1.5px;
  background: var(--track);
}

.readout-chip {
  position: absolute;
  top: 2px;
  left: calc(var(--p, 0) * 100%);
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--track) 55%, var(--border-bright));
  border-radius: 6px;
  background: var(--float-bg);
  box-shadow: var(--control-shadow);
  transform: translateX(calc(var(--p, 0) * -100% + (0.5 - var(--p, 0)) * 20px));
  white-space: nowrap;
}

.readout-chip b { color: var(--track-ink); font-weight: 600; }

.dtab {
  padding: 5px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dtab.is-on { color: var(--activities-ink); background: color-mix(in srgb, var(--activities) 12%, transparent); }

.transport { display: flex; align-items: center; gap: 6px; margin-top: 9px; }

.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 28px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--border-bright);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.tbtn.wide { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.play-btn { color: var(--text-primary); }
.play-btn:hover { border-color: var(--activities-ink); }

.speeds { display: inline-flex; gap: 3px; margin-left: 4px; }
.speeds span {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.speeds .is-on { color: var(--explore-ink); border-color: color-mix(in srgb, var(--explore) 60%, transparent); }

.progress {
  flex: 1;
  height: 3px;
  margin: 0 8px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--activities);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
}

.clock { color: var(--text-secondary); }

/* ── Narrow: the phone shell — map, sheet, mode bar (DESIGN.md §7) ─────── */

@media (max-width: 899px) {
  .page { padding: 16px 12px 16px; }
  .head { flex-wrap: wrap; gap: 6px 12px; margin-bottom: 12px; }
  .line { order: 3; flex-basis: 100%; padding-left: 0; border-left: 0; }

  .console {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'map' 'tabs' 'dock' 'sheet';
    grid-template-rows: auto auto auto auto;
    height: auto;
  }

  .side { display: contents; }
  .map { height: min(50vh, 420px); min-height: 300px; }
  .dock { grid-area: dock; align-self: auto; transform: none; visibility: visible; transition: none; }
  .console[data-mode='explore'] .dock { display: none; }
  .console:not([data-mode='explore']) .coords,
  .console:not([data-mode='explore']) .ctl-zoom { bottom: 12px; }

  .panels {
    grid-area: sheet;
    height: 300px;
    border-top: 1px solid var(--border-bright);
    background: var(--bg-sidebar);
  }

  .panels::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    margin: 7px auto 0;
    border-radius: 999px;
    background: var(--border-bright);
  }

  .tabs { grid-area: tabs; border-top: 1px solid var(--border-bright); }
  .dock { border-top: 0; }
  .dock-bar { gap: 10px; }
  .dock-bar .data { white-space: nowrap; }
  .dock-bar .seg { display: none; }

  .ctl-style { display: none; }
  .ctl-right > span { display: none; }
  .ctl-right .sep { display: none; }
  .ctl-zoom { display: none; }

  .speeds, .tbtn.wide { display: none; }
  .legend span:nth-child(n + 4) { display: none; }
  .foot { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .draw-mask { stroke-dashoffset: 0; }
}
