/* Estilos comunes para todas las vistas */
html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    /* Added DM Sans */
    font-weight: 500;
    /* Apply Medium weight */
}

#scene-container {
    width: 100vw;
    height: 100vh;
}

#info-box {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    background: rgba(0, 0, 0, 0.88);
    color: #f0f0f0;
    padding: 14px 18px;
    border-radius: 10px;
    display: none;
    width: min(90vw, 420px);
    min-width: 260px;
    max-width: 420px;
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
}

#info-box a {
    color: #6133ff;
    text-decoration: underline;
}

#info-box a:hover {
    color: #338aff;
    text-decoration: none;
}

.reference-label,
.equatorial-label {
    color: white;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    /* Added DM Sans */
    font-weight: 500;
    /* Use specified weight */
    pointer-events: none;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
}

/* ============================================= */
/* Caja de vistas (izquierda) */
/* ============================================= */
#view-box {
    position: absolute;
    top: 10px;
    left: 10px;
    /* background-color: #333; */
    /* Removed again */
    /* border: 2px solid white; */
    /* Removed */
    border-radius: 8px;
    padding: 10px;
    color: white;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    /* Added DM Sans */
    z-index: 1000;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
}

#view-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
    /* Align items horizontally now that button is next to link */
    flex-direction: row;
    align-items: center;
    /* Vertically align items */
    justify-content: center;
    /* Center items horizontally */
    gap: 5px;
    /* Add some space between items */
}

/* Common styles for both links and the toggle button in the view box */
#view-buttons a,
#view-buttons button#toggleCameraView {
    display: inline-block;
    /* Changed to inline-block for horizontal layout */
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    /* Adjusted padding */
    margin: 5px 0;
    border-radius: 4px;
    background-color: #444;
    text-align: center;
    font-size: 12px;
    /* width: 80%; Removed fixed width */
    position: relative;
    /* margin-bottom: 10px; Removed bottom margin for horizontal layout */
    border: none;
    /* Ensure button has no border */
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    /* Ensure font consistency */
    cursor: pointer;
    /* Add pointer cursor to button */
    line-height: normal;
    /* Ensure consistent line height */
}

/* Hover effect for both links and button */
#view-buttons a:hover,
#view-buttons button#toggleCameraView:hover {
    background-color: #555;
}

/* Tooltip style - applied via data-tooltip attribute */
#view-buttons a:hover::after,
#view-buttons button#toggleCameraView:hover::after,
#calculate-distance:hover::after {
    /* Keep existing tooltip rule */
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ccc;
    color: #000;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
}

/* ============================================= */
/* Caja de acciones (derecha) */
/* ============================================= */
#action-box {
    position: absolute;
    top: 10px;
    right: 10px;
    /* background-color: #333; */
    /* Removed again */
    /* border: 2px solid white; */
    /* Removed */
    border-radius: 8px;
    padding: 10px;
    color: white;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    /* Added DM Sans */
    z-index: 1000;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
}

#action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 10px;
}

/* #action-buttons button rules removed as they were all commented out */

#action-buttons button:hover {
    background-color: #555;
}

#action-buttons button:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ccc;
    color: #000;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
}

/* ============================================= */
/* Estilos para el cálculo de distancias */
/* ============================================= */
#distance-calculator {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* #calculate-distance {
    background-color: #444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
} */

#distance-inputs {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

#distance-inputs input {
    width: 80px;
    padding: 5px;
    margin: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 12px;
}

#distance-inputs button {
    background-color: #444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
}

#distance-result {
    margin-top: 10px;
    font-weight: 500;
    /* Use specified weight */
    font-size: 12px;
    text-align: center;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    /* Added DM Sans */
}

/* ============================================= */
/* Estilos específicos para Vista 2 */
/* ============================================= */
#controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

#toggleHeight {
    padding: 10px;
    background-color: #333;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.permanent-label,
.reference-label {
    display: block;
    /* Keep display block */
    visibility: visible;
    /* Keep visibility */
    z-index: 1000;
    /* Keep high z-index, remove !important */
}

.reference-label {
    pointer-events: none !important;
    user-select: none !important;
}

#info-box {
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Estilos para etiquetas de estrellas */
.star-label {
    color: white !important;
    background: transparent !important;
    font-size: 9px !important;
    font-family: 'DM Sans', Verdana, Arial, sans-serif !important;
    /* Added DM Sans */
    font-weight: 500 !important;
    /* Added font weight */
    pointer-events: none !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8) !important;
    white-space: nowrap !important;
    opacity: 0.9;
    transition: opacity 0.2s;
    transform: translate(-50%, -150%) !important;
    /* Cambiado para posicionar arriba */
    position: absolute !important;
    display: none;
    /* Ocultar por defecto - REMOVED !important */
    visibility: hidden;
    /* Ocultar por defecto - REMOVED !important */
    /* z-index: 10; */
    /* Removed for now */
}

/* Clase para mostrar etiquetas - REMOVED as JS should control visibility directly */
/*
.show-labels .star-label {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
*/

