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

body {
    overflow: hidden;
    background: #000;
    font-family: 'VT323', monospace;
    color: #00ff88;
}

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

#scene-container canvas {
    display: block;
}

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

#hud-top-left {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 8, 20, 0.85);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 4px;
    padding: 12px 16px;
    min-width: 280px;
}

#progress-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #00ff88;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

#progress-bar-container {
    width: 100%;
    height: 18px;
    background: #0a1628;
    border: 1px solid #1a3a5c;
    border-radius: 2px;
    position: relative;
    margin-bottom: 8px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff88, #00cc66);
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

#progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #fff;
    text-shadow: 0 0 4px #000;
}

#planets-moved {
    font-size: 18px;
    color: #88ccff;
    margin-bottom: 4px;
}

#time-remaining {
    font-size: 16px;
    color: #ff8844;
    animation: blink-slow 2s infinite;
}

@keyframes blink-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#hud-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 8, 20, 0.85);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 4px;
    padding: 10px 14px;
    text-align: right;
    font-size: 15px;
}

#block-pos {
    color: #00ff88;
    margin-bottom: 4px;
}

#block-speed {
    color: #ffcc00;
}

/* Notification */
#notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 8, 20, 0.92);
    border: 2px solid #00ff88;
    border-radius: 6px;
    padding: 16px 28px;
    font-size: 20px;
    color: #fff;
    text-align: center;
    max-width: 500px;
    animation: notification-pop 0.3s ease;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

#notification.hidden {
    display: none;
}

@keyframes notification-pop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Controls Help */
#hud-bottom {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 8, 20, 0.8);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 14px;
    color: #88aacc;
}

.key {
    display: inline-block;
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.4);
    border-radius: 3px;
    padding: 1px 6px;
    color: #00ff88;
    font-size: 12px;
    font-family: 'Press Start 2P', monospace;
}

/* Error Dialog - Windows XP style */
#error-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ECE9D8;
    border: 2px solid #0054E3;
    border-radius: 8px 8px 4px 4px;
    box-shadow: 4px 4px 20px rgba(0,0,0,0.6);
    z-index: 100;
    min-width: 380px;
    max-width: 460px;
    pointer-events: all;
    animation: dialog-appear 0.2s ease;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

#error-dialog.hidden {
    display: none;
}

@keyframes dialog-appear {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#error-titlebar {
    background: linear-gradient(180deg, #0A246A 0%, #3A6EA5 8%, #0A246A 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: bold;
}

#error-close {
    background: linear-gradient(180deg, #C45140, #B33527);
    color: white;
    border: 1px solid #6d1e15;
    border-radius: 3px;
    width: 21px;
    height: 21px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

#error-body {
    display: flex;
    align-items: flex-start;
    padding: 16px 14px;
    gap: 12px;
    color: #000;
    font-size: 13px;
    line-height: 1.5;
}

#error-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #D32F2F;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

#error-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0 14px 14px;
}

.error-btn {
    background: linear-gradient(180deg, #fff 0%, #ECE9D8 100%);
    border: 1px solid #ACA899;
    border-radius: 3px;
    padding: 4px 20px;
    font-size: 13px;
    cursor: pointer;
    pointer-events: all;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.error-btn:hover {
    background: linear-gradient(180deg, #fff 0%, #ddd 100%);
}

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

#win-screen.hidden {
    display: none;
}

#win-content {
    background: rgba(0, 20, 40, 0.95);
    border: 2px solid #00ff88;
    border-radius: 8px;
    padding: 40px 50px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 0 60px rgba(0, 255, 136, 0.3);
}

#win-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    color: #00ff88;
    margin-bottom: 16px;
}

#win-subtitle {
    font-size: 22px;
    color: #88ccff;
    margin-bottom: 12px;
}

#win-time {
    font-size: 18px;
    color: #ff8844;
    margin-bottom: 16px;
}

#win-bar-container {
    width: 100%;
    height: 20px;
    background: #0a1628;
    border: 1px solid #1a3a5c;
    border-radius: 3px;
    margin-bottom: 16px;
    overflow: hidden;
}

#win-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00ff88, #00cc66);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

#win-message {
    font-size: 16px;
    color: #aaa;
    margin-bottom: 24px;
    line-height: 1.5;
}

#win-restart {
    background: transparent;
    border: 2px solid #00ff88;
    color: #00ff88;
    font-family: 'VT323', monospace;
    font-size: 20px;
    padding: 10px 30px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

#win-restart:hover {
    background: #00ff88;
    color: #000;
}

/* Mobile Joystick */
#mobile-joystick {
    position: fixed;
    bottom: 80px;
    left: 20px;
    z-index: 50;
    pointer-events: all;
}

#mobile-joystick.hidden {
    display: none;
}

#joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 50%;
    position: relative;
    touch-action: none;
}

#joystick-knob {
    width: 44px;
    height: 44px;
    background: rgba(0, 255, 136, 0.4);
    border: 2px solid rgba(0, 255, 136, 0.6);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: none;
}

#mobile-boost {
    margin-top: 10px;
    background: rgba(255, 136, 0, 0.2);
    border: 2px solid rgba(255, 136, 0, 0.5);
    color: #ff8800;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
}

/* Glitch Effect */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 90;
    mix-blend-mode: screen;
    animation: glitch-anim 0.15s linear;
}

@keyframes glitch-anim {
    0% { 
        background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 255, 136, 0.08) 2px, rgba(0, 255, 136, 0.08) 4px);
        transform: translateX(0);
    }
    25% { 
        background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255, 0, 0, 0.12) 3px, rgba(255, 0, 0, 0.12) 5px);
        transform: translateX(-3px);
    }
    50% { 
        background: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0, 100, 255, 0.1) 1px, rgba(0, 100, 255, 0.1) 3px);
        transform: translateX(5px);
    }
    75% { 
        background: repeating-linear-gradient(0deg, transparent, transparent 4px, rgba(0, 255, 0, 0.08) 4px, rgba(0, 255, 0, 0.08) 6px);
        transform: translateX(-2px);
    }
    100% { background: transparent; transform: translateX(0); }
}

/* Screen Shake */
.screen-shake {
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-4px, 2px); }
    20% { transform: translate(4px, -3px); }
    30% { transform: translate(-3px, 4px); }
    40% { transform: translate(3px, -2px); }
    50% { transform: translate(-2px, 3px); }
    60% { transform: translate(2px, -4px); }
    70% { transform: translate(-4px, 2px); }
    80% { transform: translate(3px, -3px); }
    90% { transform: translate(-2px, 4px); }
}

/* Confetti */
.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    z-index: 210;
    pointer-events: none;
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* Footer */
#footer {
    position: fixed;
    bottom: 8px;
    right: 16px;
    z-index: 15;
}

#footer a {
    color: rgba(0, 255, 136, 0.4);
    text-decoration: none;
    font-family: 'VT323', monospace;
    font-size: 14px;
}

#footer a:hover {
    color: rgba(0, 255, 136, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
    #hud-top-left {
        top: 8px;
        left: 8px;
        min-width: 200px;
        padding: 8px 10px;
    }
    
    #progress-title {
        font-size: 8px;
    }
    
    #planets-moved {
        font-size: 14px;
    }
    
    #time-remaining {
        font-size: 13px;
    }
    
    #hud-top-right {
        top: 8px;
        right: 8px;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    #hud-bottom {
        display: none;
    }
    
    #error-dialog {
        min-width: 280px;
        max-width: 340px;
    }
    
    #win-content {
        padding: 24px 20px;
        margin: 16px;
    }
}