:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17;
  --bg-elev: #121826;
  --bg-elev-2: #171f30;
  --line: #243049;
  --line-soft: #1b2337;
  --text: #e6edf7;
  --muted: #8b9ab5;
  --accent: #4fd1a5;
  --accent-ink: #06231b;
  --accent-hover: #63e0b6;
  --accent-2: #58a6ff;
  --down: #f0616d;
  --warn: #f2b544;
  --topbar: linear-gradient(180deg, #131a29, #0d1220);
  --btn-hover: #1f2942;
  --btn-hover-border: #33456b;
  --code-bg: #0e1524;
  --code-text: #b9c6df;
  --dz-border: #2b3a5c;
  --dz-glow: #16203399;
  --dz-drag-bg: #14231f;
  --tooltip-bg: #0a1120f2;
  --tooltip-border: #33456b;
  --row-hover: #1a2438;
  --range-active: #1d2b48;
  --shadow: 0 8px 24px #0008;
  --radius: 12px;

  /* canvas palette */
  --c-plot-bg: #121826;
  --c-grid: #1f2a41;
  --c-axis: #8b9ab5;
  --c-frame: #2a3653;
  --c-line: #4fd1a5;
  --c-area-top: rgba(79, 209, 165, 0.32);
  --c-area-bottom: rgba(79, 209, 165, 0.02);
  --c-crosshair: #7f8db0;
  --c-marker: #e6edf7;
  --c-marker-core: #121826;
  --c-wpt: #f2b544;
  --c-wpt-line: rgba(242, 181, 68, 0.45);
  --c-panel-bg: #0e1524;
  --c-overview: #58a6ff;
  --c-overview-fill: rgba(88, 166, 255, 0.18);
  --c-mask: rgba(11, 15, 23, 0.72);
  --c-handle: #4fd1a5;
  --c-route: #33456b;
  --c-route-active: #4fd1a5;
  --c-route-start: #4fd1a5;
  --c-route-end: #f0616d;
  --c-route-on-map: #9fb3d9;
  --c-map-tint: rgba(12, 20, 34, 0.3);
  --c-map-casing: rgba(8, 12, 20, 0.65);
  --c-map-filter: brightness(0.45) saturate(0.7) contrast(1.1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #f8fafc;
  --line: #d8e0ea;
  --line-soft: #eef2f7;
  --text: #0f172a;
  --muted: #5b6779;
  --accent: #0f9d76;
  --accent-ink: #ffffff;
  --accent-hover: #0c8763;
  --accent-2: #1d4ed8;
  --down: #d4323f;
  --warn: #b45309;
  --topbar: linear-gradient(180deg, #ffffff, #eef2f8);
  --btn-hover: #e8eef6;
  --btn-hover-border: #b6c3d4;
  --code-bg: #eef2f7;
  --code-text: #334155;
  --dz-border: #b6c3d4;
  --dz-glow: #dbeafe66;
  --dz-drag-bg: #e7f7f1;
  --tooltip-bg: #ffffffF2;
  --tooltip-border: #b6c3d4;
  --row-hover: #eef4fb;
  --range-active: #dde7f5;
  --shadow: 0 8px 24px #0f172a26;
  --radius: 12px;

  /* canvas palette */
  --c-plot-bg: #ffffff;
  --c-grid: #e5eaf1;
  --c-axis: #5b6779;
  --c-frame: #cbd5e1;
  --c-line: #0f9d76;
  --c-area-top: rgba(15, 157, 118, 0.28);
  --c-area-bottom: rgba(15, 157, 118, 0.03);
  --c-crosshair: #64748b;
  --c-marker: #0f172a;
  --c-marker-core: #ffffff;
  --c-wpt: #b45309;
  --c-wpt-line: rgba(180, 83, 9, 0.4);
  --c-panel-bg: #f8fafc;
  --c-overview: #1d4ed8;
  --c-overview-fill: rgba(29, 78, 216, 0.16);
  --c-mask: rgba(241, 245, 249, 0.76);
  --c-handle: #0f9d76;
  --c-route: #a3b1c4;
  --c-route-active: #0f9d76;
  --c-route-start: #0f9d76;
  --c-route-end: #d4323f;
  --c-route-on-map: #334f7a;
  --c-map-tint: rgba(255, 255, 255, 0.2);
  --c-map-casing: rgba(255, 255, 255, 0.8);
  --c-map-filter: saturate(0.9);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", Roboto, -apple-system, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3 { margin: 0; font-weight: 650; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(14px, 1.8vw, 32px);
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 19px; letter-spacing: .3px; }
.logo { font-size: 26px; }
.tagline { margin: 0; color: var(--muted); font-size: 12px; }

.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { background: var(--btn-hover); border-color: var(--btn-hover-border); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.is-active { background: var(--btn-hover); border-color: var(--btn-hover-border); }

.btn.icon {
  padding: 8px 10px;
  font-size: 15px;
  line-height: 1;
}

main { padding: 22px clamp(14px, 1.8vw, 32px); max-width: none; margin: 0; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--dz-border);
  border-radius: 16px;
  background: radial-gradient(1200px 400px at 50% -10%, var(--dz-glow), transparent), var(--bg-elev);
  padding: 70px 24px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone.dragover { border-color: var(--accent); background: var(--dz-drag-bg); }
.dz-icon { font-size: 42px; color: var(--accent); }
.dz-inner h2 { margin: 10px 0 6px; font-size: 22px; }
.dz-inner p { color: var(--muted); margin: 4px 0; }
.dz-hint { font-size: 12px; }
.dz-sample { margin-top: 12px !important; }
.linklike { color: var(--accent-2); cursor: pointer; text-decoration: underline; }
button.linklike { background: none; border: 0; padding: 0; font: inherit; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; color: var(--code-text); }

.error { margin-top: 14px; color: var(--down); font-size: 13px; }
.loading { margin-top: 14px; color: var(--accent); font-size: 13px; }

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-elev);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.notice.error { border-left-color: var(--down); color: var(--down); margin-top: 0; }
.notice.loading { border-left-color: var(--accent-2); color: var(--muted); margin-top: 0; }
.notice.ok { border-left-color: var(--accent); }

/* Workspace */
.track-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.track-head h2 { font-size: 18px; }

.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ctl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.ctl input[type=range] { width: 120px; accent-color: var(--accent); }
.ctl.checkbox { cursor: pointer; }
.ctl.checkbox input { accent-color: var(--accent); }
.ctl output { color: var(--text); min-width: 18px; text-align: right; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn {
  padding: 6px 12px;
  background: var(--bg-elev-2);
  border: 0;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.seg-btn.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.stat .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v.up { color: var(--accent); }
.stat .v.down { color: var(--down); }

/* Chart */
.chart-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 12px 8px;
}
.chart-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 8px; }
.readout { display: flex; flex-direction: column; gap: 2px; }
.ro-main { font-size: 15px; font-variant-numeric: tabular-nums; }

.chart-wrap { position: relative; height: 420px; }
.chart-wrap canvas { width: 100%; max-width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }

.brush-wrap { height: 78px; margin-top: 6px; }
.brush-wrap canvas { width: 100%; max-width: 100%; height: 100%; display: block; cursor: ew-resize; touch-action: none; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--tooltip-bg);
  border: 1px solid var(--tooltip-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  box-shadow: var(--shadow);
  z-index: 5;
}
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .tt-k { color: var(--muted); }
.tooltip .tt-v { font-variant-numeric: tabular-nums; }
.tooltip .tt-title { color: var(--warn); font-weight: 600; margin-bottom: 2px; }
.tooltip .tt-sub { color: var(--muted); font-size: 11px; margin-bottom: 2px; }

.range-bar { display: flex; align-items: center; gap: 8px; padding: 8px 4px 2px; flex-wrap: wrap; }
.range-label { color: var(--muted); font-size: 12px; margin-right: 2px; }
.range-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
}
.range-btn:hover { color: var(--text); border-color: var(--btn-hover-border); }
.range-btn.is-active { background: var(--range-active); color: var(--text); border-color: var(--btn-hover-border); }
.range-info { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.range-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.range-pct {
  width: 62px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 4px 6px;
}
.range-pct:focus { outline: none; border-color: var(--btn-hover-border); }
.range-unit { color: var(--muted); font-size: 12px; margin-left: -4px; }

/* Full-screen sections: everything but the expanded card is hidden and it fills the viewport. */
.chart-head { gap: 12px; }
.chart-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.expand-btn { align-self: center; flex: none; }
.panel-head .chart-actions { margin-left: auto; }
.expand-btn .expand-off { display: none; }
body.is-full .is-expanded .expand-btn .expand-on { display: none; }
body.is-full .is-expanded .expand-btn .expand-off { display: inline; }

body.is-full { overflow: hidden; }
body.is-full > header.topbar,
body.is-full > main > section:not(#workspace),
body.is-full > footer {
  display: none !important;
}
body.is-full > main { padding: 0; margin: 0; max-width: none; }
body.is-full #workspace {
  position: fixed;
  inset: 0;
  z-index: 40;
  margin: 0;
  padding: 8px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
/* Only the expanded card, or the row that holds it, stays on screen. */
body.is-full #workspace > *:not(.is-expanded):not(.has-expanded),
body.is-full .lower > *:not(.is-expanded) {
  display: none !important;
}
body.is-full .lower.has-expanded {
  display: flex;
  flex: 1;
  min-height: 0;
  margin: 0;
}
body.is-full .is-expanded {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}
body.is-full .is-expanded .chart-wrap,
body.is-full .is-expanded .map-wrap { flex: 1; min-height: 0; height: auto; }
body.is-full .is-expanded .climbs,
body.is-full .is-expanded .waypoints { flex: 1; min-height: 0; max-height: none; overflow: auto; }

/* Lower panels */.lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 900px) {
  .lower { grid-template-columns: minmax(0, 1fr); }
  .chart-wrap { height: 320px; }
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
  overflow: hidden;
}
.panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; }
.panel-note { color: var(--muted); font-size: 11px; margin: 8px 0 0; }
.map-pin-hint { margin-top: 4px; }
.note-link {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer;
}
.note-link:hover { text-decoration: none; }
.note-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.map-wrap { height: 600px; min-width: 0; position: relative; border-radius: 8px; overflow: hidden; }
.map-wrap canvas { width: 100%; max-width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.map-wrap canvas.is-panning { cursor: grabbing; }
.map-attrib {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  background: var(--bg-elev);
  border-top-left-radius: 6px;
  opacity: 0.85;
  pointer-events: auto;
}
.map-attrib a { color: inherit; }
.map-attrib[hidden] { display: none; }
#btn-options { margin-left: auto; }
#btn-options + .expand-btn { margin-left: 0; }
#btn-png { margin-left: auto; align-self: center; }
#btn-profile-options { align-self: center; }
#btn-profile-options + .expand-btn { margin-left: 0; }
/* Basemap picker */
.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;
}
.map-style {
  background: var(--btn-bg, var(--bg-elev));
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 11px;
  padding: 4px 6px;
  max-width: 220px;
}
.map-style:focus { outline: none; border-color: var(--btn-hover-border); }
.map-style:disabled { opacity: 0.5; }

/* Display options dialog */
.opts-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--fg);
  padding: 0;
  min-width: 300px;
  max-width: 92vw;
  box-shadow: var(--shadow);
}
.opts-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.opts-form { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.opts-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.opts-head h3 { margin: 0; }
.opts-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}
.opts-group legend { color: var(--muted); font-size: 11px; padding: 0 4px; }
.opts-select { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opts-range { display: flex; align-items: center; gap: 8px; }
.opts-range input[type="range"] { width: 130px; }
.opts-range input[type="number"] {
  width: 88px; padding: 5px 8px; text-align: right;
  color: var(--text); background: var(--bg-elev-2);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.opts-note { color: var(--muted); font-size: 11px; margin: 0; }

/* Waypoint symbol toggles — one row per Garmin <sym> in Profile options */
.wpt-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 14px;
  max-height: 260px;
  overflow: auto;
}
.wpt-group { gap: 6px; min-width: 0; }
.wpt-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpt-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25) inset;
}
.wpt-group-count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.climbs { max-height: 600px; overflow: auto; -webkit-overflow-scrolling: touch; }
table.climb-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.climb-table th {
  text-align: right;
  color: var(--muted);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg-elev);
}
.climb-table th:first-child, .climb-table td:first-child { text-align: left; }
.climb-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.climb-table tbody tr { cursor: pointer; }
.climb-table tbody tr:hover { background: var(--row-hover); }
.empty { color: var(--muted); font-size: 12px; }

