/* app.css — добавлены правила для блокировки скролла/overscroll и для глобального загрузочного оверлея */

/* Глобальная блокировка скролла и overscroll */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
    -ms-scroll-chaining: none;
    touch-action: none;
}

/* Защита для игровых элементов */
.game-container, .game-wrapper, #gameCanvas,
.modal-overlay, .modal-content,
.music-button-overlay, .music-button-content {
    user-select: none !important;
    -webkit-user-select: none !important;
    -ms-user-select: none !important;
    -moz-user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-drag: none !important;
    overscroll-behavior: none !important;
    touch-action: none !important;
}

/* Глобальный загрузочный оверлей (показывается до полной готовности ассетов и SDK) */
.global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(10,10,15,0.95), rgba(25,25,35,0.95));
    color: #fff;
    flex-direction: column;
    gap: 18px;
    pointer-events: all;
}

    .global-loading-overlay .spinner {
        width: 64px;
        height: 64px;
        border: 6px solid rgba(255,255,255,0.18);
        border-top-color: #ffffff;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    .global-loading-overlay .loading-text {
        font-size: 1.05rem;
        opacity: 0.95;
        text-align: center;
    }

/* Остальной ваш CSS (копия ранее использовавшегося) */

.game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: url('../images/sky.jpg') center/cover no-repeat;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 800 / 600;
}

@media (orientation: portrait) and (max-width: 600px) {
    .game-wrapper {
        aspect-ratio: 9 / 16;
    }
}

#gameCanvas {
    width: 100%;
    border: 2px solid black;
    background-color: rgba(255, 255, 255, 0.45);
    display: block;
    touch-action: none;
}

/* UI и прочее (копия) */

.game-ui {
    text-align: center;
    color: white;
    text-shadow: 1px 1px 3px black;
    width: 100%;
    padding: 1vh 0;
    box-sizing: border-box;
    font-size: clamp(0.8rem, 3vh, 1.5rem);
}

/* Стили для кнопки запуска музыки */
.music-button-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.music-button-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

    .music-button-content h2 {
        margin: 0 0 15px 0;
        font-size: 2rem;
    }

    .music-button-content p {
        margin: 0 0 25px 0;
        font-size: 1.1rem;
        opacity: 0.9;
    }

.music-start-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

    .music-start-btn:hover {
        background: #ff5252;
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.6);
    }

    .music-start-btn:active {
        transform: translateY(0);
    }

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom));
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: linear-gradient(180deg, #ffffff, #fafafa);
    color: #111;
    border-radius: 12px;
    padding: 16px;
    box-sizing: border-box;
    text-align: center;
    width: min(92%, 420px);
    max-height: calc(100vh - 48px);
    overflow: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.btn {
    padding: 10px 14px;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}
