:root {
  --bg-dark: #09111f;
  --glass-bg: rgba(12, 22, 39, 0.78);
  --glass-border: rgba(148, 197, 255, 0.18);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --beginner: #22c55e;
  --intermediate: #2563eb;
  --advanced: #ef4444;
  --expert: #111827;
  --gold: #facc15;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  touch-action: none;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
}

/* Loading */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 15, 29, 0.82);
  backdrop-filter: blur(8px);
}
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 36px;
  border-radius: 16px;
  background: rgba(15, 28, 50, 0.95);
  border: 1px solid var(--glass-border);
  font-size: 14px;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(56, 189, 248, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Top Bar */
.top-bar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 54px;
  border-radius: var(--radius);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-icon {
  font-size: 22px;
}
.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.skill-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.skill-bar::-webkit-scrollbar { display: none; }
.skill-label {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.chip {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.55);
  color: var(--text-main);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.18s ease;
}
.chip:hover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.16);
}
.chip.active {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mobile-only { display: none; }

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-secondary {
  background: rgba(250, 204, 21, 0.15);
  color: var(--gold);
  border: 1px solid rgba(250, 204, 21, 0.38);
}
.btn-secondary:hover {
  background: rgba(250, 204, 21, 0.25);
}
.btn-ghost {
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: #fff;
}
.btn-danger-glass {
  background: rgba(244, 63, 94, 0.22);
  color: #fecdd3;
  border: 1px solid rgba(244, 63, 94, 0.45);
  backdrop-filter: blur(12px);
}
.btn-danger-glass:hover {
  background: rgba(244, 63, 94, 0.4);
  color: #fff;
}
.btn-full { width: 100%; margin-top: 8px; }
.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
}
.btn-link:hover { color: var(--accent); }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 78px;
  left: 12px;
  bottom: 14px;
  width: 345px;
  border-radius: var(--radius);
  z-index: 15;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  padding: 6px;
  gap: 6px;
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 6px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.16s;
}
.tab.active {
  background: rgba(56, 189, 248, 0.16);
  color: #fff;
}
.badge-pill {
  background: var(--gold);
  color: #0f172a;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.tab-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}
.tab-panel.active { display: block; }

.panel-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

/* Resort Cards */
.resort-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.resort-card {
  padding: 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
  cursor: pointer;
  transition: all 0.18s ease;
}
.resort-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(20, 35, 62, 0.8);
}
.resort-card.active {
  border-color: var(--accent);
  background: rgba(14, 54, 92, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}
.resort-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.resort-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.resort-region {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.fit-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.fit-high { background: rgba(34, 197, 94, 0.2); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.35); }
.fit-mid { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.32); }

.resort-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0 8px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(9, 17, 31, 0.6);
}
.rstat-val { font-weight: 700; font-size: 13px; color: #e2e8f0; }
.rstat-lbl { font-size: 10px; color: var(--text-muted); }

.resort-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}
.resort-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Trails Panel */
.current-resort-mini {
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  margin-bottom: 12px;
  font-size: 12px;
}
.section-block { margin-bottom: 14px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.section-title {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 7px;
}
.section-header .section-title { margin-bottom: 0; }

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preset-card {
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
  cursor: pointer;
  transition: all 0.16s;
}
.preset-card:hover {
  border-color: var(--gold);
  background: rgba(250, 204, 21, 0.08);
}
.preset-title { font-weight: 600; font-size: 12px; color: #fef08a; }
.preset-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.plan-box {
  padding: 10px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(250, 204, 21, 0.24);
}
.plan-summary {
  font-size: 11.5px;
  color: #fde047;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.plan-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.plan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.7);
  font-size: 11.5px;
}
.plan-item-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.plan-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 4px;
}

.filter-row { margin-bottom: 8px; }
.search-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(9, 17, 31, 0.75);
  color: #fff;
  font-size: 12px;
  outline: none;
}
.search-input:focus { border-color: var(--accent); }

