html, body {
    margin: 0; 
    padding: 0; 
    width: 100%; 
    height: 100%; 
    position: fixed; 
    inset: 0; 
    overflow: hidden;
    background-color: #11151c; 
    font-family: Arial, sans-serif;
    touch-action: none; user-select: none; 
    -webkit-user-select: none;
}
#loadingOverlay {
    position: fixed; 
    inset: 0;
    background: #1a1a1a; 
    z-index: 3000; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    color: white;
}
#menuOverlay {
    position: fixed; 
    inset: 0;
    background: rgba(0,0,0,0.85); 
    z-index: 2000;
    display: none; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    color: white;
}
#menuOverlay h1 { 
    font-size: 3rem; 
    margin-bottom: 10px; 
    text-align: center; 
}
#menuOverlay button { 
    margin: 10px; 
    padding: 12px 24px; 
    font-size: 1.2rem; 
    cursor: pointer; 
    background: #2196F3; 
    color: white; 
    border: none; 
    border-radius: 5px; 
}
        
#gameWrapper {
    position: absolute; 
    inset: 0; 
    width: 100%; 
    height: 100%;
    display: flex; 
    justify-content: center; 
    align-items: stretch; 
    background: #0d1117;
}
#gameCanvas {
    display: block; 
    width: 100%; 
    max-width: 800px; 
    height: 100%;
    background: #1a1a1a;
    box-shadow: 0 0 40px rgba(0,0,0,0.9);
}
        
/* Верхняя панель HUD с учетом выреза экрана (safe-area) */
#hudData {
    position: absolute; 
    top: calc(10px + env(safe-area-inset-top, 0px)); 
    left: 10px;
    right: 10px; 
    max-width: 780px; 
    margin: 0 auto;
    color: white; 
    font-weight: bold; 
    font-size: 15px; 
    z-index: 100; 
    text-shadow: 1px 1px 3px black;
    display: flex; 
    flex-wrap: wrap; 
    justify-content: space-between; 
    gap: 6px; 
    pointer-events: none;
}
    .hud-item { 
        background: rgba(0,0,0,0.55); 
        padding: 6px 10px; 
        border-radius: 6px; 
        pointer-events: auto; 
}
.back-btn { 
    color: white; 
    text-decoration: none; 
    font-weight: bold; 
}
        
/* Графический спидометр внизу экрана */
#speedometerWidget {
    position: absolute;
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 150px;
    background-image: url('../images/speedometer.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    pointer-events: none;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}
#hudSpeedVal {
    color: #ffffff;
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 6px rgba(0,0,0,0.9);
    margin-top: 10px;
}
#hudSpeedUnit {
    color: #f1c40f;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    margin-top: 2px;
}

#pauseOverlay, #gameOverOverlay {
    display: none; 
    position: absolute; 
    inset: 0;
    background: rgba(0,0,0,0.75); 
    z-index: 1000; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    color: white;
}