:root {
    --bg-main: #070b12;
    --bg-card: #0d1522;
    --bg-card-header: #121c2e;
    --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;
}

/* Header */
.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-audition {
    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;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-audition.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* Status Bar */
.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.danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.5);
    animation: pulse-danger 1.5s infinite;
}

@keyframes pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

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

/* Cards */
.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;
}

/* Canvases */
.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;
    background: #0a0e17;
}

/* Button groups */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    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);
}

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

.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);
}

/* Range Inputs */
input[type=range] {
    accent-color: var(--accent-blue);
}

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

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

/* Audiogram Sliders */
.audiogram-container {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 4px;
    background: #090e18;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.slider-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.freq-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.vertical-slider {
    writing-mode: bt-lr; /* IE */
    -webkit-appearance: slider-vertical;
    width: 8px;
    height: 100px;
    accent-color: var(--accent-amber);
}

.hl-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-primary);
}

/* Custom Select */
.custom-select {
    background: #162032;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

.custom-select:focus {
    border-color: var(--accent-blue);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    .status-bar {
        padding: 8px 14px;
        gap: 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;
}


/* ========================================================= */
/* Floating Engineering HUD Overlay & Avionics Styles        */
/* ========================================================= */

.live-sticky-screen {
  position: relative !important;
  overflow: hidden !important;
}

.hud-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}

/* Top-Left HUD Controls */
.hud-top-left {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;
  z-index: 25;
}
.hud-pill-box {
  position: relative;
  width: 155px;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.hud-pill-box:hover {
  border-color: rgba(0, 229, 255, 0.4);
}
.hud-pill-inner {
  display: flex;
  align-items: center;
  padding: 4px 7px;
  gap: 6px;
}
.hud-pill-icon {
  color: #94a3b8;
  flex-shrink: 0;
}
.hud-text-stack {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.hud-mini-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7.5px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.4px;
  line-height: 1;
}
.hud-val-text {
  font-size: 9.5px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.hud-caret {
  font-size: 9px;
  color: #64748b;
  margin-left: auto;
}
.hud-hidden-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Tag Pills Row */
.hud-tags-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.hud-tag-wrapper {
  position: relative;
}
.hud-tag-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3.5px 7px;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.hud-tag-pill:hover {
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.25);
}
.hud-tag-pill.active {
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
}
.hud-dot-active {
  color: #00e5ff;
  font-size: 8px;
  text-shadow: 0 0 6px #00e5ff;
}

/* Top-Right Floating Circular Buttons */
.hud-top-right {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: auto;
  z-index: 25;
}
.hud-circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.hud-circle-btn:hover, .hud-circle-btn:active {
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.6);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
  transform: scale(1.05);
}

/* Floating Vertical Sliders */
.hud-vertical-rail {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 200px;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 3px;
  pointer-events: auto;
  z-index: 22;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s ease;
}
.hud-vertical-rail:hover {
  border-color: rgba(0, 229, 255, 0.35);
}
.hud-left-rail {
  left: 8px;
}
.hud-right-rail {
  right: 8px;
}
.hud-rail-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #94a3b8;
}
.hud-rail-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #94a3b8;
}
.hud-rail-track-container {
  position: relative;
  width: 18px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
}
.hud-rail-track {
  position: absolute;
  width: 3.5px;
  height: 100%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: visible;
}
.hud-rail-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(to top, #2979ff, #00e5ff);
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}
.hud-rail-thumb {
  position: absolute;
  left: 50%;
  bottom: 0%;
  width: 13px;
  height: 13px;
  transform: translate(-50%, 50%);
  border-radius: 50%;
  background: #cbd5e1;
  border: 2px solid #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.hud-vertical-rail:hover .hud-rail-thumb,
.hud-rail-track-container.active .hud-rail-thumb {
  background: #00e5ff;
  box-shadow: 0 0 10px #00e5ff;
}
.hud-rail-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.hud-rail-val-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #00e5ff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 22px;
  text-align: center;
}
.hud-rail-val-pill.is-paused {
  color: #ff9100;
  border-color: rgba(255, 145, 0, 0.3);
}
.hud-rail-val-pill.is-live {
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.3);
}
.hud-rail-pause-btn {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: rgba(14, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.hud-rail-pause-btn:hover {
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

/* Bottom Controls Area */
.hud-bottom-area {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  z-index: 25;
}
.hud-bottom-subrow {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 36px;
}
.hud-aocs-trigger-pill {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 2px 8px;
  border-radius: 16px;
  background: rgba(11, 18, 32, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 2;
  max-width: 120px;
}
.hud-aocs-trigger-pill:hover, .hud-aocs-trigger-pill:active {
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}
.aocs-trigger-icon {
  color: #00e5ff;
  font-size: 13px;
  flex-shrink: 0;
}
.aocs-trigger-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.1;
  min-width: 0;
}
.aocs-trigger-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: 800;
  color: #f1f5f9;
}
.aocs-trigger-sub {
  font-size: 6.5px;
  color: #64748b;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.aocs-trigger-chevron {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

/* Simulation Transport Cluster Centered */
.hud-sim-transport {
  position: absolute;
  left: 58%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 2px 4px;
  border-radius: 16px;
  background: rgba(11, 18, 32, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 1;
}
.hud-transport-step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.hud-transport-step:hover, .hud-transport-step:active {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
}
.hud-transport-pause {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  background: rgba(0, 229, 255, 0.12);
  border: 1.5px solid #00e5ff;
  color: #00e5ff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
  transition: all 0.2s ease;
}
.hud-transport-pause:hover, .hud-transport-pause:active {
  background: rgba(0, 229, 255, 0.22);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.55);
}
.hud-transport-pause.is-paused {
  background: rgba(255, 145, 0, 0.15);
  border-color: #ff9100;
  color: #ff9100;
  box-shadow: 0 0 12px rgba(255, 145, 0, 0.35);
}

/* Bottom Row: 4 Primary Mode Cards */
.hud-flight-modes-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
}
.hud-mode-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 4px 4px;
  height: 44px;
  border-radius: 7px;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  min-width: 0;
  overflow: hidden;
}
.hud-mode-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(16, 26, 46, 0.9);
}
.hud-mode-card.active {
  background: rgba(0, 229, 255, 0.12) !important;
  border-color: #00e5ff !important;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.4) !important;
}
.mode-card-header {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
}
.mode-card-icon {
  font-size: 9.5px;
  color: #94a3b8;
  flex-shrink: 0;
}
.hud-mode-card.active .mode-card-icon {
  color: #00e5ff;
}
.mode-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7.2px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-mode-card.active .mode-card-title {
  color: #00e5ff;
}
.mode-card-sub {
  font-size: 6.5px;
  color: #64748b;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.hud-mode-card.active .mode-card-sub {
  color: #80f0ff;
}

