html {
    overflow: hidden;
    height: 100%;
    width: 100%;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
}

body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
    position: fixed;
}

/* Hard Mode Visual Enhancements */
body[data-hard-mode="true"] {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 30%, #87CEEB 70%, #98FB98 100%);
    animation: hardModeBackground 10s ease-in-out infinite;
}

@keyframes hardModeBackground {
    0%, 100% {
        background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 30%, #87CEEB 70%, #98FB98 100%);
    }
    50% {
        background: linear-gradient(135deg, #e74c3c 0%, #c0392b 30%, #87CEEB 70%, #98FB98 100%);
    }
}

body[data-hard-mode="true"] .player {
    box-shadow: 
        0 0 0 2px #FFFFFF,
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.8),
        0 0 15px rgba(231, 76, 60, 0.5);
    animation: hardModePlayerGlow 2s ease-in-out infinite;
}

@keyframes hardModePlayerGlow {
    0%, 100% {
        box-shadow: 
            0 0 0 2px #FFFFFF,
            0 4px 8px rgba(0, 0, 0, 0.3),
            inset 0 2px 4px rgba(255, 255, 255, 0.8),
            0 0 15px rgba(231, 76, 60, 0.5);
    }
    50% {
        box-shadow: 
            0 0 0 2px #FFFFFF,
            0 4px 8px rgba(0, 0, 0, 0.3),
            inset 0 2px 4px rgba(255, 255, 255, 0.8),
            0 0 25px rgba(231, 76, 60, 0.8);
    }
}

.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.mode-selection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.mode-selection-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    padding: 50px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
}

.mode-selection-content h1 {
    font-size: 42px;
    margin-bottom: 10px;
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.mode-selection-content h2 {
    font-size: 24px;
    margin-bottom: 40px;
    color: #34495e;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mode-btn {
    position: relative;
    padding: 25px 40px;
    border: 3px solid #2c3e50;
    border-radius: 15px;
    background: #6990ff;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(105, 144, 255, 0.3);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #6610f2;
    transition: left 0.3s ease;
    z-index: -1;
}

.mode-btn:hover::before {
    left: 0;
}

.mode-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 16, 242, 0.4);
}

.mode-btn.easy {
    background: #27ae60;
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
}

.mode-btn.easy::before {
    background: #2ecc71;
}

.mode-btn.easy:hover {
    box-shadow: 0 12px 35px rgba(46, 204, 113, 0.4);
}

.mode-btn.hard {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
    border: 3px solid #8b0000;
    animation: hardModePulse 2s ease-in-out infinite;
}

@keyframes hardModePulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 12px 35px rgba(231, 76, 60, 0.6);
        transform: scale(1.02);
    }
}

.mode-btn.hard::before {
    background: #c0392b;
}

.mode-btn.hard:hover {
    box-shadow: 0 12px 35px rgba(192, 57, 43, 0.4);
}

.mode-title {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: bold;
}

.mode-description {
    font-size: 16px;
    opacity: 0.9;
    font-weight: normal;
}

.game-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 900px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.game-info .mode {
    font-weight: bold;
    color: #2c3e50;
    position: relative;
}

.game-info .mode[data-mode="hard"] {
    color: #e74c3c;
    animation: hardModeFlash 3s ease-in-out infinite;
}

@keyframes hardModeFlash {
    0%, 100% {
        color: #e74c3c;
        text-shadow: none;
    }
    50% {
        color: #c0392b;
        text-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
    }
}

.audio-controls {
    display: flex;
    align-items: center;
}

.audio-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #2c3e50;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    backdrop-filter: blur(5px);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.audio-btn:hover {
    background: #6990ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(105, 144, 255, 0.3);
}

.audio-btn.muted {
    background: #e74c3c;
    color: white;
}

.audio-btn.muted:hover {
    background: #c0392b;
}

.game-world {
    position: relative;
    width: 100vw;
    height: calc(100vh - 160px);
    overflow: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;
    touch-action: pan-y pinch-zoom;
}

.lane {
    position: absolute;
    width: 100%;
    height: 80px;
    transform-style: preserve-3d;
}