/* Etiquetas de estrellas principales */
.main-star-label {
    color: #a0d8ff !important;
    font-weight: normal !important;
    font-size: 10px !important;
    background: transparent !important;
    padding: 1px 3px !important;
    border: none !important;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.main-star-label:hover {
    opacity: 1;
}

/* Etiqueta para la línea de distancia */
.distance-label {
    position: absolute;
    color: #33FF99;
    /* New color requested by user */
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 1px 1px 2px black;
    display: block;
    /* Ensure it's visible when added */
    z-index: 10;
    /* Ensure it's above most elements but potentially below UI boxes */
    transform: translate(-50%, -50%);
    /* Center on the midpoint */
}


/* --- New Vista 3 UI Panel Styles --- */
#star-info-panel {
    position: absolute;
    top: 0;
    right: -450px;
    /* Start hidden off-screen to the right */
    width: min(85vw, 380px);
    height: 100vh;
    background: rgba(12, 14, 25, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(170, 189, 230, 0.15);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
    color: #e2e8f0;
    font-family: 'DM Sans', sans-serif;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    padding: 0;
    /* Remove padding here, move to content */
}

#star-info-panel.visible {
    right: 0;
    /* Slide in smoothly */
}


#star-info-panel h3 {
    margin: 0 0 15px 0;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 2px;
    color: #ffffff;
    text-transform: uppercase;
}

#star-info-content {
    padding: 25px;
    flex-grow: 1;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #b0c4de;
}

/* Customize the scrollbar for elegance */
#star-info-content::-webkit-scrollbar {
    width: 6px;
}

#star-info-content::-webkit-scrollbar-track {
    background: transparent;
}

#star-info-content::-webkit-scrollbar-thumb {
    background: rgba(170, 189, 230, 0.3);
    border-radius: 10px;
}

#star-info-content::-webkit-scrollbar-thumb:hover {
    background: rgba(170, 189, 230, 0.5);
}

#star-info-content a {
    color: #8bb4f6;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(139, 180, 246, 0.3);
    transition: all 0.2s ease;
}

#star-info-content a:hover {
    color: #ffffff;
    border-color: #ffffff;
}

#close-info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: rgba(170, 189, 230, 0.6);
    font-size: 28px;
    cursor: pointer;
    z-index: 11;
    /* Above the header gradient */
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#close-info-panel:hover {
    color: #ffffff;
    transform: rotate(90deg);
}

/* .show-labels .star-label rule removed above */

/* Styles for Hover Effects */
.hover-label {
    position: absolute;
    /* Needed for CSS2DObject positioning */
    background: rgba(0, 0, 0, 0.65);
    /* Slightly less transparent background */
    padding: 3px 6px;
    /* Slightly larger padding */
    border-radius: 3px;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    font-size: 11px;
    /* Increased base font size */
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
    white-space: nowrap;
    /* Add transition for potential fade later */
    /* transition: opacity 0.3s ease; */
    /* opacity: 0; */
    /* Start hidden if using fade */
}

.hover-label-name {
    font-weight: 600;
    /* Semi-bold */
    font-size: 11px;
    z-index: 1000;
}

.hover-label-main-star {
    color: white !important;
    font-weight: bold !important;
    font-size: 11px !important;
    text-shadow: 1px 1px 2px black !important;
}

/* RTL adjustments */
[dir="rtl"] #color-legend {
    text-align: right;
    max-width: 250px;
    /* Adjust as needed */
    overflow-x: auto;
}

[dir="rtl"] #left-menu {
    left: auto;
    right: 10px;
}

[dir="rtl"] #right-menu {
    right: auto;
    left: 70px;
    /* Adjust as needed */
}

.hover-label-coord {
    font-weight: 400;
    /* Fine */
    font-size: 9px;
    color: #aaaaff;
    /* Bluish */
}

.hover-label-altitude {
    font-weight: 400;
    /* Fine */
    font-size: 11px;
    /* Increased size to match base */
    color: #E0B0FF;
    /* Default color for the altitude part */
    line-height: 1.3;
    /* Add line-height for multi-line text */
}

/* Override specific styles for the star name span within the hover label */
.hover-label.hover-label-altitude span:first-child {
    /* Increased specificity */
    color: white !important;
    /* Force white color */
    font-weight: bold !important;
    /* Force bold weight */
    text-decoration: none !important;
    /* Remove underline if present */
}

/* --- Vista 3 Dynamic Controls Panel --- */
#controls-panel {
    position: absolute;
    bottom: 10px;
    left: 10px;
    /* Position bottom-left */
    background-color: rgba(51, 51, 51, 0.85);
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    color: white;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    z-index: 1001;
    /* Above legend */
    font-size: 11px;
    width: 280px;
    /* Adjust width as needed */
    max-height: 40vh;
    /* Limit height */
    overflow-y: auto;
    /* Add scroll if needed */
    display: none;
    /* Hide the panel */
}

