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

body {
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
    background: #1a1a2e;
}

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

.screen {
    position: fixed;
    z-index: 100;
}

.hidden {
    display: none !important;
}

/* Start Screen */
#start-screen {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.title-container {
    position: relative;
    text-align: center;
}

.game-title {
    font-family: 'Bangers', cursive;
    font-size: clamp(3rem, 12vw, 8rem);
    color: #ff6b6b;
    text-shadow: 
        4px 4px 0 #4ecdc4,
        8px 8px 0 #45b7aa,
        12px 12px 20px rgba(0,0,0,0.5);
    letter-spacing: 0.1em;
    animation: titleBounce 2s ease-in-out infinite;
}

.title-3d {
    font-family: 'Bangers', cursive;
    font-size: clamp(2rem, 8vw, 5rem);
    color: #ffe66d;
    text-shadow: 
        3px 3px 0 #f9844a,
        6px 6px 15px rgba(0,0,0,0.4);
    animation: titleBounce 2s ease-in-out infinite 0.3s;
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

.tagline {
    font-size: 1.2rem;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.3em;
}

.instructions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #ccc;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn:hover {
    transform: scale(1.05);
}

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

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    box-shadow: 0 6px 0 #cc4444, 0 10px 20px rgba(0,0,0,0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 0 #cc4444, 0 8px 15px rgba(0,0,0,0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #555, #444);
    color: white;
    box-shadow: 0 4px 0 #333, 0 8px 15px rgba(0,0,0,0.3);
}

.btn-go {
    background: linear-gradient(135deg, #4ecdc4, #45b7aa);
    color: white;
    box-shadow: 0 6px 0 #3a9e97, 0 10px 20px rgba(0,0,0,0.3);
    font-size: 2rem;
    padding: 1.2rem 3rem;
}

.btn-small {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
}

/* Garage UI */
#garage-ui {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

#garage-ui > * {
    pointer-events: auto;
}

.brick-palette {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    padding: 1rem;
    width: fit-content;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.brick-palette h3 {
    font-family: 'Bangers', cursive;
    color: #ffe66d;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
}

.brick-options {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.brick-btn {
    width: 50px;
    height: 50px;
    background: #333;
    border: 3px solid #444;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.brick-btn.selected {
    border-color: #4ecdc4;
    background: #2a3a3a;
}

.brick-preview {
    border-radius: 4px;
}

.brick-preview.small { width: 20px; height: 20px; background: #ff4444; }
.brick-preview.wide { width: 30px; height: 15px; background: #4444ff; }
.brick-preview.tall { width: 15px; height: 30px; background: #44cc44; }
.brick-preview.big { width: 30px; height: 30px; background: #ffcc00; }

.color-options {
    display: flex;
    gap: 0.4rem;
}

.color-btn {
    width: 30px;
    height: 30px;
    border: 3px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn.selected {
    border-color: white;
    transform: scale(1.1);
}

.stats-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    padding: 1rem;
    min-width: 150px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.stat {
    margin-bottom: 0.8rem;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 1.4rem;
    color: #fff;
    font-weight: bold;
}

.stability-bar {
    height: 12px;
    background: #333;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 0.3rem;
}

.stability-fill {
    height: 100%;
    width: 100%;
    transition: all 0.3s;
    border-radius: 6px;
}

.stability-fill.green { background: linear-gradient(90deg, #4ecdc4, #45b7aa); }
.stability-fill.yellow { background: linear-gradient(90deg, #ffe66d, #f9844a); }
.stability-fill.red { background: linear-gradient(90deg, #ff6b6b, #ee5a5a); }

.action-buttons {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
}

.hint {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    color: #666;
    font-size: 0.8rem;
}

/* Race UI */
#race-ui {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 1rem;
}

#race-ui > * {
    pointer-events: auto;
}

.race-hud {
    display: flex;
    gap: 2rem;
    justify-content: center;
    background: rgba(20, 20, 30, 0.9);
    padding: 1rem 2rem;
    border-radius: 16px;
    width: fit-content;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.hud-item {
    text-align: center;
}

.hud-label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hud-value {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    color: #4ecdc4;
}

.hud-unit {
    font-size: 0.7rem;
    color: #666;
}

.controls-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 120px;
}

.key {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.race-buttons {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Result Screen */
#result-screen {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-width: 90%;
}

.result-title {
    font-family: 'Bangers', cursive;
    font-size: 4rem;
    margin-bottom: 2rem;
}

.result-title.success {
    color: #4ecdc4;
    text-shadow: 4px 4px 0 #3a9e97;
}

.result-title.fail {
    color: #ff6b6b;
    text-shadow: 4px 4px 0 #cc4444;
}

.result-stats {
    display: flex;
    gap: 3rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.result-stat {
    text-align: center;
}

.result-label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.result-value {
    font-family: 'Bangers', cursive;
    font-size: 2.5rem;
    color: #ffe66d;
}

.result-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0.5rem;
    right: 0.5rem;
    color: rgba(255,255,255,0.3);
    font-size: 0.7rem;
    z-index: 50;
}

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

.footer a:hover {
    color: #4ecdc4;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .game-title {
        font-size: 3rem;
    }
    
    .title-3d {
        font-size: 2rem;
    }
    
    .brick-palette {
        position: absolute;
        bottom: 5rem;
        left: 1rem;
        right: auto;
    }
    
    .stats-panel {
        min-width: 120px;
        padding: 0.8rem;
    }
    
    .race-hud {
        gap: 1rem;
        padding: 0.8rem 1.2rem;
    }
    
    .hud-value {
        font-size: 1.5rem;
    }
    
    .result-stats {
        flex-direction: column;
        gap: 1rem;
    }
}