:root {
  --accent: #1f6f4a;
  --accent-2: #2f8f62;
  --accent-soft: #e3f1e9;
  --route: #e11d48;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-2: #f3f4f1;
  --text: #1c2420;
  --muted: #5f6b65;
  --line: rgba(28, 36, 32, 0.12);
  --shadow: 0 6px 24px rgba(16, 24, 20, 0.16), 0 1px 3px rgba(16, 24, 20, 0.12);
  --radius: 14px;
  --chart-ink: #26312c;
  --chart-grid: rgba(95, 107, 101, 0.18);
  --good: #16a34a;
  --ok: #ca8a04;
  --warn: #ea580c;
  --bad: #dc2626;
  --sheet-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #3fb07a;
    --accent-2: #56c48f;
    --accent-soft: rgba(63, 176, 122, 0.16);
    --surface: rgba(24, 28, 26, 0.94);
    --surface-solid: #181c1a;
    --surface-2: #232825;
    --text: #e8ece9;
    --muted: #9aa69f;
    --line: rgba(232, 236, 233, 0.12);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --chart-ink: #e8ece9;
    --chart-grid: rgba(154, 166, 159, 0.18);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #3fb07a; --accent-2: #56c48f; --accent-soft: rgba(63, 176, 122, 0.16);
  --surface: rgba(24, 28, 26, 0.94); --surface-solid: #181c1a; --surface-2: #232825;
  --text: #e8ece9; --muted: #9aa69f; --line: rgba(232, 236, 233, 0.12);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --chart-ink: #e8ece9; --chart-grid: rgba(154, 166, 159, 0.18);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
/* No browser pinch-zoom on the UI chrome (gestures.js sends it to the map). */
html { touch-action: none; }
.panel-body, .sheet-body, #search-results, .hours { touch-action: pan-y; }
.hours { touch-action: pan-x; }
body {
  font: 14px/1.4 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: #dfe6e0;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
#map { position: fixed; inset: 0; }
.ic { flex: none; display: block; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  width: min(520px, calc(100vw - 96px));
}
.brand {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  backdrop-filter: blur(10px);
}
.search {
  position: relative; flex: 1; display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 10px 0 12px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); backdrop-filter: blur(10px);
  color: var(--muted);
}
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 15px; height: 100%;
}
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font: 11px ui-monospace, monospace; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted);
}
.search:focus-within { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
#search-results {
  position: absolute; top: 46px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--surface-solid); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 60vh; overflow: auto;
}
#search-results li { padding: 8px 10px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; }
#search-results li.active, #search-results li:hover { background: var(--accent-soft); }
.r-name { color: var(--text); font-weight: 600; }
.r-sub { color: var(--muted); font-size: 12px; text-transform: capitalize; }

