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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: #2c3e50;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.game-header {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #3498db;
    flex-wrap: wrap; /* Позволяет переносить элементы на новую строку */
    gap: 10px; /* Отступ между элементами */
}

.info-panel {
    display: flex;
    gap: 15px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    flex-wrap: wrap; /* Перенос на новую строку при необходимости */
    flex-shrink: 0; /* Не сжимается */
}

.info-panel span {
    color: #3498db;
}

.english-word-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(52, 152, 219, 0.2);
    padding: 10px 18px;
    border-radius: 25px;
    border: 2px solid #3498db;
    min-width: 180px; /* Минимальная ширина для длинных слов */
    flex: 1; /* Занимает доступное пространство */
    max-width: 380px; /* Максимальная ширина */
    flex-shrink: 1; /* Может сжиматься при необходимости */
    min-height: 45px; /* Минимальная высота для многострочного текста */
}

#english-word {
    color: white;
    font-size: clamp(16px, 3.5vw, 20px); /* Адаптивный размер шрифта, немного меньше */
    font-weight: bold;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    word-wrap: break-word; /* Перенос длинных слов */
    overflow-wrap: break-word; /* Перенос длинных слов */
    word-break: break-word; /* Перенос слов при необходимости */
    line-height: 1.3; /* Межстрочный интервал */
    max-width: 100%; /* Не больше контейнера */
    flex: 1; /* Занимает доступное пространство */
    min-width: 0; /* Позволяет сжиматься */
    text-align: center; /* Центрирование текста */
    display: inline-block; /* Позволяет тексту переноситься */
    white-space: normal; /* Разрешаем перенос строк */
}

.sound-btn {
    background: #3498db;
    border: none;
    color: white;
    font-size: 20px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sound-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.sound-btn:active {
    transform: scale(0.95);
}

.sound-btn.playing {
    background: #27ae60;
    animation: pulse-sound 0.5s ease-in-out;
}

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

.game-area {
    width: 100%;
    height: calc(100% - 80px);
    position: relative;
    background: url('background_image.jpg') center/cover no-repeat;
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 4;
}

.player {
    position: absolute;
    width: 110px;
    height: 110px;
    z-index: 10;
    transition: left 0.1s linear, top 0.1s linear;
    /* Игрок как картинка (увеличенный герой) */
    background-image: url('901787.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent;
    border-radius: 0;
    border: none;
    /* Убираем "квадрат" от box-shadow (он рисуется по прямоугольнику div).
       Вместо этого используем drop-shadow, который повторяет форму PNG по альфа-каналу. */
    box-shadow: none;
    /* Лёгкое "плавание" как у пришельцев */
    animation: monsterFloat 2s ease-in-out infinite;
    position: relative;
    overflow: visible;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.35));
}

/* Белый "туман" вокруг персонажа в стиле свечения пришельцев */
.player::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.0) 65%);
    filter: blur(4px);
    opacity: 0.8;
    pointer-events: none;
    z-index: -1;
    animation: heroFog 2.2s ease-in-out infinite alternate;
}

.player::after {
    content: none;
}

/* Анимация свечения супергероя */
@keyframes heroGlow {
    0% {
        box-shadow: 
            0 0 15px rgba(52, 152, 219, 0.8),
            0 0 25px rgba(142, 68, 173, 0.5),
            0 4px 8px rgba(0, 0, 0, 0.5),
            inset 0 -3px 8px rgba(0, 0, 0, 0.3);
    }
    100% {
        box-shadow: 
            0 0 25px rgba(52, 152, 219, 1),
            0 0 40px rgba(142, 68, 173, 0.8),
            0 0 60px rgba(241, 196, 15, 0.5),
            0 4px 8px rgba(0, 0, 0, 0.5),
            inset 0 -3px 8px rgba(0, 0, 0, 0.3);
    }
}

/* Мягкий пульсирующий "туман" вокруг героя */
@keyframes heroFog {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 0.3;
    }
}

