/* ============================================================================
   3D ROUTE INSPECTOR — live GPX marker, elevation sync, timeline, playback,
   checkpoint popovers. Additive to the existing 3D map (route-map3d) and
   elevation profile (route-elev) — does not restyle either.
   ============================================================================ */

.route-inspector { margin-top: 12px; }

.route-inspector__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 12px;
  background: var(--surface, var(--bg));
  border: 1px solid var(--border);
  border-radius: 12px;
}

.route-inspector__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
}

.route-inspector__label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-inspector__v {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Live marker (a MapLibre custom-element Marker) that follows the GPX line */
.route-inspector__marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fc4c02;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  display: none;
  position: relative;
}

.route-inspector__marker.is-active { display: block; animation: route-marker-glow 1.6s ease-in-out infinite; }

@keyframes route-marker-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(252, 76, 2, 0.55); }
  50% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 0 8px rgba(252, 76, 2, 0); }
}

/* Optional direction-of-travel arrow, rotated via bearing between adjacent GPX points */
.route-inspector__marker-arrow {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid #fc4c02;
  transform-origin: 50% 18px;
  margin-left: -5px;
}

/* Interactive elevation strip (crosshair overlaid on the existing SVG) */
.route-inspector__elev {
  position: relative;
  margin-top: 10px;
  cursor: crosshair;
  color: var(--primary, #fc4c02);
  touch-action: none;
}

.route-inspector__elev svg { display: block; width: 100%; height: auto; }

.route-inspector__crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 2px;
  background: var(--primary, #fc4c02);
  box-shadow: 0 0 6px rgba(252, 76, 2, 0.6);
  pointer-events: none;
}

/* Timeline slider */
.route-inspector__timeline {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--primary, #fc4c02);
}

/* Live Route Progress */
.route-inspector__progress { margin-top: 10px; }

.route-inspector__progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.route-inspector__progress-pct { font-size: 16px; font-weight: 800; color: var(--primary, #fc4c02); }

.route-inspector__progress-track {
  height: 8px;
  border-radius: 6px;
  background: var(--surface-2, var(--border));
  overflow: hidden;
  margin: 6px 0;
}

.route-inspector__progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary, #fc4c02);
  border-radius: 6px;
  transition: width 0.12s linear;
}

.route-inspector__progress-remaining { font-size: 12px; color: var(--muted); }

/* Analysis panel config (pace/weight ephemeral inputs) */
.route-inspector--analysis { margin-top: 14px; }

.route-inspector__config {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 8px;
}

.route-inspector__config-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

/* Checkpoint System popover */
.route-inspector__checkpoint {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, #f59e0b 12%, var(--surface, var(--bg)));
  border: 1px solid #f59e0b;
}

.route-inspector__checkpoint.is-pulsing { animation: route-cp-pulse 0.9s ease-out; }

@keyframes route-cp-pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  100% { box-shadow: 0 0 0 16px rgba(245, 158, 11, 0); }
}

.route-inspector__cp-title { margin: 0 0 4px; font-size: 15px; font-weight: 800; color: var(--text); }
.route-inspector__cp-meta { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }

.route-inspector__cp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }

.route-inspector__cp-chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.route-inspector__cp-note { margin: 4px 0 0; font-size: 12.5px; color: var(--text); font-style: italic; }

.route-inspector__cp-photos { display: flex; gap: 6px; margin-top: 8px; }

.route-inspector__cp-photos img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px; cursor: pointer;
}

/* Playback + camera mode controls */
.route-inspector__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.route-inspector__playback {
  display: flex;
  align-items: center;
  gap: 6px;
}

