* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(to bottom, #87CEEB, #E0F6FF);
    font-family: 'Arial', sans-serif;
    overflow: hidden;
}

#gameContainer {
    position: relative;
    width: 800px;
    height: 600px;
    max-width: 100vw;
    max-height: 100vh;
    background: linear-gradient(to bottom, #87CEEB 0%, #B0E0E6 50%, #708090 50%, #556B2F 100%);
    border: 5px solid #333;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    perspective: 1000px;
}

@media (max-width: 850px) {
    #gameContainer {
        width: 100vw;
        height: 100vh;
        border: none;
        border-radius: 0;
    }
}

#road {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

#horizon {
    position: absolute;
    width: 100%;
    height: 2px;
    top: 30%;
    background: linear-gradient(to right, transparent, #fff, transparent);
    opacity: 0.5;
}

.road-segment {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: #404040;
    border-left: 3px solid #666;
    border-right: 3px solid #666;
}

.stripe {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    background: #FFD700;
    border-radius: 2px;
}

.tree {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 40px solid #228B22;
}

.tree::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 20px;
    background: #8B4513;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
}

#playerCar {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 140px;
    z-index: 1000;
    transition: left 0.2s ease-out;
}

.car-body {
    position: relative;
    width: 100%;
    height: 100%;
}

.car-top {
    position: absolute;
    width: 70%;
    height: 45%;
    top: 10%;
    left: 15%;
    background: linear-gradient(to bottom, #FF4444, #CC0000);
    border-radius: 20px 20px 5px 5px;
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.3);
}

.windshield {
    position: absolute;
    width: 60%;
    height: 35%;
    top: 15%;
    left: 20%;
    background: rgba(100, 200, 255, 0.4);
    border-radius: 10px 10px 0 0;
    border: 2px solid #333;
}

.car-bottom {
    position: absolute;
    width: 100%;
    height: 55%;
    bottom: 0;
    background: linear-gradient(to bottom, #FF6666, #FF0000);
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.wheel {
    position: absolute;
    width: 18px;
    height: 25px;
    background: #222;
    border-radius: 4px;
    bottom: 15%;
    box-shadow: inset 0 0 5px rgba(255,255,255,0.3);
}

.wheel.left {
    left: 5px;
}

.wheel.right {
    right: 5px;
}

.wheel::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 5px;
    background: #444;
    top: 50%;
    transform: translateY(-50%);
}

.headlight {
    position: absolute;
    width: 12px;
    height: 8px;
    background: #FFFF00;
    bottom: 5px;
    border-radius: 2px;
    box-shadow: 0 0 10px #FFFF00;
}

.headlight.left {
    left: 15px;
}

.headlight.right {
    right: 15px;
}

.enemy-car {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.enemy-small {
    width: 40px;
    height: 70px;
}

.enemy-medium {
    width: 60px;
    height: 100px;
}

.enemy-large {
    width: 80px;
    height: 130px;
}

.enemy-body {
    position: relative;
    width: 100%;
    height: 100%;
}

.enemy-top {
    position: absolute;
    width: 70%;
    height: 45%;
    bottom: 55%;
    left: 15%;
    background: linear-gradient(to top, #4444FF, #0000CC);
    border-radius: 5px 5px 20px 20px;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.3);
}

.enemy-window {
    position: absolute;
    width: 60%;
    height: 35%;
    bottom: 15%;
    left: 20%;
    background: rgba(100, 200, 255, 0.4);
    border-radius: 0 0 10px 10px;
    border: 2px solid #333;
}

.enemy-bottom {
    position: absolute;
    width: 100%;
    height: 55%;
    top: 45%;
    background: linear-gradient(to top, #6666FF, #0000FF);
    border-radius: 10px;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.5);
}

.enemy-wheel {
    position: absolute;
    width: 14px;
    height: 18px;
    background: #222;
    border-radius: 3px;
    top: 55%;
}

.enemy-wheel.left {
    left: 3px;
}

.enemy-wheel.right {
    right: 3px;
}

#dashboard {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    z-index: 2000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 30px;
    color: #fff;
    font-weight: bold;
}

.dash-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.dash-label {
    font-size: 12px;
    opacity: 0.7;
    text-transform: uppercase;
}

.dash-value {
    font-size: 24px;
    color: #00FF00;
    text-shadow: 0 0 10px #00FF00;
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.95);
    color: #fff;
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    display: none;
    z-index: 3000;
    border: 3px solid #FF0000;
}

#gameOver h2 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #FF4444;
    text-shadow: 0 0 20px #FF0000;
}

#gameOver p {
    font-size: 24px;
    margin-bottom: 30px;
}

.btn {
    padding: 15px 40px;
    font-size: 20px;
    background: linear-gradient(to bottom, #00FF00, #00AA00);
    color: #000;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(0,255,0,0.3);
}

.btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0,255,0,0.5);
}

#startScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(50,50,50,0.9));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

#startScreen h1 {
    color: #fff;
    font-size: 56px;
    margin-bottom: 20px;
    text-shadow: 0 0 30px #FF0000;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#startScreen p {
    color: #ccc;
    font-size: 20px;
    margin-bottom: 40px;
}

.crash-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #FF0000;
    opacity: 0;
    pointer-events: none;
    z-index: 2500;
}

@keyframes crash {
    0% { opacity: 0; }
    50% { opacity: 0.8; }
    100% { opacity: 0; }
}

#mobileControls {
    position: absolute;
    bottom: 70px;
    width: 100%;
    height: 200px;
    display: none;
    z-index: 2000;
    pointer-events: none;
}

.touch-area {
    position: absolute;
    width: 50%;
    height: 100%;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-area.left {
    left: 0;
}

.touch-area.right {
    right: 0;
}

.touch-button {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    backdrop-filter: blur(10px);
    transition: all 0.1s;
    user-select: none;
}

.touch-button:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

@media (max-width: 850px), (hover: none) {
    #mobileControls {
        display: block;
    }

    #startScreen p:first-of-type {
        display: none;
    }
}