/* Анимация символа супергероя */
@keyframes heroSymbol {
    0% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        text-shadow: 
            0 0 10px rgba(241, 196, 15, 1),
            0 0 20px rgba(241, 196, 15, 0.8),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    100% {
        transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
        text-shadow: 
            0 0 15px rgba(241, 196, 15, 1),
            0 0 30px rgba(241, 196, 15, 1),
            0 0 45px rgba(241, 196, 15, 0.6),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

/* Анимация ауры супергероя */
@keyframes heroAura {
    0%, 100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Альтернативный вариант: если есть изображение супергероя */
/* Раскомментируйте следующее и закомментируйте выше, если хотите использовать изображение: */
/*
.player {
    position: absolute;
    width: 60px;
    height: 60px;
    background: url('superhero.png') center/contain no-repeat;
    z-index: 10;
    transition: left 0.1s linear, top 0.1s linear;
    filter: drop-shadow(0 0 10px rgba(52, 152, 219, 0.8));
    animation: heroGlow 2s ease-in-out infinite alternate;
}
*/

.bullet {
    position: absolute;
    width: 10px;
    height: 20px;
    background: url('bullet.png') center/contain no-repeat;
    z-index: 5;
    /* Эффект энергии для пуль супергероя */
    filter: drop-shadow(0 0 5px rgba(241, 196, 15, 0.8)) brightness(1.3);
}

.target {
    position: absolute;
    min-width: 80px;
    min-height: 80px;
    max-width: 120px;
    max-height: 120px;
    z-index: 3;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px;
    box-sizing: border-box;
    /* Автоматическое расширение по высоте для длинного текста */
    overflow: visible;
    /* Легкое покачивание при падении */
    transform: translateX(var(--sway, 0px));
}

/* Монстр - тело */
.target::before {
    content: '👾';
    font-size: 60px;
    line-height: 1;
    text-shadow: 
        0 0 10px rgba(0, 0, 0, 0.8),
        0 4px 8px rgba(0, 0, 0, 0.6);
    animation: monsterFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
    z-index: 1;
    display: block;
    pointer-events: none;
}

/* Текст слова на монстре */
.target::after {
    content: attr(data-word);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    /* Всегда красный текст слова */
    color: #ff2d2d;
    background: rgba(0, 0, 0, 0.7);
    padding: 3px 8px;
    border-radius: 8px;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.target:hover {
    transform: translateX(var(--sway, 0px)) scale(1.1);
    z-index: 4;
}

.target:hover::before {
    animation: monsterFloat 0.5s ease-in-out infinite, monsterShake 0.3s ease-in-out infinite;
}

/* Анимация плавания монстра */
@keyframes monsterFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-5px) rotate(2deg);
    }
}

/* Анимация тряски монстра при наведении */
@keyframes monsterShake {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(-3deg);
    }
    75% {
        transform: translateY(-3px) rotate(3deg);
    }
}

/* Стили для правильных монстров (дружественные) */
.target-correct::before {
    content: '👾';
    /* Всегда "красный инопланетянин" */
    filter: drop-shadow(0 0 10px rgba(231, 76, 60, 0.9))
            drop-shadow(0 0 18px rgba(192, 57, 43, 0.75))
            brightness(1.2)
            hue-rotate(-30deg);
}

.target-correct::after {
    /* Фон/рамка остаются, но слово уже красное; можно оставить нейтральным */
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(231, 76, 60, 0.8);
}

/* Уровень 1 (обучение): подсказка — правильные цели подсвечиваются зелёным */
.target-hint-correct::before {
    filter: drop-shadow(0 0 10px rgba(46, 204, 113, 0.95))
            drop-shadow(0 0 18px rgba(39, 174, 96, 0.8))
            brightness(1.3);
}

.target-hint-correct::after {
    border: 2px solid rgba(46, 204, 113, 0.95);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.55);
    color: #a8ffbf;
}

/* Стили для неправильных монстров (враги) */
.target-wrong::before {
    /* Такой же красный инопланетянин, чтобы не различать по цвету */
    content: '👾';
    filter: drop-shadow(0 0 10px rgba(231, 76, 60, 0.9))
            drop-shadow(0 0 18px rgba(192, 57, 43, 0.75))
            brightness(1.2)
            hue-rotate(-30deg);
    animation: monsterFloat 1.8s ease-in-out infinite, monsterAngry 2s ease-in-out infinite;
}

.target-wrong::after {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(231, 76, 60, 0.8);
}