/* Waypoints panel (spans the full width of the lower grid) */
.panel-wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h3 { margin-bottom: 0; }
.wpt-filter {
  flex: 1 1 220px;
  max-width: 340px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
}
.wpt-filter:focus { outline: none; border-color: var(--btn-hover-border); }
.wpt-count { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.waypoints { max-height: 680px; overflow: auto; -webkit-overflow-scrolling: touch; }
.wpt-table .wpt-name { text-align: left; font-variant-numeric: normal; }
.wpt-table .wpt-cat, .wpt-table .wpt-desc { text-align: left; color: var(--muted); font-variant-numeric: normal; }
.wpt-table .wpt-desc { max-width: min(520px, 24vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpt-table th.wpt-name, .wpt-table th.wpt-cat, .wpt-table th.wpt-desc { text-align: left; }
.wpt-table tr.is-off td { opacity: .62; }
.wpt-table .wpt-coord { white-space: nowrap; font-variant-numeric: tabular-nums; }
.wpt-table .wpt-off, .wpt-table th.wpt-off { white-space: nowrap; }

/* How-to-use panel */
.help {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.help-head h2 { font-size: 16px; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.help-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px 14px;
}
.help-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }
.help-card p { font-size: 13px; line-height: 1.55; }
.help-card code { font-size: 12px; }
.help-card a { color: var(--accent); }
/* Contact panel — cards and photo share one width so their edges line up */
.contact-grid {
  --contact-w: 900px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  max-width: var(--contact-w);
}
.contact-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.contact-card p { font-size: 13px; line-height: 1.6; color: var(--muted); }
.contact-id { display: flex; align-items: center; gap: 12px; }
.contact-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elev-2);
  box-shadow: 0 0 0 2px var(--accent);
}
.contact-name { font-size: 16px !important; font-weight: 600; color: var(--fg) !important; }
.contact-role { font-size: 12px !important; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
.contact-actions .btn { text-decoration: none; }
.btn.donate { background: #ffc439; border-color: #ffc439; color: #17202a; font-weight: 600; }
.btn.donate:hover { background: #ffb31a; border-color: #ffb31a; }
.contact-fineprint { font-size: 11px !important; opacity: .85; }

/* Ride photo under the contact cards, shown at its own size */
.contact-photo { grid-column: 1 / -1; margin: 0; }
.contact-photo img {
  display: block;
  width: var(--contact-w);
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
}
.contact-photo figcaption {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}
.help-keys { list-style: none; font-size: 13px; line-height: 1.9; }
.help-keys kbd {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: inherit;
}

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

/* Loading overlay */
.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: .92;
  backdrop-filter: blur(2px);
}
.loading[hidden] { display: none; }
.loading-box { text-align: center; max-width: 420px; padding: 24px; }
.loading-title { font-size: 15px; font-weight: 600; margin-top: 16px; color: var(--text); }
.loading-sub { color: var(--muted); font-size: 12px; margin-top: 6px; min-height: 16px; }
.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Narrow screens (phones in portrait) */
@media (max-width: 640px) {
  main { padding: 16px 12px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .stat .v { font-size: 17px; }
  .climb-table { font-size: 11px; }
  .climb-table th, .climb-table td { padding: 6px 6px; }
  .wpt-table .wpt-desc { max-width: 160px; }
  .wpt-count { margin-left: 0; }
  .range-info { margin-left: 0; }
  .map-wrap { height: 420px; }
  .climbs { max-height: 420px; }
}