* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

#scoreBoard {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

#scoreBoard div {
    margin: 2px 8px;
}

#environment {
    color: #ffeb3b;
    text-transform: uppercase;
}

#muteBtn {
    margin: 0 6px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    line-height: 1.2;
    cursor: pointer;
}

#muteBtn:hover {
    background: rgba(255, 255, 255, 0.22);
}

#message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: bold;
    color: #ffeb3b;
    text-shadow: 2px 2px 4px #000;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
}

#message.show {
    opacity: 1;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.3s;
}

.overlay.hidden {
    display: none;
}

.menu-box {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 3px solid #e94560;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    color: #fff;
    max-width: 90%;
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.4);
}

.menu-box h1 {
    font-size: 42px;
    margin-bottom: 15px;
    color: #e94560;
    text-shadow: 2px 2px 4px #000;
}

.menu-box p {
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.5;
}

.menu-box button {
    background: #e94560;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    margin: 10px;
    transition: transform 0.1s, background 0.2s;
    pointer-events: auto;
}

.menu-box button:hover {
    background: #ff6b6b;
    transform: scale(1.05);
}

.menu-box button:active {
    transform: scale(0.95);
}

.controls-info {
    margin-top: 15px;
    font-size: 14px;
    color: #aaa;
}

.controls-info p {
    margin: 5px 0;
}

#mobileControls {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    z-index: 15;
    pointer-events: none;
}

.control-row {
    display: flex;
    justify-content: space-between;
    pointer-events: auto;
}

.control-btn {
    width: 22%;
    height: 70px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.1s, transform 0.05s;
    pointer-events: auto;
}

.control-btn:active, .control-btn.active {
    background: rgba(233, 69, 96, 0.5);
    transform: scale(0.95);
}

.control-btn.gas {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
}

.control-btn.brake {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.5);
}

@media (min-width: 768px) {
    #mobileControls {
        display: none;
    }
    
    #scoreBoard {
        font-size: 18px;
        justify-content: center;
        gap: 30px;
    }
}

@media (max-width: 767px) {
    .menu-box h1 {
        font-size: 32px;
    }
    
    .menu-box p {
        font-size: 14px;
    }
    
    #scoreBoard {
        font-size: 12px;
        padding: 6px;
    }
}