#controls-panel h4 {
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid #666;
    padding-bottom: 5px;
}

#controls-panel .control-group {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#controls-panel label {
    flex-basis: 50%;
    /* Reduced label width */
    margin-right: 5px;
    white-space: nowrap;
    overflow: hidden;
    /* Prevent long labels from breaking layout */
    text-overflow: ellipsis;
    /* Show ellipsis for overflow */
}

#controls-panel input[type="range"] {
    flex-grow: 1;
    height: 5px;
    cursor: pointer;
    margin: 0 5px;
    /* Add some horizontal margin */
}

#controls-panel span {
    min-width: 35px;
    /* Increased min-width for value */
    width: 35px;
    /* Fixed width */
    text-align: right;
    font-weight: bold;
    color: #ffffaa;
    /* Yellowish color for value */
}

/* --- Off-Screen Star Indicators --- */
#offscreen-indicator-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Allow clicks to pass through */
    overflow: hidden;
    /* Hide indicators that might slightly overflow */
    z-index: 998;
    /* Below UI boxes but above scene */
}

.offscreen-indicator {
    position: absolute;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    /* Center the indicator on its calculated position */
    transition: opacity 0.2s ease-in-out;
    /* Optional fade effect */
}

.offscreen-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Subtle border */
}

/* .offscreen-indicator-name { } -- Removed empty rule */

/* --- Off-Screen Indicator Aura Styles --- */
.offscreen-indicator.aura-fina {
    border-style: solid;
    border-width: 1px;
    padding: 1px 4px;
    /* Adjust padding slightly for border */
}

.offscreen-indicator.aura-trazos {
    border-style: dashed;
    border-width: 1px;
    padding: 1px 4px;
}

.offscreen-indicator.aura-puntos {
    border-style: dotted;
    border-width: 1px;
    padding: 1px 4px;
}

/* Default state (no border) */
.offscreen-indicator {
    border: 1px solid transparent;
    /* Reserve space but keep invisible */
}

/* ============================================= */
/* New UI Styles - Vertical Menus & Icon Buttons */
/* ============================================= */

/* Keyframes for click animation */
@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.9);
    }
}

/* Keyframes for help button pulse animation */
@keyframes helpPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(51, 187, 255, 0.7);
        /* Light blue glow */
    }

    70% {
        box-shadow: 0 0 0 10px rgba(51, 187, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(51, 187, 255, 0);
    }
}

/* Class to apply the pulse animation */
.needs-attention {
    animation: helpPulse 1.5s infinite;
}


/* Base Menu Styles */
#left-menu,
#right-menu {
    position: absolute;
    top: 15px;
    /* Adjust vertical position */
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Space between buttons */
    z-index: 1000;
    /* Ensure menus are above scene */
}

#left-menu {
    left: 15px;
    align-items: flex-start;
    /* Align items to the start (left) */
    /* Remove bottom positioning if language button is moved */
}

#right-menu {
    right: 15px;
    align-items: flex-end;
    /* Align items to the end (right) */
}

/* Menu Button Styles (Common for a and button) */
.menu-button {
    display: flex;
    /* Use flex to center icon */
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background-color: rgba(51, 51, 51, 0.7);
    /* Semi-transparent dark grey */
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Subtle white border */
    border-radius: 50%;
    /* Circular */
    cursor: pointer;
    position: relative;
    /* Needed for label positioning */
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    padding: 0;
    /* Remove default padding */
    color: white;
    /* Ensure text color is white for potential fallback */
    text-decoration: none;
    /* Remove underline from links */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    /* Add subtle shadow */
}

.menu-button:hover {
    background-color: rgba(85, 85, 85, 0.8);
    /* Lighter grey on hover */
    border-color: rgba(255, 255, 255, 0.6);
}

/* Click Animation */
.menu-button:active {
    animation: bounce 0.2s ease;
}

/* Icon Styles */
.menu-button img.menu-icon {
    /* More specific selector */
    width: 24px;
    /* Adjust icon size as needed */
    height: 24px;
    vertical-align: middle;
    /* Helps alignment */
    filter: brightness(0) invert(1);
    /* Try simpler filter first to force white */
    pointer-events: none;
    /* Prevent icon itself capturing events */
}

/* Label Styles (Hidden by default) */
.menu-label {
    position: absolute;
    top: 50%;
    background-color: rgba(30, 30, 30, 0.9);
    /* Dark background for label */
    color: #eee;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    /* Start hidden */
    visibility: hidden;
    /* Ensure hidden */
    pointer-events: auto;
    /* Let people click the text to turn it off too */
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
    /* Delay visibility change */
    z-index: 1001;
    /* Above button */
}

/* Label Positioning and Animation */
#left-menu .menu-label {
    left: 100%;
    /* Start to the right of the button */
    transform: translateY(-50%) translateX(-15px);
    /* Initial position (shifted left) */
    margin-left: 10px;
    /* Space between button and label */
}

