* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow: hidden;
    background-color: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* === СТАРТОВЫЙ ЭКРАН И ОВЕРЛЕИ === */
#startScreen, .overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 5vmin; /* Отступы от краев */
}

#startScreen {
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.9));
}

.overlay-screen {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    color: white;
}

/* === ТИПОГРАФИКА (Адаптивная) === */
h1 {
    font-size: 8vmin; /* Размер зависит от меньшей стороны экрана */
    line-height: 1.2;
    margin-bottom: 2vmin;
    text-align: center;
    text-transform: uppercase;
}

#startScreen h1 {
    color: #f1c40f;
    font-size: 9vmin; /* Чуть крупнее для главного заголовка */
    text-shadow: 0 0.5vmin 1.5vmin rgba(0,0,0,0.5);
}

p {
    font-size: 4vmin;
    margin-bottom: 4vmin;
    color: #eee;
    text-align: center;
    max-width: 90%;
    line-height: 1.4;
}

/* === КНОПКИ МЕНЮ (Адаптивные) === */
button {
    padding: 2.5vmin 8vmin;
    font-size: 4.5vmin;
    font-weight: bold;
    color: white;
    background-color: #2ed573;
    border: none;
    border-radius: 6vmin;
    cursor: pointer;
    margin-top: 2vmin;
    text-transform: uppercase;
    box-shadow: 0 1vmin 2vmin rgba(46, 213, 115, 0.3);
    transition: all 0.2s;
    outline: none;
}

button:hover {
    background-color: #26de81;
    transform: scale(1.05) translateY(-0.2vmin);
    box-shadow: 0 1.5vmin 2.5vmin rgba(46, 213, 115, 0.4);
}

button:active {
    transform: scale(0.95);
}

/* === HUD (ИНТЕРФЕЙС В ИГРЕ) === */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    padding: 2vmin 3vmin;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 100;
}

.hud-item {
    color: white;
    font-size: 3.5vmin; /* Текст HUD масштабируется */
    font-weight: bold;
    text-shadow: 0.2vmin 0.2vmin 0.4vmin rgba(0, 0, 0, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 15vmin; /* Чтобы блоки не наезжали при совсем узком экране */
}

/* Правый блок выравниваем вправо */
.hud-item:last-child {
    align-items: flex-end; 
}

/* Левый блок выравниваем влево */
.hud-item:first-child {
    align-items: flex-start;
}

/* Подписи (Time, Score) */
.hud-item span {
    white-space: nowrap; /* Запрет переноса строк */
}

.hud-item div {
    margin-top: 0.5vmin;
}

/* Бар турбо-ускорения */
#turbo-container {
    width: 15vmin;
    height: 1.5vmin;
    background-color: #333;
    border: 0.2vmin solid #fff;
    border-radius: 1vmin;
    margin-top: 1vmin;
    overflow: hidden;
}

#turbo-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #f1c40f, #e67e22);
    transition: width 0.1s linear;
}

/* Кнопка звука */
#muteBtn {
    pointer-events: auto; 
    cursor: pointer;
    font-size: 5vmin;
    margin-top: 1vmin;
    transition: transform 0.2s;
    text-shadow: none;
    filter: drop-shadow(0.2vmin 0.2vmin 0.4vmin rgba(0,0,0,0.8));
}

#muteBtn:hover {
    transform: scale(1.2);
}

/* === МОБИЛЬНОЕ УПРАВЛЕНИЕ === */
#mobile-controls {
    position: absolute;
    bottom: 5vmin; /* Отступ снизу в % */
    left: 0;
    width: 100%;
    padding: 0 5vmin;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 100;
}

#btn-left, #btn-right {
    pointer-events: auto;
    width: 18vmin;  /* Кнопки теперь зависят от размера экрана */
    height: 18vmin;
    background-color: rgba(255, 255, 255, 0.15);
    border: 0.3vmin solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 8vmin; /* Стрелка внутри */
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    margin: 0;
    padding: 0;
    box-shadow: 0 1vmin 3vmin rgba(0,0,0,0.3);
    transition: background-color 0.1s, transform 0.1s;
}

#btn-left:hover, #btn-right:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: none;
    box-shadow: 0 1vmin 3vmin rgba(0,0,0,0.3);
}

#btn-left:active, #btn-right:active {
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(0.9);
}

/* === ЭКРАН ЗАГРУЗКИ === */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    color: white;
}

#loading-screen h1 {
    font-size: 6vmin;
    margin-bottom: 2vmin;
}

#progress-container {
    width: 40vmin; /* Ширина бара загрузки адаптивна */
    height: 2.5vmin;
    background-color: #333;
    border-radius: 2vmin;
    border: 0.3vmin solid #555;
    margin-top: 2vmin;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: #2ed573;
}

.hidden {
    display: none !important;
}

/* === ДОПОЛНИТЕЛЬНЫЕ УЛУЧШЕНИЯ ДЛЯ ЦВЕТОВ ЗАГОЛОВКОВ === */
#crashTitle { color: orange; }
#levelCompTitle { color: #2ed573; }
#gameOverTitle { color: #ff4757; }

body.ad-active .overlay-screen,
body.ad-active #hud,
body.ad-active #mobile-controls,
body.ad-active #startScreen {
    display: none !important;
}

/* ... Ваш существующий код ... */

/* === ВАЖНО: ПРИНУДИТЕЛЬНО ПОКАЗЫВАЕМ РЕКЛАМУ ПОВЕРХ ВСЕГО === */
#gamemonetize-video {
    position: fixed !important;
    z-index: 999999 !important; /* Самый высокий приоритет */
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* Гарантируем, что при активной рекламе интерфейс точно скрыт */
body.ad-active .overlay-screen,
body.ad-active #hud,
body.ad-active #mobile-controls,
body.ad-active #startScreen,
body.ad-active #loading-screen {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}