/* === SOLAR SYSTEM BACKGROUND === */
#solar-system-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* z-index and pointer-events managed by JS */
    background: radial-gradient(circle at center, #0b0d15 0%, #000000 100%);
}

/* Ensure stars container allows visibility of underlying layers if needed */
.stars-container {
    z-index: 1;
    /* On top of 3D background */
    pointer-events: none;
    /* Let clicks pass through */
    transition: opacity 0.5s ease;
}

/* Toggle Button Style (if not inline) */
.bg-toggle-button {
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 5px rgba(0, 240, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
    }

    100% {
        box-shadow: 0 0 5px rgba(0, 240, 255, 0.3);
    }
}

/* === BACKGROUND HUD CONTAINER === */
.bg-hud-container {
    position: fixed !important;
    bottom: 20px !important;
    top: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(6, 9, 15, 0.78);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    /* Ensure it stays at bottom when scrolling */
    will-change: transform;
}

/* Hide bg-hud-container in ALL fullscreen modes (mobile portrait, mobile landscape, desktop) */
/* This rule applies globally, regardless of orientation */
body.mobile-fullscreen-active .bg-hud-container,
html.mobile-fullscreen-active .bg-hud-container,
body:has(.mobile-fullscreen-active) .bg-hud-container,
html:has(.mobile-fullscreen-active) .bg-hud-container,
.dynamic-showcase.mobile-fullscreen ~ .bg-hud-container,
/* Desktop fullscreen */
.dynamic-showcase:fullscreen ~ .bg-hud-container,
body:has(.dynamic-showcase:fullscreen) .bg-hud-container,
html:has(.dynamic-showcase:fullscreen) .bg-hud-container,
.dynamic-showcase:fullscreen .bg-hud-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.bg-hud-segment {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: transparent;
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    color: var(--font-color, #e1e1e1);
    font-size: 0.5rem;
    font-family: var(--font-body, 'Exo 2', sans-serif);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    height: 20px;
}

.bg-hud-segment:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: rgba(0, 240, 255, 0.5);
    transform: translateY(-1px);
}

.bg-hud-segment.active {
    background: rgba(0, 240, 255, 0.2);
    border-color: rgba(0, 240, 255, 0.6);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.bg-hud-segment span {
    font-size: 0.5rem;
    line-height: 1;
}

.bg-hud-segment.zoom-btn {
    min-width: 20px;
    width: 20px;
    height: 20px;
    justify-content: center;
    padding: 0;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
}

/* Mobile Portrait Support */
@media (max-width: 768px) and (orientation: portrait) {
    .bg-hud-container {
        bottom: 10px !important;
        top: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 4px 6px;
        gap: 4px;
        flex-wrap: nowrap;
        max-width: calc(100vw - 20px);
        overflow-x: auto;
        overflow-y: hidden;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1000 !important;
        position: fixed !important;
        pointer-events: auto !important;
        border-radius: 10px;
        /* Ensure it stays at bottom when scrolling */
        will-change: transform;
    }
    
    /* Hide HUD in ALL fullscreen modes - mobile portrait, mobile landscape, desktop fullscreen */
    body.mobile-fullscreen-active .bg-hud-container,
    html.mobile-fullscreen-active .bg-hud-container,
    .dynamic-showcase.mobile-fullscreen ~ .bg-hud-container,
    body:has(.mobile-fullscreen-active) .bg-hud-container,
    /* Desktop fullscreen */
    .dynamic-showcase:fullscreen ~ .bg-hud-container,
    body:has(.dynamic-showcase:fullscreen) .bg-hud-container,
    html:has(.dynamic-showcase:fullscreen) .bg-hud-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .bg-hud-segment {
        padding: 2px 4px;
        font-size: 0.45rem;
        height: 18px;
        min-height: 18px;
        min-width: auto;
    }

    .bg-hud-segment span {
        font-size: 0.45rem;
    }

    .bg-hud-segment.zoom-btn {
        min-width: 18px;
        width: 18px;
        height: 18px;
        padding: 0;
        font-size: 0.65rem;
        border-radius: 50%;
    }
    
    /* Hide HUD in ALL fullscreen modes - mobile portrait, mobile landscape, desktop fullscreen */
    body.mobile-fullscreen-active .bg-hud-container,
    html.mobile-fullscreen-active .bg-hud-container,
    .dynamic-showcase.mobile-fullscreen ~ .bg-hud-container,
    body:has(.mobile-fullscreen-active) .bg-hud-container,
    /* Desktop fullscreen */
    .dynamic-showcase:fullscreen ~ .bg-hud-container,
    body:has(.dynamic-showcase:fullscreen) .bg-hud-container,
    html:has(.dynamic-showcase:fullscreen) .bg-hud-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* Mobile Landscape Support */
@media (max-width: 768px) and (orientation: landscape) {
    .bg-hud-container {
        bottom: 10px;
        top: auto;
        padding: 4px 8px;
        gap: 6px;
    }

    .bg-hud-segment {
        padding: 3px 5px;
        font-size: 0.48rem;
        height: 20px;
    }

    .bg-hud-segment.zoom-btn {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }

    /* Hide HUD in mobile landscape fullscreen */
    body.mobile-fullscreen-active .bg-hud-container,
    html.mobile-fullscreen-active .bg-hud-container,
    .dynamic-showcase.mobile-fullscreen ~ .bg-hud-container,
    body:has(.mobile-fullscreen-active) .bg-hud-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}