/* Глобальные стили для отключения выделения и контекстного меню */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

/* Предотвращаем горизонтальную прокрутку */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Дополнительная защита от контекстного меню */
html, body {
    -webkit-context-menu: none;
    -moz-context-menu: none;
    context-menu: none;
}

/* Гарантия отображения фона */
html {
    background: linear-gradient(135deg, #f8b195, #f67280, #c06c84, #6c5b7b, #355c7d);
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    min-height: 100vh;
    overflow: hidden;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
    /* Дополнительная защита от выделения на мобильных */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Разрешаем выделение только для кнопок и интерактивных элементов */
button, input, textarea, select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Дополнительная защита от выделения для всех игровых элементов */
.character, .powerup, .game-info, .score-container, .coins-container, .next-container {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-context-menu: none;
    -moz-context-menu: none;
    context-menu: none;
    touch-action: manipulation;
}

/* Дополнительная защита для всех дочерних элементов игрового контейнера */
#game-container * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-context-menu: none;
    -moz-context-menu: none;
    context-menu: none;
    touch-action: manipulation;
}

/* Разрешаем выделение только для элементов управления внутри игрового контейнера */
#game-container input[type="range"],
#game-container button,
#game-container select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
    -webkit-tap-highlight-color: auto;
    touch-action: auto;
}

/* Отключаем контекстное меню для всех кнопок */
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Основные стили страницы */
body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #f8b195, #f67280, #c06c84, #6c5b7b, #355c7d);
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    width: 100vw;
    min-height: 100vh;
    max-width: 100vw;
    box-sizing: border-box;
    /* Дополнительная защита от выделения на мобильных */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Loading overlay */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #fff;
    font-weight: bold;
    font-size: 16px;
}

/* Контейнер для масштабирования всего контента */
.scale-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transform-origin: top center;
    transition: transform 0.3s ease;
    padding: 10px 0;
    overflow: hidden; /* Скрываем выходящий за границы контент */
    max-width: 100vw; /* Ограничиваем максимальную ширину */
    box-sizing: border-box;
    /* Дополнительная защита от выделения на мобильных */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

h1 {
    margin: 7px 0;
    font-size: 16px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Игровой контейнер в виде вольера/аквариума */
#game-container {
    background: linear-gradient(to bottom, #dbe9f4 0%, #b0bec5 100%);
    border-left: 7px solid #37474f;
    border-right: 7px solid #37474f;
    border-bottom: 8px solid #263238;
    border-top: none;
    box-shadow: inset 0 -7px 13px rgba(0,0,0,0.4);
    width: 520px; /* Постоянная ширина для ПК */
    height: 600px; /* Постоянная высота для ПК */
    position: relative;
    overflow: visible; /* Разрешаем персонажам выходить сверху контейнера */
    touch-action: manipulation;
    margin: 10px auto; /* Центрируем контейнер */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    /* Дополнительная защита от выделения и контекстного меню на мобильных */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-context-menu: none;
    -moz-context-menu: none;
    context-menu: none;
    /* Предотвращение масштабирования на мобильных */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;

    /* Стилизация под вольер с сетчатой клеткой */
    background-color: rgba(230, 230, 230, 0.2);
    border-left: 7px solid #8B4513; /* Коричневый цвет рамки */
    border-right: 7px solid #8B4513;
    border-bottom: 7px solid #8B4513;
    border-top: none; /* Убираем верхнюю границу */
    border-radius: 0 0 10px 10px; /* Скругление только снизу */
    box-shadow: 0 7px 17px rgba(0, 0, 0, 0.4);

    /* Сетчатый фон */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 13px 13px;

    /* Внутренняя тень для объема */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Добавление деревянных планок сверху и снизу */


/* Горизонтальная линия для движения (на верхнем крае контейнера) */
.movement-line {
    position: absolute;
    top: 0px;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, transparent, #00ff00, transparent);
    z-index: 20;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.9);
    border-radius: 3px;
}

/* Индикатор позиции на линии движения */
.movement-indicator {
    position: absolute;
    top: 0px;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #00ff00, #008000);
    border: 4px solid #fff;
    border-radius: 50%;
    z-index: 25;
    transform: translateX(-50%);
    box-shadow: 0 0 20px rgba(0, 255, 0, 1);
    transition: left 0.1s ease-out;
}

/* Анимация пульсации индикатора */
.movement-indicator::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, rgba(0, 255, 0, 0.3), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Стили персонажей - без границ */
.character {
    position: absolute;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.2s;
    z-index: 10;
    /* Добавляем небольшую тень для лучшей видимости на сетчатом фоне */
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.3));
    /* Предотвращаем выход за границы контейнера */
    max-width: 100%;
    max-height: 100%;
    pointer-events: none; /* Предотвращаем взаимодействие с персонажами */
}