.grass-lane {
    background: linear-gradient(45deg, #8FBC8F 25%, #90EE90 25%, #90EE90 50%, #8FBC8F 50%, #8FBC8F 75%, #90EE90 75%);
    background-size: 40px 40px;
    border-top: 2px solid #6B8E23;
    border-bottom: 2px solid #6B8E23;
}

.road-lane {
    background: linear-gradient(90deg, #2F4F4F 0%, #696969 50%, #2F4F4F 100%);
    border-top: 3px solid #FFD700;
    border-bottom: 3px solid #FFD700;
    position: relative;
}

.road-lane::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        #FFFF00 0px,
        #FFFF00 30px,
        transparent 30px,
        transparent 60px
    );
    transform: translateY(-50%);
}

.player {
    position: absolute;
    width: 40px;
    height: 40px;
    background: #FFFFFF;
    border-radius: 50% 50% 0 0;
    border: 3px solid #000;
    z-index: 50;
    transition: all 0.2s ease;
    transform-style: preserve-3d;
    box-shadow: 
        0 0 0 2px #FFFFFF,
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

.player::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
}

.player::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
}

.vehicle {
    position: absolute;
    width: 60px;
    height: 35px;
    border-radius: 12px 12px 8px 8px;
    border: 1px solid #333;
    z-index: 40;
    transform-style: preserve-3d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    overflow: visible;
}

/* Car headlights and details */
.car {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 50%, #a93226 100%);
    position: relative;
}

.car::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 8px;
    width: calc(100% - 16px);
    height: 12px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px 8px 4px 4px;
    border: 1px solid #1a252f;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.car::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 8px;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #2c3e50 30%, #34495e 70%);
    border-radius: 50%;
    border: 1px solid #1a252f;
    box-shadow: 44px 0 0 0 #2c3e50, 44px 0 0 1px #1a252f;
}

/* Car headlights */
.car {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 50%, #a93226 100%);
    position: relative;
    border: 1px solid #a93226;
}

.car::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 8px;
    width: calc(100% - 16px);
    height: 12px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px 8px 4px 4px;
    border: 1px solid #1a252f;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.car::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 8px;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #2c3e50 30%, #34495e 70%);
    border-radius: 50%;
    border: 1px solid #1a252f;
    box-shadow: 44px 0 0 0 #2c3e50, 44px 0 0 1px #1a252f;
}

/* Add headlights to cars */
.vehicle {
    position: absolute;
    width: 60px;
    height: 35px;
    border-radius: 12px 12px 8px 8px;
    border: 1px solid #333;
    z-index: 40;
    transform-style: preserve-3d;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4), 
        0 2px 4px rgba(0, 0, 0, 0.2),
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: visible;
    transform: rotateX(5deg);
    background-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
}

/* Vehicle reflections */
.vehicle::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 50%;
    background: inherit;
    opacity: 0.2;
    transform: rotateX(180deg) rotateY(0deg);
    filter: blur(2px);
    z-index: -1;
    border-radius: inherit;
}

/* Car body shine effect */
.vehicle .body-shine {
    position: absolute;
    top: 2px;
    left: 10%;
    width: 80%;
    height: 60%;
    background: linear-gradient(45deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 30%, 
        rgba(255, 255, 255, 0.1) 70%, 
        transparent 100%);
    border-radius: 8px;
    pointer-events: none;
}

/* Enhanced headlight glow effect */
.vehicle .headlight {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #fff 0%, #f1c40f 60%, #e67e22 100%);
    border-radius: 50%;
    border: 1px solid #2c3e50;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 
        0 0 8px rgba(241, 196, 64, 0.8),
        0 0 4px rgba(255, 255, 255, 0.6),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

.vehicle .headlight.left {
    left: -3px;
}

.vehicle .headlight.right {
    right: -3px;
}

/* Reverse direction styling */
.vehicle.reverse .headlight.left {
    left: auto;
    right: -3px;
}

.vehicle.reverse .headlight.right {
    right: auto;
    left: -3px;
}

/* Enhanced truck styling */
.truck {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 50%, #21618c 100%);
    width: 80px;
    height: 40px;
    position: relative;
    border: 1px solid #21618c;
}

.truck::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 10px;
    width: calc(100% - 20px);
    height: 14px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px 8px 4px 4px;
    border: 1px solid #1a252f;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.truck::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 10px;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #2c3e50 30%, #34495e 70%);
    border-radius: 50%;
    border: 1px solid #1a252f;
    box-shadow: 60px 0 0 0 #2c3e50, 60px 0 0 1px #1a252f;
}