/* ---------------------------------------------------------------- activity bar */
.activity-bar {
  position: absolute; top: 62px; left: 12px; z-index: 4;
  display: flex; gap: 2px; padding: 4px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.act {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer; color: var(--muted); font-weight: 600;
  transition: background .15s, color .15s;
}
.act:hover { background: var(--surface-2); color: var(--text); }
.act[aria-pressed="true"] { background: var(--accent); color: #fff; }
.act:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.zoom-hint {
  position: absolute; top: 112px; left: 12px; z-index: 3; height: 30px; padding: 0 12px; border: 0; border-radius: 999px;
  background: var(--surface); color: var(--muted); box-shadow: var(--shadow); font-size: 12px; font-weight: 600; cursor: pointer;
}
.zoom-hint:hover { color: var(--text); }

/* ---------------------------------------------------------------- floating buttons */
.fab-col {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  display: flex; flex-direction: column; gap: 8px;
}
.fab {
  width: 60px; height: 56px; border: 0; border-radius: 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); backdrop-filter: blur(10px);
  font-size: 11px; font-weight: 600;
}
.fab:hover { background: var(--surface-solid); }
.fab[aria-pressed="true"] { background: var(--accent); color: #fff; }
.fab.primary { background: var(--route); color: #fff; }
.fab.primary[aria-pressed="true"] { background: #9f1239; }
.fab-3d { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; }
.fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Weather */
.wx-canvas { position: absolute; top: 0; left: 0; pointer-events: none; transition: opacity .3s; }
.wx-canvas.wx-hide { opacity: 0; transition: opacity .1s; }
.wx-bar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sheet-h) + 18px); z-index: 6;
  width: min(560px, calc(100% - 200px)); padding: 6px 12px 8px 6px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(12px); transition: bottom .2s;
}
.wx-row { display: flex; align-items: center; gap: 8px; }
.wx-row input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.wx-time.linked::before { content: "⚑ "; color: var(--route); }
.wx-time { font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 120px; text-align: right; }
.wx-info { justify-content: space-between; padding-left: 8px; flex-wrap: wrap; gap: 4px 14px; }
.wx-legend { display: flex; gap: 12px; }
.wx-lg { display: inline-flex; align-items: center; gap: 6px; }
.wx-lg i { display: block; width: 110px; height: 7px; border-radius: 999px; }
.wx-lg small, .wx-read { font-size: 11px; color: var(--muted); }
.wx-read { font-variant-numeric: tabular-nums; }

/* 3D tilt & rotate */
.view3d {
  position: absolute; right: 12px; bottom: calc(var(--sheet-h) + 44px); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px 8px;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px);
  transition: bottom .2s;
}
.orbit {
  position: relative; width: 76px; height: 76px; border-radius: 50%; cursor: grab; touch-action: none;
  background: radial-gradient(circle, var(--surface-solid) 0 30%, var(--surface-2) 31% 100%);
  box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center;
  outline-offset: 3px;
}
.orbit::before, .orbit::after { content: ""; position: absolute; background: var(--line); }
.orbit::before { width: 1px; height: 100%; }
.orbit::after { height: 1px; width: 100%; }
.orbit.active { cursor: grabbing; box-shadow: inset 0 0 0 2px var(--accent); }
.orbit-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.35); z-index: 1; transition: transform .05s; }
.orbit-label { position: absolute; bottom: 6px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.v3-row { display: flex; gap: 0; }
.view3d .tool { width: 30px; height: 30px; }

/* MapLibre controls */
.maplibregl-ctrl-top-right { top: 334px; right: 4px; }
.maplibregl-ctrl-group { border-radius: 12px !important; box-shadow: var(--shadow) !important; overflow: hidden; background: var(--surface-solid); }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--sheet-h) + 4px); transition: bottom .2s; }
.maplibregl-ctrl-scale { border-radius: 4px; background: rgba(255,255,255,0.8); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
}

/* ---------------------------------------------------------------- panels */
.panel {
  position: absolute; top: 12px; right: 84px; z-index: 6;
  width: 340px; max-height: calc(100% - 24px - var(--sheet-h));
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 6px 16px; }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-body { overflow: auto; padding: 0 16px 16px; }
.lp-sec { padding: 10px 0; border-top: 1px solid var(--line); }
.lp-sec:first-child { border-top: 0; }
.lp-sec h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.note a { color: var(--accent); }

.tg { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.tg-text { flex: 1; display: flex; flex-direction: column; }
.tg-text small { color: var(--muted); font-size: 11px; }
/* keep the real checkbox inside its row: focusing it must not scroll the page */
.tg input { position: absolute; right: 0; top: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.tg-ui { width: 36px; height: 21px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.tg-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.tg input:checked + .tg-ui { background: var(--accent); }
.tg input:checked + .tg-ui::after { transform: translateX(15px); }
.tg input:focus-visible + .tg-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.range { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
.range input { accent-color: var(--accent); }
.key-row { display: flex; gap: 6px; margin-top: 8px; }
.key-row input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-solid); color: var(--text); font: inherit; }

/* segmented controls & chips */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 12px; }
.seg.full { display: flex; flex-wrap: wrap; }
.seg.full button { flex: 1 1 auto; }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.seg.small button { height: 28px; padding: 0 10px; font-size: 12px; }
.seg button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface-solid); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-solid); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger-text { color: var(--bad); border-color: transparent; background: transparent; padding: 0 4px; }
.tool {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer;
}
.tool:hover { background: var(--surface-2); }
.tool:disabled { opacity: .35; cursor: default; background: transparent; }
.tool.danger:hover { color: var(--bad); }
.tool-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.link { border: 0; background: none; padding: 4px 0; color: var(--accent); cursor: pointer; font-weight: 600; font-size: 12px; text-align: left; }

