/**
 * Geodesic Flight Visualizer - Stylesheet
 *
 * Visual Identity:
 * - Cosmic Cartographic Theme (Obsidian #070a13, Cyan #06b6d4, Amber #f59e0b, Emerald #10b981)
 * - Glassmorphism surface panels with blur(12px)
 * - Tabular typography for crisp telemetry metrics
 * - Floating HUD on desktop, ergonomic bottom drawer on mobile (<640px)
 */

/* ==========================================================================
   Design Tokens & CSS Variables
   ========================================================================== */
:root {
  /* Color Palette */
  --color-bg: #070a13;
  --color-surface: rgba(12, 19, 34, 0.92);
  --color-surface-hover: rgba(19, 29, 51, 0.95);
  --color-surface-input: rgba(15, 23, 42, 0.75);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-focus: rgba(6, 182, 212, 0.5);

  /* Accents */
  --color-cyan: #06b6d4;
  --color-cyan-glow: rgba(6, 182, 212, 0.25);
  --color-amber: #f59e0b;
  --color-amber-glow: rgba(245, 158, 11, 0.25);
  --color-emerald: #fb4a5c; /* destination accent (rose); name kept for existing selectors */
  --color-emerald-glow: rgba(251, 74, 92, 0.25);

  /* Text & Labels */
  --color-text-primary: #f8fafc;
  --color-text-secondary: #cbd5e1;
  --color-text-muted: #94a3b8;
  --color-text-subtle: #64748b;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;

  /* Elevations & Effects */
  --shadow-hud: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-dropdown: 0 12px 32px -4px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --blur-glass: blur(12px);

  /* Radii */
  --radius-hud: 16px;
  --radius-card: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   CSS Reset & Base Rules
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Canvas Container */
#app, .app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--color-bg);
}


#hud-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#hud-container > * {
  pointer-events: auto;
}

.globe-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

canvas.globe-terrain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 1;
}

canvas.globe-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

canvas.globe-canvas:active {
  cursor: grabbing;
}

/* ==========================================================================
   Geodesic HUD Floating Container (Desktop)
   ========================================================================== */
.geodesic-hud {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  background: var(--color-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-hud);
  box-shadow: var(--shadow-hud);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.geodesic-hud::-webkit-scrollbar {
  width: 5px;
}
.geodesic-hud::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.geodesic-hud::-webkit-scrollbar-track {
  background: transparent;
}

/* Drawer handle for mobile */
.hud-drawer-handle {
  display: none;
  justify-content: center;
  align-items: center;
  padding-bottom: 4px;
  cursor: pointer;
}

.hud-drawer-pill {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--color-text-subtle);
  opacity: 0.6;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 14px;
}

.hud-branding {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hud-status-pulse {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-cyan);
  box-shadow: 0 0 10px var(--color-cyan);
  animation: pulse-glow 2.5s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.hud-title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-text-primary);
}

/* Header Actions & HUD Buttons */
.hud-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Projection Toggle Switch Segmented Control */
.hud-proj-toggle {
  position: fixed;
  top: max(24px, env(safe-area-inset-top, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  z-index: 130;
  display: inline-flex;
  align-items: center;
  background: var(--color-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  box-shadow: var(--shadow-hud);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.hud-proj-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  min-height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--color-text-muted);
  font-size: 0.6875rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.hud-proj-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.hud-proj-btn:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
}

.hud-proj-btn.is-active {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.5);
  color: var(--color-cyan);
  font-weight: 600;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.25);
}

/* [eclipse-overlay] Eclipse layer switch: same pill as the projection toggle,
   stacked beneath it, with an amber active state so it reads as a layer, not a view. */
.hud-eclipse-toggle {
  top: calc(max(24px, env(safe-area-inset-top, 0px)) + 50px);
}

.hud-eclipse-btn.is-active {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.25);
}

.hud-eclipse-btn:focus-visible {
  outline-color: #fbbf24;
}

/* [eclipse-overlay] Description card under the eclipse switch. */
.hud-eclipse-card {
  position: fixed;
  top: calc(max(24px, env(safe-area-inset-top, 0px)) + 98px);
  right: max(24px, env(safe-area-inset-right, 0px));
  z-index: 129;
  width: min(300px, calc(100vw - 48px));
  padding: 12px 32px 12px 14px;
  background: var(--color-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  box-shadow: var(--shadow-hud);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.75rem;
  line-height: 1.45;
}

.hud-eclipse-card-title {
  color: #fbbf24;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hud-eclipse-card-line {
  margin: 0 0 6px;
  color: var(--color-text-muted);
}

.hud-eclipse-card-line:last-child {
  margin-bottom: 0;
}

.hud-eclipse-card-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.hud-eclipse-card-close:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.hud-eclipse-card-close:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 1px;
}