/* Truck cab separator */
.truck {
    position: relative;
}

.truck::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 10px;
    width: calc(100% - 20px);
    height: 14px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px 8px 4px 4px;
    border: 1px solid #1a252f;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

/* Enhanced bus styling */
.bus {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 50%, #d35400 100%);
    width: 100px;
    height: 45px;
    position: relative;
    border: 1px solid #d35400;
}

.bus::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 12px;
    width: calc(100% - 24px);
    height: 16px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 10px 10px 6px 6px;
    border: 1px solid #1a252f;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

.bus::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 15px;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #2c3e50 30%, #34495e 70%);
    border-radius: 50%;
    border: 1px solid #1a252f;
    box-shadow: 70px 0 0 0 #2c3e50, 70px 0 0 1px #1a252f;
}

/* Car grille styling */
.car .grille {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 4px;
    background: linear-gradient(90deg, #2c3e50 0%, #34495e 50%, #2c3e50 100%);
    border-radius: 2px;
    border: 1px solid #1a252f;
}

.car .grille::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #34495e;
}

/* Side mirrors for vehicles */
.vehicle .mirror {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #2c3e50;
    border-radius: 50%;
    top: 8px;
    border: 1px solid #1a252f;
}

.vehicle .mirror.left {
    left: -2px;
}

.vehicle .mirror.right {
    right: -2px;
}

/* Car color variations */
.car.red {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 50%, #a93226 100%);
}

.car.blue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 50%, #1f4e79 100%);
}

.car.green {
    background: linear-gradient(135deg, #27ae60 0%, #229954 50%, #196f3d 100%);
}

.car.silver {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 50%, #7f8c8d 100%);
}

.car.black {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 50%, #1b2631 100%);
}

.car.white {
    background: linear-gradient(135deg, #ecf0f1 0%, #d5dbdb 50%, #aeb6bf 100%);
}

/* Antenna for cars */
.vehicle .antenna {
    position: absolute;
    width: 1px;
    height: 8px;
    background: #2c3e50;
    top: -8px;
    left: 75%;
    border-radius: 1px;
}

.vehicle .antenna::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -1px;
    width: 3px;
    height: 3px;
    background: #e74c3c;
    border-radius: 50%;
}

/* Enhanced wheel styling */
.vehicle .wheel {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #2c3e50 30%, #34495e 60%, #1a252f 100%);
    border-radius: 50%;
    border: 1px solid #1a252f;
    bottom: -4px;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.vehicle .wheel::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: #1a252f;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.car .wheel.front {
    left: 8px;
}

.car .wheel.rear {
    right: 8px;
}

.truck .wheel.front {
    left: 10px;
    width: 10px;
    height: 10px;
    bottom: -5px;
}

.truck .wheel.rear {
    right: 10px;
    width: 10px;
    height: 10px;
    bottom: -5px;
}

.bus .wheel.front {
    left: 15px;
    width: 12px;
    height: 12px;
    bottom: -6px;
}

.bus .wheel.rear {
    right: 15px;
    width: 12px;
    height: 12px;
    bottom: -6px;
}

/* Bumper styling */
.vehicle .bumper {
    position: absolute;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #2c3e50 0%, #34495e 50%, #2c3e50 100%);
    bottom: -2px;
    left: 0;
    border-radius: 2px;
    border: 1px solid #1a252f;
}

/* License plate */
.vehicle .license-plate {
    position: absolute;
    width: 12px;
    height: 6px;
    background: #ecf0f1;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid #2c3e50;
    border-radius: 1px;
    font-size: 4px;
    text-align: center;
    line-height: 4px;
    color: #2c3e50;
}

/* Windshield wipers for trucks and buses */
.truck .wiper, .bus .wiper {
    position: absolute;
    width: 1px;
    height: 8px;
    background: #2c3e50;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 1px;
}

/* Side windows for buses */
.bus .side-window {
    position: absolute;
    width: 8px;
    height: 10px;
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    border: 1px solid #1a252f;
    border-radius: 2px;
    top: 6px;
}

.bus .side-window.window1 {
    left: 20px;
}

.bus .side-window.window2 {
    left: 35px;
}

.bus .side-window.window3 {
    left: 50px;
}

.bus .side-window.window4 {
    right: 20px;
}

.tree {
    position: absolute;
    width: 30px;
    height: 60px;
    z-index: 30;
}

.tree::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 8px;
    height: 20px;
    background: #8B4513;
    transform: translateX(-50%);
    border-radius: 4px;
}

