/* Open Race Plan — web planner.
   Dark only, in the language of the Garmin Connect app's PacePro pages: near-black page, flat
   grey rows split by hairlines, one blue accent. Built for a phone held in one hand: every
   control is at least 44 px, the main action sits at the bottom within thumb reach. */

:root {
  --bg: #121212;
  --surface: #1a1a1a;
  --raised: #222222;
  --pressed: #2a2a2a;
  --hair: #2c2c2c;
  --line: #4d4d4d;
  --track: #565656;
  --accent: #10a9ed;
  --on-accent: #00131f;     /* dark text on the accent: 7.1:1 (white would be 2.6:1) */
  --text: #ffffff;
  --text-2: #b3b3b3;
  --text-3: #8f8f8f;        /* the dimmest text: 5.8:1 on --bg, 4.9:1 on --raised */
  --good: #4cc76a;
  --bad: #ff6a5f;
  --warn: #f2c14e;
  --gutter: 16px;
  --radius: 8px;
  --bar-h: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 var(--font);
  font-variant-numeric: tabular-nums;   /* every number lines up, in tables and while it changes */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(16, 169, 237, .45); color: #fff; }
.sheet:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 18px; height: 18px; }
.icon--dots { stroke-width: 3.5; }

/* ── Top bar: black with Garmin's thin blue rule under it ───────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 1100;
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  height: calc(var(--bar-h) + var(--safe-top));
  padding: var(--safe-top) max(4px, env(safe-area-inset-right)) 0 max(4px, env(safe-area-inset-left));
  background: #000;
  border-bottom: 1px solid var(--accent);
}
.bar-title {
  grid-column: 2; text-align: center; font-size: 17px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-back {
  grid-column: 1; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; background: none; color: var(--accent); border-radius: var(--radius);
}
.bar-back svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.bar-end { grid-column: 3; justify-self: end; }
.bar-end .link { padding: 0 10px; text-decoration: none; }

main { display: block; outline: none; }

/* Every step fills the screen, so its main button (.bottom) rests at the bottom edge. */
.screen {
  display: flex; flex-direction: column;
  min-height: calc(100vh - var(--bar-h) - var(--safe-top) - 1px);
  min-height: calc(100dvh - var(--bar-h) - var(--safe-top) - 1px);
  padding-bottom: calc(24px + var(--safe-bottom));
}
.screen:has(> .bottom) { padding-bottom: 0; }
.screen > .bottom { margin-top: auto; }

/* Full-height pages (the route map): the map takes whatever the panel leaves. */
.screen--fill {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--bar-h) - var(--safe-top) - 1px);
  height: calc(100dvh - var(--bar-h) - var(--safe-top) - 1px);
  padding-bottom: 0;
  overflow: hidden;
}

.lede { padding: 20px var(--gutter) 4px; color: var(--text-2); font-size: 15px; text-align: center; }
.lede + .list { margin-top: 12px; }
.note { color: var(--text-3); font-size: 13px; line-height: 1.4; }
.note--warn { color: var(--warn); }
.note--bad { color: var(--bad); }
.pad { padding-left: var(--gutter); padding-right: var(--gutter); }

/* ── Buttons ───────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--raised); color: var(--text);
  font-size: 17px; font-weight: 500; text-decoration: none;
}
.btn:active { background: var(--pressed); }
.btn--primary { width: 100%; border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn--primary:active { background: #0e96d3; }
.btn--danger { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
/* A disabled main button is plainly grey (as in Garmin Connect), not a faded blue: 4.9:1 text. */
.btn--primary:disabled, .btn--primary:disabled:active { opacity: 1; background: var(--raised); border-color: var(--line); color: var(--text-3); }

.link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  border: 0; background: none; color: var(--accent); font-size: 17px;
}
.link:disabled { color: var(--text-3); cursor: default; }

