:root {
  /* Alpine Daylight Palette (high-contrast for outdoor snow glare) */
  --bg-canvas: #dbe7f2;
  --surface: rgba(249, 252, 255, 0.90);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-muted: rgba(232, 240, 248, 0.88);
  --border: rgba(15, 30, 46, 0.12);
  --border-strong: rgba(15, 30, 46, 0.22);
  --ink: #0f1e2e;
  --ink-secondary: #3f556b;
  --ink-muted: #657c93;

  /* Alpine Signal & Ski Difficulty Tokens */
  --accent: #e8501a;
  --accent-soft: rgba(232, 80, 26, 0.14);
  --accent-ink: #ffffff;
  --diff-novice: #109e56;
  --diff-easy: #1472e0;
  --diff-intermediate: #d92d20;
  --diff-advanced: #1c242d;
  --diff-freeride: #d97706;
  --lift-color: #7c3aed;

  --shadow-sm: 0 2px 10px rgba(10, 24, 38, 0.10);
  --shadow-md: 0 10px 28px rgba(10, 24, 38, 0.16);
  --shadow-lg: 0 18px 42px rgba(10, 24, 38, 0.22);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dusk"] {
  --bg-canvas: #0b1622;
  --surface: rgba(15, 28, 42, 0.88);
  --surface-strong: rgba(19, 34, 51, 0.96);
  --surface-muted: rgba(29, 48, 69, 0.86);
  --border: rgba(214, 232, 250, 0.14);
  --border-strong: rgba(214, 232, 250, 0.28);
  --ink: #f1f6fb;
  --ink-secondary: #b6cbe0;
  --ink-muted: #7f9bb8;
  --accent: #ff6a2e;
  --accent-soft: rgba(255, 106, 46, 0.20);
  --diff-advanced: #f59e0b;
  --lift-color: #a78bfa;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.56);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button,
input,
select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

/* Full-bleed 3D Map Canvas */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.maplibregl-ctrl-attrib {
  font-size: 10px !important;
  opacity: 0.55;
  background: transparent !important;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  bottom: calc(92px + var(--safe-bottom)) !important;
}

/* Loading Splash */
.loading-veil {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(165deg, #0d1c2b 0%, #1c354f 58%, #284b6b 100%);
  color: #f4f9ff;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loading-veil.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.loading-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.loading-sub {
  font-size: 13px;
  color: rgba(235, 245, 255, 0.78);
}

.loading-bar {
  width: 168px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.loading-bar-fill {
  width: 45%;
  height: 100%;
  border-radius: 99px;
  background: #ff6a2e;
  animation: loadingSlide 1.1s ease-in-out infinite;
}

@keyframes loadingSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

/* Top Floating Bar */
.top-bar {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.brand-pill,
.zone-switch {
  pointer-events: auto;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 10px 0 9px;
  border-radius: var(--radius-pill);
  min-width: 0;
  flex-shrink: 1;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-elev {
  font-size: 10.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.zone-switch {
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 1px;
  flex-shrink: 0;
}

.zone-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
  white-space: nowrap;
}

.zone-btn:active {
  transform: scale(0.95);
}

.zone-btn.active {
  background: var(--ink);
  color: #ffffff;
}

[data-theme="dusk"] .zone-btn.active {
  background: var(--accent);
  color: #ffffff;
}

/* Active Live Navigation / Flythrough Top HUD */
.nav-hud {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 45;
  background: rgba(13, 27, 42, 0.94);
  color: #f4f9ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: none;
  flex-direction: column;
  gap: 10px;
}

.nav-hud.visible {
  display: flex;
}

.nav-hud-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-hud-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 700;
}

.nav-hud-icon.lift {
  background: #7c3aed;
}

.nav-hud-copy {
  flex: 1;
  min-width: 0;
}

.nav-hud-action {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.nav-hud-meta {
  font-size: 12.5px;
  color: rgba(235, 245, 255, 0.78);
  margin-top: 2px;
}

.nav-hud-close {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.nav-hud-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-hud-progress {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.nav-hud-progress-fill {
  height: 100%;
  width: 0%;
  background: #ff6a2e;
  border-radius: 99px;
  transition: width 0.15s linear;
}

.nav-hud-pill {
  height: 32px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.nav-hud-pill.active {
  background: #ff6a2e;
}

/* Right Thumb Rail (Glove-Friendly 46px targets) */
.thumb-rail {
  position: fixed;
  right: 12px;
  top: calc(64px + var(--safe-top));
  z-index: 28;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: top 0.22s ease;
}

body.nav-active .thumb-rail {
  top: calc(144px + var(--safe-top));
}

.rail-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--ink);
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}

.rail-btn:active {
  transform: scale(0.93);
}

.rail-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.rail-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-label {
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

#compassArrow {
  transition: transform 0.12s ease-out;
}

/* Left Quick Telemetry / Legend Pill */
.slope-legend {
  position: fixed;
  left: 12px;
  top: calc(64px + var(--safe-top));
  z-index: 26;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 10px;
  box-shadow: var(--shadow-sm);
  display: none;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.slope-legend.visible {
  display: flex;
}

.slope-legend-title {
  font-weight: 700;
  color: var(--ink);
}

.slope-legend-bar {
  display: flex;
  gap: 6px;
  align-items: center;
}

.slope-swatch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-secondary);
}

.slope-swatch i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

/* One-Handed Camera Control Bar (Chairlift Mode) */
.onehand-pad {
  position: fixed;
  right: 66px;
  top: calc(66px + var(--safe-top));
  z-index: 28;
  width: 196px;
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  gap: 10px;
}

.onehand-pad.visible {
  display: flex;
}

.onehand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
}

.onehand-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.onehand-row label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.onehand-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 24px;
}

.onehand-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.onehand-chip {
  height: 30px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
}

.onehand-chip:active {
  transform: scale(0.95);
}

/* Layer / Style Popover */
.layer-panel {
  position: fixed;
  right: 66px;
  top: calc(122px + var(--safe-top));
  z-index: 28;
  width: 214px;
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  gap: 10px;
}

.layer-panel.visible {
  display: flex;
}

.layer-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.basemap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.basemap-opt {
  padding: 8px 4px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}

.basemap-opt.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 2px;
}

.toggle-switch {
  width: 40px;
  height: 24px;
  border-radius: 99px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.18s ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.toggle-switch.on {
  background: var(--accent);
}

.toggle-switch.on::after {
  transform: translateX(16px);
}

/* Difficulty Filter Pills (Floating cleanly above collapsed bottom sheet) */
.diff-filter-strip {
  position: fixed;
  left: 12px;
  bottom: calc(124px + var(--safe-bottom));
  z-index: 25;
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  scrollbar-width: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.diff-filter-strip::-webkit-scrollbar {
  display: none;
}

.diff-filter-strip.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.diff-chip {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.diff-chip:active {
  transform: scale(0.95);
}

.diff-chip.off {
  opacity: 0.45;
}

.diff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.diff-dot.novice { background: var(--diff-novice); }
.diff-dot.easy { background: var(--diff-easy); }
.diff-dot.intermediate { background: var(--diff-intermediate); }
.diff-dot.advanced { background: var(--diff-advanced); }
.diff-dot.freeride { background: var(--diff-freeride); }
.diff-dot.lift { background: var(--lift-color); }

/* Bottom Sheet (Collapsible Navigation & Inspector Dock) */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface-strong);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding-bottom: var(--safe-bottom);
  display: flex;
  flex-direction: column;
  max-height: 60dvh;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 768px) {
  .sheet {
    left: 16px;
    right: auto;
    bottom: 16px;
    width: 400px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-height: calc(100dvh - 100px);
  }

  .diff-filter-strip {
    left: 432px;
    bottom: 22px;
  }
}

.sheet-handle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px 5px;
  cursor: grab;
  touch-action: none;
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-strong);
}

/* Compact Dock Summary (Always visible in sheet header) */
.sheet-dock {
  padding: 2px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dock-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-route-trigger {
  flex: 1;
  height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  min-width: 0;
}

.dock-route-trigger:active {
  transform: scale(0.99);
}

.dock-route-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.dock-route-summary span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-go-btn {
  height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(232, 80, 26, 0.30);
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.dock-go-btn:active {
  transform: scale(0.96);
}

.quick-presets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.quick-presets::-webkit-scrollbar {
  display: none;
}

.preset-pill {
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.preset-pill:active {
  transform: scale(0.95);
}

.preset-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Scrollable Sheet Body */
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet.collapsed .sheet-body {
  display: none;
}

/* Route Planner Form */
.planner-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.planner-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
}

.track-dot-start {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #109e56;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1.5px #109e56;
}

.track-line {
  width: 2px;
  height: 24px;
  background: var(--border-strong);
}

.track-dot-end {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1.5px var(--accent);
}

.planner-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.planner-select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.swap-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-secondary);
}

.swap-btn:active {
  transform: rotate(180deg);
}

/* Skill Level Selector */
.skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.skill-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.skill-pills {
  display: flex;
  gap: 5px;
  flex: 1;
  justify-content: flex-end;
}

.skill-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.skill-pill.active {
  background: var(--ink);
  color: #ffffff;
  border-color: transparent;
}

[data-theme="dusk"] .skill-pill.active {
  background: var(--accent);
}

.planner-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.btn-primary {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 14px rgba(232, 80, 26, 0.28);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* Route Result Panel */
.route-result {
  display: none;
  flex-direction: column;
  gap: 11px;
}

.route-result.visible {
  display: flex;
}

.route-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.stat-cell {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
}

.stat-val {
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.2;
}

.stat-lbl {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.route-cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 7px;
}

/* Interactive 2D Elevation Profile */
.profile-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 10px 6px;
}

.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-secondary);
  margin-bottom: 4px;
}