.hud-proj-btn .hud-icon {
  stroke: currentColor;
  flex-shrink: 0;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.6875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hud-btn:hover,
.hud-btn:focus-visible {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

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

.hud-btn .hud-icon {
  stroke: currentColor;
  flex-shrink: 0;
}

/* Floating Trigger Pill for Minimized HUD */
.hud-floating-trigger {
  position: fixed;
  background: rgba(10, 16, 32, 0.9);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid rgba(6, 182, 212, 0.45);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 16px rgba(6, 182, 212, 0.25);
  border-radius: 9999px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  z-index: 120;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, border-color var(--transition-fast);
  white-space: nowrap;
}

.hud-floating-trigger:hover,
.hud-floating-trigger:focus-visible {
  border-color: var(--color-cyan);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 24px rgba(6, 182, 212, 0.4);
}

.hud-floating-trigger:active {
  transform: scale(0.98);
}

.hud-floating-trigger.hidden {
  opacity: 0;
  pointer-events: none;
}

.trigger-icon {
  font-size: 0.9375rem;
  line-height: 1;
}

.trigger-summary {
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trigger-chevron {
  color: var(--color-cyan);
  flex-shrink: 0;
}

/* ==========================================================================
   Route Input & Combobox Section
   ========================================================================== */
.hud-route-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.combobox-container {
  position: relative;
  width: 100%;
}

.combobox-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.combobox-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.combobox-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.indicator-amber {
  background-color: var(--color-amber);
  box-shadow: 0 0 6px var(--color-amber-glow);
}

.indicator-emerald {
  background-color: var(--color-emerald);
  box-shadow: 0 0 6px var(--color-emerald-glow);
}

.combobox-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

/* Input Wrapper & Inputs */
.combobox-wrapper {
  position: relative;
  width: 100%;
}

.combobox-input {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 12px;
  background-color: var(--color-surface-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  outline: none;
  transition: all var(--transition-fast);
}

.combobox-input::placeholder {
  color: var(--color-text-subtle);
  font-size: 0.75rem;
}

.combobox-input:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.combobox-origin .combobox-input:focus {
  border-color: var(--color-amber);
  box-shadow: 0 0 0 2px var(--color-amber-glow);
}

.combobox-dest .combobox-input:focus {
  border-color: var(--color-emerald);
  box-shadow: 0 0 0 2px var(--color-emerald-glow);
}

/* Clear Input Button */
.combobox-clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--color-text-subtle);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.combobox-clear-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* 1-Click Swap Button */
.swap-btn-container {
  display: flex;
  justify-content: center;
  margin: -4px 0;
  z-index: 5;
}

.hud-btn-swap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-fast);
}

.hud-btn-swap:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-focus);
  color: var(--color-cyan);
  transform: scale(1.08);
}

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

.hud-btn-swap.swapping .swap-icon {
  transform: rotate(180deg);
}

