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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    overflow: hidden;
    color: white;
    user-select: none;
}

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

/* HUD Styles */
.hud {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 20px;
    transition: all 0.3s ease;
}

.metric {
    text-align: center;
    min-width: 60px;
}

.metric .label {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric .value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    color: #4a90e2;
}

/* Control Panel */
.control-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 280px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.control-panel.collapsed .panel-content {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(74, 144, 226, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #4a90e2;
}

.toggle-btn {
    background: none;
    border: none;
    color: #4a90e2;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: rgba(74, 144, 226, 0.2);
}

.panel-content {
    padding: 20px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: 12px;
    color: #ccc;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group select,
.control-group input[type="color"],
.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.control-group select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    font-size: 14px;
}

.control-group input[type="color"] {
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.control-group input[type="range"] {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.action-btn {
    width: 48%;
    padding: 10px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.action-btn.secondary {
    background: linear-gradient(135deg, #666, #444);
}

.action-btn.secondary:hover {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.control-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* Toolbar */
.toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 15px 30px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 10px;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: white;
    padding: 8px 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: rgba(74, 144, 226, 0.3);
    border-color: #4a90e2;
}

/* Spin Intensity */
.spin-intensity {
    text-align: center;
    min-width: 150px;
}

.intensity-bar {
    width: 150px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.intensity-fill {
    height: 100%;
    background: #4a90e2;
    transition: width 0.1s ease;
    border-radius: 3px;
}

.spin-intensity span {
    font-size: 11px;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Instructions */
.instructions {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    max-width: 200px;
}

.instruction-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 11px;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-item .key {
    color: #4a90e2;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.instruction-item .action {
    color: #ccc;
}

/* Achievements */
.achievements {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 20px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: achievementPop 0.5s ease;
}

.achievements.hidden {
    display: none;
}

.achievements h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #ffd700;
}

#achievement-text {
    font-size: 14px;
    color: white;
}

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

/* Zen Mode */
body.zen-mode .control-panel,
body.zen-mode .instructions,
body.zen-mode .toolbar {
    opacity: 0.1;
    transition: opacity 0.5s ease;
}

body.zen-mode .control-panel:hover,
body.zen-mode .instructions:hover,
body.zen-mode .toolbar:hover {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .control-panel {
        width: calc(100vw - 40px);
        right: 20px;
        top: 120px;
    }

    .hud {
        flex-wrap: wrap;
        gap: 10px;
    }

    .metric {
        min-width: 50px;
    }

    .toolbar {
        bottom: 10px;
        padding: 10px 20px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .toolbar-center {
        order: 3;
        width: 100%;
    }

    .instructions {
        bottom: 120px;
        font-size: 10px;
    }

    .action-btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .control-panel {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        top: 100px;
    }

    .hud {
        left: 10px;
        top: 10px;
        padding: 10px;
    }

    .toolbar {
        left: 10px;
        right: 10px;
        transform: none;
        width: calc(100vw - 20px);
    }
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 0.8);
}

/* Smooth transitions for all interactive elements */
button, select, input {
    transition: all 0.2s ease;
}

button:focus, select:focus, input:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Loading animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner-loading {
    animation: spin 2s linear infinite;
}