/* The main action of a step sits at the bottom, above the home indicator. */
.bottom {
  position: sticky; bottom: 0; z-index: 900;
  padding: 12px var(--gutter) calc(12px + var(--safe-bottom));
  background: var(--bg);
  border-top: 1px solid var(--hair);
}
.screen--fill .bottom { position: static; }
.screen--fill > .route-top, .screen--fill > .bottom { flex-shrink: 0; }

/* ── Home ─────────────────────────────────────────────────────────────────────────────── */
.intro { padding: 28px var(--gutter) 24px; }
.intro p { color: var(--text-2); font-size: 15px; margin-top: 8px; max-width: 34em; }
.intro h2 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }

.group-label {
  padding: 24px var(--gutter) 8px; color: var(--text-3);
  font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}

/* ── "Choose a route or distance" cards (Garmin's two big tiles) ──────────────────────── */
.choices { display: grid; gap: 16px; padding: 24px var(--gutter); }
.choice {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  min-height: 148px; padding: 20px; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 19px;
}
.choice:active { background: var(--raised); }
.choice .icon { width: 44px; height: 44px; color: var(--accent); stroke-width: 2.25; }
.choice small { color: var(--text-3); font-size: 13px; margin-top: -8px; }

/* ── List rows (Name / Distance / Goal Time …) ────────────────────────────────────────── */
.list { background: var(--surface); }
/* Hairlines between rows start at the text's left edge and run to the right edge, in the grey
   Garmin Connect uses (#4d4d4d on #1a1a1a), so the rows read as rows, not one grey block. */
