/* ZapMinder — snowfield surfaces, slate ink, and one diverging pair:
   rust = the battery is working, glacier = the hill is paying you back. */
:root {
  --bg: #E9EEF0;
  --surface: #F7F9FA;
  --raised: #FFFFFF;
  --ink: #16232B;
  --ink2: #44545D;
  --muted: #6E7E87;
  --hair: #CBD5D9;
  --hair2: #B3C0C5;
  --burn: #B5400F;
  --burn2: #D9774A;
  --burn3: #EDB99C;
  --mid: #C7CED1;
  --regen3: #A2CCCF;
  --regen2: #4E9EA6;
  --regen: #0B6E79;
  --zap: #C99A00;
  --zapInk: #3B2D00;
  --terrain: #D7DEE1;
  --warn: #A3480B;
  --focus: #1E5FAF;
  --shadow: 0 1px 0 rgba(22, 35, 43, .06), 0 8px 24px -12px rgba(22, 35, 43, .25);
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F161A; --surface: #151F25; --raised: #1B2830; --ink: #E4ECEF; --ink2: #B2C0C6; --muted: #81939B;
    --hair: #26353D; --hair2: #34464F;
    --burn: #F07A3E; --burn2: #C25A2A; --burn3: #6E3A22; --mid: #55646B; --regen3: #1F4D52; --regen2: #2F8A93; --regen: #5CC9D2;
    --zap: #F2C230; --zapInk: #1A1400; --terrain: #24323A; --warn: #F0A15E; --focus: #7FB2F0;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F161A; --surface: #151F25; --raised: #1B2830; --ink: #E4ECEF; --ink2: #B2C0C6; --muted: #81939B;
  --hair: #26353D; --hair2: #34464F;
  --burn: #F07A3E; --burn2: #C25A2A; --burn3: #6E3A22; --mid: #55646B; --regen3: #1F4D52; --regen2: #2F8A93; --regen: #5CC9D2;
  --zap: #F2C230; --zapInk: #1A1400; --terrain: #24323A; --warn: #F0A15E; --focus: #7FB2F0;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif; font-size: 15px; line-height: 1.45;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num, output, td.n { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
a { color: inherit; }

/* ---------------- header ---------------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 10px max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair);
}
.mark { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.mark svg { width: 28px; height: 28px; }
.mark .mtn { fill: var(--ink); }
.mark .bolt { fill: var(--zap); stroke: var(--bg); stroke-width: 1.5; stroke-linejoin: round; }
.mark span { font-weight: 800; font-size: 20px; font-variation-settings: 'wdth' 125; letter-spacing: -.02em; }
.tabs { display: flex; gap: 4px; }
.tabs a {
  text-decoration: none; padding: 6px 12px; border-radius: 999px; color: var(--ink2); font-weight: 550;
  font-variation-settings: 'wdth' 90;
}
.tabs a:hover { color: var(--ink); background: var(--surface); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.carChip {
  margin-left: auto; border: 1px solid var(--hair2); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; color: var(--ink2); cursor: pointer; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.carChip:hover { border-color: var(--ink2); color: var(--ink); }

/* ---------------- building blocks ---------------- */
.h { font-size: 13px; font-weight: 650; color: var(--ink2); margin-bottom: 10px; font-variation-settings: 'wdth' 85; letter-spacing: .01em; }
.h2 { font-size: 22px; font-weight: 750; letter-spacing: -.015em; font-variation-settings: 'wdth' 112; margin-bottom: 6px; line-height: 1.15; }
.lede { color: var(--ink2); max-width: 64ch; margin-bottom: 16px; }
.block { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 16px; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; flex-wrap: wrap; }
.small { font-size: 13px; color: var(--muted); }
.primary {
  width: 100%; margin-top: 14px; padding: 11px 16px; border: 0; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-weight: 650; cursor: pointer; font-variation-settings: 'wdth' 105;
}
.primary:hover { filter: brightness(1.15); }
.primary:disabled { opacity: .55; cursor: progress; }
.ghost {
  border: 1px solid var(--hair2); background: transparent; border-radius: 8px; padding: 6px 10px;
  font-size: 13px; cursor: pointer; color: var(--ink2);
}
.ghost:hover { border-color: var(--ink2); color: var(--ink); }
.linkish { background: none; border: 0; color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }
.status { min-height: 1.2em; margin-top: 8px; font-size: 13px; color: var(--muted); }
.status.err { color: var(--warn); }

/* ---------------- trip form ---------------- */
.stops { list-style: none; display: grid; gap: 6px; margin-bottom: 10px; counter-reset: s; }
.stop { position: relative; display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; }
.stop .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: var(--surface); justify-self: center; }
.stop:first-child .dot { background: var(--ink); }
.stop:last-child .dot { border-radius: 2px; background: var(--ink); }
.stop input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--hair2); border-radius: 8px; background: var(--raised);
}
.stop input:focus { border-color: var(--ink2); outline: none; box-shadow: 0 0 0 3px color-mix(in oklab, var(--focus) 25%, transparent); }
.stop .x { border: 0; background: none; color: var(--muted); cursor: pointer; width: 28px; height: 28px; border-radius: 6px; font-size: 18px; line-height: 1; }
.stop .x:hover { color: var(--ink); background: var(--bg); }
.suggest {
  position: absolute; left: 26px; right: 36px; top: 100%; z-index: 30; margin-top: 2px;
  background: var(--raised); border: 1px solid var(--hair2); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden;
}
.suggest button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; cursor: pointer; font-size: 14px; }
.suggest button:hover, .suggest button.on { background: var(--bg); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.presets button { border: 1px dashed var(--hair2); background: none; border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--ink2); cursor: pointer; }
.presets button:hover { border-style: solid; color: var(--ink); }