/* Анимация злого монстра */
@keyframes monsterAngry {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(231, 76, 60, 0.8)) 
                drop-shadow(0 0 15px rgba(192, 57, 43, 0.6))
                brightness(1.1) 
                hue-rotate(-30deg);
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(231, 76, 60, 1)) 
                drop-shadow(0 0 20px rgba(192, 57, 43, 0.8))
                brightness(1.3) 
                hue-rotate(-30deg);
    }
}

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

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.overlay-content h2 {
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.overlay-content p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.game-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

.game-button:active {
    transform: translateY(0);
}

.mode-selection-button {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 20px 50px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    text-align: center;
}

.mode-selection-button:hover {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.mode-selection-button:active {
    transform: translateY(-1px) scale(1.02);
}

.mode-select-wrapper {
    margin: 20px 0;
}

.mode-select-wrapper label {
    display: block;
    color: white;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.mode-select-wrapper select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid #3498db;
    background: white;
    color: #2c3e50;
    cursor: pointer;
}

.advanced-modes-section {
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
}

.advanced-mode-button {
    background: linear-gradient(135deg, #7f8c8d 0%, #95a5a6 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 25px;
    cursor: not-allowed;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
    text-align: center;
    opacity: 0.6;
    position: relative;
}

.advanced-mode-button:not(:disabled) {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    cursor: pointer;
    opacity: 1;
}

.advanced-mode-button:not(:disabled):hover {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.advanced-mode-button:not(:disabled):active {
    transform: translateY(0);
}

.advanced-mode-button .lock-icon {
    margin-right: 8px;
}

.advanced-mode-button:not(:disabled) .lock-icon {
    display: none;
}

@keyframes hit {
    0% { transform: translateX(var(--sway, 0px)) scale(1) rotate(0deg); }
    25% { transform: translateX(calc(var(--sway, 0px) - 10px)) scale(1.3) rotate(-10deg); }
    50% { transform: translateX(calc(var(--sway, 0px) + 10px)) scale(1.5) rotate(10deg); opacity: 0.5; }
    75% { transform: translateX(calc(var(--sway, 0px) - 5px)) scale(1.2) rotate(-5deg); opacity: 0.3; }
    100% { transform: translateX(var(--sway, 0px)) scale(0) rotate(0deg); opacity: 0; }
}

.target.hit {
    animation: hit 0.4s ease-out;
}

.target.hit::before {
    animation: monsterDie 0.4s ease-out forwards;
}

/* Анимация смерти монстра */
@keyframes monsterDie {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.7;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Эффект взрыва при попадании во врага */
.explosion {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 6;
    /* Яркий всплеск в тёплых цветах */
    background: radial-gradient(circle,
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 230, 150, 0.95) 25%,
        rgba(255, 160, 60, 0.85) 50%,
        rgba(255, 80, 0, 0.6) 70%,
        rgba(0, 0, 0, 0) 100%
    );
    box-shadow:
        0 0 25px rgba(255, 255, 255, 0.9),
        0 0 45px rgba(255, 160, 60, 0.7),
        0 0 65px rgba(255, 80, 0, 0.6);
    mix-blend-mode: screen;
    animation: explosionBurst 0.45s ease-out forwards;
}

@keyframes explosionBurst {
    0% {
        transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
        opacity: 1;
    }
    60% {
        transform: translate(-50%, -50%) scale(1.2) rotate(15deg);
        opacity: 0.9;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.7) rotate(30deg);
        opacity: 0;
    }
}

/* Анимация pulse убрана для лучшей читаемости длинных слов */


/* Мобильная адаптация, не меняющая оформление десктопной версии */
.mobile-controls { display: none; }

@media (max-width: 820px), (pointer: coarse) {
    html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
    body { height: 100dvh; }
    .game-container {
        width: 100%; height: 100dvh; min-height: 0;
        display: flex; flex-direction: column;
    }
    .game-header {
        flex: 0 0 auto; padding: 7px 9px;
        gap: 7px; justify-content: center; border-bottom-width: 2px;
    }
    .info-panel {
        width: 100%; justify-content: space-around; gap: 5px;
        font-size: clamp(11px, 3vw, 14px);
    }
    .english-word-display {
        min-width: 0; max-width: none; width: 100%; flex: 1 1 100%;
        padding: 5px 10px; min-height: 38px;
    }
    #english-word { font-size: clamp(15px, 4.5vw, 20px); }
    .sound-btn { min-width: 36px; width: 36px; height: 36px; flex-shrink: 0; }
    .game-area { height: auto; min-height: 0; flex: 1 1 auto; }
    .player { width: 60px; height: 60px; }
    .target::before { font-size: clamp(38px, 10vw, 60px); }
    .target::after {
        font-size: 11px; max-width: min(120px, 30vw);
        white-space: normal; overflow-wrap: anywhere;
        bottom: -18px; line-height: 1.05;
    }
    .game-overlay { padding: 8px; overflow-y: auto; align-items: safe center; }
    .overlay-content {
        width: min(100%, 460px); max-height: calc(100dvh - 16px);
        overflow-y: auto; overscroll-behavior: contain;
        padding: 16px 14px; border-radius: 12px;
    }
    .overlay-content h2 { font-size: clamp(19px, 5vw, 25px); margin-bottom: 10px; }
    .overlay-content p { font-size: 13px; line-height: 1.3; margin-bottom: 12px; }
    .mode-select-wrapper { margin: 10px 0; }
    .mode-select-wrapper select { padding: 10px; }
    .advanced-modes-section { padding-top: 9px; }
    #advancedModesSection { margin-top: 10px !important; }
    #advancedModesTitle { font-size: 16px !important; margin-bottom: 7px !important; }
    .advanced-mode-button { padding: 10px 12px; font-size: 15px; }
    .game-button { padding: 12px 22px; font-size: 17px; margin-top: 9px; max-width: 100%; }
    .mobile-help { color: #a8e6ff; }

    .mobile-controls {
        position: absolute; display: flex; z-index: 40;
        align-items: end; justify-content: space-between;
        left: 0; right: 0; bottom: 0;
        padding: 4px max(10px, env(safe-area-inset-right))
                 max(12px, env(safe-area-inset-bottom))
                 max(10px, env(safe-area-inset-left));
        pointer-events: none;
    }
    .mobile-dpad {
        display: grid; grid-template-columns: repeat(3, 48px);
        grid-template-rows: repeat(2, 47px); gap: 3px;
    }
    .control-btn {
        pointer-events: auto; touch-action: none; user-select: none;
        -webkit-user-select: none; -webkit-touch-callout: none;
        border: 1px solid rgba(255,255,255,.6); border-radius: 13px;
        background: rgba(24,43,70,.78); color: white;
        font-size: 20px; font-weight: 800;
        min-width: 44px; min-height: 44px;
        box-shadow: 0 3px 12px rgba(0,0,0,.3);
    }
    .control-btn:active, .control-btn.pressed { background: rgba(52,152,219,.98); }
    .control-up { grid-column: 2; grid-row: 1; }
    .control-left { grid-column: 1; grid-row: 2; }
    .control-down { grid-column: 2; grid-row: 2; }
    .control-right { grid-column: 3; grid-row: 2; }
    .mobile-fire {
        border-radius: 50%; width: 87px; height: 87px;
        background: rgba(207, 55, 55, .88); font-size: 16px;
        display: flex; align-items: center; flex-direction: column;
        justify-content: center; gap: 2px;
    }
    .mobile-fire span { font-size: 15px; }
    .mobile-fire:active, .mobile-fire.pressed { background: #f44336; }
}
@media (max-width: 360px) {
    .mobile-dpad { grid-template-columns: repeat(3,44px); grid-template-rows: repeat(2,44px); }
    .mobile-fire { height: 73px; width: 73px; }
}
@media (max-height: 590px) and (orientation: landscape) {
    .game-header { flex-wrap: nowrap; }
    .info-panel { width: auto; flex: 1; }
    .english-word-display { flex: 1; width: auto; }
    .mobile-dpad { grid-template-columns: repeat(3,44px); grid-template-rows: repeat(2,44px); }
    .mobile-fire { height: 74px; width: 74px; }
}

/* Mobile menu fix: independent document-like scrolling and tappable primary action. */
@media (max-width: 820px), (pointer: coarse) {
  .game-overlay:not(.hidden) {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) 12px max(24px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    z-index: 1000;
  }
  .game-overlay .overlay-content {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 460px;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: 16px 12px 22px;
    touch-action: pan-y;
  }
  .game-overlay .game-button {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    min-height: 52px;
    margin: 12px auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255,255,255,.2);
  }
  .game-overlay .game-button[style*="display: none"] { display: none !important; }
  .game-overlay select, .game-overlay button { touch-action: manipulation; }
}

/* Mobile menu v3: keep start action in sight and ensure native touch scrolling. */
@media (max-width: 820px), (pointer: coarse) {
  #gameOverlay:not(.hidden) {
    position: fixed !important; inset: 0 !important;
    display: block !important;
    width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    overflow-x: hidden !important; overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding: max(10px, env(safe-area-inset-top)) 10px max(28px, env(safe-area-inset-bottom)) !important;
    z-index: 99999 !important;
  }
  #gameOverlay .overlay-content {
    display: block !important; position: relative !important;
    box-sizing: border-box !important; width: 100% !important; max-width: 470px !important;
    height: auto !important; min-height: 0 !important; max-height: none !important;
    overflow: visible !important; margin: 0 auto !important;
    padding: 16px 14px 22px !important; transform: none !important;
  }
  #gameOverlay .overlay-content h2 { font-size: 20px !important; line-height: 1.2 !important; margin: 0 0 10px !important; }
  #gameOverlay #overlayMessage { font-size: 12px !important; line-height: 1.35 !important; margin: 10px 0 !important; }
  #gameOverlay .mobile-menu-actions { display: flex !important; flex-direction: column; align-items: center; gap: 4px; }
  #gameOverlay .mobile-menu-actions .game-button {
    display: block !important; width: 100% !important; min-height: 56px !important;
    margin: 2px 0 !important; position: relative !important; z-index: 2 !important;
    touch-action: manipulation !important;
  }
  #gameOverlay .mobile-menu-actions span { color: #eef; font-size: 12px; }
  #gameOverlay #startButton { display: none !important; }
  #gameOverlay .mode-select-wrapper { margin: 10px 0 !important; }
}
@media (min-width: 821px) and (pointer: fine) { .mobile-menu-actions {display:none;} }