.swap-icon {
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Dropdown Autocomplete Listbox
   ========================================================================== */
.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #0d1424fa;
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-dropdown);
  z-index: 1000;
  list-style: none;
  padding: 4px;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.combobox-dropdown::-webkit-scrollbar {
  width: 4px;
}
.combobox-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.combobox-option {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.combobox-option:hover,
.combobox-option.active {
  background-color: rgba(6, 182, 212, 0.12);
}

.combobox-option.active .option-city-name {
  color: var(--color-cyan);
}

.option-text-row {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.option-city-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.option-country-tag {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.option-place-chip {
  flex-shrink: 0;
  font-size: 0.59375rem;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 1px 4px;
}

.combobox-empty {
  padding: 12px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  list-style: none;
}

/* ==========================================================================
   Antipodal Warning Callout Badge
   ========================================================================== */
.hud-antipodal-badge {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  animation: badge-appear 300ms ease-out;
}

@keyframes badge-appear {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.antipodal-badge-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.antipodal-icon {
  flex-shrink: 0;
  color: var(--color-amber);
  margin-top: 1px;
}

.antipodal-message {
  font-size: 0.71875rem;
  line-height: 1.4;
  color: #fef3c7;
  font-weight: 400;
}

/* ==========================================================================
   Telemetry Card & Metrics Display
   ========================================================================== */
.hud-telemetry-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 14px;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.telemetry-metric-block {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.metric-sublabel {
  font-weight: 400;
  color: var(--color-text-subtle);
}

.metric-value-primary {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-cyan);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metric-value-secondary {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* Jet Stream Wind Block */
.telemetry-wind-block {
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wind-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.wind-label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.wind-badge {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.wind-badge-headwind {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.wind-badge-tailwind {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.wind-description {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  line-height: 1.35;
}

/* Geographic Coordinates Block */
.telemetry-coords-block {
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coord-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.6875rem;
}

.coord-tag {
  font-size: 0.59375rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
}

.origin-tag {
  color: var(--color-amber);
  background: rgba(245, 158, 11, 0.12);
}

.midpoint-tag {
  color: var(--color-cyan);
  background: rgba(6, 182, 212, 0.12);
}

.dest-tag {
  color: var(--color-emerald);
  background: rgba(251, 74, 92, 0.12);
}

.coord-val {
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  font-size: 0.6875rem;
}

/* ==========================================================================
   Responsive Layout (Mobile Sheet < 640px)
   ========================================================================== */
@media (max-width: 639px) {
  .hud-proj-toggle {
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
  }

  .hud-proj-toggle:has(~ .geodesic-hud.is-searching) {
    display: none;
  }

  .hud-eclipse-toggle { /* [eclipse-overlay] */
    top: calc(max(12px, env(safe-area-inset-top, 0px)) + 56px);
  }

  .hud-eclipse-card { /* [eclipse-overlay] */
    top: calc(max(12px, env(safe-area-inset-top, 0px)) + 112px);
    right: max(12px, env(safe-area-inset-right, 0px));
    width: min(300px, calc(100vw - 24px));
  }

  .hud-proj-btn {
    min-height: 44px;
  }

  .geodesic-hud {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 52vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px)) 16px;
    gap: 8px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  }

  .geodesic-hud.is-searching {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    bottom: auto;
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - 12px);
  }

  .combobox-dropdown {
    max-height: 40vh;
  }

  .geodesic-hud.is-minimized {
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
  }

  .hud-drawer-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 0 4px;
    cursor: pointer;
    touch-action: pan-y;
  }

  .hud-drawer-pill {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background-color: var(--color-text-subtle);
    opacity: 0.65;
    transition: background-color var(--transition-fast), width var(--transition-fast);
  }

  .hud-drawer-handle:hover .hud-drawer-pill,
  .hud-drawer-handle:focus-visible .hud-drawer-pill {
    background-color: var(--color-cyan);
    opacity: 1;
    width: 52px;
  }

  .hud-floating-trigger {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(0);
  }

  .hud-floating-trigger:hover,
  .hud-floating-trigger:focus-visible {
    transform: translateX(-50%) translateY(-2px);
  }

  .hud-floating-trigger.hidden {
    transform: translateX(-50%) translateY(24px);
  }

  .hud-header {
    padding-bottom: 6px;
  }

  .hud-title {
    font-size: 0.75rem;
  }

  .hud-telemetry-card {
    padding: 10px;
    gap: 8px;
  }

  .telemetry-coords-block {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding-top: 8px;
  }

  .coord-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .coord-val {
    font-size: 0.625rem;
    line-height: 1.4;
  }

  .telemetry-grid {
    gap: 8px;
  }

  .metric-value-primary {
    font-size: 1.125rem;
  }

  .combobox-input {
    height: 36px;
  }
}

@media (min-width: 640px) {
  .geodesic-hud.is-minimized {
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
  }

  .hud-floating-trigger {
    bottom: auto;
    top: 24px;
    left: 24px;
    transform: translateX(0) translateY(0);
  }

  .hud-floating-trigger:hover,
  .hud-floating-trigger:focus-visible {
    transform: translateX(0) translateY(-2px);
  }

  .hud-floating-trigger.hidden {
    transform: translateX(0) translateY(-20px);
  }
}


/* ==========================================================================
   Loading Splash Screen
   ========================================================================== */
.loading-splash {
  position: absolute;
  inset: 0;
  background-color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

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

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(6, 182, 212, 0.15);
  border-top-color: var(--color-cyan);
  border-radius: 50%;
  animation: spin-loader 1s linear infinite;
}

@keyframes spin-loader {
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--color-cyan);
  text-transform: uppercase;
}

.loading-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  max-width: 320px;
  line-height: 1.4;
}