.field { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 14px; color: var(--ink2); margin-bottom: 12px; }
.field output { font-weight: 650; color: var(--ink); }
.field input[type=range], .field select { grid-column: 1 / -1; width: 100%; }
.field select { padding: 7px 8px; border: 1px solid var(--hair2); border-radius: 8px; background: var(--raised); margin-top: 4px; }
input[type=range] { accent-color: var(--ink); height: 28px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink2); margin-bottom: 8px; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.more summary { cursor: pointer; font-size: 14px; color: var(--ink2); margin: 4px 0 12px; }
.more[open] summary { margin-bottom: 14px; }

/* ---------------- trip layout ---------------- */
main { padding: 16px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); }
.tripGrid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; max-width: 1500px; margin: 0 auto; }
.side { display: grid; gap: 12px; position: sticky; top: 70px; }
.stage { display: grid; gap: 12px; min-width: 0; }
#result { display: grid; gap: 12px; }
.empty { border: 1px dashed var(--hair2); border-radius: var(--r); padding: 28px; color: var(--ink2); max-width: 70ch; }
.empty p { font-size: 17px; line-height: 1.5; }

/* summary: the trip in one sentence plus the numbers */
.summary { display: grid; gap: 12px; }
.headline { font-size: clamp(20px, 2.4vw, 30px); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; font-variation-settings: 'wdth' 108; max-width: 40ch; text-wrap: balance; }
.headline .route { display: block; font-size: 14px; font-weight: 550; color: var(--muted); letter-spacing: 0; font-variation-settings: 'wdth' 90; margin-bottom: 4px; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.stat { padding: 10px 12px 10px 0; }
.stat + .stat { padding-left: 12px; border-left: 1px solid var(--hair); }
.stat b { display: block; font-size: 24px; font-weight: 700; font-variation-settings: 'wdth' 80; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* the hero: elevation filled by power */
.profile { position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 12px 6px; touch-action: pan-y; }
.profile svg { display: block; width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; }
.profile .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.profile .grid line { stroke: var(--hair); stroke-width: 1; }
.profile .eleLine { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.profile .socLine { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.profile .reserve { fill: color-mix(in oklab, var(--warn) 14%, transparent); }
.profile .zapLine { stroke: var(--zap); stroke-width: 2; }
.profile .zapTag rect { fill: var(--zap); }
.profile .zapTag text { fill: var(--zapInk); font-size: 11px; font-weight: 700; }
.profile .cross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; }
.profile .panelLabel { fill: var(--ink2); font-size: 12px; font-weight: 600; }
.legendBar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink2); padding: 4px 4px 2px; }
.legendBar .ramp { width: 160px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, var(--regen), var(--regen2), var(--regen3), var(--mid), var(--burn3), var(--burn2), var(--burn)); }
.legendBar .k { display: inline-flex; gap: 6px; align-items: center; }
.legendBar .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.mapWrap { border-radius: var(--r); overflow: hidden; border: 1px solid var(--hair); height: 420px; background: var(--terrain); }
#map { width: 100%; height: 100%; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.zapPin { width: 22px; height: 22px; border-radius: 50%; background: var(--zap); border: 2px solid var(--raised); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.zapPin svg { width: 12px; height: 12px; fill: var(--zapInk); }
.sitePin { width: 10px; height: 10px; border-radius: 50%; background: var(--raised); border: 2px solid var(--ink2); cursor: pointer; }
.endPin { width: 14px; height: 14px; border-radius: 3px; background: var(--ink); border: 2px solid var(--raised); box-shadow: var(--shadow); }
.carPin { width: 14px; height: 14px; border-radius: 50%; background: var(--raised); border: 3px solid var(--ink); box-shadow: var(--shadow); }
.maplibregl-popup-content { background: var(--raised); color: var(--ink); border-radius: 8px; font: 13px/1.4 'Archivo', sans-serif; padding: 10px 12px; box-shadow: var(--shadow); }
.maplibregl-popup-tip { border-top-color: var(--raised) !important; border-bottom-color: var(--raised) !important; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stopList { list-style: none; display: grid; gap: 10px; }
.stopItem { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; }
.stopItem .badge { width: 26px; height: 26px; border-radius: 50%; background: var(--zap); color: var(--zapInk); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.stopItem .badge.home { background: var(--ink); color: var(--bg); }
.stopItem b { font-weight: 650; }
.stopItem .money { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.stopItem .sub { font-size: 13px; color: var(--muted); }

/* where trips start */
.homeAsk { border: 1px solid var(--hair2); background: var(--raised); border-radius: 8px; padding: 12px; margin-bottom: 12px; display: grid; gap: 8px; }
.homeAsk .primary { margin-top: 0; }
.homeAsk .homeField { position: relative; }
#makeHome { display: block; margin: -4px 0 10px 26px; }
:root[data-skin="lcars"] .homeAsk { background: #000; border: 2px solid var(--lc-sun); border-radius: 0 22px 22px 0; border-left-width: 10px; }

/* summary actions, saved plans, share dialog */
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.savedHead { width: 100%; font-size: 12px; color: var(--muted); margin-top: 6px; }
.savedChip { display: inline-flex; border: 1px solid var(--hair2); border-radius: 999px; overflow: hidden; }
.presets .savedChip button { border: 0; border-radius: 0; }
.savedChip .del { padding: 4px 8px 4px 2px; color: var(--muted); }
.shareDlg { margin: auto; border: 1px solid var(--hair2); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.shareDlg::backdrop { background: rgba(10, 16, 20, .45); }
.shareDlg .qr { background: #fff; padding: 10px; border-radius: 8px; width: min(260px, 100%); margin: 12px auto; }
.shareDlg .qr svg { display: block; width: 100%; height: auto; }
.shareDlg .link { width: 100%; padding: 7px 8px; border: 1px solid var(--hair2); border-radius: 8px; background: var(--raised); font-size: 12px; }
:root[data-skin="lcars"] .shareDlg { background: #000; border: 0; border-left: 18px solid var(--lc-orange); border-top: 8px solid var(--lc-orange); border-radius: 36px 0 0 0; }
:root[data-skin="lcars"] .savedChip { border: 0; }
:root[data-skin="lcars"] .presets .savedChip button { background: var(--lc-lav); }

/* charging while parked at a stop */
.dwellBtn { grid-column: 2 / 4; justify-self: start; border: 0; background: none; color: var(--ink2); font-size: 13px; cursor: pointer; padding: 0 2px; text-decoration: underline; text-underline-offset: 3px; }
.dwell { grid-column: 2 / 4; border: 1px solid var(--hair2); border-radius: 8px; padding: 10px; display: grid; gap: 8px; background: var(--raised); font-size: 13px; }
.dwellHead { display: flex; justify-content: space-between; align-items: center; }
.dwell label { display: grid; gap: 3px; color: var(--ink2); }
.dwell select, .dwell input { padding: 6px 8px; border: 1px solid var(--hair2); border-radius: 6px; background: var(--surface); width: 100%; min-width: 0; }
.dwellNums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.near { display: flex; justify-content: space-between; gap: 8px; align-items: center; border-top: 1px solid var(--hair); padding-top: 6px; }
.near .ghost { white-space: nowrap; }
.stopItem .badge.plug { background: var(--regen2); color: var(--surface); }
:root[data-skin="lcars"] .dwell { background: #000; border: 2px solid var(--lc-blue); border-radius: 0 22px 22px 0; border-left-width: 10px; }
:root[data-skin="lcars"] .dwell select, :root[data-skin="lcars"] .dwell input { background: #000; border: 2px solid var(--hair2); border-radius: 999px; color: var(--lc-peach); }
:root[data-skin="lcars"] .dwellBtn { color: var(--lc-blue); text-transform: uppercase; letter-spacing: .06em; }

/* options spread */
.spreadGrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
#spread tr[data-stops]:hover td, #spread tr[data-start]:hover td { background: color-mix(in oklab, var(--ink) 6%, transparent); }
@media (max-width: 980px) { .spreadGrid { grid-template-columns: 1fr; } }

/* stop-count choices */
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choices button {
  flex: 1 1 120px; text-align: left; border: 1px solid var(--hair2); background: var(--raised); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; display: grid; gap: 2px;
}
.choices button span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.choices button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choices .tag { font-size: 11px; font-weight: 600; color: var(--ink2); background: var(--bg); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
:root[data-skin="lcars"] .choices button { background: #000; border: 2px solid var(--hair2); border-radius: 999px; padding: 6px 16px; text-transform: uppercase; letter-spacing: .06em; }
:root[data-skin="lcars"] .choices button[aria-pressed="true"] { background: var(--lc-sun); border-color: var(--lc-sun); box-shadow: none; }
:root[data-skin="lcars"] .choices button[aria-pressed="true"] b,
:root[data-skin="lcars"] .choices button[aria-pressed="true"] span { color: #000; }
:root[data-skin="lcars"] .choices .tag { background: #000; color: var(--lc-sun); }

/* receipt: where the energy went */
.bars { display: grid; gap: 7px; }
.barRow { display: grid; grid-template-columns: minmax(112px, 30%) 1fr 64px; gap: 10px; align-items: center; font-size: 13.5px; }
.barRow .track { height: 12px; position: relative; }
.barRow .fill { position: absolute; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.barRow .fill.neg { border-radius: 4px 0 0 4px; }
.barRow .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink2); }
.barRow.total { border-top: 1px solid var(--hair); padding-top: 7px; font-weight: 650; }

/* ---------------- pages (speed / costs / log) ---------------- */
.page { max-width: 1100px; margin: 0 auto; display: grid; gap: 16px; }
.page section, .page .card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 18px; }
.page .big { font-size: clamp(22px, 3vw, 34px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variation-settings: 'wdth' 108; max-width: 30ch; text-wrap: balance; }
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 8px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .ttl { font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.chart .ttl small { font-weight: 450; color: var(--muted); }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink2); font-size: 11.5px; }
.chart .val { fill: var(--ink); font-size: 11.5px; font-weight: 650; }
.chart .gridl { stroke: var(--hair); }
.chart .base { stroke: var(--hair2); }
.chart .bar { fill: var(--mid); }
.chart .bar.best { fill: var(--ink); }
.chart .bar.you { fill: var(--ink2); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .zero { stroke: var(--ink2); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink2); margin: 6px 0 4px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink2); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--hair2); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--hair); vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; }
table.t tr.hl td { background: color-mix(in oklab, var(--zap) 12%, transparent); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.note { font-size: 13px; color: var(--muted); max-width: 72ch; }
.note a { color: var(--ink2); }
.callout { border-left: 3px solid var(--zap); padding: 4px 0 4px 12px; max-width: 72ch; }
.inline { display: inline-flex; gap: 8px; align-items: center; }
.inline input[type=range] { width: 180px; }
.formGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.formGrid label { display: grid; gap: 4px; font-size: 13px; color: var(--ink2); }
.formGrid input, .formGrid select { padding: 7px 8px; border: 1px solid var(--hair2); border-radius: 8px; background: var(--raised); width: 100%; min-width: 0; }
.formGrid .wide { grid-column: span 2; }
.formGrid label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.formGrid label.check input { width: 16px; height: 16px; }
.formGrid label.full { grid-column: 1 / -1; }
.formGrid label.end { align-self: end; padding-bottom: 8px; grid-column: span 2; }
.btnRow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.btnRow .primary { width: auto; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--hair2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--ink2); }
.seg button.on { background: var(--ink); color: var(--bg); }

/* footer */
.foot { max-width: 1100px; margin: 8px auto 24px; padding: 0 16px; font-size: 12.5px; color: var(--muted); display: grid; gap: 6px; }
.foot a { color: var(--ink2); }
:root[data-skin="lcars"] .foot { color: var(--lc-lav); }

/* tooltip */
.tip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 150px; max-width: 260px;
  background: var(--raised); color: var(--ink); border: 1px solid var(--hair2); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums;
}
.tip b { display: block; font-weight: 650; margin-bottom: 2px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; color: var(--ink2); }
.tip .r span:last-child { color: var(--ink); font-weight: 600; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------------- phone ---------------- */
@media (max-width: 980px) {
  .tripGrid { grid-template-columns: 1fr; }
  .side { display: contents; }
  #tripForm { order: 1; } .stage { order: 2; } #conditions { order: 3; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--hair); }
  .cols, .two { grid-template-columns: 1fr; }
  .multiples { grid-template-columns: 1fr; }
  .formGrid { grid-template-columns: 1fr 1fr; }
  .mapWrap { height: 340px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  /* a backdrop-filter would trap the fixed tab bar inside the header */
  .top { gap: 12px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); position: static; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in oklab, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--hair);
  }
  .tabs a { flex: 1; text-align: center; padding: 10px 4px; font-size: 15px; }
  main { padding-top: 12px; }
  .carChip, .skinBtn { font-size: 12px; padding: 5px 9px; }
  .mark span { font-size: 18px; }
  .block { padding: 14px; }
  .barRow { grid-template-columns: 40% 1fr 56px; font-size: 13px; }
  .page section, .page .card { padding: 14px; }
  .inline input[type=range] { width: 130px; }
}
@media (prefers-reduced-motion: no-preference) {
  .profile.enter .slices { animation: rise .6s ease-out both; transform-origin: bottom; }
  @keyframes rise { from { opacity: 0; transform: scaleY(.85); } to { opacity: 1; transform: none; } }
}

/* ---------------- theme switch (both themes) ---------------- */
.skinBtn {
  margin-left: auto; border: 1px solid var(--hair2); background: transparent; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; color: var(--ink2); cursor: pointer;
}
.skinBtn:hover { border-color: var(--ink2); color: var(--ink); }
.skinBtn + .carChip { margin-left: 0; }
.lcBar { display: none; }

/* =====================================================================
   LCARS — black glass, swept elbows, pill controls, condensed caps.
   Same layout and data; only the skin changes.
   ===================================================================== */
:root[data-skin="lcars"] {
  --lc-orange: #FF9C00; --lc-peach: #FFCC99; --lc-sun: #FFCC66; --lc-lav: #CC99CC;
  --lc-violet: #9999FF; --lc-blue: #99CCFF; --lc-red: #CC6666; --lc-tan: #D9A066;
  --bg: #000000; --surface: #000000; --raised: #14141C;
  --ink: #FFCC99; --ink2: #CC99CC; --muted: #9999CC;
  --hair: #2A2A3A; --hair2: #4A4A66;
  --regen: #99CCFF; --regen2: #5F86D6; --regen3: #2C3D66; --mid: #3A3A4A;
  --burn3: #5C3A1E; --burn2: #CC7A22; --burn: #FF9C00;
  --zap: #FFCC66; --zapInk: #000000; --terrain: #0A0A10; --warn: #CC6666; --focus: #99CCFF;
  --shadow: none; --r: 0px;
  color-scheme: dark;
}
:root[data-skin="lcars"] body {
  font-family: 'Antonio', 'Archivo Narrow', sans-serif; font-variation-settings: normal;
  letter-spacing: .02em; font-size: 16px; background: #000;
}
:root[data-skin="lcars"] .num,
:root[data-skin="lcars"] output { font-family: 'Antonio', sans-serif; }

/* header: an orange end-cap, tab pills, a running bar, and the readouts */
:root[data-skin="lcars"] .top {
  background: #000; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; gap: 6px; padding-top: 12px; padding-bottom: 12px;
}
:root[data-skin="lcars"] .mark {
  background: var(--lc-orange); color: #000; padding: 6px 22px 6px 16px; border-radius: 999px 0 0 999px; height: 40px;
}
:root[data-skin="lcars"] .mark span { font-family: 'Antonio', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: .08em; text-transform: uppercase; font-variation-settings: normal; }
:root[data-skin="lcars"] .mark .mtn { fill: #000; }
:root[data-skin="lcars"] .mark .bolt { fill: #000; stroke: var(--lc-orange); }
:root[data-skin="lcars"] .tabs { gap: 6px; }
:root[data-skin="lcars"] .tabs a {
  border-radius: 0; height: 40px; display: grid; place-items: center; padding: 0 18px; color: #000;
  font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .1em; font-variation-settings: normal;
}
:root[data-skin="lcars"] .tabs a[data-tab="trip"]  { background: var(--lc-lav); }
:root[data-skin="lcars"] .tabs a[data-tab="speed"] { background: var(--lc-blue); }
:root[data-skin="lcars"] .tabs a[data-tab="costs"] { background: var(--lc-peach); }
:root[data-skin="lcars"] .tabs a[data-tab="log"]   { background: var(--lc-tan); }
:root[data-skin="lcars"] .tabs a:hover { filter: brightness(1.15); color: #000; }
:root[data-skin="lcars"] .tabs a[aria-current="page"] { background: var(--lc-orange); color: #000; }
:root[data-skin="lcars"] .lcBar { display: flex; flex: 1; gap: 6px; height: 40px; min-width: 40px; }
:root[data-skin="lcars"] .lcBar i { display: block; height: 100%; }
:root[data-skin="lcars"] .lcBar i:nth-child(1) { flex: 5; background: var(--lc-violet); }
:root[data-skin="lcars"] .lcBar i:nth-child(2) { flex: 1; background: var(--lc-red); }
:root[data-skin="lcars"] .lcBar i:nth-child(3) { flex: 2; background: var(--lc-sun); }
:root[data-skin="lcars"] .skinBtn,
:root[data-skin="lcars"] .carChip {
  margin-left: 0; height: 40px; border: 0; border-radius: 0; padding: 0 16px; color: #000; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; font-size: 14px;
}
:root[data-skin="lcars"] .skinBtn { background: var(--lc-blue); }
:root[data-skin="lcars"] .carChip { background: var(--lc-orange); border-radius: 0 999px 999px 0; padding-right: 22px; }

/* panels: the swept elbow frame, a different colour per panel */
:root[data-skin="lcars"] .block,
:root[data-skin="lcars"] .page section,
:root[data-skin="lcars"] .profile,
:root[data-skin="lcars"] .mapWrap,
:root[data-skin="lcars"] .empty {
  --frame: var(--lc-lav);
  background: #000; border: 0; border-left: 22px solid var(--frame); border-top: 10px solid var(--frame);
  border-top-left-radius: 44px; border-bottom-left-radius: 0;
}
:root[data-skin="lcars"] #tripForm { --frame: var(--lc-lav); }
:root[data-skin="lcars"] #conditions { --frame: var(--lc-blue); }
:root[data-skin="lcars"] .profile { --frame: var(--lc-orange); }
:root[data-skin="lcars"] .mapWrap { --frame: var(--lc-peach); }
:root[data-skin="lcars"] #stopsOut { --frame: var(--lc-sun); }
:root[data-skin="lcars"] #receipt { --frame: var(--lc-violet); }
:root[data-skin="lcars"] .page section:nth-child(4n+1) { --frame: var(--lc-orange); }
:root[data-skin="lcars"] .page section:nth-child(4n+2) { --frame: var(--lc-lav); }
:root[data-skin="lcars"] .page section:nth-child(4n+3) { --frame: var(--lc-blue); }
:root[data-skin="lcars"] .page section:nth-child(4n+4) { --frame: var(--lc-tan); }
:root[data-skin="lcars"] .page section.callout { --frame: var(--lc-red); }
:root[data-skin="lcars"] .mapWrap { overflow: hidden; }

/* type */
:root[data-skin="lcars"] .h,
:root[data-skin="lcars"] .h2,
:root[data-skin="lcars"] .chart .ttl {
  font-family: 'Antonio', sans-serif; text-transform: uppercase; letter-spacing: .12em; font-variation-settings: normal;
  color: var(--lc-orange); display: flex; align-items: center; gap: 10px;
}
:root[data-skin="lcars"] .h { font-size: 15px; font-weight: 600; }
:root[data-skin="lcars"] .h2 { font-size: 24px; font-weight: 600; }
:root[data-skin="lcars"] .h::after,
:root[data-skin="lcars"] .h2::after { content: ''; flex: 1; height: 8px; border-radius: 999px; background: var(--frame, var(--lc-lav)); opacity: .9; }
:root[data-skin="lcars"] .headline,
:root[data-skin="lcars"] .page .big {
  font-family: 'Antonio', sans-serif; font-variation-settings: normal; text-transform: uppercase;
  letter-spacing: .03em; font-weight: 600; color: var(--lc-peach); line-height: 1.1;
}
:root[data-skin="lcars"] .headline .route { color: var(--lc-lav); letter-spacing: .14em; font-size: 15px; }
:root[data-skin="lcars"] .lede,
:root[data-skin="lcars"] .empty p { color: var(--lc-peach); }
:root[data-skin="lcars"] .stats { border-color: var(--lc-violet); }
:root[data-skin="lcars"] .stat + .stat { border-left-color: var(--hair2); }
:root[data-skin="lcars"] .stat b { font-family: 'Antonio', sans-serif; font-variation-settings: normal; color: var(--lc-sun); font-size: 30px; font-weight: 600; }
:root[data-skin="lcars"] .stat span { text-transform: uppercase; letter-spacing: .08em; color: var(--lc-lav); font-size: 12px; }

/* controls: pills */
:root[data-skin="lcars"] .primary {
  background: var(--lc-orange); color: #000; border-radius: 999px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; font-family: 'Antonio', sans-serif;
}
:root[data-skin="lcars"] .ghost,
:root[data-skin="lcars"] .presets button,
:root[data-skin="lcars"] .seg button {
  border: 0; border-radius: 999px; color: #000; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; padding: 7px 14px;
}
:root[data-skin="lcars"] .ghost { background: var(--lc-lav); }
:root[data-skin="lcars"] .presets button { background: var(--lc-blue); }
:root[data-skin="lcars"] .presets button:nth-child(2n) { background: var(--lc-sun); }
:root[data-skin="lcars"] .ghost:hover,
:root[data-skin="lcars"] .presets button:hover { filter: brightness(1.15); color: #000; }
:root[data-skin="lcars"] .linkish { color: var(--lc-blue); }
:root[data-skin="lcars"] .stop input,
:root[data-skin="lcars"] .field select,
:root[data-skin="lcars"] .formGrid input,
:root[data-skin="lcars"] .formGrid select,
:root[data-skin="lcars"] .page input[type=number] {
  background: #000; border: 2px solid var(--hair2); border-radius: 999px; color: var(--lc-peach); padding-left: 14px;
}
:root[data-skin="lcars"] .stop input:focus { border-color: var(--lc-orange); box-shadow: none; }
:root[data-skin="lcars"] .stop .dot { border-color: var(--lc-orange); background: #000; }
:root[data-skin="lcars"] .stop:first-child .dot,
:root[data-skin="lcars"] .stop:last-child .dot { background: var(--lc-orange); }
:root[data-skin="lcars"] .suggest { background: #000; border: 2px solid var(--lc-orange); border-radius: 18px; }
:root[data-skin="lcars"] .suggest button:hover,
:root[data-skin="lcars"] .suggest button.on { background: var(--lc-orange); color: #000; }
:root[data-skin="lcars"] input[type=range],
:root[data-skin="lcars"] .check input { accent-color: var(--lc-orange); }
:root[data-skin="lcars"] .field { text-transform: uppercase; letter-spacing: .06em; color: var(--lc-lav); }
:root[data-skin="lcars"] .field output { color: var(--lc-sun); }
:root[data-skin="lcars"] .more summary { color: var(--lc-blue); text-transform: uppercase; letter-spacing: .08em; }

/* lists, tables, tips */
:root[data-skin="lcars"] .stopItem .badge.home { background: var(--lc-lav); color: #000; }
:root[data-skin="lcars"] .stopItem b { color: var(--lc-peach); }
:root[data-skin="lcars"] .stopItem .money { color: var(--lc-sun); }
:root[data-skin="lcars"] table.t th { text-transform: uppercase; letter-spacing: .08em; color: var(--lc-lav); border-bottom-color: var(--lc-violet); }
:root[data-skin="lcars"] table.t tr.hl td { background: #2A1E00; }
:root[data-skin="lcars"] .callout { border-left-color: var(--lc-red); }
:root[data-skin="lcars"] .tip { background: #000; border: 0; border-left: 10px solid var(--lc-orange); border-radius: 0 14px 14px 0; }
:root[data-skin="lcars"] .tip b { color: var(--lc-orange); text-transform: uppercase; letter-spacing: .08em; }
:root[data-skin="lcars"] .maplibregl-popup-content { background: #000; border-left: 8px solid var(--lc-orange); border-radius: 0 12px 12px 0; font-family: 'Antonio', sans-serif; color: var(--lc-peach); }
:root[data-skin="lcars"] .profile .zapTag rect { rx: 8px; }
:root[data-skin="lcars"] .profile .panelLabel { fill: var(--lc-lav); text-transform: uppercase; letter-spacing: .1em; }
:root[data-skin="lcars"] .profile .axis text,
:root[data-skin="lcars"] .chart text { font-family: 'Antonio', sans-serif; }

@media (max-width: 980px) {
  :root[data-skin="lcars"] .lcBar { display: none; }
}
@media (max-width: 640px) {
  :root[data-skin="lcars"] .tabs { background: #000; border-top: 0; gap: 4px; padding-left: 6px; padding-right: 6px; }
  :root[data-skin="lcars"] .tabs a { height: 46px; padding: 0 4px; }
  :root[data-skin="lcars"] .tabs a:first-child { border-radius: 999px 0 0 999px; }
  :root[data-skin="lcars"] .tabs a:last-child { border-radius: 0 999px 999px 0; }
  :root[data-skin="lcars"] .mark { height: 36px; padding-right: 14px; }
  :root[data-skin="lcars"] .mark span { font-size: 18px; }
  :root[data-skin="lcars"] .skinBtn, :root[data-skin="lcars"] .carChip { height: 36px; padding: 0 10px; font-size: 12px; }
  :root[data-skin="lcars"] .skinBtn { margin-left: auto; }
  :root[data-skin="lcars"] .block, :root[data-skin="lcars"] .page section, :root[data-skin="lcars"] .profile,
  :root[data-skin="lcars"] .mapWrap { border-left-width: 12px; border-top-width: 8px; border-top-left-radius: 30px; }
}