.character.falling {
    transition: none;
}

.character.new {
    animation: popIn 0.3s forwards;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Интерфейс счета и следующего персонажа */
.score-container {
    margin: 10px 0;
    font-size: 13px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background-color: #A0522D; /* Подходит под стиль деревянного вольера */
    padding: 8px 13px;
    border-radius: 33px;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    min-width: 120px;
    border: 1px solid #8B4513;
    white-space: nowrap;
}

.score-container span {
    display: inline;
    align-items: center;
}

.score-container .current-score {
    color: #FFD700; /* Золотой цвет для текущего счета */
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.score-container {
    color: #FFD700; /* Цвет для разделителя "/" */
}

.score-container .best-score {
    color: #FFA500; /* Оранжевый цвет для лучшего счета */
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-size: 11px;
    animation: bestScoreGlow 2s ease-in-out infinite alternate;
    margin-left: 2px;
}

@keyframes bestScoreGlow {
    0% {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
    100% {
        text-shadow: 0 0 10px rgba(255, 165, 0, 0.8), 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
}

/* Стили для контейнера усилений */
.powerups-container {
    position: fixed;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.powerup {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(145deg, #A0522D, #8B4513);
    padding: 8px;
    border-radius: 5px; /* Скругленные углы */
    border: 1px solid #654321;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 57px;
    height: 57px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.powerup::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.powerup:hover::before {
    left: 100%;
}

.powerup:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: linear-gradient(145deg, #B8860B, #A0522D);
    border-color: #8B4513;
}

.powerup:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.powerup.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(145deg, #6C757D, #5A6268);
    border-color: #495057;
    transform: none;
}

.powerup.disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.powerup.disabled::before {
    display: none;
}

.powerup-icon {
    width: 19px;
    height: 19px;
    margin-bottom: 4px;
    filter: brightness(1.1) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
    object-fit: contain;
    transition: transform 0.2s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

.powerup:hover .powerup-icon {
    transform: scale(1.1);
}

.powerup-name {
    font-size: 7px;
    font-weight: bold;
    color: white;
    text-align: center;
    margin-bottom: 2px;
    line-height: 1.1;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
}

.powerup-cost {
    font-size: 7px;
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    background: rgba(0, 0, 0, 0.2);
    padding: 1px 4px;
    border-radius: 7px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Стили для контейнера монеток */
.coins-container {
    margin: 10px 0;
    font-size: 13px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #DAA520; /* Золотой цвет для монеток */
    padding: 7px 11px;
    border-radius: 33px;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    min-width: 67px;
    border: 1px solid #B8860B;
}

.daily-reward-btn {
    background: linear-gradient(145deg, #28a745, #218838);
    color: #fff;
    border: 1px solid #1e7e34;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-weight: bold;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
.daily-reward-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .daily-reward-btn {
        padding: 6px 8px;
        font-size: 10px;
        min-width: 60px;
        flex: 1;
        max-width: 80px;
    }
}

.coins-container .coin-icon {
    width: 13px;
    height: 13px;
    margin-right: 5px;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.5));
    animation: coinIconGlow 2s ease-in-out infinite alternate;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

.coins-container .coins {
    color: #FFD700; /* Яркий золотой цвет для монеток */
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    animation: coinsGlow 1.5s ease-in-out infinite alternate;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

@keyframes coinsGlow {
    0% {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
    100% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.9), 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
}

@keyframes coinIconGlow {
    0% {
        filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.5));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
        transform: scale(1.05);
    }
}

.next-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 7px 0;
    background-color: #A0522D; /* Подходит под стиль деревянного вольера */
    padding: 7px;
    border-radius: 7px;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid #8B4513;
}

#next-character {
    width: 33px;
    height: 33px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-left: 7px;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.3));
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 520px; /* Постоянная ширина, соответствующая контейнеру */
    margin: 0 auto; /* Центрируем */
}



.level-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12px;
    font-weight: bold;
    /* Убираем границы */
}



/* Экран конца игры */
#game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

#game-over.show {
    opacity: 1;
    pointer-events: auto;
}

#game-over h2 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
    font-weight: bold;
}

#game-over p {
    font-size: 28px;
    margin-bottom: 20px;
    color: #f8b195;
    text-shadow: 0 0 10px rgba(248, 177, 149, 0.6);
}

