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

body {
    overflow: hidden;
    background: #10131c;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-overlay {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 24px;
    pointer-events: none;
    z-index: 10;
}

#score-display, #time-display, #high-score-display {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 8px 22px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    min-width: 90px;
}

#sound-toggle {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
    align-self: center;
    flex-shrink: 0;
    pointer-events: auto;
}

#sound-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

#sound-toggle.muted {
    opacity: 0.5;
}

.stat-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffd24d;
    text-transform: uppercase;
}

#score, #time, #high-score {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 10px rgba(255, 210, 77, 0.35);
}

#time.warning {
    color: #ff6b6b;
    text-shadow: 0 2px 14px rgba(255, 107, 107, 0.7);
    animation: pulse 0.6s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

#objective {
    position: absolute;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 8px 22px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.3s;
}

/* Touch controls */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-between;
    padding: 20px 24px 30px;
    z-index: 15;
    pointer-events: none;
}

.touch-pad {
    display: flex;
    gap: 16px;
    pointer-events: none;
}

#pad-right {
    flex-direction: column-reverse;
    align-items: center;
}

.touch-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 26px;
    backdrop-filter: blur(8px);
    pointer-events: auto;
    touch-action: none;
    box-shadow: none;
    letter-spacing: 0;
    text-transform: none;
    padding: 0;
}

.touch-btn.accel {
    background: rgba(255, 210, 77, 0.3);
    border-color: rgba(255, 210, 77, 0.6);
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.94);
}

body.touch #touch-controls {
    display: flex;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 19, 28, 0.85);
    backdrop-filter: blur(8px);
    z-index: 20;
}

.screen-content {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.screen-content h1 {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd24d, #ff8c42, #4dd0e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.screen-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.truck-icon {
    font-size: 80px;
    margin: 20px 0;
    animation: drive 1.4s ease-in-out infinite;
}

@keyframes drive {
    0%, 100% { transform: translateX(-10px) rotate(-2deg); }
    50% { transform: translateX(10px) rotate(2deg); }
}

.controls-info {
    margin: 20px 0 30px;
}

.controls-info p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

kbd {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 3px 10px;
    font-family: inherit;
    font-size: 13px;
    color: #fff;
    margin: 0 2px;
}

button {
    background: linear-gradient(135deg, #ffd24d, #ff8c42);
    color: #1a1206;
    border: none;
    padding: 16px 48px;
    font-size: 20px;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 8px 30px rgba(255, 140, 66, 0.4);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(255, 140, 66, 0.6);
}

button:active {
    transform: translateY(0);
}

#final-score-display {
    font-size: 24px;
    font-weight: 700;
    color: #ffd24d;
}

@media (max-width: 600px) {
    .screen-content h1 {
        font-size: 40px;
    }
    #score, #time, #high-score {
        font-size: 26px;
    }
    #score-display, #time-display, #high-score-display {
        min-width: 70px;
        padding: 6px 14px;
    }
    #ui-overlay {
        gap: 12px;
    }
    button {
        padding: 12px 36px;
        font-size: 16px;
    }
    #objective {
        font-size: 13px;
        top: 96px;
    }
}
