:root {
  --bg-base: #0b0f17;
  --bg-glass: rgba(13, 19, 31, 0.78);
  --bg-glass-strong: rgba(15, 23, 42, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-bright: rgba(255, 255, 255, 0.22);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-strava: #fc4c02;
  --accent-strava-hover: #ff6220;
  --accent-cyan: #06b6d4;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow-lg: 0 18px 45px rgba(0, 0, 0, 0.55);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono);
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.map-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #141e30, #090d16);
}

.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
}

/* Top Floating Toolbar */
.top-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.top-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-panel-toggles {
  display: none;
  align-items: center;
  gap: 6px;
}

.btn-mobile-toggle {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}

.btn-mobile-toggle.active {
  background: rgba(6, 182, 212, 0.24);
  border-color: rgba(6, 182, 212, 0.75);
  color: #cffafe;
}

.btn-summary-accent {
  background: rgba(252, 76, 2, 0.22);
  border-color: rgba(252, 76, 2, 0.65);
  color: #fff;
}

.btn-summary-accent.active {
  background: var(--accent-strava);
  border-color: #ff8040;
  color: #fff;
}

.mobile-sheet-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-strava), #ff8040);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(252, 76, 2, 0.45);
  flex-shrink: 0;
}

.brand-logo svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #fff;
}

.route-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.control-label strong {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  color: var(--text-primary);
  background: transparent;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent-strava);
  color: #fff;
  box-shadow: 0 4px 12px rgba(252, 76, 2, 0.35);
}

.btn-primary:hover {
  background: var(--accent-strava-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--border-bright);
}

.btn-export {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.45);
  color: #cffafe;
}

.btn-export:hover {
  background: rgba(6, 182, 212, 0.28);
  border-color: rgba(6, 182, 212, 0.75);
}

.btn-export.recording {
  background: rgba(239, 68, 68, 0.24);
  border-color: rgba(239, 68, 68, 0.8);
  color: #fecaca;
  animation: rec-pulse 1.2s infinite ease-in-out;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.btn-icon {
  padding: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.14);
}

.segmented {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented.small .seg-btn {
  padding: 4px 7px;
  font-size: 11px;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.zoom-btn {
  min-width: 28px;
  font-size: 14px;
  line-height: 1;
  padding: 4px 8px;
  color: var(--text-primary);
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.select-input {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.select-input option {
  background: #0f172a;
  color: #f8fafc;
}

.slider-group input[type="range"] {
  width: 72px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

/* Live Telemetry HUD */
.live-hud {
  position: absolute;
  top: 78px;
  left: 14px;
  z-index: 15;
  width: 274px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
}

.hud-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-strava);
  box-shadow: 0 0 8px var(--accent-strava);
}

.provider-pill {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--accent-cyan);
  font-size: 10px;
  letter-spacing: 0;
}

.hud-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 10px;
}

.hud-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.hud-value small {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

.color-legend {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  color: var(--text-secondary);
}

.legend-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
}

.preload-status {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  color: var(--text-secondary);
}

.preload-status[hidden] {
  display: none;
}

.preload-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: rec-pulse 1.2s infinite ease-in-out;
  flex-shrink: 0;
}

.preload-status.ready .preload-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: none;
}

.preload-status.ready {
  color: #bbf7d0;
}

/* Right Analysis Sidebar */
.analysis-sidebar {
  position: absolute;
  top: 78px;
  right: 14px;
  bottom: 190px;
  width: 330px;
  z-index: 15;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.analysis-sidebar.collapsed {
  transform: translateX(calc(100% + 14px));
}

.sidebar-collapse-btn {
  position: absolute;
  left: -34px;
  top: 14px;
  width: 34px;
  height: 44px;
  border-radius: 10px 0 0 10px;
  border: 1px solid rgba(252, 76, 2, 0.55);
  border-right: none;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: -4px 4px 16px rgba(0, 0, 0, 0.45);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.sidebar-collapse-btn:hover {
  background: rgba(252, 76, 2, 0.25);
  border-color: var(--accent-strava);
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
}

.analysis-sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar-tabs {
  display: flex;
  padding: 6px;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  padding: 7px 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: rgba(252, 76, 2, 0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(252, 76, 2, 0.45);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sidebar-body::-webkit-scrollbar {
  width: 5px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-subtitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 10px;
}

.stat-card .label {
  font-size: 10.5px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.stat-card .value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.stat-card.highlight {
  border-color: rgba(252, 76, 2, 0.4);
  background: linear-gradient(135deg, rgba(252, 76, 2, 0.12), rgba(255, 255, 255, 0.03));
}

/* Milestones & Climbs */
.milestones-list,
.climbs-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.item-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-bright);
  transform: translateX(-2px);
}

.item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-title {
  font-weight: 600;
  font-size: 12px;
  color: #fff;
}

.item-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.cat-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.cat-HC { background: rgba(168, 85, 247, 0.25); color: #e9d5ff; border: 1px solid rgba(168, 85, 247, 0.5); }
.cat-1 { background: rgba(239, 68, 68, 0.24); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.5); }
.cat-2 { background: rgba(249, 115, 22, 0.24); color: #fed7aa; border: 1px solid rgba(249, 115, 22, 0.5); }
.cat-3 { background: rgba(245, 158, 11, 0.24); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.5); }
.cat-4 { background: rgba(34, 197, 94, 0.2); color: #bbf7d0; border: 1px solid rgba(34, 197, 94, 0.45); }

/* Splits Table */
.splits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.splits-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.splits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.splits-table th {
  text-align: left;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
}

.splits-table td {
  padding: 7px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
}

.splits-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.splits-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Photos strip */
.photo-strip-section {
  margin-top: 14px;
}

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

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Bottom Dock */
.bottom-dock {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  height: 164px;
  z-index: 18;
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.elevation-wrap {
  position: relative;
  flex: 1;
  min-height: 86px;
  width: 100%;
}

#elevation-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  z-index: 5;
}

.playback-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 36px;
}

.playback-left,
.playback-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent-strava);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(252, 76, 2, 0.45);
  transition: transform 0.15s ease;
}

.play-btn:hover {
  transform: scale(1.06);
  background: var(--accent-strava-hover);
}

.play-btn svg {
  width: 15px;
  height: 15px;
}

.progress-readout {
  font-size: 11.5px;
  color: var(--text-secondary);
  min-width: 105px;
}

.scrubber-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}

