/* 5G/6G RF Channel & Constellation Studio - Keysight Theme */
:root {
    --bg-primary: #060b13;
    --bg-panel: #0d1520;
    --bg-panel-header: #131f30;
    --border-color: #1a2c42;
    --text-primary: #e0e6ed;
    --text-muted: #7890a8;
    --accent-cyan: #00ffc8;
    --accent-blue: #00aaff;
    --accent-amber: #ffaa00;
    --accent-red: #ff3366;
    --font-mono: "JetBrains Mono", "Courier New", Courier, monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.4;
    overflow-x: hidden;
}

/* Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel-header);
    border-bottom: 2px solid var(--border-color);
    padding: 10px 24px;
}

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

.brand-icon {
    font-size: 24px;
}

.brand-title {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.brand-model {
    font-family: var(--font-mono);
    font-size: 11px;
    background: #1c304a;
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--accent-cyan);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-btn {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: #ffffff;
    border-color: var(--accent-cyan);
}

/* App Grid */
.app-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
    padding: 16px 24px;
    max-width: 1700px;
    margin: 0 auto;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
}

.panel-header {
    background: var(--bg-panel-header);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-blue);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-body {
    padding: 14px 16px;
}

/* Form Controls */
.control-group {
    margin-bottom: 14px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.control-label span:last-child {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-weight: 600;
}

select, input[type="range"] {
    width: 100%;
}

select {
    background: #060b13;
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 8px 10px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
}

input[type="range"] {
    accent-color: var(--accent-cyan);
}

/* Presets */
.presets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.preset-btn {
    background: #060b13;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 10px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preset-btn strong {
    font-size: 11px;
    color: var(--accent-cyan);
}

.preset-btn span {
    font-size: 9px;
    color: var(--text-muted);
}

.preset-btn:hover {
    border-color: var(--accent-cyan);
    background: #0a1827;
}

/* Workspace Panels */
.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #060b13;
    border: 1px solid #142336;
    border-radius: 4px;
    overflow: hidden;
}

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

/* Telemetry HUD / Metrics */
.hud-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.hud-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 16px;
}

.hud-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.hud-val {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 4px;
}

.hud-val.cyan { color: var(--accent-cyan); }
.hud-val.amber { color: var(--accent-amber); }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.badge-pass {
    background: rgba(0, 255, 200, 0.15);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
}

.badge-fail {
    background: rgba(255, 51, 102, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

/* Testbench controls */
.testbench-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.btn {
    background: #14263b;
    border: 1px solid #234368;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #060b13;
}

.btn:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: #060b13;
    border-color: var(--accent-cyan);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.progress-bar-wrap {
    height: 4px;
    background: #101c2a;
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
    display: none;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-cyan);
    transition: width 0.1s;
}

/* Documentation / Banner */
.info-callout {
    background: rgba(0, 170, 255, 0.08);
    border-left: 3px solid var(--accent-blue);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: 0 4px 4px 0;
    margin-bottom: 14px;
}

.info-callout strong {
    color: #ffffff;
}


/* Touch & Mobile Optimization (Smartphones & Tablets) */
@media (max-width: 960px) {
    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 14px;
    }
    .nav-links {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    .nav-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    .app-container {
        grid-template-columns: 1fr;
        padding: 10px 12px;
        gap: 12px;
    }
    .workspace-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .hud-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .hud-card {
        padding: 10px 12px;
    }
    .hud-val {
        font-size: 18px;
    }
    .panel-header {
        padding: 10px 12px;
    }
    .panel-body {
        padding: 12px;
    }
    input[type="range"] {
        height: 28px;
        touch-action: pan-y;
    }
    .btn {
        padding: 12px 14px; /* Generous touch target */
        font-size: 12px;
    }
    .preset-btn {
        padding: 10px 12px;
    }
    .sweep-controls {
        flex-direction: column;
        gap: 10px;
    }
    .sweep-controls .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 15px;
    }
    .brand-model {
        font-size: 10px;
        padding: 1px 6px;
    }
    .hud-strip {
        grid-template-columns: 1fr 1fr;
    }
    .hud-val {
        font-size: 16px;
    }
    .canvas-container {
        max-width: 100%;
        overflow-x: hidden;
    }
    canvas {
        width: 100% !important;
        height: auto !important;
    }
    .presets-grid {
        grid-template-columns: 1fr;
    }
}



/* 5G NR OFDM Resource Grid Responsive Sizing */
#ofdm-canvas {
    width: 100%;
    height: 260px;
    min-height: 250px;
    display: block;
}

@media (max-width: 600px) {
    #ofdm-canvas {
        height: 255px;
    }
}

@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 {
    display: none !important;
  }
  .app-container {
    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;
  }
  .workspace {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .hud-strip {
    display: none !important;
  }
  .workspace-grid {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
  }
  .workspace > .panel:not(.live-sticky-screen) {
    display: none !important;
  }
  .panel.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;
  }
  .panel.live-sticky-screen .panel-header {
    display: none !important;
  }
  .panel.live-sticky-screen .panel-body {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .panel.live-sticky-screen .canvas-container {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #constellation-canvas {
    width: 380px !important;
    height: 380px !important;
    max-width: 100% !important;
    display: block !important;
  }
  #compliance-text {
    display: none !important;
  }
  .workspace-grid > .panel:not(.live-sticky-screen) {
    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) {
  .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: 7.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  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 .panel,
.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 .panel-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-primary,
.telemetry-drawer-body .btn-action,
.telemetry-drawer-body .preset-btn {
  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-primary:hover,
.telemetry-drawer-body .preset-btn: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-primary.active,
.telemetry-drawer-body .preset-btn.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 .app-container {
  height: 100% !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !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 {
    display: none !important;
  }
  .app-container {
    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;
  }
  .workspace {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .hud-strip {
    display: none !important;
  }
  .workspace-grid {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
  }
  .panel.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;
  }
  .panel.live-sticky-screen .panel-header {
    display: none !important;
  }
  .panel.live-sticky-screen .panel-body {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
  }
  .panel.live-sticky-screen .canvas-container {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #constellation-canvas {
    width: 370px !important;
    height: 370px !important;
    max-width: 100% !important;
    display: block !important;
  }
  #compliance-text {
    display: none !important;
  }
  .workspace-grid > .panel:not(.live-sticky-screen) {
    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;
  }
}