#game-over p:last-of-type {
    margin-bottom: 40px;
    color: #FFA500;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 165, 0, 0.8);
}

#game-over .final-current-score {
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

#game-over .final-best-score {
    color: #FFA500;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 165, 0, 0.8);
    animation: finalBestScoreGlow 2s ease-in-out infinite alternate;
}

@keyframes finalBestScoreGlow {
    0% {
        text-shadow: 0 0 15px rgba(255, 165, 0, 0.8);
    }
    100% {
        text-shadow: 0 0 25px rgba(255, 165, 0, 1), 0 0 15px rgba(255, 165, 0, 0.8);
    }
}

#game-over .final-coin-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.6));
    animation: finalCoinIconGlow 2s ease-in-out infinite alternate;
}

#game-over .final-coins {
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    animation: finalCoinsGlow 1.5s ease-in-out infinite alternate;
}

@keyframes finalCoinsGlow {
    0% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
    100% {
        text-shadow: 0 0 25px rgba(255, 215, 0, 1), 0 0 15px rgba(255, 215, 0, 0.8);
    }
}

@keyframes finalCoinIconGlow {
    0% {
        filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.6));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.9));
        transform: scale(1.1);
    }
}

/* Анимация тряски контейнера */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Анимация тряски персонажей */
@keyframes characterShake {
    0%, 100% { transform: translateX(0) translateY(0); }
    10% { transform: translateX(-3px) translateY(-2px); }
    20% { transform: translateX(3px) translateY(2px); }
    30% { transform: translateX(-2px) translateY(-1px); }
    40% { transform: translateX(2px) translateY(1px); }
    50% { transform: translateX(-1px) translateY(-1px); }
    60% { transform: translateX(1px) translateY(1px); }
    70% { transform: translateX(-1px) translateY(0); }
    80% { transform: translateX(1px) translateY(0); }
    90% { transform: translateX(0) translateY(0); }
}

/* Стили для уведомлений */
.game-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #A0522D, #8B4513);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    font-weight: bold;
    font-size: 14px;
    animation: notificationSlideIn 0.3s ease-out;
}