#playback-scrubber {
  width: 100%;
  accent-color: var(--accent-strava);
  cursor: pointer;
}

/* Custom 3D Athlete Beacon Marker */
.athlete-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 28%, var(--accent-strava) 65%);
  border: 2.5px solid #fff;
  box-shadow: 0 0 18px var(--accent-strava), 0 0 34px rgba(252, 76, 2, 0.65);
  position: relative;
  z-index: 5;
}

.athlete-marker::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(252, 76, 2, 0.7);
  animation: pulse-ring 1.6s infinite ease-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.75); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

.map-pin {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.map-pin.pin-start { border-color: #22c55e; color: #bbf7d0; }
.map-pin.pin-finish { border-color: #ef4444; color: #fecaca; }
.map-pin.pin-peak { border-color: #a855f7; color: #e9d5ff; }
.map-pin.pin-town { border-color: #f59e0b; color: #fef3c7; }
.map-pin.pin-photo { border-color: #06b6d4; color: #cffafe; }

/* Relive Photo Popup */
.photo-popup {
  position: absolute;
  left: 50%;
  top: 88px;
  transform: translateX(-50%);
  z-index: 30;
  width: 320px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: pop-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pop-in {
  from { opacity: 0; transform: translate(-50%, 14px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.photo-popup img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.photo-popup-meta {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.photo-title {
  font-weight: 700;
  font-size: 12px;
}

.photo-stats {
  font-size: 11px;
  color: var(--accent-cyan);
}

.photo-popup-timer {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.photo-popup-bar {
  height: 100%;
  width: 100%;
  background: var(--accent-strava);
  transition: width 0.1s linear;
}

.popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* Drag & Drop Overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 10, 18, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
}

.drop-card {
  padding: 40px 56px;
  border-radius: 20px;
  border: 2px dashed var(--accent-strava);
  text-align: center;
}

.drop-card svg {
  width: 48px;
  height: 48px;
  color: var(--accent-strava);
  margin-bottom: 12px;
}

.drop-card h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.drop-card p {
  color: var(--text-secondary);
}

/* Settings Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
}

.modal-card {
  width: 440px;
  max-width: calc(100vw - 28px);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header .popup-close {
  position: static;
}

.modal-desc {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.provider-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.provider-radio {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.provider-radio div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.provider-radio span {
  font-size: 11px;
  color: var(--text-secondary);
}

.token-wrap {
  margin-bottom: 14px;
}

.text-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 190px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-bright);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.65);
  color: #fecaca;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1080px) {
  .analysis-sidebar {
    width: 280px;
  }
  .live-hud {
    width: 238px;
  }
}

@media (max-width: 900px) {
  .top-bar {
    top: calc(10px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    padding: 8px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .top-bar-header {
    width: 100%;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .route-subtitle {
    max-width: 140px;
  }

  .mobile-panel-toggles {
    display: flex;
    flex-shrink: 0;
  }

  .top-bar.controls-collapsed .toolbar-controls {
    display: none;
  }

  .toolbar-controls {
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    max-height: 46vh;
    overflow-y: auto;
    gap: 8px;
  }

  .toolbar-controls .divider {
    display: none;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .mobile-sheet-close {
    display: inline-flex;
  }

  .live-hud {
    display: none;
  }

  .analysis-sidebar {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(152px + env(safe-area-inset-bottom));
    width: auto;
    height: min(46vh, 320px);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  }

  .analysis-sidebar.collapsed {
    transform: translateY(calc(100% + 180px));
    opacity: 0;
    pointer-events: none;
  }

  .bottom-dock {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    height: 136px;
    padding: 8px 10px;
    gap: 6px;
  }

  .elevation-wrap {
    min-height: 62px;
  }

  .playback-bar {
    gap: 8px;
    height: auto;
    flex-wrap: nowrap;
  }

  .progress-readout {
    display: none;
  }

  .playback-right {
    overflow-x: auto;
    max-width: 44vw;
    gap: 4px;
    scrollbar-width: none;
  }

  .playback-right::-webkit-scrollbar {
    display: none;
  }

  .toast-container {
    bottom: calc(156px + env(safe-area-inset-bottom));
  }
}