.diff-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}
.diff-chip {
  padding: 5px 2px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  background: rgba(30, 41, 59, 0.5);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.45;
  transition: all 0.15s;
}
.diff-chip.active { opacity: 1; color: #fff; }
.diff-chip.diff-beginner.active { background: rgba(34, 197, 94, 0.28); border-color: var(--beginner); }
.diff-chip.diff-intermediate.active { background: rgba(37, 99, 235, 0.32); border-color: #60a5fa; }
.diff-chip.diff-advanced.active { background: rgba(239, 68, 68, 0.28); border-color: var(--advanced); }
.diff-chip.diff-expert.active { background: rgba(17, 24, 39, 0.85); border-color: #e2e8f0; }

.trail-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.14);
  cursor: pointer;
  transition: all 0.15s;
}
.trail-row:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(24, 40, 68, 0.8);
}
.trail-row.selected {
  border-color: #fff;
  background: rgba(56, 189, 248, 0.2);
}
.trail-row-main {
  min-width: 0;
  flex: 1;
}
.trail-row-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12.5px;
}
.trail-row-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trail-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.trail-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.mini-btn {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.mini-btn:hover { border-color: var(--accent); color: #fff; }
.mini-btn.in-plan {
  background: rgba(250, 204, 21, 0.22);
  border-color: var(--gold);
  color: var(--gold);
}
.mini-btn.fpv-go {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

/* Top-Left Live Resort Minimap */
.minimap-widget {
  position: fixed;
  top: 78px;
  left: 368px;
  width: 244px;
  border-radius: 14px;
  z-index: 35;
  overflow: hidden;
  transition: left 0.25s ease, top 0.25s ease;
}
.minimap-widget.fpv-position {
  top: 66px;
  left: 16px;
}
.minimap-widget.collapsed {
  width: 176px;
}
.minimap-widget.collapsed .minimap-body {
  display: none;
}
.minimap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 12px;
  font-weight: 700;
}
.minimap-title {
  display: flex;
  align-items: center;
  gap: 7px;
}
.minimap-compass {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
}
.minimap-toggle {
  background: rgba(148, 163, 184, 0.16);
  border: none;
  color: #cbd5e1;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.minimap-toggle:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #fff;
}
.minimap-body {
  padding: 8px 10px 9px;
}
.minimap-canvas-wrap {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(148, 197, 255, 0.22);
  background: #0b1629;
  cursor: crosshair;
}
#minimap-canvas {
  display: block;
  width: 224px;
  height: 224px;
}
.minimap-loc-bar {
  margin-top: 7px;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(9, 17, 31, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
}
.minimap-trail-loc {
  font-size: 11.5px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.minimap-coords {
  font-size: 10.5px;
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.minimap-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 10px;
  color: #cbd5e1;
}
.minimap-legend span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.lg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.lg-black {
  background: #111827;
  border: 1.5px solid #f8fafc;
}

/* Top-Right Map Controls */
.map-controls {
  position: fixed;
  top: 78px;
  right: 12px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.control-group {
  display: flex;
  padding: 4px;
  border-radius: 11px;
  gap: 4px;
}
.ctrl-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.ctrl-btn:hover { color: #fff; background: rgba(148, 163, 184, 0.14); }
.ctrl-btn.active { background: rgba(56, 189, 248, 0.22); color: #fff; }

.slope-legend {
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.legend-title { font-weight: 700; margin-bottom: 2px; color: #e2e8f0; }
.legend-row { display: flex; align-items: center; gap: 7px; color: #cbd5e1; }

/* Selected Trail Inspector Card */
.trail-inspector {
  position: fixed;
  right: 14px;
  bottom: 16px;
  width: 356px;
  border-radius: 16px;
  padding: 14px 16px;
  z-index: 16;
}
.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.inspector-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 5px;
}
.diff-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}
.feel-tag {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}
.inspector-title {
  font-size: 16px;
  font-weight: 700;
}
.icon-close {
  background: rgba(148, 163, 184, 0.16);
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
}
.icon-close:hover { background: rgba(244, 63, 94, 0.25); color: #fff; }

.inspector-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(9, 17, 31, 0.65);
  margin-bottom: 10px;
  text-align: center;
}
.metric-val { font-size: 14px; font-weight: 700; color: #fff; }
.metric-lbl { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.profile-wrap {
  margin-bottom: 10px;
}
.profile-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.profile-svg {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  background: rgba(9, 17, 31, 0.65);
  display: block;
}
.inspector-tip {
  font-size: 11.5px;
  line-height: 1.45;
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.1);
  border-left: 3px solid var(--accent);
  padding: 7px 9px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 8px;
}

/* FPV HUD */
.fpv-hud {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}
.fpv-hud > * { pointer-events: auto; }

.fpv-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.fpv-trail-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}
.fpv-step {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.2);
  color: var(--gold);
}
.fpv-alert {
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.25s ease;
}
.fpv-alert.warn {
  background: rgba(249, 115, 22, 0.28);
  border-color: rgba(249, 115, 22, 0.65);
  color: #fed7aa;
}
.fpv-alert.danger {
  background: rgba(244, 63, 94, 0.32);
  border-color: rgba(244, 63, 94, 0.75);
  color: #fecdd3;
}

/* Visual Slope Inclinometer (实时坡度倾角仪) */
.slope-meter {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 108px;
  padding: 10px 8px;
  border-radius: 14px;
  text-align: center;
  pointer-events: none;
}
.slope-meter-title {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.slope-meter-svg {
  width: 90px;
  height: 58px;
  display: block;
  margin: 0 auto;
}
.slope-meter-deg {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #38bdf8;
}
.slope-meter-tag {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
  color: #e2e8f0;
}

.fpv-dock {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  border-radius: 18px;
  padding: 14px 18px;
}
.fpv-gauges {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  text-align: center;
  margin-bottom: 10px;
}
.gauge-val {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.gauge-val.accent { color: var(--accent); }
.gauge-lbl { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.fpv-scrubber-wrap {
  position: relative;
  height: 44px;
  margin-bottom: 10px;
}
.fpv-profile-svg {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  background: rgba(9, 17, 31, 0.65);
  display: block;
}
.fpv-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
}

.fpv-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.fpv-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctrl-lbl { font-size: 11.5px; color: var(--text-muted); }
.speed-btn {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.65);
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.speed-btn.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent);
  color: #fff;
}

/* Orbit Hint */
.orbit-hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  color: #cbd5e1;
  z-index: 12;
  pointer-events: none;
  white-space: nowrap;
}

/* Compare Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 880px;
  max-height: 86vh;
  border-radius: 18px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.modal-header h2 { font-size: 18px; margin-bottom: 4px; }
.compare-table-wrap { overflow: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.compare-table th, .compare-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  text-align: left;
  vertical-align: top;
}
.compare-table th {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Responsive Mobile Layout (iPhone / Android / WeChat Browser) */
@media (max-width: 900px) {
  .brand-sub, .skill-label, .orbit-hint { display: none; }
  .mobile-only { display: inline-flex; }

  .top-bar {
    top: calc(8px + env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    height: auto;
    min-height: 48px;
    padding: 6px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .brand-title { font-size: 14px; }
  .brand-icon { font-size: 18px; }
  .skill-bar {
    order: 3;
    flex-basis: 100%;
    padding-top: 2px;
  }
  .chip {
    padding: 4px 9px;
    font-size: 11.5px;
  }
  .top-actions .btn {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  /* Sidebar slides cleanly from bottom-left on mobile without blocking initial 3D view */
  .sidebar {
    top: calc(96px + env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    z-index: 40;
  }
  .sidebar.mobile-collapsed {
    transform: translateY(115%);
    opacity: 0;
    pointer-events: none;
  }

  /* Compact top-right map controls on mobile */
  .map-controls {
    top: calc(96px + env(safe-area-inset-top));
    right: 8px;
    gap: 6px;
  }
  .control-group {
    padding: 3px;
    gap: 2px;
  }
  .ctrl-btn {
    padding: 5px 7px;
    font-size: 11px;
  }

  /* Compact minimap at top-left on mobile */
  .minimap-widget {
    left: 8px;
    top: calc(96px + env(safe-area-inset-top));
    width: 146px;
  }
  .minimap-widget.fpv-position {
    top: calc(58px + env(safe-area-inset-top));
    left: 8px;
    width: 140px;
  }
  .minimap-header {
    padding: 5px 8px;
    font-size: 11px;
  }
  .minimap-body {
    padding: 6px;
  }
  #minimap-canvas {
    width: 126px;
    height: 126px;
  }
  .minimap-loc-bar {
    padding: 4px 5px;
  }
  .minimap-trail-loc { font-size: 10.5px; }
  .minimap-coords { font-size: 9.5px; }
  .minimap-legend {
    flex-wrap: wrap;
    gap: 3px 6px;
    font-size: 9.5px;
  }

  /* Trail Inspector card flush at bottom on mobile */
  .trail-inspector {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    padding: 12px 13px;
  }

  /* FPV HUD compact & thumb-friendly on mobile */
  .fpv-hud {
    padding: calc(10px + env(safe-area-inset-top)) 8px calc(10px + env(safe-area-inset-bottom));
  }
  .fpv-top-bar {
    gap: 6px;
  }
  .fpv-trail-pill {
    padding: 6px 10px;
    font-size: 12px;
  }
  .fpv-alert {
    padding: 5px 10px;
    font-size: 11.5px;
    order: 3;
    width: 100%;
    text-align: center;
  }
  .slope-meter {
    right: 8px;
    top: calc(116px + env(safe-area-inset-top));
    transform: none;
    width: 78px;
    padding: 6px 5px;
  }
  .slope-meter-svg {
    width: 66px;
    height: 40px;
  }
  .slope-meter-deg { font-size: 14px; }
  .slope-meter-tag { font-size: 9.5px; }

  .fpv-dock {
    padding: 10px 10px;
    border-radius: 14px;
  }
  .fpv-gauges {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 7px;
  }
  .fpv-gauges .gauge:nth-child(4) {
    display: none; /* Hide remaining distance on narrow phones to keep 1 crisp row */
  }
  .gauge-val { font-size: 15px; }
  .gauge-lbl { font-size: 9.5px; }
  .fpv-scrubber-wrap {
    height: 36px;
    margin-bottom: 8px;
  }
  .fpv-profile-svg { height: 36px; }
  .fpv-controls {
    gap: 6px;
    justify-content: center;
  }
  .fpv-btn-group {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }
  .fpv-controls .btn {
    padding: 6px 10px;
    font-size: 11.5px;
  }
  .ctrl-lbl { display: none; }
}