.route-inspector__camera {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

/* ============================================================================
   CHECKPOINT PLANNING SYSTEM (Race Director) — toolbar, map markers, live
   list, per-checkpoint analysis, summary, exports, print sheet. Additive to
   the blocks above; reuses the same var(--surface/--border/--muted/--primary)
   tokens as the rest of the 3D Route Inspector so it reads as one system.
   ============================================================================ */

.route-cpsys { margin-top: 16px; }

/* ── Toolbar: "➕ Προσθήκη Checkpoint" + drag-ghost readout ── */
.route-cp-toolbar { margin: 10px 0; }

.route-cp-toolbar .btn.is-active {
  background: var(--ink, #18181b);
  border-color: var(--ink, #18181b);
  color: #fff;
}

.route-cp-dragghost {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px dashed var(--primary, #fc4c02);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* ── 3D-map markers (draggable, snap-to-route) ── */
.route-cp-marker {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.route-cp-marker:hover,
.route-cp-marker.is-highlighted {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45), 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

/* ── Preview marker while placing a new checkpoint ── */
.route-cp-preview {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary, #fc4c02);
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  animation: route-cp-preview-pulse 1s ease-in-out infinite;
}

@keyframes route-cp-preview-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

/* ── Checkpoint markers overlaid on the elevation-sync strip — centered
   exactly on the curve via inline left/top %, so margins here just offset
   by half the dot's own size to align its CENTER (not its top-left corner)
   with that computed point. ── */
.route-inspector__elev-cp {
  position: absolute;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  margin-top: -6.5px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  z-index: 2;
  transition: transform 0.12s ease;
}

.route-inspector__elev-cp:hover,
.route-inspector__elev-cp.is-highlighted {
  transform: scale(1.5);
  z-index: 3;
}

.route-inspector__elev-cp-tip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink, #18181b);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.route-inspector__elev-cp:hover .route-inspector__elev-cp-tip,
.route-inspector__elev-cp.is-highlighted .route-inspector__elev-cp-tip {
  opacity: 1;
}

/* ── Checkpoint Manager (live list) ── */
.route-cp-list { margin-top: 16px; }

.route-cp-list__table {
  display: flex;
  flex-direction: column;
  min-width: 1040px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.route-cp-list__row {
  display: grid;
  grid-template-columns: 44px 1.3fr 1fr 84px 84px 68px 68px 84px 96px 76px 76px 160px 88px 118px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.route-cp-list__row:last-child { border-bottom: none; }

.route-cp-list__row--head {
  font-weight: 800;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
}

.route-cp-list__row:not(.route-cp-list__row--head):hover,
.route-cp-list__row.is-highlighted {
  background: color-mix(in srgb, var(--primary, #fc4c02) 8%, var(--surface, var(--bg)));
}

.route-cp-list__status { font-weight: 700; font-size: 11.5px; color: var(--muted); }

.route-cp-list__actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ── Service badges (presets + unlimited custom) — used in the Checkpoint
   List column, CP Analysis cards, and the modal's live preview. Always
   wraps onto multiple lines rather than clipping or forcing a scrollbar. ── */
.route-cp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.route-cp-badges--compact { margin-top: 4px; }

.route-cp-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.route-cp-badge--custom {
  background: color-mix(in srgb, var(--primary, #fc4c02) 10%, var(--surface, var(--bg)));
  border-color: color-mix(in srgb, var(--primary, #fc4c02) 35%, var(--border));
}

/* ── Custom service editor (inside the checkpoint modal) ── */
.route-cp-service-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.route-cp-service-add .input { flex: 1; min-width: 180px; }

.route-cp-service-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.route-cp-service-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.route-cp-service-chip__edit-input {
  width: 120px;
  font-size: 12px;
  padding: 2px 6px;
}

.route-cp-service-chip__btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 2px;
  color: var(--muted);
  border-radius: 6px;
}

.route-cp-service-chip__btn:hover {
  background: color-mix(in srgb, var(--primary, #fc4c02) 14%, transparent);
  color: var(--text);
}

/* ── Per-checkpoint analysis cards + automatic summary ── */
.route-cp-analysis { margin-top: 16px; }

.route-cp-analysis__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.route-cp-analysis__card {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface, var(--bg));
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.route-cp-analysis__card:hover,
.route-cp-analysis__card.is-highlighted {
  border-color: var(--primary, #fc4c02);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #fc4c02) 16%, transparent);
}

.route-cp-analysis__card h5 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.route-cp-summary { margin-top: 16px; }

/* ── Exports ── */
.route-cp-exports { margin-top: 16px; }

/* ── Print sheet (PDF / Race Book) — hidden on screen, only rendered on print ── */
.route-print-sheet { display: none; }

@media print {
  body > *:not(.route-print-sheet) { display: none !important; }
  .route-print-sheet {
    display: block !important;
    padding: 24px;
    color: #000;
    background: #fff;
  }
  .route-print-sheet__table { width: 100%; border-collapse: collapse; font-size: 11px; }
  .route-print-sheet__table th,
  .route-print-sheet__table td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
  .route-print-sheet__table th { background: #f1f1f1; }
}

/* ── Registration Form Builder — draggable field rows (reuses route-cp-list__row's grid/border, just adds the drag affordance) ── */
.regform-field-row { cursor: grab; }
.regform-field-row:active { cursor: grabbing; }

/* ============================================================================
   CHECKPOINT CONTROL CENTER (card-based redesign) — all additive/scoped.
   Nothing in .card/.stat/.btn/.collapse base rules is touched.
   ============================================================================ */

/* Header stat tiles — reuses .stat/.stat__icon/.stat__value/.stat__label as-is */
.route-cp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }

/* Filter bar — structurally mirrors participants.js's toolbar (search + chips + selects), own prefix to avoid cross-feature class coupling */
.route-cp-filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.route-cp-filterbar__search { flex: 1; min-width: 200px; }
.route-cp-filterbar__group { display: flex; gap: 6px; flex-wrap: wrap; }
.route-cp-chip {
  font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.route-cp-chip.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Card — no forced min-width (unlike the old 1040px table): cards reflow at any viewport width */
.route-cp-card { margin-top: 8px; }
.route-cp-card.is-highlighted { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.route-cp-card__head { position: relative; z-index: 1; background: var(--surface); touch-action: pan-y; width: 100%; text-align: left; }
.route-cp-card__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; font-size: 15px; }
.route-cp-card__title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.route-cp-card__meta { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.route-cp-card__status { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.route-cp-card__section { padding: 10px 0; border-top: 1px solid var(--border); }
.route-cp-card__section:first-child { border-top: none; }
.route-cp-card__section-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.route-cp-card__minimap-canvas { width: 100%; height: 220px; border-radius: 10px; overflow: hidden; }
.route-cp-card__drag-handle { cursor: grab; color: var(--muted); }

/* Smooth open/close via the grid-template-rows trick — cost is bounded to
   the one card whose class changes on any given click. */
.route-cp-card.collapse .collapse__body { display: grid; grid-template-rows: 0fr; padding: 0 12px; overflow: hidden; transition: grid-template-rows .22s ease, padding .22s ease; }
.route-cp-card.collapse .collapse__body > * { overflow: hidden; min-height: 0; }
.route-cp-card.collapse.is-open .collapse__body { grid-template-rows: 1fr; padding: 0 12px 12px; }

/* Filtered-out map markers/elevation dots stay visible but de-emphasized, never removed */
.route-cp-marker.is-filtered-out, .route-inspector__elev-cp.is-filtered-out { opacity: .32; filter: grayscale(40%); }

/* "Open in 3D Map" flash */
.route-map3d.is-flash { animation: route-map-flash 900ms ease-out; }
@keyframes route-map-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } 100% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--primary) 0%, transparent); } }

/* Swipe-to-reveal (mobile) — actions layer sits behind the head row */
.route-cp-card { position: relative; }
.route-cp-card__head { position: relative; }

/* Drag-reorder (mirrors workout-builder-premium.js's is-dragging/is-drag-over) */
.route-cp-card.is-dragging { opacity: .5; }
.route-cp-card.is-drag-over { outline: 2px dashed var(--primary); outline-offset: 2px; }

/* Volunteer editor rows (inside openCheckpointModal) */
.route-cp-volunteer-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.route-cp-volunteer-row__field { flex: 1; min-width: 100px; }

/* ── Stage B: compact live-data — 3 primary metrics + 2 secondary + details ──
   Replaces the old 10-item emoji grid; coordinates demoted to a collapsible. */
.route-inspector--compact { margin-top: 12px; }
.ri-metrics { display: grid; gap: 10px; }
.ri-metrics--primary { grid-template-columns: repeat(3, 1fr); }
.ri-metrics--secondary { grid-template-columns: repeat(2, 1fr); margin-top: 10px; }
.ri-metric {
  background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 8px; text-align: center;
}
.ri-metric__v {
  font-size: 20px; font-weight: 850; letter-spacing: -.02em; color: var(--text);
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.ri-metric--primary .ri-metric__v { font-size: 24px; }
.ri-metric__l {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin-top: 5px;
}
.ri-details {
  margin-top: 10px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface, #fff); overflow: hidden;
}
.ri-details > summary {
  cursor: pointer; padding: 11px 14px; font-size: 13px; font-weight: 700;
  color: var(--muted); list-style: none;
}
.ri-details > summary::-webkit-details-marker { display: none; }
.ri-details > summary::after { content: '+'; float: right; color: var(--muted); font-weight: 800; }
.ri-details[open] > summary::after { content: '\2013'; }
.ri-details__grid { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.ri-detail { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.ri-detail__l { color: var(--muted); }
.ri-detail__v { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.route-cam__ic { display: inline-flex; }
/* the play/pause primary control reads as the one main action */
.iconbtn.route-play { color: var(--primary, #fc4c02); }
@media (max-width: 380px) { .ri-metric--primary .ri-metric__v { font-size: 21px; } .ri-metric__l { font-size: 10px; } }

/* ── Stage C: MAP = HERO, topo default, deliberate [Τοπο][Δορυφ.][3D] switch ──
   Hierarchy on the course tab: map → controls → progress → ELEVATION →
   checkpoints → live data. */
.route-course { display: flex; flex-direction: column; gap: 12px; }
.route-course__main, .route-course__side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.route-course__map {
  position: relative;
  height: clamp(340px, 58vh, 560px);   /* the map dominates the page */
  border-radius: 16px;
}
.route-course__map .route-map3d,
.route-course__map .maplibregl-map { height: 100% !important; border-radius: 16px; }
/* mode switcher overlaid on the map (top-left), compact + professional */
.route-mapmode {
  position: absolute; top: 10px; left: 10px; z-index: 5;
  display: inline-flex; gap: 2px; padding: 3px;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(10px);
  border-radius: 10px; box-shadow: 0 2px 10px rgba(16,24,40,0.22);
}
.route-mapmode__btn {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 11px; border-radius: 8px; font-size: 12px; font-weight: 800;
  letter-spacing: .02em; color: #0f172a; font-family: inherit; transition: background .15s;
}
.route-mapmode__btn.is-active { background: rgba(15,23,42,0.11); }
/* elevation profile: prominent, taller, its own card directly under progress */
.route-course .route-inspector__elev {
  margin-top: 4px; min-height: 150px; padding: 10px 8px 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.route-course .route-inspector__elev svg { min-height: 132px; }
@media (min-width: 1024px) {
  /* Single FULL-WIDTH column — the map is a big cinematic hero across the whole
     width, everything below it full-width. No 2-column split (that left an empty
     side column and shrank the map). */
  .route-course__map { height: clamp(440px, 64vh, 760px); }
  .route-course .route-inspector__elev { min-height: 200px; }
  .route-course .route-inspector__elev svg { min-height: 180px; }
}

/* ── Stage D: immersive «Εξερεύνηση διαδρομής» ───────────────────────────────
   The course fills the viewport and the app chrome is hidden (mirrors the
   coach-workspace pattern). Same map/controls reused — only container size. */
.route-explore-btn {
  position: absolute; top: 10px; right: 10px; z-index: 6;
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 0; border-radius: 10px; cursor: pointer; color: #0f172a;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(16,24,40,0.22);
}
.route-explore-btn--close { color: #fff; background: rgba(15,23,42,0.86); }
body.route-explore .appbar,
body.route-explore .tabbar,
body.route-explore .sidenav,
body.route-explore .ep-fab,
body.route-explore #ep-fab,
body.route-explore .ai-fab,
body.route-explore .help-bubble { display: none !important; }
body.route-explore { overflow: hidden; }
body.route-explore .route-course {
  position: fixed; inset: 0; z-index: 190; margin: 0; gap: 10px;
  background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: max(10px, env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
}
body.route-explore .route-course__map { height: min(64vh, 640px); }
@media (min-width: 1024px) {
  body.route-explore .route-course { padding: 16px 20px; }
  body.route-explore .route-course__map { height: min(70vh, 820px); }
}

/* ── Desktop: the route detail FILLS the width (no centred strip, no void) ──
   The per-km/elevation tables use a mobile horizontal-scroll pattern
   (min-width + width:max-content); on wide screens they fill their column. */
@media (min-width: 1024px) {
  /* FILL the full content width — no cap, no side gaps. */
  .route-card { max-width: none; margin-left: 0; margin-right: 0; width: 100%; }
  .route-elev__details, .route-elev__row,
  .route-analysis__table-wrap, .route-analysis__row { min-width: 0; width: 100%; }
}

/* ── Stage E: professional trail-race Start / Finish markers ──────────────── */
.route-endpoint {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.5), 0 0 0 4px rgba(0,0,0,.18);
  cursor: pointer;
}
.route-endpoint--start { background: #10b981; }
.route-endpoint--finish { background: #0f172a; }
.route-endpoint__s { color: #fff; font-weight: 900; font-size: 15px; font-family: system-ui, sans-serif; }
.route-endpoint--finish svg { display: block; border-radius: 3px; }