#right-menu .menu-label {
    right: 100%;
    /* Start to the left of the button */
    transform: translateY(-50%) translateX(15px);
    /* Initial position (shifted right) */
    margin-right: 10px;
    /* Space between button and label */
}

/* Show Label on Button Hover */
#left-menu .menu-button:hover .menu-label,
#right-menu .menu-button:hover .menu-label {
    opacity: 1;
    visibility: visible;
    /* Make visible on hover */
    transform: translateY(-50%) translateX(0);
    /* Slide in */
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0s;
    /* Immediate visibility change */
}

/* Active State Styles - Persistent Label for Toggle State (Visible) */
/* Make label visible permanently relative to its hover anim when button is toggled ON */
#left-menu .menu-button.label-visible .menu-label,
#right-menu .menu-button.label-visible .menu-label {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(-50%) translateX(0) !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
}

/* Remove general active background/border styles, persistent label is the indicator now */
.menu-button.active {
    background-color: rgba(85, 85, 85, 0.8);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Specific Active State for Distance Button */
.menu-button#calculate-distance.active {
    background-color: rgba(217, 83, 79, 0.9);
    /* Red background (#d9534f) */
    border-color: rgba(255, 150, 150, 0.8);
    box-shadow: 0 0 8px rgba(255, 80, 80, 0.5);
    /* Reddish glow */
}

/* Keep specific active style ONLY for distance button background */
.menu-button#calculate-distance.active {
    background-color: rgba(217, 83, 79, 0.9);
    /* Red background (#d9534f) */
    border-color: rgba(255, 150, 150, 0.8);
    box-shadow: 0 0 8px rgba(255, 80, 80, 0.5);
    /* Reddish glow */
}

/* Remove general active icon filter adjustments */
/* .menu-button.active img.menu-icon { ... } */
/* Keep specific active icon filter for distance button */
.menu-button#calculate-distance.active img.menu-icon {
    /* More specific selector */
    filter: brightness(0) invert(1) brightness(1.2);
    /* Brighter for red active */
}

/* Hide original UI boxes if they weren't removed */
#view-box,
#action-box {
    display: none !important;
}

/* Specific positioning for Language and Help buttons (Bottom-Left) */
button#languageSwitcher,
button#toggleHelpButton {
    position: absolute;
    /* Position relative to viewport */
    bottom: 15px;
    /* Distance from bottom */
    top: auto;
    /* Ensure it's not positioned from top */
    z-index: 1000;
    /* Ensure it's above scene but potentially below legend/infobox */
}

button#languageSwitcher {
    left: 15px;
    /* Language button on the left */
}

button#toggleHelpButton {
    left: 65px;
    /* Help button next to language button (15px + 40px width + 10px gap) */
}


/* Adjust label positioning for the bottom-left buttons */
button#languageSwitcher .menu-label,
button#toggleHelpButton .menu-label {
    left: 100%;
    /* Start to the right */
    transform: translateY(-50%) translateX(-15px);
    /* Initial position (shifted left) */
    margin-left: 10px;
    /* Space between button and label */
    right: auto;
    /* Ensure right positioning is cleared */
    margin-right: 0;
}

/* Show Label on Button Hover for bottom-left buttons */
button#languageSwitcher:hover .menu-label,
button#toggleHelpButton:hover .menu-label {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    /* Slide in */
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0s;
}

/* Active State Styles - Persistent Label for bottom-left buttons */
button#languageSwitcher.label-visible .menu-label,
button#toggleHelpButton.label-visible .menu-label {
    /* Added help button */
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    transition: none;
}

/* --- Mobile responsive: Help & Language buttons --- */
@media (max-width: 768px) {

    button#languageSwitcher,
    button#toggleHelpButton {
        width: 36px;
        height: 36px;
        bottom: 10px;
    }

    button#languageSwitcher {
        left: 10px;
    }

    button#toggleHelpButton {
        left: 56px;
    }

    button#languageSwitcher img.menu-icon,
    button#toggleHelpButton img.menu-icon {
        width: 20px;
        height: 20px;
    }

    /* Info-box adjusts for phone screens */
    #info-box {
        bottom: 56px;
        width: min(94vw, 360px);
        min-width: 220px;
        padding: 12px 14px;
        font-size: 13px;
        border-radius: 10px;
    }
}

/* ============================================= */
/* Image Modal Styles                          */
/* ============================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* Opaque background */
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1002;
    /* Above legend and other UI elements */
    cursor: pointer;
    /* Indicate it's clickable to close */
}

.modal-overlay.show {
    display: flex;
    /* Use flex to center content */
}

.modal-content {
    background-color: rgba(40, 40, 40, 0.95);
    /* Slightly lighter than overlay */
    padding: 20px;
    border-radius: 5px;
    /* Rounded border */
    border: 1px solid #666;
    /* Visible frame */
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    /* Add scroll if content exceeds dimensions */
    text-align: center;
    position: relative;
    /* For potential future additions like a close button */
    cursor: default;
    /* Reset cursor for the content area */
}

