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

body {
    overflow: hidden;
    background: #000;
    font-family: 'Orbitron', sans-serif;
}

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

#scene-container canvas {
    display: block;
}

/* Start Screen */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a0033 0%, #000 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.start-content {
    text-align: center;
    animation: fadeIn 1s ease;
}

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

.title {
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 900;
    background: linear-gradient(90deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff00ff, #ff0000);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowShift 3s linear infinite;
    margin-bottom: 0.5rem;
    text-shadow: none;
}

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

.subtitle {
    font-size: clamp(0.8rem, 2vw, 1.4rem);
    color: #aaa;
    margin-bottom: 2rem;
    font-weight: 400;
}

.test-badge {
    display: inline-block;
    padding: 0.4rem 1.5rem;
    border: 2px solid #0ff;
    color: #0ff;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
    box-shadow: 0 0 10px #0ff, inset 0 0 10px rgba(0, 255, 255, 0.1);
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#start-btn {
    display: block;
    margin: 0 auto 2rem;
    padding: 1rem 3rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff0066, #8800ff);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 0, 102, 0.5);
}

#start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(255, 0, 102, 0.8);
}

.controls-info {
    color: #666;
    font-size: 0.75rem;
    line-height: 2;
}

.controls-info .key {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
}

.controls-info .mobile-hint {
    display: none;
    color: #0ff;
    margin-top: 0.5rem;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .controls-info .mobile-hint {
        display: block;
    }
}

/* HUD */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    font-weight: 100;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

#timer {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

#test-badge-hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.3rem 1rem;
    border: 1px solid #0ff;
    color: #0ff;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    text-shadow: 0 0 8px #0ff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

#minimap {
    position: absolute;
    top: 20px;
    right: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

#show-solution-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #0ff;
    color: #0ff;
    font-size: 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.2s;
}

#show-solution-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    pointer-events: all;
    z-index: 200;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    #mobile-controls {
        display: flex;
    }
    
    #minimap {
        width: 120px;
        height: 120px;
        top: 10px;
        right: 10px;
    }
    
    #timer {
        top: 10px;
        left: 10px;
        font-size: 0.9rem;
        padding: 0.3rem 0.7rem;
    }
    
    #test-badge-hud {
        display: none;
    }
    
    #show-solution-btn {
        bottom: auto;
        top: 10px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.6rem;
        padding: 0.4rem 0.8rem;
    }
    
    #crosshair {
        font-size: 18px;
    }
}

#joystick-zone {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#joystick-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.5);
    border: 2px solid rgba(0, 255, 136, 0.8);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
    position: absolute;
    transition: none;
}

#look-zone {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 140px;
    height: 140px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

#look-label {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.55rem;
    font-family: 'Press Start 2P', monospace;
    text-align: center;
    pointer-events: none;
}

/* Win Screen */
#win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.win-content {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.win-title {
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    font-weight: 900;
    background: linear-gradient(90deg, gold, #ffdd00, orange, gold);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowShift 2s linear infinite;
    margin-bottom: 1rem;
}

.win-subtitle {
    color: #ccc;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.win-time {
    color: #0ff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px #0ff;
}

#new-maze-btn {
    padding: 1rem 2.5rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #00cc66, #0088ff);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 204, 102, 0.5);
}

#new-maze-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(0, 204, 102, 0.8);
}

/* Remix Link */
#remix-link {
    position: fixed;
    bottom: 10px;
    left: 10px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
    text-decoration: none;
    z-index: 500;
    font-family: 'Orbitron', sans-serif;
    transition: color 0.2s;
}

#remix-link:hover {
    color: rgba(255, 255, 255, 0.8);
}