@keyframes notificationSlideIn {
    0% {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Эффект удаления персонажа */
.delete-effect {
    position: absolute;
    background: radial-gradient(circle, #ff4444, #cc0000);
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    animation: deleteAnimation 0.6s ease-out;
}

@keyframes deleteAnimation {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.revive-button {
    background: linear-gradient(145deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 140px;
    justify-content: center;
}

.revive-icon {
    font-size: 20px;
    animation: filmReel 2s ease-in-out infinite;
    filter: drop-shadow(0 0 5px rgba(255, 165, 0, 0.8));
}

@keyframes filmReel {
    0%, 100% {
        transform: rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: rotate(180deg);
        opacity: 1;
    }
    75% {
        transform: rotate(270deg);
        opacity: 0.8;
    }
}

.revive-reward {
    font-size: 12px;
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.revive-button:hover {
    background: linear-gradient(145deg, #f1c40f, #f39c12);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.revive-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.revive-button.disabled {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
    cursor: not-allowed;
    opacity: 0.6;
}

.revive-button.disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}



#restart-button {
    padding: 16px 32px;
    font-size: 20px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    border: 3px solid #ff4757;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#restart-button:hover {
    background: linear-gradient(135deg, #ff4757, #ff3742);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

/* Эффекты игры */
.merge-effect {
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 70%);
    animation: mergeAnimation 0.6s forwards;
    z-index: 5;
    pointer-events: none;
}

@keyframes mergeAnimation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

#level-up {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: bold;
    color: gold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    opacity: 0;
    z-index: 100;
}

#level-up.show {
    animation: levelUpAnimation 1.5s forwards;
}

@keyframes levelUpAnimation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    /* Контейнер меньшего размера для мобильных устройств */
    #game-container {
        width: 350px; /* Меньшая ширина для телефонов */
        height: 450px; /* Меньшая высота для телефонов */
        margin: 8px auto; /* Центрируем с меньшим отступом */
    }
    
    .game-info {
        width: 350px; /* Соответствует ширине контейнера */
        margin: 0 auto;
    }
    
    h1 {
        font-size: 14px;
        margin: 6px 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 200px);
        margin-left: 60px;
        box-sizing: border-box;
    }
    
    .game-header {
        margin-top: 0;
        margin-bottom: 10px;
    }
    
    .game-info {
        margin-top: 15px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 15px;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0 10px;
    }
    
    .score-container {
        font-size: 14px;
        padding: 6px 10px;
        min-width: 100px;
        flex-direction: row;
        flex: 1;
        max-width: 120px;
    }
    
    .score-container .best-score {
        font-size: 12px;
        margin-left: 2px;
    }
    
    .coins-container {
        font-size: 14px;
        padding: 6px 8px;
        min-width: 60px;
        flex: 1;
        max-width: 80px;
    }
    
    .coins-container .coin-icon {
        width: 14px;
        height: 14px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }
    
    /* Перемещаем кнопки усилений под игровое поле */
    .powerups-container {
        position: static;
        transform: none;
        flex-direction: row;
        gap: 8px;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.2);
        padding: 8px;
        border-radius: 10px;
        backdrop-filter: blur(5px);
        margin: 10px auto;
        width: 90%;
        max-width: 400px;
        justify-content: center;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .powerup {
        width: 50px;
        height: 50px;
        padding: 6px;
    }
    
    .powerup-icon {
        width: 16px;
        height: 16px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }
    
    .powerup-name {
        font-size: 6px;
    }
    
    .powerup-cost {
        font-size: 6px;
        padding: 1px 2px;
    }
    
    .next-container {
        padding: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .next-container span {
        display: none; /* Скрываем текст "Следующий" */
    }
    
    #next-character {
        width: 35px;
        height: 35px;
        margin: 0;
    }
    
    /* Контейнер теперь имеет постоянный размер */
    
    .movement-line {
        top: 0px;
        height: 5px;
    }
    
    .movement-indicator {
        top: 0px;
        width: 26px;
        height: 26px;
    }
}

@media (max-width: 480px) {
    /* Контейнер еще меньшего размера для маленьких экранов */
    #game-container {
        width: 300px; /* Еще меньшая ширина для маленьких телефонов */
        height: 400px; /* Еще меньшая высота для маленьких телефонов */
        margin: 6px auto; /* Центрируем с минимальным отступом */
    }
    
    .game-info {
        width: 300px; /* Соответствует ширине контейнера */
        margin: 0 auto;
    }
    
    h1 {
        font-size: 12px;
        margin: 4px 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 180px);
        margin-left: 50px;
    }
    
    .game-header {
        margin-top: 0;
        margin-bottom: 8px;
    }
    
    .game-info {
        margin-top: 12px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        margin-bottom: 12px;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100%;
    }
    
    .score-container {
        font-size: 12px;
        padding: 4px 8px;
        min-width: 80px;
        flex: 1;
        max-width: 100px;
    }
    
    .score-container .best-score {
        font-size: 10px;
        margin-left: 2px;
    }
    
    .coins-container {
        font-size: 12px;
        padding: 4px 6px;
        min-width: 50px;
        flex: 1;
        max-width: 70px;
    }
    
    .coins-container .coin-icon {
        width: 12px;
        height: 12px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }
    
    /* Перемещаем кнопки усилений вниз экрана */
    .powerups-container {
        position: static;
        transform: none;
        flex-direction: row;
        gap: 6px;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.2);
        padding: 6px;
        border-radius: 8px;
        backdrop-filter: blur(5px);
        margin: 8px auto;
        width: 90%;
        max-width: 350px;
        justify-content: center;
    }
    
    .powerup {
        width: 45px;
        height: 45px;
        padding: 5px;
    }
    
    .powerup-icon {
        width: 14px;
        height: 14px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }
    
    .powerup-name {
        font-size: 6px;
    }
    
    .powerup-cost {
        font-size: 5px;
        padding: 1px 2px;
    }
    
    .next-container {
        padding: 3px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .next-container span {
        display: none; /* Скрываем текст "Следующий" */
    }
    
    .daily-reward-btn {
        padding: 4px 6px;
        font-size: 9px;
        min-width: 50px;
        flex: 1;
        max-width: 60px;
    }
    
    #next-character {
        width: 30px;
        height: 30px;
        margin: 0;
    }
    
    /* Контейнер теперь имеет постоянный размер */
    
    .movement-line {
        top: 0px;
        height: 4px;
    }
    
    .movement-indicator {
        top: 0px;
        width: 22px;
        height: 22px;
    }
    
    /* Стили для экрана поражения на экранах 480px */
    #game-over {
        padding: 15px;
        box-sizing: border-box;
        justify-content: flex-start;
        padding-top: 20vh;
    }
    
    #game-over h2 {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    #game-over p {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    #game-over p:last-of-type {
        margin-bottom: 20px;
    }
    

    
    /* Адаптивные стили для экрана проигрыша */
    #game-over h2 {
        font-size: 36px;
    }
    
    #game-over p {
        font-size: 22px;
    }
    
    .game-over-buttons {
        gap: 10px;
        flex-direction: column;
    }
    
    .revive-button {
        padding: 12px 20px;
        font-size: 14px;
        min-width: 120px;
    }
    
    .revive-icon {
        font-size: 18px;
    }
    

    
    .game-over-buttons {
        gap: 8px;
        flex-direction: column;
    }
    
    .revive-button {
        padding: 10px 16px;
        font-size: 12px;
        min-width: 100px;
    }
    
    .revive-icon {
        font-size: 16px;
    }
    

    
    #restart-button {
        padding: 14px 28px;
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    /* Контейнер минимального размера для очень маленьких экранов */
    #game-container {
        width: 280px; /* Минимальная ширина для очень маленьких телефонов */
        height: 380px; /* Минимальная высота для очень маленьких телефонов */
        margin: 5px auto; /* Центрируем с минимальным отступом */
    }
    
    .game-info {
        width: 280px; /* Соответствует ширине контейнера */
        margin: 0 auto;
    }
    
    h1 {
        font-size: 10px;
        margin: 3px 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 160px);
        margin-left: 40px;
    }
    
    .game-header {
        margin-top: 0;
        margin-bottom: 6px;
    }
    
    .game-info {
        margin-top: 10px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
        margin-bottom: 10px;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100%;
    }
    
    .score-container {
        font-size: 10px;
        padding: 3px 6px;
        min-width: 70px;
        flex-direction: row;
        flex: 1;
        max-width: 80px;
    }
    
    .score-container .best-score {
        font-size: 8px;
        margin-left: 2px;
    }
    
    .coins-container {
        font-size: 10px;
        padding: 3px 5px;
        min-width: 40px;
        flex: 1;
        max-width: 60px;
    }
    
    .coins-container .coin-icon {
        width: 10px;
        height: 10px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }
    
    /* Скрываем линию с персонажами на телефонах */
    /* Перемещаем кнопки усилений вниз экрана */
    .powerups-container {
        position: static;
        transform: none;
        flex-direction: row;
        gap: 4px;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.2);
        padding: 4px;
        border-radius: 6px;
        backdrop-filter: blur(5px);
        margin: 6px auto;
        width: 90%;
        max-width: 300px;
        justify-content: center;
    }
    
    .powerup {
        width: 40px;
        height: 40px;
        padding: 4px;
    }
    
    .powerup-icon {
        width: 12px;
        height: 12px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }
    
    .powerup-name {
        font-size: 5px;
    }
    
    .powerup-cost {
        font-size: 4px;
        padding: 1px 2px;
    }
    
    .next-container {
        padding: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .next-container span {
        display: none; /* Скрываем текст "Следующий" */
    }
    
    .daily-reward-btn {
        padding: 3px 5px;
        font-size: 8px;
        min-width: 40px;
        flex: 1;
        max-width: 50px;
    }
    
    #next-character {
        width: 25px;
        height: 25px;
        margin: 0;
    }
    
    /* Контейнер теперь имеет постоянный размер */
    
    .movement-line {
        top: 0px;
        height: 3px;
    }
    
    .movement-indicator {
        top: 0px;
        width: 20px;
        height: 20px;
    }
    
    /* Стили для экрана поражения на экранах 360px */
    #game-over {
        padding: 10px;
        box-sizing: border-box;
        justify-content: flex-start;
        padding-top: 18vh;
    }
    
    #game-over h2 {
        font-size: 24px;
        margin-bottom: 12px;
    }
    
    #game-over p {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    #game-over p:last-of-type {
        margin-bottom: 15px;
    }
    
    #restart-button {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    .revive-icon {
        font-size: 14px;
    }
    
    /* Стили для селектора языка на маленьких экранах */
    .language-selector {
        position: fixed;
        top: 6px;
        right: 6px;
        z-index: 1001;
    }
    
    .language-selector select {
        font-size: 10px;
        padding: 3px 5px;
        background: rgba(0, 0, 0, 0.8);
    }
}
/* Убираем визуальный верх коробки - теперь контейнер открыт сверху */