.modal-content img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 80px);
    /* Adjust max height considering padding and caption */
    margin: 0 auto 10px auto;
    /* Center image and add space below */
    border-radius: 3px;
    /* Slightly rounded corners for the image */
}

.modal-content p {
    margin: 10px 0 0 0;
    /* Margin top for caption */
    font-size: 12px;
    color: #ccc;
    text-align: center;
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
}

/* --- Language Menu Styles --- */
.language-menu {
    position: absolute;
    bottom: 60px;
    /* Position above the switcher button (40px height + 10px gap + 10px padding) */
    left: 15px;
    /* Align with switcher */
    background: rgba(51, 51, 51, 0.9);
    border-radius: 5px;
    padding: 10px;
    color: white;
    z-index: 1100;
    /* Ensure it's above other elements */
    min-width: 150px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, visibility 0.3s ease;
    /* Default state is visible */
    opacity: 1;
    visibility: visible;
    display: block;
    /* Explicitly set display block when not hidden */
}

/* Make the hidden rule slightly more specific just in case */
div#languageMenu.language-menu.hidden {
    opacity: 0;
    visibility: hidden;
    display: none;
    /* Explicitly set display none when hidden */
    pointer-events: none;
    /* Prevent interaction when hidden */
}

.language-menu h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    text-align: center;
    border-bottom: 1px solid #666;
    padding-bottom: 5px;
}

.language-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.language-menu li {
    margin-bottom: 5px;
}

.language-menu li:last-child {
    margin-bottom: 0;
}

.language-menu a {
    display: block;
    color: #ccc;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.language-menu a:hover {
    background-color: #555;
    color: #fff;
}

/* --- Basic RTL Support --- */
html[lang="ar"] {
    /* Apply direction to html element */
    direction: rtl;
}

/* Adjust menu positioning for RTL */
html[lang="ar"] #left-menu {
    right: 15px;
    left: auto;
    align-items: flex-end;
}

html[lang="ar"] #right-menu {
    left: 15px;
    right: auto;
    align-items: flex-start;
}

html[lang="ar"] button#languageSwitcher,
html[lang="ar"] button#toggleHelpButton {
    left: auto;
    /* Clear left positioning */
    right: 15px;
    /* Position from the right */
}

/* Adjust right position for the second button in RTL */
html[lang="ar"] button#toggleHelpButton {
    right: 65px;
    /* Position next to language button (15px + 40px width + 10px gap) */
}

html[lang="ar"] #color-legend {
    left: 10px;
    right: auto;
}

html[lang="ar"] #controls-panel {
    /* Example for controls panel if needed */
    right: 10px;
    left: auto;
}

/* Adjust label positioning for RTL */
html[lang="ar"] #left-menu .menu-label {
    right: 100%;
    left: auto;
    transform: translateY(-50%) translateX(15px);
    margin-right: 10px;
    margin-left: 0;
}

html[lang="ar"] #right-menu .menu-label {
    left: 100%;
    right: auto;
    transform: translateY(-50%) translateX(-15px);
    margin-left: 10px;
    margin-right: 0;
}

html[lang="ar"] button#languageSwitcher .menu-label,
html[lang="ar"] button#toggleHelpButton .menu-label {
    right: 100%;
    left: auto;
    transform: translateY(-50%) translateX(15px);
    margin-right: 10px;
    margin-left: 0;
}

/* Adjust hover slide direction for RTL */
html[lang="ar"] #left-menu .menu-button:hover .menu-label,
html[lang="ar"] #right-menu .menu-button:hover .menu-label,
html[lang="ar"] button#languageSwitcher:hover .menu-label,
html[lang="ar"] button#toggleHelpButton:hover .menu-label {
    transform: translateY(-50%) translateX(0);
}

/* Adjust persistent label position for RTL */
html[lang="ar"] #left-menu .menu-button.label-visible .menu-label,
html[lang="ar"] #right-menu .menu-button.label-visible .menu-label,
html[lang="ar"] button#languageSwitcher.label-visible .menu-label,
html[lang="ar"] button#toggleHelpButton.label-visible .menu-label {
    /* Added help button */
    transform: translateY(-50%) translateX(0);
}

/* Force legend to bottom-left in RTL */
html[lang="ar"] body #color-legend {
    /* Increased specificity */
    left: 10px !important;
    right: auto !important;
}

/* Adjust legend item alignment for RTL */
html[lang="ar"] #color-legend li span:first-child {
    margin-left: 5px;
    margin-right: 0;
}

html[lang="ar"] #color-legend li svg {
    margin-left: 5px;
    margin-right: 0;
}

/* ============================================= */
/* Help Modal Styles                           */
/* ============================================= */

#help-modal-overlay {
    /* Inherits .modal-overlay styles: fixed, full screen, bg, hidden, flex center */
    z-index: 1003;
    /* Ensure it's above image modal if both are somehow open */
}

