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

body {
    background: #000011;
    font-family: 'Inter', 'Arial', sans-serif;
    overflow: hidden;
    color: #ffffff;
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

.ui-panel {
    position: fixed;
    background: rgba(20, 20, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 100, 255, 0.3);
    border-radius: 12px;
    padding: 16px;
    z-index: 10;
    color: #ffffff;
    font-size: 14px;
}

#stability-monitor {
    top: 20px;
    left: 20px;
    min-width: 200px;
}

#stability-monitor h3 {
    margin-bottom: 8px;
    color: #8888ff;
    font-size: 16px;
    font-weight: 600;
}

#status-text {
    margin-bottom: 12px;
    font-size: 14px;
    color: #ccccff;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6666ff, #4444cc);
    width: 50%;
    transition: width 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(102, 102, 255, 0.5);
}

#controls-panel {
    top: 20px;
    right: 20px;
    min-width: 250px;
}

#controls-toggle {
    background: linear-gradient(135deg, #4444aa, #6666cc);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
}

#controls-toggle:hover {
    background: linear-gradient(135deg, #5555bb, #7777dd);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(68, 68, 170, 0.4);
}

#controls-content {
    margin-top: 12px;
    opacity: 1;
    max-height: 500px;
    transition: all 0.3s ease;
}

#controls-content.collapsed {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

.preset-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.preset-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(100, 100, 255, 0.3);
    background: rgba(40, 40, 80, 0.8);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-btn:hover {
    background: rgba(80, 80, 160, 0.8);
    border-color: rgba(150, 150, 255, 0.6);
    transform: scale(1.05);
}

.slider-group {
    margin-bottom: 16px;
}

.slider-group label {
    display: block;
    margin-bottom: 6px;
    color: #ccccff;
    font-size: 13px;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6666ff, #4444cc);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(102, 102, 255, 0.5);
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6666ff, #4444cc);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(102, 102, 255, 0.5);
}

#instructions {
    bottom: 20px;
    left: 20px;
    min-width: 250px;
}

#instructions h3 {
    margin-bottom: 8px;
    color: #8888ff;
    font-size: 18px;
    font-weight: 600;
}

#instructions p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .ui-panel {
        font-size: 12px;
        padding: 12px;
    }
    
    #controls-panel {
        min-width: 200px;
    }
    
    #stability-monitor {
        min-width: 150px;
    }
    
    .preset-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* Fullscreen styles */
body:fullscreen {
    cursor: none;
}

body:fullscreen .ui-panel {
    opacity: 0.7;
}

body:fullscreen .ui-panel:hover {
    opacity: 1;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.ui-panel {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glow effects */
.progress-fill {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(102, 102, 255, 0.5);
    }
    to {
        box-shadow: 0 0 15px rgba(102, 102, 255, 0.8);
    }
}

#controls-toggle {
    position: relative;
    overflow: hidden;
}

#controls-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#controls-toggle:hover::before {
    left: 100%;
}