/* Стили для уведомления о новом рекорде */
.new-record-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: newRecordAnimation 0.5s ease-out;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
}

.new-record-notification h3 {
    margin: 0;
    font-size: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes newRecordAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Убираем отступ в конце страницы для предотвращения прокрутки */

/* Ad blocks removed - no automatic ad display */

/* Стили для селектора языка */
.language-selector {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.volume-control {
    position: fixed; /* на ПК закрепляем сверху слева */
    top: 10px;
    left: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(145deg, #A0522D, #8B4513);
    border: 2px solid #654321;
    padding: 8px 10px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.volume-control::before {
    content: '🔊';
    font-size: 16px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
}

.volume-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 160px;
    height: 6px;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.9), rgba(218, 165, 32, 0.9));
    border: 1px solid rgba(101, 67, 33, 0.6);
    border-radius: 999px;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.35);
}

/* WebKit thumb */
.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #FFE680, #E6B800);
    border: 2px solid #7A5A36;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: transform 0.15s ease;
}
.volume-control input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.05);
}

/* Firefox track and thumb */
.volume-control input[type="range"]::-moz-range-track {
    height: 6px;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.9), rgba(218, 165, 32, 0.9));
    border: 1px solid rgba(101, 67, 33, 0.6);
    border-radius: 999px;
}
.volume-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #FFE680, #E6B800);
    border: 2px solid #7A5A36;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: transform 0.15s ease;
}
.volume-control input[type="range"]:hover::-moz-range-thumb {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .volume-control {
        position: fixed; /* как селектор языка, но с другой стороны */
        top: 8px;
        left: 8px;
        z-index: 1001;
        padding: 4px 6px;
        gap: 4px;
        max-width: 120px;
    }
    .volume-control::before { font-size: 14px; }
    .volume-control input[type="range"] {
        width: 90px; /* компактно для мобилок */
        height: 4px;
    }
}