#help-modal-content {
    /* Inherits .modal-content styles: bg, padding, border-radius, border, max-width/height, overflow, relative */
    text-align: left;
    /* Align text to the left for readability */
    color: #eee;
    /* Light text color */
    font-family: 'DM Sans', Verdana, Arial, sans-serif;
    font-size: 13px;
    /* Base font size */
    line-height: 1.6;
    /* Improve readability */
    max-width: 700px;
    /* Allow slightly wider content */
}

#help-modal-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    text-align: center;
    color: #fff;
    border-bottom: 1px solid #666;
    padding-bottom: 10px;
}

#help-modal-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 15px;
    color: #eee;
    border-bottom: 1px dashed #555;
    padding-bottom: 5px;
}

#help-modal-content p {
    margin-bottom: 15px;
    color: #ccc;
    /* Slightly dimmer text for paragraphs */
}

#help-modal-content ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 15px;
}

#help-modal-content li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-left: 0;
}

/* Remove the default bullet styling */
/* #help-modal-content li::before { ... } */

/* Style the bold part (title + icon) within the list item */
#help-modal-content li>strong {
    /* Target only direct strong children of li */
    flex-shrink: 0;
    margin-right: 8px;
    /* Space between strong and span */
    display: inline-flex;
    /* Use flex to control icon order */
    align-items: baseline;
    /* Align text and icon baseline */
    gap: 4px;
    /* Space between text and icon within strong */
}

/* Style the description span within the list item */
#help-modal-content li>span {
    /* REMOVED flex-grow: 1; */
    display: block;
    /* Make the span block-level */
    text-align: left;
    /* Optional: Add min-width: 0; if flex basis issues arise */
}


/* General strong styling (keep existing) */
#help-modal-content strong {
    font-weight: 700;
    /* Ensure bold is noticeable */
    color: #fff;
    /* Make bold text white */
}

#help-modal-content em {
    font-style: italic;
    color: #ddd;
    /* Slightly lighter italic */
}

#help-modal-content .inline-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    /* vertical-align: -3px; Removed, rely on flex alignment */
    margin: 0 2px;
    filter: brightness(0) invert(1);
}

.modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close-button:hover {
    color: #fff;
}

/* RTL adjustments for Help Modal */
html[lang="ar"] #help-modal-content {
    text-align: right;
}

html[lang="ar"] #help-modal-content ul {
    padding-left: 0;
    padding-right: 0;
    /* Remove default padding */
}

html[lang="ar"] #help-modal-content li {
    padding-left: 0;
    padding-right: 0;
    /* Ensure no padding */
}

/* Adjust flex alignment for RTL (already flex-start) */
/* html[lang="ar"] #help-modal-content li { ... } */

/* Adjust margin and icon order for RTL for the strong tag inside li */
html[lang="ar"] #help-modal-content li>strong {
    margin-right: 0;
    margin-left: 8px;
    flex-direction: row-reverse;
    /* Put icon visually first (left) in RTL */
}

/* Remove RTL rule for ::before as it's commented out */
/* html[lang="ar"] #help-modal-content li::before {
    left: auto;
    right: 0;
} */

html[lang="ar"] .modal-close-button {
    right: auto;
    left: 15px;
}


.persistent-name-label {
    position: relative;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(10, 12, 24, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.94);
    transition: opacity 0.22s ease-out, transform 0.22s ease-out;
    will-change: opacity, transform;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.persistent-name-label.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.persistent-name-label.is-leaving {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
}

#color-legend .legend-section {
    margin: 0;
    padding: 0;
    list-style: none;
}

#color-legend .legend-relations {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#color-legend .legend-relation-entry {

    display: flex;

    align-items: center;

    gap: 8px;

    color: #f0f3ff;

    font-size: 10px;

}


#color-legend .legend-relation-entry svg {

    width: 36px;

    height: 12px;

    flex: 0 0 auto;

}


#color-legend .legend-relation-entry span {
    flex: 1 1 auto;
    line-height: 1.2;
}


#color-legend .legend-note {
    margin-top: 6px;
    font-size: 9px;
    color: #cfd3e8;
    line-height: 1.3;
}

/* Sky View compact legend: smaller, semi-transparent, expand on hover */
#color-legend.sky-compact {
    font-size: 9px;
    padding: 6px 8px;
    opacity: 0.45;
    max-height: 32vh;
    overflow-y: auto;
    transition: opacity 0.25s ease, max-height 0.3s ease;
    transform-origin: bottom right;
}

#color-legend.sky-compact:hover {
    opacity: 0.9;
}

#color-legend.sky-compact h4 {
    font-size: 10px;
    margin: 0 0 3px 0;
}

#color-legend.sky-compact ul {
    font-size: 9px;
}

#color-legend.sky-compact li {
    margin-bottom: 2px;
}

#color-legend.sky-compact .legend-relation-entry {
    gap: 4px;
    font-size: 8px;
}

#color-legend.sky-compact .legend-relation-entry svg {
    width: 28px;
    height: 10px;
}


/* =============================================
   Touch & Mobile Responsive Overrides
   ============================================= */