.profile-head strong {
  color: var(--ink);
}

.profile-svg-wrap {
  width: 100%;
  height: 88px;
  position: relative;
  touch-action: none;
}

.profile-svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Turn-by-Turn Steps */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.step-item:active,
.step-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-badge.lift { background: var(--lift-color); }
.step-badge.novice { background: var(--diff-novice); }
.step-badge.easy { background: var(--diff-easy); }
.step-badge.intermediate { background: var(--diff-intermediate); }
.step-badge.advanced { background: #1e293b; border: 1.5px solid #f59e0b; }
.step-badge.freeride { background: var(--diff-freeride); }
.step-badge.walk { background: #64748b; }

.step-info {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-sub {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.step-metric {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
  text-align: right;
}

/* Feature Inspector Card (When tapping any ski run, lift, or landmark on 3D map) */
.inspector-card {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.inspector-card.visible {
  display: flex;
}

.inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.inspector-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inspector-title {
  font-size: 17px;
  font-weight: 800;
}

.diff-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
}

.diff-tag.novice { background: var(--diff-novice); }
.diff-tag.easy { background: var(--diff-easy); }
.diff-tag.intermediate { background: var(--diff-intermediate); }
.diff-tag.advanced { background: #1e293b; border: 1px solid #f59e0b; }
.diff-tag.freeride { background: var(--diff-freeride); }
.diff-tag.lift { background: var(--lift-color); }
.diff-tag.poi { background: #0f1e2e; }

.inspector-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.inspector-desc {
  font-size: 13px;
  color: var(--ink-secondary);
  margin: 0;
}

.inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Toast Notification (Positioned cleanly above bottom dock so it never covers top HUD) */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(164px + var(--safe-bottom));
  transform: translateX(-50%) translateY(10px);
  z-index: 60;
  background: rgba(15, 30, 46, 0.92);
  color: #ffffff;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Custom Map Markers */
.poi-marker {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  background: rgba(15, 30, 46, 0.88);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.14s ease, opacity 0.2s ease;
}

.poi-marker.zoom-detail {
  display: none;
}

.poi-marker.zoom-detail.shown {
  display: flex;
}

.poi-marker:active {
  transform: scale(0.94);
}

.poi-marker.summit {
  background: linear-gradient(135deg, #c2410c, #ea580c);
  border-color: #ffffff;
}

.poi-marker.hall {
  background: #0f3b66;
}

.poi-marker .elev {
  font-weight: 600;
  opacity: 0.86;
  font-size: 10.5px;
}

.route-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  border: 2.5px solid #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.route-pin.start { background: #109e56; }
.route-pin.end { background: #e8501a; }
.route-pin.transfer { background: #7c3aed; font-size: 11px; }

.gps-puck {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1472e0;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 6px rgba(20, 114, 224, 0.28), 0 3px 10px rgba(0, 0, 0, 0.35);
  position: relative;
}

.gps-puck::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -13px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 13px solid #1472e0;
  opacity: 0.9;
}

.scrub-puck {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid #e8501a;
  box-shadow: 0 0 0 6px rgba(232, 80, 26, 0.32);
}

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