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

body {
    font-family: 'Arial', sans-serif;
    color: white;
}

.game-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.game-header {
    position: relative;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 20px;
    z-index: 100;
}

.game-header h1 {
    font-size: 2.5em;
    color: #ff4444;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.score-board {
    display: flex;
    gap: 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.game-area {
    width: 600px;
    height: 500px;
    position: relative;
    background: #333;
    border: 3px solid #555;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.road {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #444 0%, #666 20%, #777 50%, #666 80%, #444 100%);
    position: relative;
}

.road-line {
    position: absolute;
    width: 4px;
    height: 40px;
    background: #ffff00;
    left: 50%;
    transform: translateX(-50%);
    animation: roadMove 0.5s linear infinite;
}

.road-line:nth-child(1) { top: -40px; }
.road-line:nth-child(2) { top: 80px; }
.road-line:nth-child(3) { top: 200px; }
.road-line:nth-child(4) { top: 320px; }

@keyframes roadMove {
    from { transform: translateX(-50%) translateY(0); }
    to { transform: translateX(-50%) translateY(100px); }
}

.car {
    position: absolute;
    width: 40px;
    height: 80px;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    transition: left 0.1s ease;
}

.car-body {
    width: 100%;
    height: 100%;
    background: #ff0000;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 0 10px rgba(255,0,0,0.5);
    border: 2px solid #cc0000;
}

.car-window {
    position: absolute;
    top: 15px;
    left: 8px;
    width: 24px;
    height: 50px;
    background: rgba(50, 50, 150, 0.6);
    border-radius: 3px;
}

.car-window::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ff0000;
}

.car-wheel {
    position: absolute;
    width: 8px;
    height: 12px;
    background: #222;
    border-radius: 2px;
    animation: wheelSpin 0.1s linear infinite;
}

.wheel-front {
    top: 15px;
    left: -4px;
}

.wheel-back {
    top: 55px;
    left: -4px;
}

.car-wheel:after {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    width: 8px;
    height: 12px;
    background: #222;
    border-radius: 2px;
}

@keyframes wheelSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.obstacle {
    position: absolute;
    width: 35px;
    height: 60px;
    top: -60px;
    animation: obstacleMove 3s linear infinite;
}

/* Blue car obstacle */
.obstacle-car-blue {
    background: #1e40af;
    border-radius: 8px;
    border: 2px solid #1e3a8a;
    box-shadow: 0 0 10px rgba(30, 64, 175, 0.7);
}

.obstacle-car-blue::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 6px;
    width: 21px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Green car obstacle */
.obstacle-car-green {
    background: #059669;
    border-radius: 8px;
    border: 2px solid #047857;
    box-shadow: 0 0 10px rgba(5, 150, 105, 0.7);
}

.obstacle-car-green::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 6px;
    width: 21px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Yellow car obstacle */
.obstacle-car-yellow {
    background: #eab308;
    border-radius: 8px;
    border: 2px solid #ca8a04;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.7);
}

.obstacle-car-yellow::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 6px;
    width: 21px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Truck obstacle */
.obstacle-truck {
    width: 40px;
    height: 70px;
    background: #374151;
    border-radius: 6px;
    border: 2px solid #1f2937;
    box-shadow: 0 0 10px rgba(55, 65, 81, 0.7);
}

.obstacle-truck::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 28px;
    height: 20px;
    background: #4b5563;
    border-radius: 3px;
}

.obstacle-truck::after {
    content: '';
    position: absolute;
    top: 30px;
    left: 5px;
    width: 28px;
    height: 35px;
    background: #6b7280;
    border-radius: 3px;
}

/* Cone obstacle */
.obstacle-cone {
    width: 25px;
    height: 40px;
    background: linear-gradient(180deg, #ff6b00 0%, #ff6b00 70%, #333 70%, #333 100%);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    border-radius: 0;
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.7);
}

@keyframes obstacleMove {
    from { transform: translateY(0); }
    to { transform: translateY(560px); }
}

/* Collision flash effect */
@keyframes collisionFlash {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); filter: brightness(2); }
}

.collision-effect {
    animation: collisionFlash 0.2s ease-out;
}

.game-controls {
    position: relative;
    text-align: center;
    margin-top: 20px;
}

.instructions {
    margin-bottom: 20px;
    font-size: 0.9em;
    line-height: 1.4;
    color: #333;
}

.start-btn, .pause-btn, .restart-btn {
    background: linear-gradient(45deg, #ff4444, #cc0000);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,68,68,0.3);
    transition: all 0.3s ease;
}

.start-btn:hover, .pause-btn:hover, .restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,68,68,0.4);
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #ff4444;
    z-index: 200;
}

.game-over h2 {
    color: #ff4444;
    font-size: 2.5em;
    margin-bottom: 20px;
}

.game-over p {
    font-size: 1.3em;
    margin-bottom: 30px;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-area {
        width: 90vw;
        height: 60vh;
    }
    
    .game-header {
        padding: 0 20px;
    }
    
    .game-header h1 {
        font-size: 1.8em;
    }
    
    .score-board {
        gap: 15px;
        font-size: 1em;
    }
}
