* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 50%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content h1 {
    font-size: 48px;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.progress-container {
    width: 400px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto 20px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #0077ff);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 119, 255, 0.8);
}

.loading-content p {
    font-size: 24px;
    color: #00d4ff;
}

/* Controls Panel */
.controls-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.dropdown {
    position: relative;
}

.dropbtn {
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.dropbtn:hover {
    background: rgba(40, 40, 60, 0.95);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 4px 25px rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
}

.dropbtn svg {
    width: 20px;
    height: 20px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background: rgba(30, 30, 46, 0.98);
    backdrop-filter: blur(10px);
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1;
    padding: 20px;
    border-radius: 12px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
}

.dropdown.active .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-section {
    margin-bottom: 20px;
}

.dropdown-section:last-of-type {
    margin-bottom: 15px;
}

.dropdown-section h3 {
    color: #00d4ff;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-weight: 600;
}

label {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    color: #e0e0e0;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

label:hover {
    color: #ffffff;
}

label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #00d4ff;
}

label span {
    flex: 1;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.control-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #00d4ff, #0077ff);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 119, 255, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 255, 0.5);
}

.control-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.control-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* Focus Panel */
.focus-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.focus-dropdown {
    position: relative;
}

.focus-btn {
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.focus-btn:hover {
    background: rgba(40, 40, 60, 0.95);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 4px 25px rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
}

.focus-btn svg {
    width: 20px;
    height: 20px;
}

.focus-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: rgba(30, 30, 46, 0.98);
    backdrop-filter: blur(10px);
    min-width: 220px;
    max-width: 280px;
    max-height: calc(100vh - 200px); /* Prevent overlap with bottom UI */
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1;
    padding: 12px;
    border-radius: 12px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
}

/* Custom scrollbar for focus dropdown */
.focus-dropdown-content::-webkit-scrollbar {
    width: 8px;
}

.focus-dropdown-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.focus-dropdown-content::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

.focus-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

.focus-dropdown.active .focus-dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.focus-option {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.focus-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
    color: #ffffff;
    transform: translateX(4px);
}

.focus-option.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 119, 255, 0.3));
    border-color: #00d4ff;
    color: #00d4ff;
    font-weight: 600;
}

.focus-option:last-child {
    margin-bottom: 0;
}

/* Moon styling - smaller and indented, right-aligned with planets */
.focus-option-moon {
    padding: 6px 10px 6px 24px; /* More left padding for indentation */
    font-size: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    margin-bottom: 3px;
    width: 100%; /* Full width to align right edges */
}

.focus-option-moon:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.focus-option-moon.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 119, 255, 0.2));
}

/* Speed Control Panel */
.speed-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Camera Lock Panel */
.lock-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px; /* Tighter spacing */
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px 10px; /* Tighter padding */
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lock-option {
    display: flex;
    align-items: center;
}

.lock-option input[type="radio"] {
    display: none;
}

.lock-option label {
    display: flex;
    align-items: center;
    gap: 6px; /* Tighter gap */
    padding: 6px 10px; /* Tighter padding */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #e0e0e0;
    font-size: 13px; /* Smaller font */
    font-weight: 500;
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.lock-option label:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.3);
    color: #ffffff;
}

.lock-option input[type="radio"]:checked + label {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 119, 255, 0.3));
    border-color: #00d4ff;
    color: #00d4ff;
    font-weight: 600;
}

.lock-option label svg {
    flex-shrink: 0;
    color: currentColor;
}

.speed-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.speed-display svg {
    color: #00d4ff;
}

.speed-display span {
    min-width: 100px;
    text-align: center;
    color: #00d4ff;
}

