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

body {
    background: radial-gradient(circle at center, #000022 0%, #000011 100%);
    font-family: 'Inter', 'Segoe UI', 'Arial', sans-serif;
    overflow: hidden;
    color: #ffffff;
    cursor: crosshair;
}

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

.ui-panel {
    position: fixed;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(120, 120, 255, 0.4);
    border-radius: 16px;
    padding: 18px;
    z-index: 10;
    color: #ffffff;
    font-size: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 50, 0.6), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.ui-panel:hover {
    border-color: rgba(150, 150, 255, 0.6);
    box-shadow: 0 12px 40px rgba(0, 0, 80, 0.8), 
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

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

#stability-monitor h3 {
    margin-bottom: 10px;
    color: #9999ff;
    font-size: 17px;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(153, 153, 255, 0.5);
}

#status-text {
    margin-bottom: 14px;
    font-size: 15px;
    color: #ccccff;
    text-shadow: 0 0 8px rgba(204, 204, 255, 0.3);
    animation: textGlow 3s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from { text-shadow: 0 0 8px rgba(204, 204, 255, 0.3); }
    to { text-shadow: 0 0 15px rgba(204, 204, 255, 0.7); }
}

.shader-indicator {
    margin-top: 8px;
    font-size: 12px;
    color: #88ff88;
    display: flex;
    justify-content: space-between;
}

#shader-status {
    font-weight: bold;
    animation: pulse 2s ease-in-out infinite;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(100, 100, 255, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6666ff 0%, #4444cc 50%, #8888ff 100%);
    width: 80%;
    transition: width 0.4s ease;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(102, 102, 255, 0.7),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: energyFlow 2s linear infinite;
}

@keyframes energyFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

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

#controls-toggle {
    background: linear-gradient(135deg, #4444aa 0%, #6666cc 50%, #4444aa 100%);
    border: none;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 600;
    width: 100%;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

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

#controls-toggle:hover {
    background: linear-gradient(135deg, #5555bb 0%, #7777dd 50%, #5555bb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(68, 68, 170, 0.5);
}

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

#controls-content {
    margin-top: 15px;
    opacity: 1;
    max-height: 600px;
    transition: all 0.4s ease;
}

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

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: space-between;
}

.preset-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(120, 120, 255, 0.4);
    background: radial-gradient(circle at 30% 30%, rgba(60, 60, 120, 0.9), rgba(30, 30, 60, 0.9));
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preset-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transition: all 0.3s ease;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.preset-btn:hover {
    background: radial-gradient(circle at 30% 30%, rgba(100, 100, 180, 0.9), rgba(50, 50, 100, 0.9));
    border-color: rgba(180, 180, 255, 0.7);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 20px rgba(102, 102, 255, 0.6);
}

.preset-btn:hover::before {
    width: 100%;
    height: 100%;
}

.preset-btn:active {
    transform: scale(0.95);
}

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

.slider-group label {
    display: block;
    margin-bottom: 8px;
    color: #ddddff;
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.slider-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(100, 100, 255, 0.2));
    outline: none;
    -webkit-appearance: none;
    border: 1px solid rgba(100, 100, 255, 0.3);
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #8888ff, #4444cc);
    cursor: pointer;
    box-shadow: 0 0 12px rgba(102, 102, 255, 0.7),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(102, 102, 255, 1.0);
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #8888ff, #4444cc);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 12px rgba(102, 102, 255, 0.7);
}

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

#instructions h3 {
    margin-bottom: 10px;
    color: #9999ff;
    font-size: 19px;
    font-weight: 600;
    text-shadow: 0 0 12px rgba(153, 153, 255, 0.6);
}

#instructions p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 4px;
}

#effects-status {
    color: #88ff88;
    font-weight: bold;
    animation: pulse 2s ease-in-out infinite;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .ui-panel {
        font-size: 12px;
        padding: 14px;
        backdrop-filter: blur(12px);
    }
    
    #controls-panel {
        min-width: 240px;
    }
    
    #stability-monitor {
        min-width: 180px;
    }
    
    #instructions {
        min-width: 220px;
    }
    
    .preset-btn {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .preset-buttons {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .ui-panel {
        font-size: 11px;
        padding: 12px;
    }
    
    #controls-panel, #stability-monitor, #instructions {
        min-width: auto;
        width: calc(100vw - 40px);
    }
    
    #stability-monitor {
        top: 10px;
        left: 10px;
        right: 10px;
    }
    
    #controls-panel {
        top: 100px;
        left: 10px;
        right: 10px;
    }
    
    #instructions {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
}

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

body:fullscreen .ui-panel {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

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

/* Enhanced animations and effects */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.98); }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 102, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(102, 102, 255, 1.0), 
                    0 0 35px rgba(102, 102, 255, 0.5);
    }
}

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

.progress-fill {
    animation: glow 3s ease-in-out infinite, energyFlow 2s linear infinite;
    background-size: 200% 100%;
}

/* Shader effect indicators */
.shader-active {
    animation: shaderPulse 1.5s ease-in-out infinite;
}

@keyframes shaderPulse {
    0%, 100% { color: #88ff88; }
    50% { color: #aaffaa; text-shadow: 0 0 10px rgba(136, 255, 136, 0.8); }
}

/* Enhanced hover effects */
.ui-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(45deg, 
        rgba(120, 120, 255, 0.3) 0%, 
        rgba(180, 180, 255, 0.1) 50%, 
        rgba(120, 120, 255, 0.3) 100%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.ui-panel:hover::before {
    opacity: 1;
}

/* Loading animation for shader compilation */
.shader-loading {
    position: relative;
    overflow: hidden;
}

.shader-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(102, 102, 255, 0.2), 
        transparent);
    animation: shaderLoad 2s ease-in-out infinite;
}

@keyframes shaderLoad {
    0% { left: -100%; }
    100% { left: 100%; }
}