:root {
    --bg-main: #060911;
    --bg-card: #0d1424;
    --bg-card-header: #121d33;
    --border-color: #1e293b;
    --border-highlight: #38bdf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #0ea5e9;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 40px;
}

.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-badge {
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.brand-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-link {
    background: #1e293b;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-link:hover {
    border-color: var(--accent-blue);
}

.status-bar {
    background: #090e18;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    font-size: 0.82rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.status-val {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.status-pill {
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.status-pill.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-pill.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    padding: 24px;
    max-width: 1560px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.canvas-container {
    background: #0a0e17;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.slider-with-val {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 220px;
}

input[type=range] {
    flex: 1;
    accent-color: var(--accent-blue);
}

.slider-val-readout {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
    min-width: 65px;
    text-align: right;
}

.btn-group {
    display: flex;
    gap: 6px;
}

.mode-btn {
    background: #162032;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mode-btn:hover {
    background: #1e2c44;
    color: var(--text-primary);
}

.mode-btn.active {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #27354a;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent-green);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.btn-action {
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-action:hover {
    border-color: var(--accent-amber);
    color: var(--accent-amber);
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }
}

@media (max-width: 900px) {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100% !important; height: 100dvh !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }
  .app-header {
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 10px !important;
    flex-shrink: 0 !important;
  }
  .app-header .header-controls {
    display: none !important;
  }
  .status-bar {
    display: none !important;
  }
  footer {
    display: none !important;
  }
  .dashboard-grid {
    position: relative !important;
    width: 100vw !important;
    height: calc(100vh - 42px) !important;
    height: calc(100dvh - 42px) !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .card.live-sticky-screen {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1 !important;
  }
  .card.live-sticky-screen .card-header {
    padding: 6px 10px !important;
    font-size: 0.76rem !important;
    flex-shrink: 0 !important;
  }
  .card.live-sticky-screen .card-body {
    flex: 1 !important;
    min-height: 0 !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .card.live-sticky-screen canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }
}

/* ========================================================= */
/* Smart Mobile Full-Screen Canvas & Edge Collapsible Drawer  */
/* ========================================================= */

/* Glowing Yellow Spotlight (Zero Blur, Sharp & Clear) */
.tour-spotlight-active {
  position: relative !important;
  z-index: 9995 !important;
  outline: 3.5px solid #ffd600 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px #ffd600, 0 0 24px rgba(255, 214, 0, 0.95) !important;
  border-radius: 6px !important;
  animation: tourYellowPulse 1.2s infinite alternate ease-in-out !important;
}
@keyframes tourYellowPulse {
  0% { outline-color: #ffd600; box-shadow: 0 0 0 2px #ffd600, 0 0 12px rgba(255, 214, 0, 0.7); }
  100% { outline-color: #ffea00; box-shadow: 0 0 0 4px #ffea00, 0 0 28px rgba(255, 234, 0, 1); }
}

/* Crystal-Clear Interactive Tour Card */
.tour-card {
  position: fixed;
  z-index: 10000;
  background: rgba(9, 14, 26, 0.97) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 2px solid #ffd600;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.95), 0 0 24px rgba(255, 214, 0, 0.35);
  color: #f1f5f9;
  display: none;
  flex-direction: column;
  padding: 10px 14px;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
}
.tour-card.active {
  display: flex;
}

/* Position Tour Card at top on mobile so it never blocks the bottom drawer or center canvas */
@media (max-width: 900px) {
  .tour-card {
    top: 10px;
    left: 8px;
    right: 8px;
    max-width: 96%;
    padding: 8px 12px;
  }
}
@media (min-width: 901px) {
  .tour-card {
    bottom: 24px;
    right: 24px;
    width: 380px;
  }
}

.tour-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tour-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tour-step-badge {
  background: linear-gradient(135deg, #f59e0b, #ffd600);
  color: #050811;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tour-app-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
}
.tour-btn-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.tour-btn-close:hover {
  color: #ffffff;
  border-color: #ffd600;
  background: rgba(255, 214, 0, 0.1);
}

.tour-card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tour-instruction-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}
.tour-detail-row {
  font-size: 0.73rem;
  line-height: 1.4;
  padding: 4px 8px;
  border-radius: 5px;
}
.tour-detail-happens {
  background: rgba(15, 23, 42, 0.85);
  border-left: 3px solid #ffd600;
  color: #e2e8f0;
}
.tour-detail-why {
  background: rgba(11, 17, 32, 0.85);
  border-left: 3px solid #38bdf8;
  color: #cbd5e1;
}

.tour-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}
.tour-btn-prev {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.tour-btn-prev:hover {
  color: #ffffff;
  background: #334155;
}
.tour-btn-next {
  background: linear-gradient(135deg, #ffd600, #f59e0b);
  border: none;
  color: #050811;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(255, 214, 0, 0.4);
  transition: transform 0.15s;
}
.tour-btn-next:hover {
  transform: translateY(-1px);
}

/* Floating Tour Launcher Button */
.btn-tour-launcher {
  position: fixed;
  bottom: 58px;
  right: 14px;
  z-index: 8990;
  background: linear-gradient(135deg, #f59e0b, #ffd600);
  color: #050811;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 7px 14px;
  border-radius: 50px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(255, 214, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s;
}
.btn-tour-launcher:hover {
  transform: translateY(-2px);
}

/* Universal Collapsible Bottom Sheet Drawer for Controls */
@media (max-width: 900px) {
  .mobile-drawer-pane {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9000 !important;
    max-height: 44vh !important;
    height: auto !important;
    background: rgba(8, 13, 24, 0.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-top: 2px solid #ffd600 !important;
    border-radius: 18px 18px 0 0 !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.9) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateY(calc(100% - 44px)) !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin: 0 !important;
  }
  .mobile-drawer-pane.drawer-expanded {
    transform: translateY(0) !important;
  }

  .mobile-drawer-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 16px !important;
    height: 44px !important;
    min-height: 44px !important;
    background: rgba(14, 23, 42, 0.95) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 18px 18px 0 0 !important;
    cursor: pointer !important;
    user-select: none !important;
    flex-shrink: 0 !important;
  }
  .drawer-title-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .drawer-badge {
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    color: #ffd600 !important;
    letter-spacing: 0.5px !important;
  }
  .drawer-toggle-btn {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f1f5f9 !important;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  .mobile-drawer-body {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 12px 14px 48px !important;
  }

  
  /* Sleek Compact Drawer Accordion Cards */
  .mobile-drawer-body .card,
  .mobile-drawer-body .panel,
  .mobile-drawer-body .control-card {
    margin-bottom: 8px !important;
    border-radius: 10px !important;
    background: rgba(15, 23, 42, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  .mobile-drawer-body .card-header,
  .mobile-drawer-body .panel-header {
    padding: 8px 12px !important;
    font-size: 0.76rem !important;
    cursor: pointer !important;
    user-select: none !important;
  }

  /* Mobile touch controls optimization */
  input[type=range] {
    height: 38px !important;
    min-height: 38px !important;
  }
  input[type=range]::-webkit-slider-thumb {
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: #ffd600 !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 0 10px rgba(255, 214, 0, 0.8) !important;
  }
  select, button {
    min-height: 40px !important;
  }
  .btn-tour-launcher {
    bottom: 52px !important;
    right: 10px !important;
    padding: 6px 12px !important;
    font-size: 0.72rem !important;
  }
}

/* Desktop layout rules */
@media (min-width: 901px) {
  .mobile-drawer-header {
    display: none !important;
  }
  .mobile-drawer-body {
    display: contents !important;
  }
}


/* Universal Mobile Drawer Accordions */
.accordion-arrow {
  font-size: 13px !important;
  color: #ffd600 !important;
  margin-left: auto !important;
  padding-left: 8px !important;
  display: inline-block !important;
  font-weight: 800 !important;
  transition: transform 0.2s ease !important;
}
.mobile-drawer-body .card-header,
.mobile-drawer-body .card-title,
.mobile-drawer-body .panel-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  cursor: pointer !important;
  user-select: none !important;
}


/* ==========================================================================
   MOBILE FLOATING HUD & AVIONICS SLIDE-OVER DRAWER ARCHITECTURE (NAVAL RADAR)
   ========================================================================== */

/* Universal Immersive Fullscreen Fallback (iOS Safari / Mobile) */
body.immersive-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100% !important; height: 100dvh !important;
  z-index: 99999 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #020617 !important;
  overflow: hidden !important;
}

@media (max-width: 900px) {
  /* Suppress old bottom action bar completely */
  .mobile-drawer-pane,
  .mobile-drawer-header,
  #mobileDrawerHeader,
  header.app-header,
  section.status-bar,
  footer,
  #btnTourLauncher,
  .btnTourLauncher {
    display: none !important;
  }

  /* Screen and canvas containment */
  html, body {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    height: 100% !important; height: 100dvh !important;
    background: #020617 !important;
  }

  main.dashboard-grid {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important; height: 100dvh !important;
    position: relative !important;
    overflow: hidden !important;
  }

  main.dashboard-grid > .card:not(.live-sticky-screen) {
    display: none !important;
  }

  .live-sticky-screen {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important; height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #020617 !important;
    border: none !important;
    border-radius: 0 !important;
    z-index: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .live-sticky-screen .card-header,
  .live-sticky-screen .control-row,
  .live-sticky-screen > span {
    display: none !important;
  }

  .live-sticky-screen .card-body {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .hud-visualizer-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important; height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background: #020617 !important;
  }

  .canvas-container {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  #ppiCanvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  /* FLOATING HUD OVERLAY LAYER */
  .hud-overlay-layer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important; height: 100dvh !important;
    pointer-events: none !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    padding: max(10px, env(safe-area-inset-top)) 10px max(14px, env(safe-area-inset-bottom)) 10px !important;
  }

  .hud-overlay-layer * {
    pointer-events: auto;
  }

  /* TOP ROW */
  .hud-top-bar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .hud-pills-left {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  .hud-pill-select-wrap,
  .hud-status-pill {
    background: rgba(10, 15, 29, 0.85) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    color: #e2e8f0 !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
  }

  .hud-pill-tag {
    color: #38bdf8 !important;
    font-size: 0.65rem !important;
  }

  .hud-dot-active {
    color: #10b981 !important;
    animation: pulseDot 2s infinite ease-in-out;
  }

  @keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
  }

  .hud-buttons-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .hud-circle-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: rgba(10, 15, 29, 0.85) !important;
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    color: #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
  }

  .hud-circle-btn:active {
    transform: scale(0.92) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
  }

  /* VERTICAL RAILS */
  .hud-vertical-rail {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 38px !important;
    background: rgba(10, 15, 29, 0.85) !important;
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 10px 4px !important;
    gap: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
    z-index: 110 !important;
  }

  .hud-rail-left {
    left: 8px !important;
  }

  .hud-rail-right {
    right: 8px !important;
  }

  .hud-rail-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1px !important;
  }

  .hud-rail-icon {
    font-size: 0.85rem !important;
  }

  .hud-rail-label {
    font-size: 0.55rem !important;
    font-weight: 800 !important;
    color: #94a3b8 !important;
    letter-spacing: 0.05em !important;
  }

  .hud-rail-sub {
    font-size: 0.5rem !important;
    color: #38bdf8 !important;
    font-weight: 700 !important;
  }

  .hud-rail-track-container {
    position: relative !important;
    height: 125px !important;
    width: 14px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .hud-rail-track {
    position: relative !important;
    width: 6px !important;
    height: 100% !important;
    background: rgba(30, 41, 59, 0.8) !important;
    border-radius: 3px !important;
    overflow: hidden !important;
  }

  .hud-rail-fill {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: linear-gradient(to top, #0284c7, #38bdf8) !important;
    box-shadow: 0 0 10px #38bdf8 !important;
    border-radius: 3px !important;
    transition: height 0.05s linear !important;
  }

  .hud-rail-range {
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    width: 125px !important;
    height: 28px !important;
    margin: 0 !important;
    opacity: 0 !important;
    cursor: pointer !important;
    transform: rotate(-90deg) translate(-50%, -50%) !important;
    transform-origin: 0 0 !important;
    z-index: 5 !important;
  }

  .hud-rail-value-badge {
    background: rgba(14, 165, 233, 0.2) !important;
    border: 1px solid #38bdf8 !important;
    border-radius: 6px !important;
    color: #38bdf8 !important;
    font-size: 0.58rem !important;
    font-weight: 800 !important;
    padding: 2px 3px !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .hud-rail-action-btn {
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    color: #f8fafc !important;
    font-size: 0.7rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
  }

  /* BOTTOM AREA */
  .hud-bottom-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .hud-subrow {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .hud-trigger-pill {
    background: rgba(10, 15, 29, 0.85) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 20px !important;
    padding: 6px 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    color: #f8fafc !important;
    font-size: 0.75rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
    transition: all 0.2s ease !important;
  }

  .hud-trigger-pill:active {
    transform: scale(0.96) !important;
    border-color: #38bdf8 !important;
  }

  .aocs-trigger-icon {
    font-size: 0.85rem !important;
  }

  .aocs-trigger-text strong {
    color: #38bdf8 !important;
  }

  .aocs-trigger-arrow {
    color: #94a3b8 !important;
  }

  .hud-transport-capsule {
    background: rgba(10, 15, 29, 0.85) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 20px !important;
    display: flex !important;
    align-items: center !important;
    padding: 2px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
  }

  .hud-transport-btn {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    font-size: 0.85rem !important;
    padding: 4px 10px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    transition: color 0.2s ease !important;
  }

  .hud-transport-btn:active {
    color: #38bdf8 !important;
  }

  .hud-transport-pause-btn {
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
  }

  .hud-transport-pause-btn.active {
    background: rgba(56, 189, 248, 0.2) !important;
    color: #38bdf8 !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3) !important;
  }

  /* 4 MODE CARDS GRID */
  .hud-mode-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 5px !important;
    width: 100% !important;
  }

  .hud-mode-card {
    background: rgba(10, 15, 29, 0.85) !important;
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 8px !important;
    padding: 5px 3px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }

  .hud-mode-card.active {
    background: rgba(14, 165, 233, 0.2) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
  }

  .mode-card-title {
    font-size: 0.62rem !important;
    font-weight: 800 !important;
    color: #f8fafc !important;
    letter-spacing: 0.02em !important;
  }

  .hud-mode-card.active .mode-card-title {
    color: #38bdf8 !important;
  }

  .mode-card-desc {
    font-size: 0.52rem !important;
    color: #94a3b8 !important;
    margin-top: 1px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  /* TELEMETRY DRAWER (AVIONICS SLIDE-OVER) */
  .telemetry-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100% !important; height: 100dvh !important;
    background: rgba(2, 6, 23, 0.75) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    z-index: 9998 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
  }

  .telemetry-backdrop.active {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .telemetry-drawer {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 310px !important;
    max-width: 86vw !important;
    height: 100% !important; height: 100dvh !important;
    background: #090e18 !important;
    border-left: 1px solid rgba(56, 189, 248, 0.3) !important;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.85) !important;
    z-index: 9999 !important;
    transform: translateX(100%) !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .telemetry-drawer.open {
    transform: translateX(0) !important;
  }

  .telemetry-drawer-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 16px !important;
    background: #0b1329 !important;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2) !important;
  }

  .drawer-title-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .drawer-badge {
    color: #38bdf8 !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
  }

  .drawer-close-btn {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }

  .drawer-close-btn:active {
    background: rgba(239, 68, 68, 0.3) !important;
    color: #ffffff !important;
  }

  .telemetry-drawer-content {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }

  .telemetry-drawer-content .card {
    background: #0d1527 !important;
    border: 1px solid rgba(56, 189, 248, 0.18) !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  }

  .telemetry-drawer-content .card-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 8px !important;
  }

  .telemetry-drawer-content .card-title {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
  }

  .telemetry-drawer-content .control-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 6px 0 !important;
    font-size: 0.78rem !important;
    color: #cbd5e1 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  }

  .telemetry-drawer-content .btn-action {
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
    border: 1px solid #38bdf8 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3) !important;
    transition: all 0.2s ease !important;
  }

  .telemetry-drawer-content .mode-btn {
    background: #0f172a !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    color: #94a3b8 !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
    font-size: 0.72rem !important;
    cursor: pointer !important;
  }

  .telemetry-drawer-content .mode-btn.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
  }

  .telemetry-drawer-content input[type="range"] {
    accent-color: #38bdf8 !important;
  }
}

/* DESKTOP MODE ISOLATION */
@media (min-width: 901px) {
  .hud-overlay-layer,
  .hud-vertical-rail,
  .hud-bottom-area,
  .telemetry-drawer-header,
  .telemetry-backdrop {
    display: none !important;
  }
  .telemetry-drawer,
  .telemetry-drawer-content {
    display: contents !important;
  }
}

/* Clean Mobile HUD: Strictly hide desktop tour cards, launcher buttons, modal footers & headers */
@media (max-width: 900px) {
  .guide-modal-footer,
  .btn-guide-start,
  #tourCard,
  .tour-card,
  .tour-overlay,
  #btnTourLauncher,
  .btnTourLauncher,
  .tour-launcher-btn,
  .app-header,
  header.app-header,
  section.status-bar,
  footer {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}