.speed-btn-up,
.speed-btn-down {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 6px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speed-btn-up:hover,
.speed-btn-down:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.speed-btn-up:active,
.speed-btn-down:active {
    transform: translateY(0px);
}

/* Responsive Design */

/* Tablets and smaller desktops */
@media (max-width: 1024px) {
    .focus-dropdown-content {
        max-height: calc(100vh - 150px);
    }

    .speed-display span {
        min-width: 80px;
        font-size: 14px;
    }
}

/* Mobile landscape and small tablets */
@media (max-width: 768px) {
    .controls-panel {
        top: 8px;
        left: 8px;
    }

    .focus-panel {
        top: 8px;
        right: 8px;
    }

    .speed-panel {
        bottom: 8px;
        right: 8px;
        padding: 6px 10px;
        gap: 6px;
    }

    .lock-panel {
        bottom: 8px;
        left: 8px;
        padding: 6px 8px;
        gap: 3px;
    }

    .lock-option label {
        font-size: 12px;
        padding: 8px 12px; /* Larger touch targets */
        gap: 4px;
    }

    .lock-option label svg {
        width: 16px;
        height: 16px;
    }

    .dropbtn, .focus-btn {
        padding: 12px 16px; /* Larger touch targets */
        font-size: 14px;
    }

    .dropbtn svg, .focus-btn svg {
        width: 18px;
        height: 18px;
    }

    .dropdown-content, .focus-dropdown-content {
        min-width: 220px;
        max-width: calc(100vw - 20px);
        padding: 12px;
    }

    .focus-dropdown-content {
        max-height: calc(100vh - 120px);
    }

    .focus-option {
        padding: 10px 12px; /* Larger touch targets */
        font-size: 13px;
    }

    .focus-option-moon {
        padding: 8px 10px 8px 20px;
        font-size: 11px;
    }

    .speed-display {
        font-size: 14px;
        gap: 6px;
        padding: 0 6px;
    }

    .speed-display svg {
        width: 18px;
        height: 18px;
    }

    .speed-display span {
        min-width: 70px;
        font-size: 13px;
    }

    .speed-btn-up,
    .speed-btn-down {
        padding: 8px; /* Larger touch targets */
        min-width: 36px;
        min-height: 36px;
    }

    .loading-content h1 {
        font-size: 32px;
    }

    .progress-container {
        width: 280px;
    }

    .loading-content p {
        font-size: 18px;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    /* Compact UI for small phones */
    .controls-panel {
        top: 5px;
        left: 5px;
    }

    .focus-panel {
        top: 5px;
        right: 5px;
    }

    .speed-panel {
        bottom: 5px;
        right: 5px;
    }

    .lock-panel {
        bottom: 5px;
        left: 5px;
        gap: 2px;
        padding: 5px 6px;
    }

    .lock-option label {
        font-size: 11px;
        padding: 10px 10px; /* Maintain touch target size */
        gap: 3px;
    }

    .lock-option label span {
        display: none; /* Hide text labels on very small screens */
    }

    .lock-option label svg {
        width: 20px;
        height: 20px;
        margin: 0 auto;
    }

    .speed-panel {
        padding: 5px 8px;
        gap: 4px;
        flex-wrap: nowrap;
    }

    .speed-display {
        gap: 4px;
        padding: 0 4px;
    }

    .speed-display svg {
        width: 16px;
        height: 16px;
    }

    .speed-display span {
        min-width: 50px;
        font-size: 12px;
    }

    .speed-btn-up,
    .speed-btn-down {
        padding: 10px; /* Keep touch targets large */
        min-width: 40px;
        min-height: 40px;
    }

    .dropbtn, .focus-btn {
        padding: 14px 12px; /* Larger touch targets */
        font-size: 13px;
        gap: 6px;
    }

    .dropdown-content, .focus-dropdown-content {
        min-width: 200px;
        max-width: calc(100vw - 15px);
        padding: 10px;
    }

    .focus-dropdown-content {
        max-height: calc(100vh - 80px);
    }

    .focus-option {
        padding: 12px 10px; /* Large touch targets */
        font-size: 12px;
    }

    .focus-option-moon {
        padding: 10px 8px 10px 18px;
        font-size: 10px;
    }

    .dropdown-section h3 {
        font-size: 11px;
    }

    label {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .control-btn {
        padding: 12px 14px; /* Larger touch targets */
        font-size: 13px;
    }

    .loading-content h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .progress-container {
        width: calc(100vw - 40px);
        max-width: 300px;
    }

    .loading-content p {
        font-size: 16px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .speed-display span {
        font-size: 11px;
        min-width: 45px;
    }

    .focus-dropdown-content,
    .dropdown-content {
        font-size: 11px;
    }

    .lock-option label {
        min-width: 44px; /* Ensure minimum touch target */
        min-height: 44px;
        justify-content: center;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .focus-dropdown-content {
        max-height: calc(100vh - 60px);
    }

    .lock-panel {
        flex-direction: row;
        gap: 4px;
    }

    .lock-option label {
        padding: 6px 8px;
    }

    .speed-panel,
    .focus-panel {
        bottom: 5px;
    }
}