.tree::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 25px;
    height: 25px;
    background: radial-gradient(circle, #228B22, #006400);
    border-radius: 50%;
    transform: translateX(-50%);
    border: 2px solid #2F4F4F;
}

.controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-rows: auto auto;
    gap: 10px;
    z-index: 100;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.control-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #2c3e50;
    border-radius: 12px;
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    background: #6990ff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(105, 144, 255, 0.4);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.game-over-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-over-content h2 {
    font-size: 32px;
    color: #e74c3c;
    margin-bottom: 20px;
}

.game-over-content p {
    font-size: 18px;
    margin-bottom: 30px;
    color: #2c3e50;
}

.game-over-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

#restartBtn, #changeMode {
    padding: 15px 30px;
    font-size: 18px;
    background: #6990ff;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#restartBtn::before, #changeMode::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #6610f2;
    transition: left 0.3s ease;
    z-index: -1;
}

#restartBtn:hover::before, #changeMode:hover::before {
    left: 0;
}

#restartBtn:hover, #changeMode:hover {
    transform: translateY(-2px);
}

#changeMode {
    background: #95a5a6;
}

#changeMode::before {
    background: #7f8c8d;
}

.instructions-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 150;
}

.instructions-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #2c3e50;
    border-radius: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.instructions-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #6990ff;
    transition: left 0.3s ease;
    z-index: -1;
}

.instructions-btn:hover::before {
    left: 0;
}

.instructions-btn:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(105, 144, 255, 0.3);
}

.instructions-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.instructions-btn:hover .instructions-icon {
    transform: scale(1.2);
}

.instructions {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    color: #2c3e50;
    min-width: 250px;
    max-width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    border: 2px solid rgba(105, 144, 255, 0.2);
}