/* --- Touch-specific: disable hover tooltips (they don't work on touch) --- */
.touch-device #left-menu .menu-button:hover .menu-label,
.touch-device #right-menu .menu-button:hover .menu-label,
.touch-device button#languageSwitcher:hover .menu-label,
.touch-device button#toggleHelpButton:hover .menu-label {
    opacity: 0;
    visibility: hidden;
}

/* On touch devices, labels show via JS-toggled .label-visible class instead */
.touch-device #info-box {
    pointer-events: auto !important;
    /* Allow tapping links */
}

.touch-device #info-box[style*="display: none"] {
    pointer-events: none !important;
}

/* Collapsible Legend */
.touch-device #color-legend.legend-collapsed {
    max-height: 32px;
    overflow: hidden;
    cursor: pointer;
}

.touch-device #color-legend.legend-collapsed h4::after {
    content: ' ▸';
    /* Arrow indicating expandable */
}

.touch-device #color-legend h4 {
    cursor: pointer;
}

.touch-device #color-legend h4::after {
    content: ' ▾';
    /* Arrow indicating collapsible */
}

/* --- Small screens (phones, portrait tablets) --- */
@media (max-width: 768px) {

    /* Larger touch targets */
    .menu-button {
        width: 48px;
        height: 48px;
    }

    .menu-button img.menu-icon {
        width: 28px;
        height: 28px;
    }

    /* Move menus slightly inward */
    #left-menu {
        left: 8px;
        top: 10px;
        gap: 8px;
    }

    #right-menu {
        right: 8px;
        top: 10px;
        gap: 8px;
    }

    /* Compact legend */
    #color-legend {
        font-size: 9px;
        padding: 6px;
        max-width: 160px;
        max-height: 40vh;
        overflow-y: auto;
    }

    #color-legend h4 {
        font-size: 10px;
    }

    /* Bottom buttons */
    button#languageSwitcher {
        left: 8px;
        bottom: 10px;
    }

    button#toggleHelpButton {
        left: 60px;
        bottom: 10px;
    }

    /* Info box adjustments */
    #info-box {
        max-width: 250px;
        font-size: 11px;
        top: auto;
        bottom: 60px;
        left: 8px;
    }

    /* Language menu */
    .language-menu {
        bottom: 55px;
        left: 8px;
        min-width: 120px;
    }

    /* Modal content on mobile */
    .modal-content {
        max-width: 95vw;
        max-height: 85vh;
        padding: 12px;
    }
}

/* --- Extra-small screens (phones) --- */
@media (max-width: 480px) {
    .menu-button {
        width: 44px;
        height: 44px;
    }

    .menu-button img.menu-icon {
        width: 24px;
        height: 24px;
    }

    /* Collapsible legend on very small screens */
    #color-legend {
        max-width: 140px;
        font-size: 8px;
        padding: 4px;
    }

    #info-box {
        max-width: 200px;
        font-size: 10px;
    }

    .offscreen-indicator {
        font-size: 8px;
    }
}

/* iOS safe area handling */
@supports (padding-bottom: env(safe-area-inset-bottom)) {

    button#languageSwitcher,
    button#toggleHelpButton {
        bottom: calc(15px + env(safe-area-inset-bottom));
    }

    #color-legend {
        bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

/* ============================================= */
/* Vista 3 UI Overhaul - Bottom Panel & Ghost */
/* ============================================= */

/* Star Info Panel (Desktop Default: Right Side Panel) */
#star-info-panel {
    position: fixed;
    top: 50%;
    right: -450px;
    /* Start hidden off-screen to the right */
    transform: translateY(-50%);
    width: min(85vw, 380px);
    height: auto;
    max-height: 80vh;
    background: rgba(12, 14, 25, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(170, 189, 230, 0.15);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
    color: #e2e8f0;
    font-family: 'DM Sans', sans-serif;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 12px 0 0 12px;
    padding: 20px;
    box-sizing: border-box;
}

#star-info-panel.visible {
    right: 0;
    /* Slide in from right */
}

/* Mobile responsive (Phones/iPads): Bottom Sheet instead of side panel */
@media (max-width: 768px),
(pointer: coarse) {
    #star-info-panel {
        top: auto;
        bottom: 20px;
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(calc(100% + 40px));
        width: min(90vw, 420px);
        max-height: 50vh;
        border-radius: 12px;
        border-left: 1px solid rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.15);
        transition: transform 0.3s ease-out;
    }

    #star-info-panel.visible {
        transform: translateX(-50%) translateY(0);
        right: auto;
    }
}

#star-info-panel #close-info-panel {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

#star-info-panel #close-info-panel:hover {
    color: white;
}

#star-info-content {
    color: #e0e0e0;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

#star-info-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: white;
}

#star-info-content a {
    color: #6af;
    text-decoration: none;
}

/* History Ghost (Previous Star) */
#star-history-ghost {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 5px 15px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    pointer-events: none;
    /* Let clicks pass through */
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
    white-space: nowrap;
}

#star-history-ghost.visible {
    opacity: 0.7;
}