/* ---------------------------------------------------------------- planner sheet */
.sheet {
  position: absolute; left: 12px; right: 84px; bottom: 12px; z-index: 6;
  max-width: 1120px; margin: 0 auto; max-height: 52vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 6px 12px; flex-wrap: wrap; }
.tools { display: flex; align-items: center; flex-wrap: wrap; }
.sheet-body { overflow: auto; padding: 0 16px 14px; }
.sheet.collapsed .sheet-body { display: none; }
.sheet.busy .sheet-head::after {
  content: ""; position: absolute; top: 0; left: 18px; right: 18px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--route), transparent); background-size: 50% 100%; background-repeat: no-repeat;
  animation: busy 1s linear infinite;
}
@keyframes busy { from { background-position: -50% 0; } to { background-position: 150% 0; } }

.stats { display: flex; gap: 8px 22px; flex-wrap: wrap; padding: 6px 0 10px; }
.stat { display: flex; flex-direction: column; min-width: 72px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: -1px; margin-right: 5px; }

.profile-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.craft { display: none; }
.sheet.is-paddle .craft, body[data-activity="paddle"] .craft { display: inline-flex; }
.profile-box { position: relative; }
#profile-canvas { display: block; width: 100%; height: 150px; cursor: crosshair; touch-action: none; }
.profile-tip {
  position: absolute; top: 4px; pointer-events: none; z-index: 2;
  padding: 6px 9px; border-radius: 9px; background: var(--surface-solid); box-shadow: var(--shadow);
  font-size: 12px; line-height: 1.45; white-space: nowrap; text-transform: none;
}
.breakdown { margin-top: 8px; }
.bd-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.bd-bar span { display: block; height: 100%; }
.bd-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.bd-item { display: inline-flex; align-items: center; gap: 5px; }
.bd-item i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.bd-item b { color: var(--text); font-weight: 600; }

