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

body {
    font-family: 'Arial', sans-serif;
    background: #000510;
    overflow: hidden;
    color: white;
    cursor: default;
}

#scene-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Enhanced Instruction Panel */
.instruction-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 5, 16, 0.9);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(100, 181, 246, 0.3);
    max-width: 320px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 5, 16, 0.8);
}

.instruction-panel h3 {
    margin-bottom: 12px;
    color: #64b5f6;
    font-size: 18px;
    font-weight: bold;
}

.instruction-panel p {
    margin-bottom: 10px;
    font-size: 14px;
    opacity: 0.95;
    line-height: 1.5;
}

.instruction-panel p strong {
    color: #ffffff;
    font-weight: bold;
}

.click-status {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(100, 181, 246, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    border-left: 3px solid #64b5f6;
    transition: all 0.3s ease;
}

.click-status.success {
    background: rgba(76, 175, 80, 0.2);
    border-left-color: #4caf50;
    color: #4caf50;
}

.click-status.error {
    background: rgba(244, 67, 54, 0.2);
    border-left-color: #f44336;
    color: #f44336;
}

.debug-info {
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.debug-info div {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Enhanced Control Panel */
.control-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 5, 16, 0.9);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(100, 181, 246, 0.3);
    z-index: 100;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 5, 16, 0.8);
}

.theme-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.theme-swatch {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.theme-swatch:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 6px 30px rgba(255, 255, 255, 0.4);
}

.theme-swatch.active {
    border-color: #ffffff;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
}

.theme-swatch.cosmic {
    background: linear-gradient(45deg, #4c1d95, #ff00ff, #bb44ff);
}

.theme-swatch.solar {
    background: linear-gradient(45deg, #ea580c, #ffff00, #ff8800);
}

.theme-swatch.matrix {
    background: linear-gradient(45deg, #166534, #00ff00, #44ff44);
}

.theme-swatch.rainbow {
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #8b00ff);
    animation: rainbow-rotate 3s linear infinite;
}

@keyframes rainbow-rotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.density-control,
.effects-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.density-control label,
.effects-control label {
    font-size: 14px;
    color: #64b5f6;
    font-weight: bold;
}

.density-control input[type="range"],
.effects-control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.density-control input[type="range"]::-webkit-slider-thumb,
.effects-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #64b5f6, #42a5f5);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(100, 181, 246, 0.5);
    transition: all 0.3s ease;
}

.density-control input[type="range"]::-webkit-slider-thumb:hover,
.effects-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.7);
}

.density-control input[type="range"]::-moz-range-thumb,
.effects-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #64b5f6, #42a5f5);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(100, 181, 246, 0.5);
}

#densityValue,
#bloomValue {
    text-align: center;
    font-size: 12px;
    color: #ffffff;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

/* Enhanced Bottom Controls */
.bottom-controls {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(0, 5, 16, 0.9);
    padding: 18px 30px;
    border-radius: 50px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(100, 181, 246, 0.3);
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 5, 16, 0.8);
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    background: linear-gradient(45deg, rgba(100, 181, 246, 0.2), rgba(100, 181, 246, 0.1));
    border: 1px solid rgba(100, 181, 246, 0.4);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
    white-space: nowrap;
}

.control-btn:hover {
    background: linear-gradient(45deg, rgba(100, 181, 246, 0.4), rgba(100, 181, 246, 0.2));
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(100, 181, 246, 0.4);
    border-color: rgba(100, 181, 246, 0.6);
}

.control-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.control-select {
    background: linear-gradient(45deg, rgba(0, 5, 16, 0.95), rgba(0, 5, 16, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.control-select:hover {
    border-color: rgba(100, 181, 246, 0.7);
    background: linear-gradient(45deg, rgba(100, 181, 246, 0.1), rgba(0, 5, 16, 0.9));
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.2);
}

.control-select:focus {
    border-color: rgba(100, 181, 246, 1);
    box-shadow: 0 0 20px rgba(100, 181, 246, 0.5);
}

.control-select option {
    background: #000510;
    color: white;
    padding: 10px;
}

/* Click Ripple Effects */
#rippleContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.click-ripple {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(100, 181, 246, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple-expand 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-expand {
    0% {
        width: 10px;
        height: 10px;
        opacity: 1;
        border-width: 3px;
    }
    50% {
        width: 60px;
        height: 60px;
        opacity: 0.7;
        border-width: 2px;
    }
    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
        border-width: 1px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .instruction-panel {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        padding: 18px;
    }
    
    .control-panel {
        top: auto;
        bottom: 120px;
        right: 10px;
        left: 10px;
        padding: 20px;
    }
    
    .bottom-controls {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px 20px;
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        justify-content: center;
        border-radius: 20px;
    }
    
    .control-btn, .control-select {
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 20px;
    }
    
    .theme-swatch {
        width: 40px;
        height: 40px;
    }
    
    .instruction-panel h3 {
        font-size: 16px;
    }
    
    .instruction-panel p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .instruction-panel {
        padding: 15px;
    }
    
    .instruction-panel h3 {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .instruction-panel p {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .theme-selector {
        gap: 8px;
    }
    
    .theme-swatch {
        width: 35px;
        height: 35px;
        border-radius: 8px;
    }
    
    .control-btn, .control-select {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .bottom-controls {
        gap: 8px;
        padding: 12px 15px;
    }
    
    .debug-info {
        flex-direction: column;
        gap: 8px;
    }
}

/* Enhanced Loading and Transition Effects */
.control-btn, .control-select, .theme-swatch {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Glow Effects */
.instruction-panel, .control-panel, .bottom-controls {
    box-shadow: 0 8px 32px rgba(0, 5, 16, 0.8);
}

.instruction-panel:hover, .control-panel:hover {
    box-shadow: 0 12px 40px rgba(100, 181, 246, 0.1);
    border-color: rgba(100, 181, 246, 0.4);
}

/* Enhanced Scrollbar Styling */
.control-select::-webkit-scrollbar {
    width: 8px;
}

.control-select::-webkit-scrollbar-track {
    background: rgba(0, 5, 16, 0.8);
    border-radius: 4px;
}

.control-select::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, rgba(100, 181, 246, 0.5), rgba(100, 181, 246, 0.8));
    border-radius: 4px;
}

.control-select::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, rgba(100, 181, 246, 0.7), rgba(100, 181, 246, 1));
}

/* Fullscreen Enhancements */
body:fullscreen .instruction-panel,
body:-webkit-full-screen .instruction-panel,
body:-moz-full-screen .instruction-panel {
    background: rgba(0, 5, 16, 0.95);
}

body:fullscreen .control-panel,
body:-webkit-full-screen .control-panel,
body:-moz-full-screen .control-panel {
    background: rgba(0, 5, 16, 0.95);
}

body:fullscreen .bottom-controls,
body:-webkit-full-screen .bottom-controls,
body:-moz-full-screen .bottom-controls {
    background: rgba(0, 5, 16, 0.95);
}

/* Accessibility Enhancements */
.control-btn:focus,
.control-select:focus,
.theme-swatch:focus {
    outline: 2px solid rgba(100, 181, 246, 0.8);
    outline-offset: 2px;
}

/* Performance Optimizations */
.theme-swatch,
.control-btn,
.control-select {
    will-change: transform;
}

/* Animation Optimizations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}