/* =========================================================
   AVANT-GARDE HUD SYSTEM - SYSTEMIC VARIABLES
   ========================================================= */
:root {
    --hud-bg: rgba(8, 8, 12, 0.65);
    --hud-border: 1px solid rgba(255, 255, 255, 0.08);
    --hud-blur: blur(16px);
    --hud-highlight: rgba(255, 255, 255, 0.15);
    --hud-accent: #6133ff;
    /* Deep electric violet */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --transition-snappy: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   STRUCTURAL CONTAINERS (Menus & Legend)
   ========================================================= */
/* Grouping individual circles into sleek, floating pills for cohesiveness */
#left-menu,
#right-menu {
    background: var(--hud-bg);
    backdrop-filter: var(--hud-blur);
    -webkit-backdrop-filter: var(--hud-blur);
    border: var(--hud-border);
    border-radius: 24px;
    padding: 8px 6px;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#left-menu {
    left: 20px;
    top: 20px;
}

#right-menu {
    right: 20px;
    top: 20px;
}

/* Base refinement for the info and legend boxes */
#color-legend,
#info-box,
#controls-panel {
    background: var(--hud-bg) !important;
    backdrop-filter: var(--hud-blur) !important;
    -webkit-backdrop-filter: var(--hud-blur) !important;
    border: var(--hud-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
}

#info-box {
    bottom: 40px;
    letter-spacing: 0.01em;
}

/* =========================================================
   INTERACTIVE ELEMENTS (Menu Buttons)
   ========================================================= */
.menu-button {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: transform var(--transition-snappy), background-color var(--transition-snappy) !important;
}

/* Create an invisible hit-area larger than the icon for better UX */
.menu-button::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--hud-highlight);
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-snappy);
    z-index: -1;
}

.menu-button:hover::before {
    opacity: 1;
    transform: scale(1);
}

.menu-button:active {
    transform: scale(0.92) !important;
    animation: none !important;
    /* Discard bouncy animation for sophisticated scaling */
}

/* Icon refinement */
.menu-button img.menu-icon {
    opacity: 0.7;
    transition: opacity var(--transition-snappy), transform var(--transition-snappy);
}

.menu-button:hover img.menu-icon {
    opacity: 1;
}

/* =========================================================
   TOOLTIPS (Micro-interactions & Asymmetrical Reveals)
   ========================================================= */
/* Overriding clunky default block tooltips with elegant cinematic reveals */
.menu-button::after,
#view-buttons a:hover::after,
#view-buttons button#toggleCameraView:hover::after,
#calculate-distance:hover::after {
    background: var(--hud-bg) !important;
    backdrop-filter: var(--hud-blur) !important;
    -webkit-backdrop-filter: var(--hud-blur) !important;
    border: var(--hud-border) !important;
    color: var(--text-primary) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;

    /* Animation state */
    opacity: 0 !important;
    transform: translate(-50%, 10px) scale(0.95) !important;
    pointer-events: none;
    transition: opacity var(--transition-smooth), transform var(--transition-smooth) !important;
}

.menu-button:hover::after,
#view-buttons a:hover::after,
#view-buttons button#toggleCameraView:hover::after,
#calculate-distance:hover::after {
    opacity: 1 !important;
    transform: translate(-50%, 0) scale(1) !important;
}

/* Specific position adjustments for side tooltips to prevent edge clipping */
#left-menu .menu-button::after {
    left: calc(100% + 15px) !important;
    top: 50% !important;
    transform: translate(10px, -50%) scale(0.95) !important;
}

#left-menu .menu-button:hover::after {
    transform: translate(0, -50%) scale(1) !important;
}

#right-menu .menu-button::after {
    left: auto !important;
    right: calc(100% + 15px) !important;
    top: 50% !important;
    transform: translate(-10px, -50%) scale(0.95) !important;
}

#right-menu .menu-button:hover::after {
    transform: translate(0, -50%) scale(1) !important;
}

/* =========================================================
   TOUCH DEVICE OVERRIDES FOR AVANT-GARDE HUD
   ========================================================= */
.touch-device .menu-button::after,
.touch-device .menu-button:hover::after,
.touch-device .menu-button:active::after {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* --- Mobile & iPad Minimized Menus --- */
/* Core menu minimization logic for tactile interfaces */
.touch-device #left-menu,
.touch-device #right-menu {
    max-height: 56px;
    /* Show only top element roughly */
    overflow: hidden;
    transition: max-height var(--transition-smooth), background-color var(--transition-smooth);
}

/* Expand on hover/active (touch hold/tap depending on browser behavior, or JS toggle) */
.touch-device #left-menu.expanded,
.touch-device #right-menu.expanded {
    max-height: 500px;
}

/* Apply a visual cue that the menu is collapsed (e.g., lower opacity of background until expanded) */
.touch-device #left-menu:not(.expanded),
.touch-device #right-menu:not(.expanded) {
    background: rgba(8, 8, 12, 0.3);
    border-color: transparent;
}