.list > * + * { position: relative; }
.list > * + *::before {
  content: ""; position: absolute; top: 0; left: var(--gutter); right: 0;
  height: 1px; background: var(--line); pointer-events: none;
}
.unsaved { margin-top: 16px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 10px var(--gutter);
  border: 0; background: none; text-align: left; color: var(--text);
}
button.row:active, a.row:active { background: var(--raised); }
.row--danger .row-title { color: var(--bad); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-size: 17px; }
.row-value { display: block; margin-top: 2px; color: var(--text-2); font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.row-end { color: var(--text-3); display: flex; align-items: center; }
.row--radio[aria-checked="true"] .row-end { color: var(--accent); }
.row--radio .row-end .icon { visibility: hidden; }
.row--radio[aria-checked="true"] .row-end .icon { visibility: visible; }
.row-more {
  width: 44px; height: 44px; margin-right: -10px; border: 0; background: none;
  color: var(--text-2); display: grid; place-items: center; border-radius: var(--radius);
}
.plan-row { display: flex; align-items: center; padding-right: var(--gutter); }
.plan-row .row { padding-right: 0; }

/* ── Inputs ───────────────────────────────────────────────────────────────────────────── */
.fields { padding: 8px var(--gutter) 24px; display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field > label, .field-label { font-size: 15px; color: var(--text-2); }
.input {
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--text); font-size: 20px;
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input-wrap { position: relative; }
.input-wrap .unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 17px; pointer-events: none;
}
.input-wrap .input { padding-right: 76px; }
.field .note { min-height: 1.4em; }
.suggest { justify-self: start; min-height: 44px; }

/* Segmented control */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
  padding: 2px; border-radius: 10px; background: var(--raised);
}
.seg button {
  min-height: 44px; border: 0; border-radius: 8px; background: none;
  color: var(--text-2); font-size: 15px; font-weight: 500;
}
.seg button[aria-pressed="true"] { background: #3a3a3a; color: var(--text); }

/* ── Route page: map + panel ──────────────────────────────────────────────────────────── */
.route-top { padding: 12px var(--gutter); }
/* On a short phone the map gives way first (down to its floor), then the panel scrolls inside
   itself, so the Next bar always stays whole on screen. */
.map { position: relative; flex: 1 1 0; min-height: clamp(160px, 32dvh, 220px); background: #1c1c1c; }
.map--plan { height: 240px; flex: none; min-height: 0; }
.panel {
  flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px var(--gutter); background: var(--bg); border-top: 1px solid var(--hair);
}
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.stats:first-child { margin-top: 0; }
.stat b { display: block; font-size: 20px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 359px) { .stat b { font-size: 18px; } }
.stat span { color: var(--text-3); font-size: 13px; }
.status { margin-top: 8px; display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--text-2); min-height: 20px; }
.status .icon { width: 18px; height: 18px; margin-top: 1px; }
.status--ok { color: var(--text-2); }
.status--ok .icon { color: var(--good); }
.status--busy .icon { color: var(--accent); animation: spin 1s linear infinite; }
.status--warn .icon, .status--warn { color: var(--warn); }
.status .link { min-height: 0; padding: 0; font-size: 14px; }

.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 4px; border: 1px solid var(--hair); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 12px;
}
.tool:active { background: var(--raised); }
.tool[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.tool:disabled { color: var(--text-3); }
.tool .icon { width: 22px; height: 22px; }

.upload {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--raised); color: var(--accent); font-size: 17px; cursor: pointer;
}
.upload:active { background: var(--pressed); }
.upload:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
/* Hints over the top of the map (the zoom buttons sit at the bottom right). */
.map-over {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 800;
  width: max-content; max-width: calc(100% - 32px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.map-hint {
  padding: 8px 12px; border-radius: var(--radius);
  background: rgba(0, 0, 0, .78); color: var(--text); font-size: 14px; text-align: center;
}
.map-locate {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent);
  color: var(--on-accent); font-size: 15px; font-weight: 600; pointer-events: auto;
}
.map-locate:active { background: #0e96d3; }
.map-locate .icon { width: 20px; height: 20px; }
.map-btn {
  position: absolute; right: 10px; bottom: 28px; z-index: 800;
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); background: #000; color: var(--text);
}

/* ── Strategy page ────────────────────────────────────────────────────────────────────── */
.legend { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 0; font-size: 15px; color: var(--text-2); }
.legend i { width: 96px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #2458d6, #3f8fe8, #5cc3f0, #5cc85a, #f0d03c, #f5922b, #e8392f); }

.section { background: var(--surface); margin-top: 12px; padding: 4px 0 16px; }
.section-head { display: flex; align-items: center; gap: 4px; padding: 8px var(--gutter) 0; min-height: 52px; }
.section-head h2 { flex: 1; font-size: 20px; font-weight: 400; }
.section-head .link { padding: 0 8px; }
.section-head .link:last-child { margin-right: -8px; }
.section .note { padding: 4px var(--gutter) 0; }

.minmax { display: grid; grid-template-columns: 1fr 1fr; text-align: center; padding: 6px var(--gutter) 4px; }
.minmax b { display: block; font-size: 28px; font-weight: 400; }
.minmax span { color: var(--text-3); font-size: 15px; }

.chart { position: relative; padding: 8px 0 0; }
.chart-tap { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: inherit; cursor: zoom-in; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-hint { display: block; text-align: center; color: var(--text-3); font-size: 13px; margin-top: 8px; }

/* SVG chart parts (presentation lives here, not in attributes, so the CSP needs no inline style) */
.c-axis { fill: var(--text-3); font-size: 12px; font-family: var(--font); }
.c-axis--x { text-anchor: middle; }
.c-axis--r { text-anchor: end; }      /* right labels end at the gutter */
.c-axis--l { text-anchor: start; }    /* left labels start at the gutter */
.c-title { fill: var(--text-2); font-size: 13px; text-anchor: middle; font-family: var(--font); }
.c-grid { stroke: #2a2a2a; stroke-width: 1; }
.c-elev { fill: #565656; }
.c-elev-line { fill: none; stroke: #7a7a7a; stroke-width: 1; }
.c-goal { stroke: #fff; stroke-width: 1.5; stroke-dasharray: 6 5; stroke-linecap: butt; fill: none; }
.c-step { fill: none; stroke-width: 3; stroke-linecap: round; }
.c-dot { fill: #3a3a3a; }
.c-cursor { stroke: #fff; stroke-width: 1; }
.c-lock { fill: var(--text); }

.slider { padding: 0 var(--gutter); }
.slider-readout { color: var(--text-2); font-size: 15px; padding: 0 var(--gutter) 4px; min-height: 22px; }
.slider-ends { display: flex; justify-content: space-between; color: var(--text-2); font-size: 15px; padding: 0 var(--gutter); }

.range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px;
  margin: 4px 0; background: transparent; touch-action: pan-y;
}
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--track); }
.range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 30px; height: 30px; margin-top: -13px;
  border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.range::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 0; }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--accent); }
.range:disabled { opacity: .4; }

/* Split table */
.splits-head { display: flex; justify-content: flex-end; gap: 8px; padding: 8px var(--gutter); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
/* All columns left-aligned, small grey headers on one bottom line, as in Garmin's table. */
.table th {
  color: var(--text-3); font-weight: 400; font-size: 13px; line-height: 1.25; text-align: left; vertical-align: bottom;
  padding: 10px 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.table td { padding: 0 6px; height: 48px; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: var(--gutter); }
.table th:last-child, .table td:last-child { padding-right: var(--gutter); }
@media (max-width: 359px) {
  .table th, .table td { padding-left: 4px; padding-right: 4px; }
  .table th:first-child, .table td:first-child { padding-left: var(--gutter); }
  .table th:last-child, .table td:last-child { padding-right: var(--gutter); }
}
.table tbody tr:nth-child(odd) { background: #0f0f0f; }
.table tbody tr:nth-child(even) { background: #151515; }
.table .lock { display: inline-block; width: 14px; height: 14px; margin-left: 4px; vertical-align: -1px; color: var(--accent); }
.table tr.edit-row { cursor: pointer; }
.table tr.edit-row:active { background: var(--raised); }
.table tr.edit-row td:first-child { color: var(--accent); }
.table .split-btn { min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; text-align: left; }

/* Error banner on the strategy page */
.top-note { padding-top: 12px; }
.alert {
  margin: 12px var(--gutter) 0; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid #5c2b28; background: #2a1514; color: #ffd9d6; font-size: 15px;
}
.alert .link { min-height: 36px; padding: 0; color: #ffb4ad; text-decoration: underline; }

/* Watch code */
.code-head { padding: 16px var(--gutter) 0; }
.checked { display: flex; align-items: flex-start; gap: 8px; padding: 12px var(--gutter) 0; color: var(--text-2); font-size: 15px; }
.checked .icon { width: 20px; height: 20px; color: var(--good); margin-top: 1px; }
.codebox {
  display: block; width: calc(100% - 2 * var(--gutter)); margin: 12px var(--gutter) 0;
  min-height: 112px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #0c0c0c; color: var(--text); font: 14px/1.45 var(--mono);
  word-break: break-all; resize: none; overflow: hidden; -webkit-user-select: text; user-select: text;
}
.code-actions { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px var(--gutter) 0; }
.code-meta { padding: 8px var(--gutter) 0; }
.steps { counter-reset: step; list-style: none; padding: 8px var(--gutter) 0; }
.steps li { position: relative; padding: 10px 0 10px 40px; font-size: 15px; color: var(--text-2); }
.steps li + li { border-top: 1px solid var(--hair); }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 9px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--text); font-size: 14px; text-align: center; line-height: 24px;
}
.steps b { color: var(--text); font-weight: 600; }

.foot { padding: 28px var(--gutter) 8px; color: var(--text-3); font-size: 13px; line-height: 1.5; }
.foot a { color: var(--text-2); }
.foot p + p { margin-top: 8px; }

/* ── Bottom sheet (all small editors: name, goal, splits, one split, confirm) ─────────── */
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100dvh - 40px);
  margin: auto auto 0; padding: 0; border: 0; border-radius: 14px 14px 0 0;
  background: #1e1e1e; color: var(--text);
}
.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet[open] { animation: rise .22s ease-out; }
.sheet-in { padding: 8px var(--gutter) calc(16px + var(--safe-bottom)); }
.sheet-grip { width: 36px; height: 5px; margin: 0 auto 8px; border-radius: 3px; background: #4a4a4a; }
.sheet h2 { font-size: 17px; font-weight: 600; text-align: center; padding: 6px 40px 2px; }
.sheet .sub { text-align: center; color: var(--text-3); font-size: 14px; }
.sheet-body { padding: 16px 0 4px; display: grid; gap: 18px; }
.sheet-actions { display: grid; gap: 8px; padding-top: 12px; }
.sheet .list { border-radius: var(--radius); overflow: hidden; background: #262626; }
.sheet .list > * + *::before { background: #474747; }   /* still shows on the lighter sheet */

/* ── Full chart (Garmin's landscape view) ─────────────────────────────────────────────── */
.full {
  position: fixed; inset: 0; z-index: 2000; background: var(--bg); overflow: hidden;
}
.full-in { position: relative; display: flex; flex-direction: column; width: 100vw; height: 100vh; height: 100dvh; padding: 12px max(16px, env(safe-area-inset-right)) max(12px, var(--safe-bottom)) max(16px, env(safe-area-inset-left)); }
/* A phone held upright gets the chart turned sideways, as if the phone were rotated. */
@media (orientation: portrait) {
  .full-in {
    position: absolute; left: 50%; top: 50%;
    width: 100vh; width: 100dvh; height: 100vw;
    transform: translate(-50%, -50%) rotate(90deg);
    padding: max(12px, env(safe-area-inset-right)) max(16px, var(--safe-bottom)) 12px max(16px, var(--safe-top));
  }
}
.full-head { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.full-head h2 { flex: 1; font-size: 17px; font-weight: 600; }
.full-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--text); }
.full-read { color: var(--text-2); font-size: 15px; min-height: 22px; }
.full-chart { flex: 1; min-height: 0; touch-action: none; }
.full-chart svg { display: block; width: 100%; height: 100%; }

html.locked, html.locked body { overflow: hidden; }
.help-text { color: var(--text-2); font-size: 16px; line-height: 1.5; }

/* ── Toast ────────────────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-bottom)); z-index: 3000;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--radius);
  background: #f2f2f2; color: #121212; font-size: 15px; font-weight: 500;
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { padding: 24px var(--gutter); color: var(--text-2); }

/* ── Map details (Leaflet) ────────────────────────────────────────────────────────────── */
/* OSM's standard tiles, turned dark in the browser so the map sits quietly behind the route. */
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) saturate(.35); }
.leaflet-container { background: #1c1c1c; font: 12px/1.4 var(--font); }
.leaflet-control-attribution { background: rgba(0, 0, 0, .65) !important; color: var(--text-2); }
.leaflet-control-attribution a { color: var(--text); }
/* Zoom buttons: 44 px like every other control. ".leaflet-touch .leaflet-bar a" matches
   Leaflet's own touch rule (30 px) and wins by coming later; .leaflet-container covers mice. */
.leaflet-container .leaflet-bar { border: 1px solid var(--line) !important; border-radius: var(--radius); background-clip: padding-box; overflow: hidden; }
.leaflet-container .leaflet-bar a,
.leaflet-touch .leaflet-bar a {
  width: 44px; height: 44px; line-height: 44px; font-size: 22px;
  background: var(--raised); color: var(--text); border-bottom: 1px solid var(--line);
}
.leaflet-container .leaflet-bar a:last-child { border-bottom: 0; }
.leaflet-touch .leaflet-bar a:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.leaflet-touch .leaflet-bar a:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.leaflet-container .leaflet-bar a:hover, .leaflet-container .leaflet-bar a:active { background: #2e2e2e; color: var(--text); }
.pin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; display: grid; place-items: center; }
.pin--start { background: #2fa84f; }
.pin--end { background: #e8392f; }
.pin--end::after { content: ""; width: 6px; height: 6px; background: #fff; }
.pin--start::after { content: ""; border-left: 6px solid #fff; border-top: 4px solid transparent; border-bottom: 4px solid transparent; margin-left: 2px; }
.wp { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Wider screens: keep the phone layout, centred. */
@media (min-width: 640px) {
  main, .bottom { max-width: 560px; margin-left: auto; margin-right: auto; }
}
