:root {
    --glass-bg: rgba(11, 15, 25, 0.65);
    --glass-border: rgba(56, 189, 248, 0.2);
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --danger: #ef4444;
    --ground-accent: #ef4444;
    --iss-accent: #a855f7;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Inter', sans-serif;
    color: white;
    -webkit-font-smoothing: antialiased;
    touch-action: none;
    /* Prevents zooming/scrolling on mobile */
}

#webgl-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    box-sizing: border-box;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.4) 100%);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(56, 189, 248, 0.05);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* View Mode Color Accents */
.ground-mode .glass-panel {
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(239, 68, 68, 0.05);
}

.iss-mode .glass-panel {
    border-color: rgba(168, 85, 247, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(168, 85, 247, 0.05);
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 1px;
    background: var(--accent);
}

.glass-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30px;
    height: 1px;
    background: var(--accent);
}

.ground-mode .glass-panel::before,
.ground-mode .glass-panel::after {
    background: var(--ground-accent);
}

.iss-mode .glass-panel::before,
.iss-mode .glass-panel::after {
    background: var(--iss-accent);
}

.data-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
    font-weight: 700;
}

.ground-mode .data-value {
    color: var(--ground-accent);
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.iss-mode .data-value {
    color: var(--iss-accent);
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 12px #22c55e, 0 0 24px #22c55e;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(0.9);
        opacity: 1;
    }
}

/* Loading Screen */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #02040a;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out;
}

.orbit-spinner {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-bottom-color: var(--accent);
    animation: spin 2s linear infinite;
    position: relative;
    margin-bottom: 2rem;
}

.orbit-spinner::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-left-color: #fff;
    animation: spin-reverse 1.5s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes spin-reverse {
    100% {
        transform: rotate(-360deg);
    }
}

/* Reticles */
.orbit-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40vw;
    height: 40vw;
    max-width: 600px;
    max-height: 600px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

.orbit-reticle::before,
.orbit-reticle::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
}

.orbit-reticle::before {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
}

.orbit-reticle::after {
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
}

.btn-toggle {
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

select option {
    background-color: #0f172a;
    color: #38bdf8;
}

/* D-Pad controls */
.dpad-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-weight: bold;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    transition: all 0.1s;
}

.ground-mode .dpad-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.iss-mode .dpad-btn {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
    color: #a855f7;
}

.dpad-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.4);
    border-radius: 3px;
}

/* Tooltips */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* FPS Counter */
#fps-counter {
    position: fixed;
    top: 1rem;
    right: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 50;
    pointer-events: none;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 90;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

/* Keyboard Key Badge */
.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
}

/* Toggle Switch */
.toggle-switch {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.2s ease;
}

.toggle-switch.active::after {
    left: 22px;
}

/* Loading Progress Bar */
.loader-progress {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    overflow: hidden;
    margin-top: 1rem;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #fff);
    width: 0%;
    transition: width 0.3s ease;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

select option {
    background-color: #0f172a;
    color: #38bdf8;
}

/* Planet Info Card */
#planet-card {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 350px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateX(50px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

#planet-card.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.planet-card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.planet-card-field {
    margin-bottom: 0.8rem;
}

.planet-card-label {
    display: block;
    font-size: 9px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.planet-card-value {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
}

.planet-card-info {
    font-size: 12px;
    line-height: 1.6;
    color: #cbd5e1;
    margin-top: 1rem;
}

.btn-close-card {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #94a3b8;
    transition: color 0.2s;
}

.btn-close-card:hover {
    color: #fff;
}
