:root {
    --theme-primary: #4B0082;
    --theme-accent: #9B7ED9;
    --bg-dark: #1a0a2e;
    --bg-gradient: linear-gradient(135deg, #0d0520 0%, #1a0a2e 30%, #2d1654 70%, #1a0a2e 100%);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    overflow: hidden;
    color: white;
    min-height: 100vh;
    min-height: 100dvh;
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#scene-container:active {
    cursor: grabbing;
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.control-btn {
    background: rgba(75, 0, 130, 0.7);
    border: 1px solid var(--theme-accent);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(107, 63, 160, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(155, 126, 217, 0.4);
}

#color-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(75, 0, 130, 0.7);
    border: 1px solid var(--theme-accent);
    padding: 10px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

#console-name {
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 0 10px var(--theme-accent);
}

#instructions {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0.7;
    font-size: 14px;
    pointer-events: none;
}

#instructions p {
    margin: 4px 0;
}

.mobile-hint {
    display: none;
}

@media (max-width: 768px) {
    .mobile-hint {
        display: block;
    }
    
    #instructions p:first-child {
        display: none;
    }
}

#speed-control {
    position: absolute;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: auto;
}

#speed-control label {
    font-size: 12px;
    opacity: 0.8;
}

#speed-slider {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(75, 0, 130, 0.7);
    border-radius: 3px;
    outline: none;
}

#speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--theme-accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--theme-accent);
}

#speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--theme-accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--theme-accent);
}

#menu-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    transition: all 0.3s ease;
}

#menu-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.9);
}

.menu-content {
    background: rgba(75, 0, 130, 0.9);
    border: 2px solid var(--theme-accent);
    border-radius: 16px;
    padding: 40px 60px;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 0 40px rgba(155, 126, 217, 0.4);
    position: relative;
    min-width: 300px;
}

.menu-content h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 0 20px var(--theme-accent);
}

.menu-content p {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 300;
}

.menu-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.menu-close:hover {
    opacity: 1;
}

#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    background: linear-gradient(transparent, rgba(10, 5, 20, 0.8));
    z-index: 10;
    font-size: 12px;
}

#footer a {
    color: var(--theme-accent);
    text-decoration: none;
    transition: color 0.2s;
}

#footer a:hover {
    color: white;
    text-shadow: 0 0 10px var(--theme-accent);
}

.disclaimer {
    opacity: 0.5;
    font-size: 10px;
}

@media (max-width: 600px) {
    #top-controls {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    #color-indicator {
        top: 10px;
        left: 10px;
        padding: 8px 14px;
    }
    
    #speed-control {
        bottom: 70px;
        right: 10px;
    }
    
    #speed-slider {
        width: 80px;
    }
    
    .menu-content {
        padding: 30px 40px;
        min-width: 260px;
    }
    
    .menu-content h2 {
        font-size: 22px;
    }
    
    #footer {
        flex-direction: column;
        gap: 6px;
        padding: 12px;
    }
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(155, 126, 217, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(155, 126, 217, 0.6);
    }
}

.control-btn {
    animation: pulse-glow 3s ease-in-out infinite;
}

/* Canvas polyfill for rounded rectangles */
@supports not (selector(::-webkit-slider-thumb)) {
    #speed-slider {
        background: linear-gradient(to right, var(--theme-primary), var(--theme-accent));
    }
}