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

body {
    font-family: 'JetBrains Mono', monospace;
    background: #050510;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#hud-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: linear-gradient(180deg, rgba(5, 5, 16, 0.95) 0%, rgba(5, 5, 16, 0) 100%);
    z-index: 10;
    text-align: center;
}

.title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 4vw, 2.2rem);
    font-weight: 900;
    background: linear-gradient(90deg, #00ffff, #ff6600, #00ffff);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    letter-spacing: 0.1em;
}

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

.progress-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.progress-bar {
    width: 200px;
    max-width: 50vw;
    height: 12px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ffff, #00ff88);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    transition: width 0.3s ease;
}

.progress-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.15em;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: #00ffff;
}

#stats-panel {
    position: fixed;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: rgba(10, 10, 30, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stat-title {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.1em;
}

.stat-data {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: #ff6600;
    text-shadow: 0 0 8px rgba(255, 102, 0, 0.6);
}

#control-panel {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 30, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-width: 250px;
}

.glow-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 15px 30px;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(0, 255, 255, 0.1));
    border: 2px solid #00ffff;
    border-radius: 8px;
    color: #00ffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.glow-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.4), rgba(0, 255, 255, 0.2));
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.6), inset 0 0 30px rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
}

.glow-btn:active {
    transform: scale(0.98);
}

.btn-icon {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-label input:checked + .toggle-slider {
    background: rgba(0, 255, 255, 0.5);
}

.toggle-label input:checked + .toggle-slider::after {
    transform: translateX(20px);
    background: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.speed-label, .speed-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.speed-text {
    min-width: 100px;
    text-align: left;
    color: #ff6600;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #ff6600;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.8);
}

.reset-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    padding: 8px 15px;
    background: transparent;
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 5px;
    color: rgba(255, 100, 100, 0.7);
    cursor: pointer;
    transition: all 0.3s;
}

.reset-btn:hover {
    border-color: rgba(255, 100, 100, 0.8);
    color: #ff6666;
    background: rgba(255, 100, 100, 0.1);
}

#milestone-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid #ff6600;
    border-radius: 15px;
    padding: 25px 40px;
    z-index: 100;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: #ff6600;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 102, 0, 0.5);
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#completion-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 16, 0.9);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.completion-content {
    text-align: center;
    padding: 40px;
}

.completion-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.5rem, 5vw, 3rem);
    background: linear-gradient(90deg, #ffd700, #ff6600, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 2s linear infinite;
    margin-bottom: 20px;
}

.achievement {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #00ffff;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

.sub-text {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
    max-width: 400px;
}

.share-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    padding: 15px 30px;
    background: linear-gradient(135deg, #1da1f2, #0d8ecf);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    margin-right: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.share-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(29, 161, 242, 0.6);
}

.restart-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    padding: 15px 25px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s;
}

.restart-btn:hover {
    border-color: #fff;
    color: #fff;
}

.hidden {
    display: none !important;
}

#footer {
    position: fixed;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    z-index: 5;
}

#footer a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}

#footer a:hover {
    color: #00ffff;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #stats-panel {
        position: fixed;
        top: auto;
        bottom: 200px;
        right: 10px;
        transform: none;
        padding: 10px;
        font-size: 0.8rem;
    }
    
    #control-panel {
        bottom: 40px;
        padding: 15px;
        min-width: 200px;
    }
    
    .glow-btn {
        padding: 12px 20px;
        font-size: 0.85rem;
    }
    
    .stats-row {
        gap: 15px;
    }
    
    #footer {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1rem;
    }
    
    #stats-panel {
        display: none;
    }
    
    #control-panel {
        width: calc(100% - 30px);
        min-width: unset;
    }
}