/* Telemetry Drawer Slide-Over Panel */
.telemetry-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.telemetry-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.telemetry-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(6, 11, 20, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}
.drawer-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  color: #00e5ff;
  letter-spacing: 0.5px;
}
.drawer-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.drawer-close-btn:hover {
  background: rgba(255, 23, 68, 0.2);
  border-color: #ff1744;
  color: #ff5252;
}

.telemetry-drawer-body {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* Avionics Dark Theme for ALL Drawer Elements (NEVER WHITE BUTTONS) */
.telemetry-drawer-body .card {
  background: rgba(11, 18, 32, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
}
.telemetry-drawer-body .card-header {
  background: rgba(15, 23, 42, 0.95) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 8px 12px !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #00e5ff !important;
}
.telemetry-drawer-body .btn,
.telemetry-drawer-body .btn-audition,
.telemetry-drawer-body .btn-action {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
  padding: 7px 12px !important;
  border-radius: 6px !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}
.telemetry-drawer-body .btn:hover,
.telemetry-drawer-body .btn-audition:hover {
  background: rgba(22, 36, 66, 0.95) !important;
  border-color: #00e5ff !important;
  color: #00e5ff !important;
}
.telemetry-drawer-body .btn.active,
.telemetry-drawer-body .btn-audition.active {
  background: rgba(0, 229, 255, 0.14) !important;
  border-color: #00e5ff !important;
  color: #00e5ff !important;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.35) !important;
}

/* Immersive Fullscreen Mode */
body.immersive-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100% !important; height: 100dvh !important;
  height: 100dvh !important;
  z-index: 999999 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #02050b !important;
}
body.immersive-fullscreen header,
body.immersive-fullscreen .app-header {
  display: none !important;
}
body.immersive-fullscreen .dashboard-grid {
  height: 100% !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.immersive-fullscreen .live-sticky-screen {
  height: 100% !important;
  height: 100dvh !important;
}

/* Modal Overlay Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: #0b1220;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #00e5ff;
}
.modal-body {
  padding: 14px 16px;
  color: #cbd5e1;
  font-size: 11.5px;
  line-height: 1.6;
}
.modal-body h4 {
  color: #38bdf8;
  margin: 10px 0 4px 0;
  font-size: 12px;
}
.modal-body code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  color: #00e5ff;
  font-family: 'JetBrains Mono', monospace;
}

/* Responsive Mobile & Desktop Layout Rules */
@media (max-width: 900px) {
  html, body {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important; height: 100dvh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    background: #02050b !important;
  }
  header, .app-header, .status-bar {
    display: none !important;
  }
  .dashboard-grid {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    overflow: hidden !important;
  }
  .live-sticky-screen {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #02050b !important;
    overflow: hidden !important;
  }
  .live-sticky-screen .card-header {
    display: none !important;
  }
  .live-sticky-screen .card-body {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .live-sticky-screen .canvas-container {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #soundfieldCanvas {
    width: 380px !important;
    height: 380px !important;
    max-width: 100% !important;
    display: block !important;
  }
  .live-sticky-screen .control-row {
    display: none !important;
  }

  .hud-overlay-layer {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
  }
  
  /* Telemetry Drawer on Mobile (Slide-Over) */
  .telemetry-drawer {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 310px !important;
    max-width: 86vw !important;
    height: 100% !important;
    max-height: 100% !important;
    background: rgba(8, 14, 26, 0.96) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-left: 1px solid rgba(0, 229, 255, 0.3) !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.85) !important;
    z-index: 9995 !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    pointer-events: auto !important;
    margin: 0 !important;
  }
  .telemetry-drawer.open {
    transform: translateX(0) !important;
  }
  
  /* Remove old drawer action bar */
  .mobile-drawer-header,
  .mobile-drawer-pane {
    display: none !important;
  }
  .btn-tour-launcher {
    display: none !important;
  }
}

@media (min-width: 901px) {
  .hud-overlay-layer,
  .hud-vertical-rail,
  .hud-bottom-area,
  .telemetry-drawer-header,
  .telemetry-backdrop {
    display: none !important;
  }
  .telemetry-drawer {
    display: flex !important;
    position: static !important;
    transform: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !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;
  }
}
