/* Global Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #020208;
    font-family: 'Rajdhani', sans-serif;
    color: #e2e8f0;
}

/* Deep Space Nebula Background Animation */
.space-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.nebula-1 {
    position: absolute;
    width: 150%;
    height: 150%;
    top: -25%;
    left: -25%;
    background: radial-gradient(circle at 30% 40%, rgba(88, 28, 135, 0.15) 0%, transparent 60%),
                radial-gradient(circle at 70% 60%, rgba(13, 148, 136, 0.1) 0%, transparent 50%);
    filter: blur(40px);
    animation: nebulaMove1 80s ease-in-out infinite alternate;
}

.nebula-2 {
    position: absolute;
    width: 160%;
    height: 160%;
    top: -30%;
    left: -30%;
    background: radial-gradient(circle at 80% 20%, rgba(124, 58, 237, 0.12) 0%, transparent 65%),
                radial-gradient(circle at 20% 80%, rgba(219, 39, 119, 0.08) 0%, transparent 55%);
    filter: blur(50px);
    animation: nebulaMove2 110s ease-in-out infinite alternate;
}

.dust {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 0),
        radial-gradient(rgba(255, 255, 255, 0.1) 2px, transparent 0);
    background-size: 550px 550px, 350px 350px;
    background-position: 0 0, 40px 60px;
    opacity: 0.25;
    animation: dustScroll 200s linear infinite;
}

@keyframes nebulaMove1 {
    0% { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(10deg) scale(1.1); }
}

@keyframes nebulaMove2 {
    0% { transform: rotate(0deg) scale(1.1); }
    100% { transform: rotate(-15deg) scale(0.95); }
}

@keyframes dustScroll {
    0% { background-position: 0 0, 40px 60px; }
    100% { background-position: 550px 1100px, 1090px 760px; }
}

/* Space Canvas */
#space-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

/* Glassmorphism Panel styles */
.glass-panel {
    background: rgba(10, 12, 28, 0.65);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(0, 242, 254, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5),
                inset 0 0 12px rgba(0, 242, 254, 0.05);
    border-radius: 4px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
    border-color: rgba(0, 242, 254, 0.3);
    box-shadow: 0 12px 40px 0 rgba(0, 242, 254, 0.1),
                inset 0 0 16px rgba(0, 242, 254, 0.1);
}

/* HUD Overlay Container */
#hud-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none; /* Let clicks pass to canvas when clicking outside HUD panels */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

#hud-container * {
    pointer-events: auto; /* Enable clicks for all UI items */
}

/* HUD Header Style */
.hud-header {
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    margin-bottom: auto;
}

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

.header-logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #00f2fe;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #00f2fe;
    box-shadow: 0 0 10px #00f2fe;
    animation: beaconPulse 2s infinite;
}

@keyframes beaconPulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 15px rgba(0, 242, 254, 0.8); }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.current-status, .current-coordinates {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-size: 0.85rem;
    color: #64748b;
    letter-spacing: 1px;
    font-weight: 600;
}

.status-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    color: #e2e8f0;
    text-shadow: 0 0 8px rgba(226, 232, 240, 0.3);
    min-width: 90px;
}

#speed-indicator {
    color: #00f2fe;
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

/* Side Panels */
.hud-panel {
    position: absolute;
    width: 320px;
    max-height: calc(100% - 200px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
}

.left-panel {
    left: 20px;
    top: 95px;
}

.right-panel {
    right: 20px;
    top: 95px;
}

.right-panel.hidden {
    opacity: 0;
    transform: translateX(40px);
    pointer-events: none;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 242, 254, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #00f2fe;
    letter-spacing: 1.5px;
}

.icon-button {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.icon-button:hover {
    color: #00f2fe;
}

.panel-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.panel-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 242, 254, 0.05);
}

/* Forms, sliders, toggles */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    flex: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00f2fe;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.8);
    transition: transform 0.1s, background-color 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ffffff;
}

.slider-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: #00f2fe;
    min-width: 45px;
    text-align: right;
}