@media (max-width: 360px) {
    .volume-control input[type="range"] {
        width: 70px; /* ещё меньше на очень маленьких экранах */
        height: 4px;
    }
}

/* Mobile banner removed - no automatic ad display */

.language-selector select {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.language-selector select:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.language-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Адаптивность для селектора языка */
@media (max-width: 768px) {
    .language-selector {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1001;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .language-selector select {
        background: rgba(0, 0, 0, 0.6);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 8px;
        padding: 6px 8px;
        font-size: 12px;
        backdrop-filter: blur(10px);
    }
}

@media (max-width: 480px) {
    .language-selector {
        position: fixed;
        top: 8px;
        right: 8px;
        z-index: 1001;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .language-selector select {
        font-size: 11px;
        padding: 4px 6px;
        background: rgba(0, 0, 0, 0.7);
    }
}

/* --- Селектор языка --- */
.language-select {
    background: linear-gradient(90deg, #a97c50 0%, #e2c290 100%);
    border: 2px solid #7a5a36;
    border-radius: 12px;
    padding: 8px 18px;
    font-size: 16px;
    font-weight: bold;
    color: #3a2a13;
    box-shadow: 0 2px 8px rgba(80, 60, 30, 0.15);
    outline: none;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    margin: 0 0 0 8px;
    cursor: pointer;
}
.language-select:hover, .language-select:focus {
    background: linear-gradient(90deg, #e2c290 0%, #a97c50 100%);
    border-color: #b08a5a;
    box-shadow: 0 4px 16px rgba(80, 60, 30, 0.25);
    color: #2d1c08;
}

/* Дополнительные стили для мобильных устройств */