.instructions-container:hover .instructions {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.instructions p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.instructions p:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-container {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-world {
        height: calc(100vh - 140px);
        touch-action: pan-y;
        overflow: hidden;
        position: relative;
    }
    
    .game-info {
        padding: 10px;
        font-size: 14px;
        flex-wrap: wrap;
        gap: 8px;
        height: 60px;
        min-height: 60px;
        max-height: 60px;
        overflow: hidden;
    }
    
    .game-info > div {
        font-size: 16px;
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
    
    .audio-controls {
        flex: none;
        min-width: auto;
    }
    
    .audio-btn {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .mode-selection-content {
        padding: 30px 20px;
    }
    
    .mode-selection-content h1 {
        font-size: 32px;
    }
    
    .mode-selection-content h2 {
        font-size: 20px;
        margin-bottom: 30px;
    }
    
    .mode-btn {
        padding: 20px 30px;
    }
    
    .mode-title {
        font-size: 20px;
    }
    
    .mode-description {
        font-size: 14px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .instructions-container {
        position: fixed;
        bottom: 150px;
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
    }
    
    .instructions-btn {
        padding: 12px 16px;
        font-size: 14px;
        background: rgba(255, 255, 255, 0.95);
        border: 2px solid #2c3e50;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
    
    .instructions-icon {
        font-size: 16px;
    }
    
    .instructions {
        min-width: 280px;
        max-width: 320px;
        font-size: 13px;
        padding: 15px;
        left: 50%;
        transform: translateX(-50%);
        bottom: 100%;
        top: auto;
        margin-bottom: 15px;
        margin-top: 0;
    }
    
    .instructions-container:hover .instructions {
        transform: translateX(-50%) translateY(0);
    }
    
    .player {
        width: 35px;
        height: 35px;
    }
    
    .vehicle {
        width: 50px;
        height: 30px;
    }
    
    .truck {
        width: 65px;
        height: 35px;
    }
    
    .bus {
        width: 80px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-container {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-world {
        height: calc(100vh - 120px);
        touch-action: pan-y;
        overflow: hidden;
        position: relative;
    }
    
    .lane {
        height: 60px;
    }
    
    .game-info {
        flex-direction: row;
        gap: 6px;
        padding: 6px;
        background: rgba(255, 255, 255, 0.92);
        height: 50px;
        min-height: 50px;
        max-height: 50px;
        overflow: hidden;
        font-size: 12px;
    }
    
    .game-info > div {
        text-align: center;
        font-size: 14px;
        padding: 2px;
    }
    
    .mode-selection-content {
        padding: 20px 15px;
        margin: 10px;
    }
    
    .mode-selection-content h1 {
        font-size: 28px;
    }
    
    .mode-selection-content h2 {
        font-size: 18px;
    }
    
    .mode-btn {
        padding: 18px 25px;
        font-size: 16px;
    }
    
    .mode-title {
        font-size: 18px;
    }
    
    .mode-description {
        font-size: 13px;
    }
    
    .game-over-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    #restartBtn, #changeMode {
        width: 100%;
        max-width: 200px;
        padding: 12px 24px;
        font-size: 16px;
    }
    
    .instructions-container {
        bottom: 120px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .instructions-btn {
        padding: 10px 14px;
        font-size: 13px;
        gap: 8px;
    }
    
    .instructions-icon {
        font-size: 15px;
    }
    
    .instructions {
        min-width: 260px;
        max-width: 300px;
        font-size: 12px;
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .instructions p {
        margin-bottom: 4px;
        line-height: 1.2;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .player {
        width: 30px;
        height: 30px;
    }
    
    .vehicle {
        width: 40px;
        height: 25px;
    }
    
    .truck {
        width: 55px;
        height: 30px;
    }
    
    .bus {
        width: 70px;
        height: 35px;
    }
}

/* Extra small screens */
@media (max-width: 320px) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-container {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-world {
        height: calc(100vh - 110px);
        touch-action: pan-y;
        overflow: hidden;
        position: relative;
    }
    .instructions-container {
        bottom: 100px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .instructions-btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
    }
    
    .instructions-icon {
        font-size: 13px;
    }
    
    .instructions {
        min-width: 240px;
        max-width: 280px;
        font-size: 11px;
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .instructions p {
        margin-bottom: 3px;
        line-height: 1.1;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .game-info {
        gap: 6px;
        padding: 6px;
    }
    
    .game-info > div {
        font-size: 13px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-container {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: manipulation;
    }
    
    .game-world {
        height: calc(100vh - 80px);
        touch-action: pan-y;
        overflow: hidden;
        position: relative;
    }
    .instructions-container {
        top: 10px;
        left: 10px;
        transform: none;
    }
    
    .instructions-btn {
        padding: 5px 8px;
        font-size: 10px;
        gap: 4px;
    }
    
    .instructions-icon {
        font-size: 11px;
    }
    
    .instructions {
        min-width: 160px;
        max-width: 200px;
        font-size: 9px;
        padding: 6px;
        margin-top: 5px;
        margin-bottom: 0;
        left: 0;
        transform: none;
        bottom: auto;
        top: 100%;
    }
    
    .instructions-container:hover .instructions {
        transform: none;
    }
    
    .instructions p {
        margin-bottom: 2px;
        line-height: 1.1;
    }
    
    .game-info {
        padding: 8px;
        gap: 8px;
    }
    
    .game-info > div {
        font-size: 12px;
    }
    
    .controls {
        bottom: 10px;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* Animations */
@keyframes moveVehicle {
    from {
        transform: translateX(-100px);
    }
    to {
        transform: translateX(calc(100vw + 100px));
    }
}

@keyframes moveVehicleReverse {
    from {
        transform: translateX(calc(100vw + 100px));
    }
    to {
        transform: translateX(-100px);
    }
}

.vehicle.moving {
    animation: moveVehicle linear;
}

.vehicle.moving.reverse {
    animation: moveVehicleReverse linear;
}

@keyframes playerBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.player.invulnerable {
    animation: playerBlink 0.2s infinite;
}

.explode {
    animation: explodeEffect 0.5s ease-out;
}

@keyframes explodeEffect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}