/* DeepGIS HUD: toolbar, panels, indicators and flight widgets (templates/web/hud/). */
/* ========== HUD BOTTOM TOOLBAR ========== */
.hud-toolbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    z-index: 2000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    /* Never wider than the window: icons only on narrow screens, then scrollable */
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    scrollbar-width: none;
}
.hud-toolbar::-webkit-scrollbar { display: none; }

.hud-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.hud-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.hud-btn.active {
    background: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
    border-color: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.hud-btn i {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.hud-btn span {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Icons only on narrow screens (after the base rules so they win) */
@media (max-width: 1000px) {
    .hud-btn { min-width: 44px; padding: 8px 10px; }
    .hud-btn span { display: none; }
    .hud-btn i { margin-bottom: 0; }
}

/* Special colored buttons */
.hud-btn.hud-ai { border-color: rgba(16, 185, 129, 0.5); }
.hud-btn.hud-ai:hover, .hud-btn.hud-ai.active { 
    background: rgba(16, 185, 129, 0.3); 
    border-color: #10b981;
    color: #34d399;
}

.hud-btn.hud-flight { border-color: rgba(6, 182, 212, 0.5); }
.hud-btn.hud-flight:hover, .hud-btn.hud-flight.active {
    background: rgba(6, 182, 212, 0.25);
    border-color: #06b6d4;
    color: #67e8f9;
}

.hud-btn.hud-pilot { border-color: rgba(245, 158, 11, 0.5); }
.hud-btn.hud-pilot:hover, .hud-btn.hud-pilot.active {
    background: rgba(245, 158, 11, 0.25);
    border-color: #f59e0b;
    color: #fbbf24;
}

/* AI pilot chat: stays open while the user moves the map */
.pilot-panel {
    position: fixed;
    bottom: 70px;
    right: 120px;
    width: min(340px, calc(100vw - 148px));
    height: min(40vh, 360px);
    max-height: calc(100vh - 86px);
    display: none;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 12px;
    padding: 8px;
    z-index: 1998;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}
.pilot-panel.visible { display: flex; }
.pilot-panel .hud-panel-header { flex-shrink: 0; margin-bottom: 8px; }
.pilot-header-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pilot-model {
    width: 8.6rem;
    max-width: 34vw;
    background: rgba(30, 41, 59, 0.95);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.55);
    border-radius: 6px;
    padding: 4px 6px;
    font: 600 0.75rem/1.2 system-ui, sans-serif;
}
.pilot-model:focus { outline: none; border-color: #f59e0b; }
.pilot-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.8rem;
}
.pilot-msg {
    padding: 6px 9px;
    border-radius: 8px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.pilot-msg.user { align-self: flex-end; background: rgba(59, 130, 246, 0.18); color: #e2e8f0; max-width: 85%; }
.pilot-msg.ai { align-self: flex-start; background: rgba(51, 65, 85, 0.32); color: #f1f5f9; max-width: 92%; }
.pilot-msg.step { align-self: flex-start; color: #94a3b8; font-size: 0.72rem; padding: 0 9px; }
.pilot-msg.error { align-self: flex-start; color: #fca5a5; font-size: 0.75rem; padding: 0 9px; }
.pilot-msg.geo { align-self: flex-start; color: #fde68a; font-size: 0.74rem; padding: 0 9px; }
.pilot-msg a { color: #fbbf24; }
.pilot-msg.robot { align-self: flex-start; max-width: 92%; background: rgba(120, 53, 15, 0.55);
    border: 1px solid rgba(251, 191, 36, 0.6); color: #fef3c7; }
.pilot-robot-title { font-weight: 600; }
.pilot-robot-text { margin-top: 3px; font-style: italic; }
.pilot-robot-buttons { display: flex; gap: 6px; margin-top: 6px; }
.pilot-robot-buttons button { border: 0; border-radius: 6px; padding: 3px 10px; font-size: 0.78rem; cursor: pointer;
    background: rgba(51, 65, 85, 0.9); color: #e2e8f0; }
.pilot-robot-buttons button.send { background: #d97706; color: #111827; font-weight: 600; }
.pilot-robot-buttons button:disabled { opacity: 0.5; cursor: default; }
.pilot-form { display: flex; gap: 6px; flex-shrink: 0; }
.pilot-form input {
    flex: 1;
    min-width: 0;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(100, 116, 139, 0.5);
    border-radius: 6px;
    color: #f1f5f9;
    padding: 6px 8px;
    font-size: 0.8rem;
}
.pilot-form input:focus { outline: none; border-color: #f59e0b; }
.pilot-form button {
    background: rgba(245, 158, 11, 0.25);
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: 6px;
    color: #fbbf24;
    padding: 0 10px;
    cursor: pointer;
}
.pilot-form button:disabled { opacity: 0.4; cursor: default; }
.pilot-form button.pilot-stop { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }

.hud-btn.hud-vr { border-color: rgba(139, 92, 246, 0.5); }
.hud-btn.hud-vr:hover, .hud-btn.hud-vr.active { 
    background: rgba(139, 92, 246, 0.3); 
    border-color: #8b5cf6;
    color: #a78bfa;
}

.hud-btn.hud-mission { border-color: rgba(59, 130, 246, 0.5); }
.hud-btn.hud-mission:hover, .hud-btn.hud-mission.active { 
    background: rgba(59, 130, 246, 0.3); 
    border-color: #3b82f6;
    color: #60a5fa;
}

.hud-btn.hud-sampler { border-color: rgba(245, 158, 11, 0.5); }
.hud-btn.hud-sampler:hover, .hud-btn.hud-sampler.active { 
    background: rgba(245, 158, 11, 0.3); 
    border-color: #f59e0b;
    color: #fbbf24;
}

.hud-btn.hud-weather { border-color: rgba(16, 185, 129, 0.5); }
.hud-btn.hud-weather:hover, .hud-btn.hud-weather.active { 
    background: rgba(16, 185, 129, 0.3); 
    border-color: #10b981;
    color: #34d399;
}

/* ========== HUD FLOATING PANELS ========== */
.hud-panel {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: 380px;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 16px;
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.hud-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.hud-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.hud-panel-title {
    color: #f1f5f9;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-panel-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.hud-panel-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ========== FLIGHT PANEL (hud/flight_panel.html, hud/drone.js) ==========
   Docked at the left so the view stays clear while flying; stays open on
   globe clicks (data-sticky). */
.hud-panel.flight-panel {
    left: 10px;
    right: auto;
    bottom: 90px;
    width: 236px;
    max-height: calc(100vh - 290px); /* keeps the camera pose readout (top 80-190) clear */
    padding: 12px;
    border-color: rgba(6, 182, 212, 0.35);
    transform: translateY(20px);
}
.hud-panel.flight-panel.visible { transform: none; }
.flight-panel .hud-panel-header { margin-bottom: 8px; padding-bottom: 6px; }
.fp-header-tools { display: flex; align-items: center; gap: 2px; }
.fp-joy.active { color: #67e8f9; background: rgba(6, 182, 212, 0.2); }
.fp-joy:hover { color: #67e8f9; background: rgba(6, 182, 212, 0.25); }
.fp-section { margin-bottom: 8px; }
.fp-section-last { margin-bottom: 0; }
.fp-section .dl-heading { margin-bottom: 4px; font-size: 0.68rem; color: #94a3b8; }
.fp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: end; margin-bottom: 6px; }
.fp-row:last-child { margin-bottom: 0; }
.fp-field { display: flex; flex-direction: column; gap: 2px; margin: 0; color: #cbd5e1; font-size: 0.7rem; line-height: 1.2; }
.fp-field .dl-input { width: 100%; padding: 3px 6px; font-size: 0.8rem; }
.fp-field .dl-input::placeholder { color: #64748b; font-style: italic; }
.fp-btn { width: 100%; white-space: nowrap; font-size: 0.78rem; padding: 4px 6px; }
.fp-btn.active { animation: pulse 1.5s ease-in-out infinite; }
.fp-check { display: flex; align-items: center; gap: 5px; margin: 0; min-height: 29px; color: #cbd5e1; font-size: 0.72rem; }
.fp-check input { margin: 0; }
.fp-note { display: block; color: #64748b; font-size: 0.64rem; line-height: 1.25; }
.fp-slider { display: flex; flex-direction: column; gap: 0; margin: 0 0 4px; color: #cbd5e1; font-size: 0.7rem; }
.fp-slider span { display: flex; justify-content: space-between; }
.fp-slider b { color: #e2e8f0; font-weight: 600; }
.fp-slider input[type="range"] { width: 100%; height: 18px; margin: 0; accent-color: #06b6d4; }
/* Left stick moves clear of the open panel (both are top-level siblings in hud.html) */
#flightPanel.visible ~ #leftJoystick { left: 266px; }

@media (max-width: 760px) {
    .hud-panel.flight-panel { left: 8px; right: 8px; width: auto; bottom: 80px; max-height: 55vh; }
}

/* Custom scrollbar for panels */
.hud-panel::-webkit-scrollbar {
    width: 6px;
}
.hud-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
.hud-panel::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 3px;
}

/* ========== HIDE OLD SIDEBAR & FULL-WIDTH MAP ========== */
#sidebar-wrapper {
    display: none !important;
    width: 0 !important;
}

#wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.mobile-toggle {
    display: none !important;
}

/* Make cesium container full width */
#cesiumContainer {
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
}

/* Hide the old status indicator (sidebar mode messages) */
.status-indicator {
    display: none !important;
}

/* ========== PERFORMANCE & AIRCRAFT COUNT INDICATORS ========== */
.performance-indicator {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(139, 92, 246, 0.85);
    backdrop-filter: blur(8px);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1500;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.aircraft-count-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(245, 158, 11, 0.90);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    z-index: 1500;
    border: 2px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(245, 158, 11, 0.3);
    display: none;
    transition: all 0.3s ease;
    min-width: 180px;
    text-align: center;
}

.aircraft-count-indicator.visible {
    display: block;
    animation: pulseGlow 2s ease-in-out infinite;
}

.aircraft-count-indicator .icon {
    font-size: 1.3rem;
    margin-right: 8px;
    vertical-align: middle;
}

.aircraft-count-indicator .count {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.aircraft-count-indicator .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    display: block;
    margin-top: 2px;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(245, 158, 11, 0.5);
    }
}

/* ========== CONSISTENT LEFT WIDGET WIDTHS ========== */
.camera-info {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    left: 10px !important;
    position: fixed !important;
    top: 80px !important;
    padding: 4px 6px !important;
    font-size: 9px !important;
    /* Faint backdrop so the pose stays legible over bright imagery */
    background: rgba(15, 23, 42, 0.45) !important;
    border: none !important;
    border-radius: 6px !important;
    box-shadow: none !important;
}

.camera-info-title {
    margin-bottom: 2px !important;
    font-size: 9px !important;
    padding-bottom: 1px !important;
    font-weight: 600 !important;
}

.camera-info-item {
    margin-bottom: 1px !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
    display: flex !important;
    justify-content: space-between !important;
}

.camera-info-label, .camera-info-value {
    font-size: 9px !important;
}

.weather-stations-widget {
    width: 200px !important;
}

/* ========== QUICK VIEW BUTTONS (Top Right) ========== */
.hud-quick-views {
    position: fixed;
    top: 70px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 1500;
    padding: 3px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.45);
}

/* Navigation widget: below the quick actions (Share / QR / Label Rocks) */
.navigation-widget-group {
    position: fixed !important;
    top: 170px !important;
    right: 10px !important;  /* Moved left slightly */
    width: 100px;  /* Reduced from 120px */
    max-height: 200px;  /* Reduced height */
    z-index: 1400;  /* Below quick view buttons but above other elements */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.navigation-widget-group .widget-title {
    font-size: 8px !important;
    font-weight: 600 !important;
    color: #f1f5f9 !important;
    margin-bottom: 2px !important;
    text-align: left !important;
}

/* ========== ALTITUDE METER ========== */
.altitude-meter {
    width: 100px;
    height: 120px;
    margin-top: 8px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.altitude-meter-container {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
}

.altitude-tape {
    position: absolute;
    left: 0;
    width: 100%;
    transition: transform 0.3s ease-out;
}

.altitude-tape-value {
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #f1f5f9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.altitude-tape-value.major {
    font-size: 13px;
    color: #60a5fa;
    border-bottom: 2px solid rgba(96, 165, 250, 0.3);
}

.altitude-pointer {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
}

.altitude-pointer::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid #ef4444;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.altitude-readout {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35px;
    background: rgba(0, 0, 0, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.altitude-value {
    font-size: 16px;
    font-weight: 700;
    color: #10b981;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.altitude-unit {
    font-size: 8px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

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

/* Train button special styling */
.hud-quick-btn#quickTrain {
    border-color: rgba(16, 185, 129, 0.4);
}

.hud-quick-btn#quickTrain:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: #10b981;
}

.hud-quick-btn#quickTrain i {
    color: #10b981;
}

.hud-quick-btn {
    padding: 4px 6px;
    background: transparent;
    backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    text-decoration: none;
}

.hud-quick-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
    text-decoration: none;
}

.hud-quick-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.4);
}

/* ========== QR CODE OVERLAY ========== */
.qr-code-overlay {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.qr-code-overlay.visible {
    display: flex;
}

.qr-code-container {
    width: 128px;
    height: 128px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-container canvas,
.qr-code-container img {
    max-width: 100%;
    max-height: 100%;
}

.qr-code-label {
    font-size: 9px;
    color: #1e293b;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qr-code-controls {
    display: flex;
    gap: 4px;
}

.qr-code-btn {
    padding: 3px 6px;
    font-size: 8px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.qr-code-btn:hover {
    background: #2563eb;
}

.qr-code-btn.close {
    background: #ef4444;
}

.qr-code-btn.close:hover {
    background: #dc2626;
}

/* Hide keyboard shortcut hint */
.hud-toolbar::after {
    content: 'Press H to toggle HUD';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: #475569;
    opacity: 0;
    transition: opacity 0.3s;
}

.hud-toolbar:hover::after {
    opacity: 1;
}

/* ========== MAIN HEADING CENTERING ========== */
.main-heading {
    transition: all 0.3s ease;
}

/* ========== VIRTUAL JOYSTICKS ========== */
.joystick-container {
    position: fixed;
    bottom: 100px;
    z-index: 1800;
    display: none; /* Hidden by default, toggled by button */
}

.joystick-container.active {
    display: block;
}

#leftJoystick {
    left: 40px;
}

#rightJoystick {
    right: 40px;
}

.joystick-base {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.85) 100%);
    border: 2px solid rgba(59, 130, 246, 0.4);
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 2px 10px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    cursor: pointer;
    user-select: none;
}

.joystick-base::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 1px dashed rgba(59, 130, 246, 0.3);
}

.joystick-base::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px dashed rgba(59, 130, 246, 0.2);
}

.joystick-stick {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #60a5fa, #3b82f6);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: move;
    touch-action: none;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: box-shadow 0.1s ease;
}

.joystick-stick:active {
    box-shadow: 0 2px 15px rgba(59, 130, 246, 0.7), 0 0 30px rgba(59, 130, 246, 0.5);
}

.joystick-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.joystick-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 9px;
    font-weight: 600;
    pointer-events: none;
    z-index: 1;
}

/* Joystick cardinal direction markers */
.joystick-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.joystick-marker {
    position: absolute;
    color: rgba(148, 163, 184, 0.4);
    font-size: 10px;
    font-weight: bold;
}

.joystick-marker.north { top: 5px; left: 50%; transform: translateX(-50%); }
.joystick-marker.south { bottom: 5px; left: 50%; transform: translateX(-50%); }
.joystick-marker.east { right: 5px; top: 50%; transform: translateY(-50%); }
.joystick-marker.west { left: 5px; top: 50%; transform: translateY(-50%); }

/* ========== KEYBOARD SHORTCUTS LEGEND PANEL (HUD Style) ========== */
.keyboard-shortcuts-legend {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 12px;
    padding: 20px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.keyboard-shortcuts-legend.visible {
    opacity: 1;
    visibility: visible;
}

.keyboard-shortcuts-legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.keyboard-shortcuts-legend-title {
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.keyboard-shortcuts-legend-title i {
    color: #60a5fa;
    font-size: 1.1rem;
}

.keyboard-shortcuts-legend-close {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
}

.keyboard-shortcuts-legend-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.keyboard-shortcuts-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (max-width: 768px) {
    .keyboard-shortcuts-list {
        grid-template-columns: 1fr;
    }
}

.keyboard-shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 6px;
    transition: all 0.2s;
}

.keyboard-shortcut-item:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.keyboard-shortcut-label {
    color: #cbd5e1;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.keyboard-shortcut-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 6px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    color: #93c5fd;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.keyboard-shortcut-key.arrow {
    font-size: 0.85rem;
}

/* Custom scrollbar for legend */
.keyboard-shortcuts-legend::-webkit-scrollbar {
    width: 6px;
}
.keyboard-shortcuts-legend::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
.keyboard-shortcuts-legend::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
}
.keyboard-shortcuts-legend::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

@media (max-width: 760px) {
    .pilot-panel { right: 8px; left: auto; width: min(340px, calc(100vw - 16px)); height: min(38vh, 320px); }
}

/* ========== LAYERS PANEL: DATA LAYERS (hud/layers-panel.js) ========== */
.dl-heading { color: #cbd5e1; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em;
    text-transform: uppercase; margin: 0 0 6px; }
.dl-catalog-heading { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(59, 130, 246, 0.2); }
.dl-group { color: #64748b; font-size: 0.72rem; margin: 8px 0 2px; }
.dl-top { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.dl-top .form-check-input { margin: 0; flex: none; }
.dl-title { flex: 1; min-width: 0; margin: 0; color: #e2e8f0; font-size: 0.82rem; cursor: pointer; }
.dl-row.loading .dl-title { color: #93c5fd; }
.dl-row.loading .dl-title::after { content: ' \2026'; }
.dl-hint { margin-left: 6px; color: #64748b; font-size: 0.68rem; }
.dl-input { background: rgba(30, 41, 59, 0.9); color: #e2e8f0; border: 1px solid rgba(100, 116, 139, 0.5);
    border-radius: 4px; font-size: 0.74rem; padding: 1px 4px; }
.dl-input:focus { outline: none; border-color: #3b82f6; }
.dl-place { width: 100%; padding: 4px 8px; margin-bottom: 4px; }
.dl-radius { width: 58px; }
.dl-cmap { width: 74px; }
.dl-unit { color: #64748b; font-size: 0.7rem; }
.dl-refresh { background: none; border: 0; color: #60a5fa; padding: 0 4px; cursor: pointer; }
.dl-refresh:disabled { color: #475569; cursor: default; }
.dl-results { display: flex; flex-direction: column; gap: 3px; max-height: 200px; overflow-y: auto;
    margin: 2px 0 6px 22px; font-size: 0.8rem; }
.dl-results .pilot-msg { align-self: stretch; padding: 0; }

/* ========== AI PILOT WIDGETS (hud/pilot-widgets.js) ========== */
.pw-section { margin-bottom: 4px; }
.pw-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.pw-input { flex: 1; min-width: 0; padding: 4px 8px; }
.pw-row .btn { width: auto; flex: none; margin: 0; }
.pw-buttons .btn { flex: 1; }
.pw-results { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; font-size: 0.82rem; }
.pw-results .pilot-msg { align-self: stretch; max-width: none; }
.pw-note { color: #94a3b8; font-size: 0.75rem; }
.pw-note a { color: #fbbf24; }
.pw-rule { border-color: rgba(148, 163, 184, 0.25); margin: 12px 0; }

/* ========== SIM DESKTOPS (hud/sims.js) ========== */
.hud-btn.hud-sims { border-color: rgba(56, 189, 248, 0.5); }
.hud-btn.hud-sims:hover, .hud-btn.hud-sims.active {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #7dd3fc;
}
.sims-note { color: #94a3b8; font-size: 0.78rem; margin: 0 0 10px; }
.sims-list { display: flex; flex-direction: column; gap: 8px; }
.sim-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 10px; border: 1px solid rgba(56, 189, 248, 0.25); border-radius: 8px;
    background: rgba(15, 23, 42, 0.45);
}
.sim-row-text { min-width: 0; }
.sim-row-name { color: #f1f5f9; font-weight: 600; font-size: 0.86rem; }
.sim-row-robots { color: #94a3b8; font-size: 0.76rem; }
a.sim-open {
    color: #7dd3fc; text-decoration: none; border: 1px solid rgba(56, 189, 248, 0.45);
    border-radius: 6px; padding: 4px 10px; white-space: nowrap; font-size: 0.8rem;
}
a.sim-open:hover { background: rgba(56, 189, 248, 0.2); color: #e0f2fe; }

.sim-actions { display: flex; gap: 6px; flex: none; align-items: center; }
button.sim-act {
    color: #e2e8f0; background: transparent; cursor: pointer;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 6px; padding: 4px 8px; font-size: 0.75rem;
}
button.sim-act:hover { background: rgba(148, 163, 184, 0.16); }
button.sim-act:disabled { opacity: 0.55; cursor: default; }
button.sim-act-purge { color: #fecaca; border-color: rgba(248, 113, 113, 0.55); }
button.sim-act-purge:hover { background: rgba(248, 113, 113, 0.16); }
