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

body {
    font-family: 'Noto Sans', sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #E0F6FF 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 800px;
    height: 650px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.game-title {
    background: linear-gradient(135deg, #4169E1 0%, #2E4BC6 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
    border-bottom: 3px solid #1E3A8A;
}

.game-title h1 {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.score-board {
    background: #333;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
}

.game-area {
    position: relative;
    width: 100%;
    height: 430px;
    overflow: hidden;
}

.street {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #87CEEB 0%, #87CEEB 60%, #666 60%, #666 100%);
}

.road {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: #333;
    border-top: 5px solid #FFF;
}

.lane-lines {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-around;
    overflow: hidden;
}

.lane-line {
    width: 40px;
    height: 4px;
    background: #FFF;
    border-radius: 2px;
    animation: moveLines 1.5s linear infinite;
}

.lane-line:nth-child(1) {
    animation-delay: 0s;
}

.lane-line:nth-child(2) {
    animation-delay: -0.5s;
}

.lane-line:nth-child(3) {
    animation-delay: -1s;
}

.lane-line:nth-child(4) {
    animation-delay: -0.25s;
}

.lane-line:nth-child(5) {
    animation-delay: -0.75s;
}

@keyframes moveLines {
    0% { transform: translateX(-100px); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateX(calc(100vw + 100px)); opacity: 0; }
}

.car-container {
    position: absolute;
    bottom: 120px;
    left: -100px;
    width: 100px;
    height: 50px;
}

.police-car, .normal-car, .ambulance-car, .fire-truck, .delivery-truck, .taxi-car, .sports-car {
    position: absolute;
    width: 80px;
    height: 40px;
    display: none;
}

.police-car .car-body {
    background: #000;
    border: 2px solid #FFF;
    border-radius: 5px;
    height: 100%;
    position: relative;
}

.normal-car .car-body {
    background: #4169E1;
    border: 2px solid #333;
    border-radius: 5px;
    height: 100%;
    position: relative;
}

.ambulance-car .car-body {
    background: #FFFFFF;
    border: 2px solid #FF0000;
    border-radius: 5px;
    height: 100%;
    position: relative;
}

.fire-truck .car-body {
    background: #DC143C;
    border: 2px solid #8B0000;
    border-radius: 5px;
    height: 100%;
    position: relative;
}

.delivery-truck .car-body {
    background: #8B4513;
    border: 2px solid #654321;
    border-radius: 5px;
    height: 100%;
    position: relative;
}

.taxi-car .car-body {
    background: #FFD700;
    border: 2px solid #333;
    border-radius: 5px;
    height: 100%;
    position: relative;
}

.sports-car .car-body {
    background: #FF4500;
    border: 2px solid #8B0000;
    border-radius: 8px;
    height: 100%;
    position: relative;
}

.car-light {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #FFD700;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.car-light:first-child {
    left: -5px;
}

.car-light:last-child {
    right: -5px;
}

.police-label, .ambulance-label, .fire-label, .delivery-label, .taxi-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 9px;
    font-weight: bold;
}

.ambulance-label, .taxi-label {
    color: #000;
}

.red-cross {
    position: absolute;
    top: 2px;
    right: 2px;
    color: #FF0000;
    font-size: 12px;
    font-weight: bold;
}

.taxi-sign {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 6px;
    background: #000;
    border-radius: 2px;
}

.character {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 80px;
}

.head {
    width: 40px;
    height: 40px;
    background: #FDBCB4;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
    border: 2px solid #333;
}

.eye {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.left-eye {
    left: 25%;
}

.right-eye {
    right: 25%;
}

.body {
    width: 30px;
    height: 40px;
    background: #4169E1;
    border-radius: 15px;
    margin: 0 auto;
    border: 2px solid #333;
}

.instructions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    text-align: center;
    color: #333;
    font-size: 14px;
}

.instructions p {
    margin: 2px 0;
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    text-align: center;
}

.game-over h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

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

#restart-btn {
    padding: 15px 30px;
    font-size: 18px;
    background: #4169E1;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#restart-btn:hover {
    background: #2E4BC6;
}

.eyes-up {
    transform: translateY(-50%) translateX(0) !important;
}

.eyes-down {
    transform: translateY(-50%) translateX(0) translateY(3px) !important;
}

.police-car.active, .normal-car.active, .ambulance-car.active, .fire-truck.active, .delivery-truck.active, .taxi-car.active, .sports-car.active {
    display: block;
    animation: driveCar 3s linear forwards;
}

@keyframes driveCar {
    0% { transform: translateX(0); }
    100% { transform: translateX(900px); }
}

.police-car.active .car-light, .ambulance-car.active .car-light, .fire-truck.active .car-light {
    animation: policeFlash 0.5s infinite alternate;
}

.ambulance-car.active .car-light {
    animation: ambulanceFlash 0.3s infinite alternate;
}

.fire-truck.active .car-light {
    animation: fireFlash 0.4s infinite alternate;
}

@keyframes ambulanceFlash {
    0% { background: #FF0000; }
    100% { background: #FFFFFF; }
}

@keyframes fireFlash {
    0% { background: #FF0000; }
    100% { background: #FF4500; }
}