* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#solar-system-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#controls-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 280px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 16px;
    backdrop-filter: blur(15px);
    z-index: 1000;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform-origin: top right;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#controls-panel.collapsed {
    width: 50px;
    height: 50px;
    padding: 0;
    overflow: hidden;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

#controls-panel.collapsed:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.panel-content {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.25s ease 0.1s, transform 0.25s ease 0.1s;
}

#controls-panel.collapsed .panel-content {
    display: none !important;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    visibility: hidden;
}

#controls-panel.collapsed .panel-header {
    margin: 0;
    padding: 0;
    border: none;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#controls-panel.collapsed .panel-header h2 {
    display: none !important;
}

#controls-panel.collapsed .header-controls {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#controls-panel.collapsed .header-controls #pause-btn {
    display: none !important;
}

#controls-panel.collapsed .collapse-btn {
    background: none !important;
    border: none;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    min-width: auto;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1001;
    position: relative;
    cursor: pointer;
}

#controls-panel.collapsed .collapse-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #444;
    position: relative;
}

.header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collapse-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.panel-header h2 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

#pause-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff5252);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

#pause-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

#pause-btn.paused {
    background: linear-gradient(45deg, #4caf50, #45a049);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.master-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.master-speed-control {
    flex: 1;
    min-width: 120px;
}

.master-speed-control label {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 4px;
    display: block;
}

.master-speed-control input {
    width: 100%;
}

.planet-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.planet-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.planet-control:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.planet-control label {
    font-weight: bold;
    color: #fff;
    font-size: 14px;
}

.planet-control input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.planet-control input[type="range"]:hover {
    opacity: 1;
}

.planet-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4caf50;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.planet-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #45a049;
}

.planet-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4caf50;
    cursor: pointer;
    border: none;
}

.speed-value {
    font-size: 12px;
    color: #ccc;
    text-align: right;
}

.camera-controls {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #444;
}

.camera-controls h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.camera-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.camera-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 60px;
}

.camera-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.camera-btn.active {
    background: linear-gradient(45deg, #4caf50, #45a049);
    border-color: #4caf50;
}

#stop-follow-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff5252);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

#stop-follow-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.advanced-controls {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #444;
}

.advanced-controls h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.feature-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

#scale-toggle-btn, #tour-btn, #screenshot-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 70px;
}

#scale-toggle-btn:hover, #tour-btn:hover, #screenshot-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

#tour-btn {
    background: linear-gradient(45deg, #f093fb, #f5576c);
}

#tour-btn:hover {
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.4);
}

#screenshot-btn {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
}

#screenshot-btn:hover {
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.4);
}

.sound-controls {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sound-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #ccc;
    cursor: pointer;
}

.sound-controls input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #4caf50;
}

#sound-status {
    font-size: 10px;
    color: #aaa;
}

#test-sound-btn {
    background: linear-gradient(45deg, #ff9500, #ff5722);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#test-sound-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.4);
}

.instructions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #444;
    font-size: 10px;
    color: #999;
    text-align: center;
}

.instructions p {
    margin: 2px 0;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #fff;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid #4caf50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Planet-specific colors for controls */
.planet-control:nth-child(1) input[type="range"]::-webkit-slider-thumb { background: #8c7853; }
.planet-control:nth-child(2) input[type="range"]::-webkit-slider-thumb { background: #ffc649; }
.planet-control:nth-child(3) input[type="range"]::-webkit-slider-thumb { background: #6b93d6; }
.planet-control:nth-child(4) input[type="range"]::-webkit-slider-thumb { background: #c1440e; }
.planet-control:nth-child(5) input[type="range"]::-webkit-slider-thumb { background: #d8ca9d; }
.planet-control:nth-child(6) input[type="range"]::-webkit-slider-thumb { background: #fad5a5; }
.planet-control:nth-child(7) input[type="range"]::-webkit-slider-thumb { background: #4fd0e4; }
.planet-control:nth-child(8) input[type="range"]::-webkit-slider-thumb { background: #4b70dd; }

/* Planet Info Display */
.planet-info {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 16px;
    backdrop-filter: blur(15px);
    z-index: 999;
    max-width: 250px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.planet-info.visible {
    opacity: 1;
    pointer-events: auto;
}

.planet-info h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #fff;
}

.planet-info p {
    margin: 4px 0;
    font-size: 12px;
    color: #ccc;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #controls-panel {
        width: 260px;
        top: 10px;
        right: 10px;
        padding: 12px;
        font-size: 14px;
    }
    
    .panel-header h2 {
        font-size: 14px;
    }
    
    #pause-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .planet-control {
        padding: 6px;
        gap: 3px;
    }
    
    .planet-control label {
        font-size: 11px;
    }
    
    .speed-value {
        font-size: 10px;
    }
    
    .instructions {
        font-size: 9px;
    }
    
    .planet-info {
        max-width: 200px;
        padding: 12px;
        left: 10px;
    }
    
    .planet-info h3 {
        font-size: 14px;
    }
    
    .planet-info p {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    #controls-panel {
        width: calc(100% - 20px);
        top: 10px;
        right: 10px;
        left: 10px;
        max-height: 50vh;
    }
    
    #controls-panel.collapsed {
        width: 50px !important;
        height: 50px !important;
        left: auto !important;
        right: 10px !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }
    
    .planet-controls {
        gap: 8px;
    }
    
    .planet-control {
        padding: 4px;
    }
    
    .master-controls {
        gap: 4px;
    }
    
    .loading-content h1 {
        font-size: 18px;
    }
    
    .planet-info {
        position: fixed;
        bottom: 20px;
        left: 10px;
        right: 10px;
        max-width: none;
        top: auto;
    }
}

@media (max-width: 360px) {
    #controls-panel {
        padding: 8px;
        max-height: 45vh;
    }
    
    .panel-header {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }
    
    .planet-control {
        padding: 2px;
        gap: 2px;
    }
    
    .planet-control label {
        font-size: 10px;
    }
    
    .speed-value {
        font-size: 9px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .planet-control input[type="range"]::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }
    
    .planet-control input[type="range"] {
        height: 8px;
    }
    
    #pause-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .collapse-btn {
        padding: 8px;
        font-size: 20px;
    }
}

/* Scrollbar styling for controls panel */
#controls-panel::-webkit-scrollbar {
    width: 6px;
}

#controls-panel::-webkit-scrollbar-track {
    background: #333;
    border-radius: 3px;
}

#controls-panel::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}

#controls-panel::-webkit-scrollbar-thumb:hover {
    background: #888;
}