.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 18px; margin-top: 10px; }
.list:empty { display: none; }
.list h4 { margin: 8px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.li {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; text-align: left; color: var(--text);
}
.li:hover, .li.sel { background: var(--surface-2); }
.li .ic { color: var(--warn); }
.li-row { display: flex; align-items: center; gap: 4px; }
.li-row .li { flex: 1; min-width: 0; }
.btn.avoid { height: 26px; padding: 0 9px; font-size: 12px; color: var(--bad); border-color: rgba(220,38,38,.35); }
.btn.avoid:hover { background: rgba(220,38,38,.08); }
.kind-incident .li .ic, .kind-roadwork .li .ic { color: var(--bad); }
.kind-busy .li .ic { color: #b45309; }
.kind-roadcond .li .ic { color: #7e22ce; }
.li-main { display: flex; flex-direction: column; min-width: 0; }
.li-main span { color: var(--muted); font-size: 12px; }
.badge { flex: none; min-width: 32px; height: 22px; padding: 0 6px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12px; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.wind-body { font-size: 13px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.list.wind h4 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.start { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 600; }
.start-select { height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-solid); color: var(--text); font: inherit; font-size: 12px; padding: 0 6px; }
.chip-map { display: inline-flex; align-items: center; gap: 4px; }
.wx-sum { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.wx-sum .link { font-weight: 500; color: var(--text); text-decoration: underline dotted; text-underline-offset: 3px; }
.wx-links { display: flex; gap: 12px; flex-wrap: wrap; }
.chip-map .ic { width: 14px; height: 14px; }
.wind-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wind-arrow { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; background: var(--surface-2); font-size: 16px; font-weight: 700; }
.pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.good { background: rgba(22,163,74,.14); color: var(--good); }
.pill.ok { background: rgba(202,138,4,.14); color: var(--ok); }
.pill.warn { background: rgba(234,88,12,.14); color: var(--warn); }
.pill.bad { background: rgba(220,38,38,.14); color: var(--bad); }
.exposure { display: grid; gap: 4px; margin: 4px 0; width: 100%; }
.ex-item { display: grid; grid-template-columns: 90px 1fr; align-items: center; font-size: 12px; color: var(--muted); }
.ex-item i { grid-column: 2; grid-row: 1; height: 7px; border-radius: 999px; display: block; }
.hours { display: flex; gap: 4px; overflow-x: auto; }
.hour { display: flex; flex-direction: column; align-items: center; min-width: 40px; padding: 4px; border-radius: 8px; background: var(--surface-2); font-size: 12px; }
.hour i { font-style: normal; font-weight: 700; }
.hour small { color: var(--muted); font-size: 10px; }

/* ---------------------------------------------------------------- waypoints */
.wp {
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font: 700 11px/1 system-ui, sans-serif; color: #111; background: #fff; border: 2.5px solid #111;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: grab;
}
.wp:active { cursor: grabbing; }
.wp-start { background: #16a34a; border-color: #fff; width: 24px; height: 24px; }
.wp-start::after { content: ""; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; margin-left: 2px; }
.wp-end { background: #111; border-color: #fff; width: 24px; height: 24px; }
.wp-end::after { content: ""; width: 8px; height: 8px; background: #fff; border-radius: 1px; }
.wp-loop { background: conic-gradient(#16a34a 0 50%, #111 50% 100%); }

/* ---------------------------------------------------------------- popups */
.polku-popup .maplibregl-popup-content { border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); background: var(--surface-solid); color: var(--text); }
.polku-popup .maplibregl-popup-tip { border-top-color: var(--surface-solid); border-bottom-color: var(--surface-solid); }
.polku-popup .maplibregl-popup-close-button { font-size: 18px; width: 26px; height: 26px; right: 4px; top: 4px; border-radius: 8px; color: var(--muted); }
.insp { min-width: 230px; }
.insp-title { font-weight: 700; font-size: 15px; padding-right: 22px; }
.insp-sub { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.insp-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: baseline; }
.insp-row span { color: var(--muted); }
.insp-row b { font-weight: 600; overflow-wrap: anywhere; }
.insp-row b .dot { vertical-align: 0; }
.insp-info { font-size: 12px; color: var(--muted); margin: 6px 0; }
.insp-links { display: flex; gap: 12px; margin-top: 8px; font-size: 12px; }
.insp-links a { color: var(--accent); display: inline-flex; align-items: center; gap: 3px; font-weight: 600; text-decoration: none; }
.insp-more { margin-top: 6px; }
.insp-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.pt-menu { display: flex; flex-direction: column; gap: 8px; min-width: 190px; }
.pt-title { font-weight: 700; }
.pt-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: -4px; }

/* ---------------------------------------------------------------- legend */
.lg-item { display: flex; align-items: center; gap: 10px; padding: 3px 0; font-size: 12.5px; }
.lg-line { display: block; width: 34px; flex: none; border-radius: 3px; }
.lg-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; margin: 0 10px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.lg-arrow { width: 34px; text-align: center; font-weight: 800; }

/* ---------------------------------------------------------------- modal & cards */
.modal {
  padding: 0; border: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--surface-solid); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.35);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal:not([open]) { display: none; }
.modal::backdrop { background: rgba(10, 14, 12, 0.55); backdrop-filter: blur(2px); }
.modal-wide { width: min(980px, calc(100vw - 24px)); }
.modal-card { position: fixed; inset: auto auto calc(var(--sheet-h) + 16px) 12px; margin: 0; width: min(360px, calc(100vw - 24px)); max-height: min(70vh, calc(100vh - var(--sheet-h) - 140px)); z-index: 9; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 12px 8px 18px; }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.modal-body { padding: 0 18px 16px; overflow: auto; }
.cam-tabs { margin-bottom: 10px; }
.cam-stage { position: relative; background: #0b0f0d; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; max-height: calc(100vh - 270px); min-height: 160px; display: flex; align-items: center; justify-content: center; }
.cam-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-loading { position: absolute; inset: auto 12px 12px auto; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; }
.cam-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.cam-controls input[type=range] { flex: 1; accent-color: var(--accent); }
.cam-time { font-size: 12px; font-weight: 600; color: var(--muted); min-width: 170px; text-align: right; font-variant-numeric: tabular-nums; }
.cam-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; align-items: flex-end; }
.cam-wx { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.cam-wx-title { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); width: 100%; }
.cam-wx-item { display: flex; flex-direction: column; font-size: 13px; }
.cam-wx-item small { color: var(--muted); font-size: 11px; }
.cam-links { display: flex; gap: 14px; }
.ship-live { margin-bottom: 6px; }
.ship-static .insp-row:last-child { border-bottom: 0; }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 720px) {
  .modal-wide { width: calc(100vw - 12px); }
  .cam-time { min-width: 0; }
  .modal-card { inset: auto 8px calc(var(--sheet-h) + 8px) 8px; width: auto; }
}

/* ---------------------------------------------------------------- misc */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--sheet-h) + 24px); z-index: 20; transform: translate(-50%, 10px);
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px;
  background: #111a16; color: #fff; box-shadow: var(--shadow); font-weight: 500; opacity: 0; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-tone="warn"] { background: #7c2d12; }
.track-card {
  position: absolute; left: 12px; bottom: calc(var(--sheet-h) + 40px); z-index: 7;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tc-main { display: flex; flex-direction: column; }
.tc-main span { color: var(--muted); font-size: 12px; }
.drop-hint {
  position: fixed; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center;
  background: rgba(31,111,74,.18); border: 3px dashed var(--accent); font-size: 22px; font-weight: 700; color: var(--accent);
}
body.dropping .drop-hint { display: flex; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 720px) {
  .topbar { width: auto; right: 12px; }
  .brand span { display: none; }
  .search kbd { display: none; }
  .activity-bar { left: 12px; right: 12px; justify-content: space-between; overflow-x: auto; }
  .act { padding: 0 10px; flex: 1; justify-content: center; }
  .act span { font-size: 12px; }
  .fab-col { top: 112px; }
  .zoom-hint { top: 112px; }
  .fab { width: 48px; height: 48px; border-radius: 14px; }
  .fab span:not(.fab-3d) { display: none; }
  .maplibregl-ctrl-top-right { top: 392px; }
  .view3d { bottom: calc(var(--sheet-h) + 40px); padding: 8px 6px 6px; }
  .wx-bar { width: calc(100% - 24px); bottom: calc(var(--sheet-h) + 40px); }
  .wx-time { min-width: 0; }
  body.planning .wx-bar { display: none; }
  .orbit { width: 62px; height: 62px; }
  .panel { left: 12px; right: 12px; top: auto; bottom: calc(12px + var(--sheet-h)); width: auto; max-height: 62vh; }
  .sheet { left: 8px; right: 8px; bottom: 8px; max-height: 52vh; }
  .sheet-head { padding: 8px 6px 4px 8px; gap: 4px; }
  .tool { width: 30px; height: 32px; }
  .tool-sep { display: none; }
  .seg button span { display: none; }
  /* While planning, keep only Plan + Layers so the sheet has room */
  body.planning .fab-col .fab:nth-child(n+3) { display: none; }
  body.planning .maplibregl-ctrl-top-right { display: none; }
  .stats { gap: 6px 16px; }
  .stat-value { font-size: 17px; }
  #profile-canvas { height: 120px; }
}
@media (max-width: 380px) {
  .act span { display: none; }
}