.toggle-group {
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.toggle-item span {
    font-size: 0.9rem;
    color: #e2e8f0;
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: #64748b;
    transition: .3s;
}

.switch input:checked + .slider {
    background-color: rgba(0, 242, 254, 0.2);
    border-color: rgba(0, 242, 254, 0.4);
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #00f2fe;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.8);
}

.switch .slider.round {
    border-radius: 20px;
}

.switch .slider.round:before {
    border-radius: 50%;
}

/* Buttons */
.hud-button {
    width: 100%;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    text-transform: uppercase;
}

.hud-button.primary {
    background: rgba(0, 242, 254, 0.15);
    border-color: rgba(0, 242, 254, 0.4);
    color: #00f2fe;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
}

.hud-button.primary:hover {
    background: rgba(0, 242, 254, 0.3);
    border-color: #00f2fe;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}

.hud-button.secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.hud-button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.hud-button.large {
    padding: 16px;
    font-size: 0.95rem;
    border-radius: 6px;
    letter-spacing: 2px;
}

/* Constellation Info details styling */
.constellation-title-container {
    margin-bottom: 16px;
}

#constellation-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

#constellation-latin {
    font-size: 0.9rem;
    color: #00f2fe;
    font-style: italic;
    letter-spacing: 0.5px;
}

.hud-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, rgba(0, 242, 254, 0.3), rgba(0, 242, 254, 0));
    margin-bottom: 16px;
}

.constellation-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.detail-label {
    color: #64748b;
}

.detail-value {
    color: #f1f5f9;
    font-weight: 600;
}

.constellation-description {
    margin-top: 18px;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: 4px;
}

/* Footer Section */
.hud-footer {
    width: 100%;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    height: 60px;
    z-index: 10;
}

.hud-instruction {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #94a3b8;
}

.icon-mouse {
    font-size: 1.1rem;
}

.active-signals {
    display: flex;
    gap: 12px;
}

.signal-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.signal-tag.green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}

.signal-tag.blue {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
    border-color: rgba(14, 165, 233, 0.3);
    animation: glowText 2s infinite alternate;
}

.signal-tag.red {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

@keyframes glowText {
    0% { text-shadow: 0 0 2px rgba(14, 165, 233, 0.2); }
    100% { text-shadow: 0 0 10px rgba(14, 165, 233, 0.8); }
}

/* Target Reticle in Center of the Screen */
#target-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    pointer-events: none;
    z-index: 5;
    opacity: 0.4;
    transition: opacity 0.5s, transform 0.1s;
}

#target-reticle.active {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
}

.reticle-circle-outer {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px dashed #00f2fe;
    border-radius: 50%;
    animation: rotateCW 20s linear infinite;
}

.reticle-circle-inner {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70%;
    height: 70%;
    border: 1px double rgba(0, 242, 254, 0.6);
    border-radius: 50%;
    animation: rotateCCW 15s linear infinite;
}

.reticle-line {
    position: absolute;
    background-color: #00f2fe;
    opacity: 0.7;
}

.reticle-line.horiz {
    top: 50%;
    left: -10px;
    width: 120px;
    height: 1px;
}

.reticle-line.vert {
    left: 50%;
    top: -10px;
    width: 1px;
    height: 120px;
}

#reticle-target-name {
    position: absolute;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #00f2fe;
    letter-spacing: 2px;
    white-space: nowrap;
    text-shadow: 0 0 5px rgba(0, 242, 254, 0.5);
}

@keyframes rotateCW {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes rotateCCW {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

/* Intro Screen Overlay styling */
.intro-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(2, 2, 8, 0.45); /* More transparent */
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px); /* Reduced blur so stars are visible */
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.8s ease-in-out;
}

.intro-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.intro-content {
    width: 500px;
    max-width: 90%;
    padding: 40px;
    text-align: center;
    border-color: rgba(0, 242, 254, 0.25);
    animation: introEntrance 1s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes introEntrance {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.intro-content h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #ffffff;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}

.intro-content .subtitle {
    font-size: 1.05rem;
    color: #00f2fe;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 24px;
}

.intro-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #94a3b8;
    margin-bottom: 30px;
}

.intro-hints {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 35px;
    text-align: left;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 18px;
    border-radius: 4px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.hint-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Custom Scrollbar for side panels */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 254, 0.2);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 242, 254, 0.4);
}

/* Responsiveness adjustments */
@media (max-width: 768px) {
    #hud-container {
        padding: 10px;
    }
    
    .hud-header {
        height: auto;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }
    
    .hud-panel {
        width: calc(100% - 20px);
        max-height: 35%;
        left: 10px !important;
        right: 10px !important;
    }
    
    .left-panel {
        top: auto;
        bottom: 80px;
    }
    
    .right-panel {
        top: 120px;
    }
    
    .hud-footer {
        display: none; /* Hide instruction footer on small mobiles to save space */
    }
    
    #target-reticle {
        width: 80px;
        height: 80px;
    }
    
    .reticle-line.horiz { width: 100px; }
    .reticle-line.vert { height: 100px; }
}
