
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    
}
.menu-container {
    overflow: hidden !important;
    max-height: 100vh !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: none !important;
}

/* Игровой экран - абсолютно без прокрутки */
#gameScreen {
    flex-direction: column;
    padding: 10px;
}
/* Обучающий контент - тоже без прокрутки */
.tutorial-content {
    overflow: hidden !important;
    max-height: none !important;
    -webkit-overflow-scrolling: touch !important;
}

body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
#soundToggle {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    min-width: 80px;
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.menu-buttons,
.settings-options,
.stats-content,
.tutorial-step,
.overlay-content {
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* iOS специфичные фиксы */
@supports (-webkit-touch-callout: none) {
    html, body {
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }
}

/* Android специфичные фиксы */
@supports not (-webkit-touch-callout: none) {
    html, body {
        overscroll-behavior: none !important;
    }
}
@media (min-width: 1200px) and (max-width: 1400px) {
    /* Примерно 125% zoom */
    .number-pad {
        margin-top: 20px;
    }
    
    .number-buttons {
        gap: 10px;
        padding: 0 15px;
    }
    
    .num-btn {
        min-height: 55px;
        font-size: 22px !important;
        border-radius: 10px;
    }
    
    .num-btn.clear {
        font-size: 24px !important;
    }
}

@media (min-width: 1401px) {
    /* Примерно 150%+ zoom */
    .number-pad {
        margin-top: 2005px;
    }
    
    .number-buttons {
        gap: 12px;
        padding: 0 20px;
    }
    
    .num-btn {
        min-height: 60px;
        font-size: 24px !important;
        border-radius: 12px;
    }
    
    .num-btn.clear {
        font-size: 26px !important;
    }
}

/* Гарантия что viewport не позволяет масштабирование */
@media screen and (max-width: 768px) {
    html, body {
        touch-action: none !important;
        -ms-touch-action: none !important;
    }
    
    .screen {
        touch-action: none !important;
        -ms-touch-action: none !important;
    }
     .number-buttons {
        grid-template-columns: repeat(1000, minmax(45px, 1fr));
        gap: 800px;
    }
    
    .num-btn {
        min-height: 50px;
        font-size: 20px !important;
    }
    
    .num-btn.clear {
        font-size: 22px !important;
    }

}
/* Гарантия что кнопка всегда кликабельна */
.toggle-btn {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Состояние отключенного звука */
.toggle-btn.off {
    background: #e74c3c !important;
}

.toggle-btn:not(.off) {
    background: #27ae60 !important;
}
/* Убираем выделение для всех элементов */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
}

/* Убираем любые медиа-элементы */
media-controls, media-controller {
    display: none !important;
}
/* Переключатель языка */
.language-switcher {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}
/* Полностью скрываем любые аудио элементы */

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: #fff;
    transform: scale(1.1);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Остальные стили остаются такими же, но добавляем: */
/* Скрываем аудио элемент полностью */


/* Остальные стили без изменений */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    overflow: hidden;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}
#gameBoard, .cell, .board {
    pointer-events: auto;
}

/* Дополнительная защита от выделения */
.cell, .menu-btn, .level-btn, .control-btn, .num-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
/* Убираем возможность выделения текста в ячейках */
.cell {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Убираем контекстное меню для игрового поля */
#gameBoard {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
/* Темы */
body[data-theme="dark"] {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
}

body[data-theme="blue"] {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body[data-theme="green"] {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 90%;
    backdrop-filter: blur(10px);
}

body[data-theme="dark"] .menu-container {
    background: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
}

h1, h2 {
    margin-bottom: 30px;
    color: #2c3e50;
}

body[data-theme="dark"] h1,
body[data-theme="dark"] h2 {
    color: #ecf0f1;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-btn, .level-btn, .control-btn {
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    width: 100%;
}

.menu-btn:hover, .level-btn:hover, .control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.menu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.back-btn {
    background: linear-gradient(135deg, #fd746c, #ff9068);
    margin-top: 20px;
}

/* Игровой экран */
/* Стили для кнопок с рекламой */
.buy-btn, .shop-btn {
        z-index: 1000 !important;
    position: relative !important;
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
    border: 2px solid #f39c12 !important;
}
/* Базовые стили тем для ВСЕХ экранов */
body[data-theme="default"] .screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

body[data-theme="dark"] .screen {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    color: #ecf0f1 !important;
}

body[data-theme="blue"] .screen {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

body[data-theme="green"] .screen {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%) !important;
}

body[data-theme="purple"] .screen {
    background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%) !important;
}

body[data-theme="sunset"] .screen {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 100%) !important;
}

/* Гарантия что темы применяются к контейнерам */
body[data-theme="dark"] .menu-container {
    background: rgba(44, 62, 80, 0.95) !important;
    color: #ecf0f1 !important;
}

body[data-theme="blue"] .menu-container {
    background: rgba(255, 255, 255, 0.95) !important;
}

body[data-theme="green"] .menu-container {
    background: rgba(255, 255, 255, 0.95) !important;
}

body[data-theme="purple"] .menu-container {
    background: rgba(255, 255, 255, 0.95) !important;
}

body[data-theme="sunset"] .menu-container {
    background: rgba(255, 255, 255, 0.95) !important;
}

/* Темная тема для контейнеров */
body[data-theme="dark"] .game-header,
body[data-theme="dark"] .overlay-content,
body[data-theme="dark"] .resource {
    background: rgba(44, 62, 80, 0.95) !important;
    color: #ecf0f1 !important;
}
body[data-theme="default"] .btn-text,
body[data-theme="blue"] .btn-text,
body[data-theme="green"] .btn-text,
body[data-theme="purple"] .btn-text,
body[data-theme="sunset"] .btn-text {
    color: #000000 !important;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5) !important;
}


.buy-btn::after, .shop-btn::after {
    content: '📺';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    background: #e74c3c;
    border-radius: 50%;
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.buy-btn:hover::after, .shop-btn:hover::after {
    background: #c0392b;
    transform: scale(1.2);
}

/* Тултипы для кнопок с рекламой */
.buy-btn[title]:hover::before,
.shop-btn[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 15px;
}

body[data-theme="dark"] .game-header {
    background: rgba(44, 62, 80, 0.95);
}

.game-info {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Кнопки покупки */
.buy-btn {
    width: 22px !important;
    height: 22px !important;
    border: none !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
    color: white !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 5px rgba(39, 174, 96, 0.3) !important;
}

.buy-btn:hover {
    background: linear-gradient(135deg, #219a52, #27ae60) !important;
    transform: scale(1.15) !important;
    box-shadow: 0 3px 8px rgba(39, 174, 96, 0.4) !important;
}

.buy-btn:disabled {
    background: #95a5a6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;

}
/* КОМПАКТНЫЕ КНОПКИ КАК DIV - никаких стандартных стилей */
.compact-controls {
    display: flex !important;
    gap: 8px !important;
    background: linear-gradient(135deg, rgb(247, 233, 233), rgba(255, 255, 255, 0.894)) !important;
    padding: 8px !important;
    border-radius: 15px !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

.compact-btn, .custom-btn {
display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 55px !important;
    height: 50px !important;
    border: none !important;
    border-radius: 10px !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    padding: 6px !important;
    font-size: 12px !important;
    position: relative !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, #667eea, #764ba2) !important; /* дефолтный цвет */
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    box-sizing: border-box !important;
    text-align: center !important;
    line-height: normal !important;
    margin: 0 !important;
    opacity: 1 !important; /* ДОБАВЛЕНО: гарантия непрозрачности */
}

/* Убираем все состояния фокуса */
.compact-btn:focus, .custom-btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Анимация блеска */
.compact-btn::before, .custom-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.865), transparent) !important;
    transition: left 0.5s !important;
}

.compact-btn:hover::before, .custom-btn:hover::before {
    left: 100% !important;
}

/* Ховер эффекты */
.compact-btn:hover, .custom-btn:hover {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
}

/* Активные состояния */
.compact-btn:active, .custom-btn:active {
    transform: translateY(-1px) scale(1.02) !important;
}

/* Иконки и текст */
.btn-icon {
    font-size: 18px !important;
    margin-bottom: 3px !important;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2)) !important;
    display: block !important;
}

.btn-text {
    font-size: 9px !important;
    line-height: 1 !important;
    font-weight: bold !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
    letter-spacing: 0.5px !important;
    display: block !important;
}

/* ЯРКИЕ ЦВЕТА ДЛЯ КАЖДОЙ КНОПКИ */
/* ЯРКИЕ ЦВЕТА ДЛЯ КАЖДОЙ КНОПКИ - БЕЗ ПРОЗРАЧНОСТИ */
.hint-btn {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53) !important;
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3) !important;
    opacity: 1 !important;
}

.hint-btn:hover {
    background: linear-gradient(135deg, #FF8E53, #FF6B6B) !important;
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.4) !important;
    opacity: 1 !important;
}

.pause-btn {
    background: linear-gradient(135deg, #4ECDC4, #44A08D) !important;
    box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3) !important;
    opacity: 1 !important;
}

.pause-btn:hover {
    background: linear-gradient(135deg, #44A08D, #4ECDC4) !important;
    box-shadow: 0 6px 15px rgba(78, 205, 196, 0.4) !important;
    opacity: 1 !important;
}

.menuu-btn { 
    background: linear-gradient(135deg, #FF9A8B, #FF6A88) !important;
    box-shadow: 0 4px 8px rgba(255, 106, 136, 0.3) !important;
    opacity: 1 !important;
}

.menuu-btn:hover {
    background: linear-gradient(135deg, #FF6A88, #FF9A8B) !important; 
    box-shadow: 0 6px 15px rgba(255, 106, 136, 0.4) !important;
    opacity: 1 !important;
}

/* Адаптивность */
@media (max-width: 600px) {
    .compact-controls {
        gap: 3px !important;
        padding: 6px !important;
    }
    
    .compact-btn, .custom-btn {
        width: 50px !important;
        height: 45px !important;
    }
    
    .btn-icon {
        font-size: 16px !important;
    }
    
    .btn-text {
        font-size: 8px !important;
    }
}
/* Темная тема */
body[data-theme="dark"] .compact-controls {
    background: linear-gradient(135deg, rgba(52, 73, 94, 0.9), rgba(44, 62, 80, 0.7)) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}

body[data-theme="dark"] .resource {
    background: rgba(52, 73, 94, 0.8) !important;
    color: #ecf0f1 !important;
}

body[data-theme="dark"] #timer {
    background: linear-gradient(135deg, #3498db, #9b59b6) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}


#timer {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
}

body[data-theme="dark"] #timer {
    color: #ecf0f1;
}
.buy-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(39, 174, 96, 0.3);
}

.buy-btn:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(39, 174, 96, 0.4);
}

.buy-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.resources {
 display: flex;
    gap: 12px;
}

.resource {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: bold;
    background: rgba(255,255,255,0.8);
    padding: 6px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Игровое поле */
.board {
    display: inline-grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    background-color: #2c3e50;
    border: 3px solid #2c3e50;
    border-radius: 10px;
    padding: 3px;
    margin: 20px 0;
    max-width: 500px;
    width: 100%;
    aspect-ratio: 1;
}

body[data-theme="dark"] .board {
    background-color: #34495e;
    border-color: #34495e;
}

.cell {
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    aspect-ratio: 1;
}

body[data-theme="dark"] .cell {
    background-color: #2c3e50;
    color: #ecf0f1;
}

.cell:hover {
    background-color: #f8f9fa;
}

body[data-theme="dark"] .cell:hover {
    background-color: #34495e;
}

.cell.prefilled {
    background-color: #e9ecef;
    color: #2c3e50;
    font-weight: bold;
}

body[data-theme="dark"] .cell.prefilled {
    background-color: #34495e;
    color: #bdc3c7;
}

.cell.selected {
    background-color: #cce5ff;
}

body[data-theme="dark"] .cell.selected {
    background-color: #3498db;
    color: white;
}

.cell.error {
    background-color: #ffcccc;
    color: #dc3545;
}

body[data-theme="dark"] .cell.error {
    background-color: #e74c3c;
    color: white;
}

.cell.hint {
    animation: pulse 1s infinite;
    background-color: #fff3cd;
}

@keyframes pulse {
    0% { background-color: #fff3cd; }
    50% { background-color: #ffeaa7; }
    100% { background-color: #fff3cd; }
}

/* Границы для блоков 3x3 */
.cell:nth-child(3n) {
    border-right: 2px solid #2c3e50;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #2c3e50;
}

body[data-theme="dark"] .cell:nth-child(3n),
body[data-theme="dark"] .cell:nth-child(n+19):nth-child(-n+27),
body[data-theme="dark"] .cell:nth-child(n+46):nth-child(-n+54) {
    border-color: #34495e;
}

/* Элементы управления игрой */
.game-controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    padding: 12px 20px;
    font-size: 16px;
    flex: 1;
    min-width: 120px;
}

/* Цифровая клавиатура */
.number-pad {
    width: 100%;
    max-width: 500px;
    margin-top: 10px;
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    padding: 0 10px;
}

.num-btn {
    padding: 12px 5px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: #3498db;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.num-btn.clear {
    background: #e74c3c;
    font-size: 18px;
}

.num-btn.clear:hover {
    background: #c0392b;
}

        
.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

body[data-theme="dark"] .setting {
    background: rgba(255, 255, 255, 0.1);
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #27ae60;
    color: white;
    cursor: pointer;
}

.toggle-btn.off {
    background: #e74c3c;
}

/* Статистика */
.stats-content {
    text-align: left;
    margin: 20px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

body[data-theme="dark"] .stat-item {
    background: rgba(255, 255, 255, 0.1);
}

/* Обучение */
.tutorial-content {
    text-align: left;
    margin: 20px 0;
    min-height: 200px;
}

.tutorial-step {
    display: none;
}

.tutorial-step.active {
    display: block;
}

.tutorial-step h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

body[data-theme="dark"] .tutorial-step h3 {
    color: #ecf0f1;
}

.tutorial-step ul {
    margin: 10px 0 10px 20px;
}

.tutorial-step li {
    margin: 5px 0;
}

.tutorial-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Адаптивность */

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-container {
    animation: fadeIn 0.5s ease;
}

.cell.filled {
    animation: pop 0.3s ease;
}

@keyframes pop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
/* Гарантия что оверлей победы показывается */
#winOverlay.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Анимация появления оверлея победы */
.win-content {
    animation: winAppear 0.5s ease-out !important;
}

@keyframes winAppear {
    0% { 
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    50% { 
        transform: scale(1.05) translateY(0);
    }
    100% { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Улучшение видимости кнопки очистки */
.num-btn.clear {
    background: #e74c3c !important;
    font-size: 18px !important;
    font-weight: bold !important;
}

.num-btn.clear:hover {
    background: #c0392b !important;
    transform: translateY(-2px) scale(1.05) !important;
}

.num-btn.clear:active {
    background: #a93226 !important;
    transform: translateY(0) scale(0.95) !important;
}
/* Добавьте эти стили в конец файла */

/* Оверлей для паузы и game over */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex;
}

.overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.3s ease;
}

body[data-theme="dark"] .overlay-content {
    background: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
}

.overlay-content h2 {
    margin-bottom: 20px;
    color: #e74c3c;
}

.pause-stats {
    margin: 20px 0;
    text-align: left;
}

.pause-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

body[data-theme="dark"] .pause-stat {
    background: rgba(255, 255, 255, 0.1);
}

.pause-buttons,
.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Улучшенные границы для темной темы */
body[data-theme="dark"] .board {
    background-color: #595f61;
    border-color: #595f61;
}

body[data-theme="dark"] .cell {
    background-color: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #34495e;
}

body[data-theme="dark"] .cell.prefilled {
    background-color: #34495e;
    color: #ecf0f1;
}

body[data-theme="dark"] .cell:nth-child(3n) {
    border-right: 3px solid #595f61;
}

body[data-theme="dark"] .cell:nth-child(n+19):nth-child(-n+27),
body[data-theme="dark"] .cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #595f61;
}

/* Убираем лишние границы для стандартной темы */
.cell {
    border: 1px solid #bdc3c7;
}

.cell:nth-child(3n) {
    border-right: 3px solid #2c3e50;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #2c3e50;
}


/* Добавьте эти стили в конец файла */

/* Оверлей для паузы, game over и победы */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex;
}

.overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.3s ease;
}

body[data-theme="dark"] .overlay-content {
    background: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
}

.overlay-content h2 {
    margin-bottom: 20px;
    color: #e74c3c;
}

.win-content h2 {
    color: #27ae60;
    font-size: 28px;
}

.pause-stats,
.win-stats {
    margin: 20px 0;
    text-align: left;
}

.pause-stat,
.win-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

body[data-theme="dark"] .pause-stat,
body[data-theme="dark"] .win-stat {
    background: rgba(255, 255, 255, 0.1);
}

.pause-buttons,
.gameover-buttons,
.win-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Улучшенные границы для темной темы */
body[data-theme="dark"] .board {
    background-color: #ecf0f1;
    border-color: #ecf0f1;
}

body[data-theme="dark"] .cell {
    background-color: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #34495e;
}

body[data-theme="dark"] .cell.prefilled {
    background-color: #34495e;
    color: #ecf0f1;
}

body[data-theme="dark"] .cell:nth-child(3n) {
    border-right: 3px solid #ecf0f1;
}

body[data-theme="dark"] .cell:nth-child(n+19):nth-child(-n+27),
body[data-theme="dark"] .cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #ecf0f1;
}

/* Убираем лишние границы для стандартной темы */
.cell {
    border: 1px solid #bdc3c7;
}

.cell:nth-child(3n) {
    border-right: 3px solid #2c3e50;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #2c3e50;
}
/* Добавьте эти стили в конец файла */

/* Новые темы оформления */
body[data-theme="purple"] {
    background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%);
}

body[data-theme="sunset"] {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 100%);
}

body[data-theme="blue"] {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body[data-theme="green"] {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* Стили для кнопок покупки */
.buy-btn {
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    cursor: pointer;
    margin-left: 5px;
    transition: all 0.3s ease;
}

.buy-btn:hover {
    background: #219a52;
    transform: scale(1.1);
}

.buy-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

.resource-shop {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

body[data-theme="dark"] .resource-shop {
    background: rgba(255, 255, 255, 0.1);
}

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 8px 0;
}

.shop-btn {
    background: #e67e22;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.shop-btn:hover {
    background: #d35400;
    transform: translateY(-2px);
}

/* Оверлей для паузы, game over и победы */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex;
}

.overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.3s ease;
}

body[data-theme="dark"] .overlay-content {
    background: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
}

body[data-theme="purple"] .overlay-content {
    background: rgba(142, 45, 226, 0.95);
    color: white;
}

body[data-theme="sunset"] .overlay-content {
    background: rgba(255, 107, 107, 0.95);
    color: white;
}

body[data-theme="blue"] .overlay-content {
    background: rgba(79, 172, 254, 0.95);
    color: white;
}

body[data-theme="green"] .overlay-content {
    background: rgba(67, 233, 123, 0.95);
    color: #2c3e50;
}

.overlay-content h2 {
    margin-bottom: 20px;
    color: #e74c3c;
}

.win-content h2 {
    color: #27ae60;
    font-size: 28px;
}

.pause-stats,
.win-stats {
    margin: 20px 0;
    text-align: left;
}

.pause-stat,
.win-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

body[data-theme="dark"] .pause-stat,
body[data-theme="dark"] .win-stat {
    background: rgba(255, 255, 255, 0.1);
}

body[data-theme="purple"] .pause-stat,
body[data-theme="purple"] .win-stat,
body[data-theme="sunset"] .pause-stat,
body[data-theme="sunset"] .win-stat,
body[data-theme="blue"] .pause-stat,
body[data-theme="blue"] .win-stat,
body[data-theme="green"] .pause-stat,
body[data-theme="green"] .win-stat {
    background: rgba(255, 255, 255, 0.2);
}

.pause-buttons,
.gameover-buttons,
.win-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Состояние паузы */
.pause-btn.paused .btn-icon {
    content: '▶️' !important;
}

.pause-btn:not(.paused) .btn-icon {
    content: '⏸️' !important;
}

/* Или через псевдо-элементы если не работает */
.pause-btn.paused .btn-icon::before {
    content: '▶️' !important;
}

.pause-btn:not(.paused) .btn-icon::before {
    content: '⏸️' !important;
}











/* Добавьте в конец style.css */

/* Стили для кнопок рекламы */
.buy-btn:disabled,
.shop-btn:disabled {
    background: #95a5a6 !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
    transform: none !important;
}

.buy-btn:disabled:hover,
.shop-btn:disabled:hover {
    background: #95a5a6 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Анимация восстановления кнопки */
.buy-btn, .shop-btn {
    transition: all 0.3s ease;
}

/* Индикатор загрузки рекламы */
.ad-loading {
    position: relative;
    overflow: hidden;
}

.ad-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: loadingShine 3s ease;
}

@keyframes loadingShine {
    0% { left: -100%; }
    100% { left: 100%; }
}







/* Адаптивность для всех устройств */
@media (max-width: 480px) {
    .menu-container {
        padding: 20px 15px;
        margin: 10px;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .menu-buttons {
        gap: 10px;
    }
    
    .menu-btn, .level-btn, .control-btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 50px;
    }
    
    /* Игровой экран для мобилок */
    #gameScreen {
        padding: 5px;
        justify-content: flex-start;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        margin-bottom: 10px;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    .header-left, .header-right {
        width: 100%;
        justify-content: center;
    }
    
    .resources {
        justify-content: center;
        gap: 15px;
    }
    
    .resource {
        font-size: 12px;
        padding: 5px 8px;
    }
    
    .buy-btn {
        width: 18px !important;
        height: 18px !important;
        font-size: 12px !important;
    }
    
    /* Компактные кнопки для мобилок */
    .compact-controls {
        gap: 100px !important;
        padding: 6px !important;
    }
    
    .compact-btn, .custom-btn {
        width: 45px !important;
        height: 40px !important;
        min-width: 45px !important;
        min-height: 40px !important;
    }
    
    .btn-icon {
        font-size: 14px !important;
        margin-bottom: 2px !important;
    }
    
    .btn-text {
        font-size: 7px !important;
    }
    
    /* Скрываем кнопку меню на очень маленьких экранах */
    @media (max-width: 320px) {
        .menuu-btn {
            display: none !important;
        }
        
        .compact-controls {
            gap: 6px !important;
        }
        
        .compact-btn, .custom-btn {
            width: 40px !important;
            height: 35px !important;
        }
    }
    
    /* Игровое поле */
    .board {
        max-width: calc(100vw - 20px);
        width: 100%;
        aspect-ratio: 1;
        margin: 10px 0;
    }
    
    .cell {
        font-size: 16px;
    }
    
    /* Цифровая клавиатура - ВСЕГДА В ОДНУ СТРОКУ */
    .number-pad {
        width: 100%;
        max-width: calc(100vw - 20px);
        margin-top: 10px;
    }
    
    .number-buttons {
        grid-template-columns: repeat(10, 1fr);
        gap: 3px;
        padding: 0 5px;
    }
    
    .num-btn {
        padding: 8px 2px;
        font-size: 14px;
        min-height: 35px;
        aspect-ratio: 1;
    }
    
    .num-btn.clear {
        font-size: 16px;
    }
    
    /* Таймер и статистика */
    #timer {
        font-size: 18px;
    }
    
    .game-info {
        font-size: 18px;
    }
    
    /* Оверлеи */
    .overlay-content {
        padding: 25px 20px;
        margin: 10px;
        width: calc(100% - 20px);
    }
    
    .pause-stat, .win-stat, .stat-item {
        padding: 8px;
        font-size: 14px;
    }
    
    .resource-shop {
        padding: 10px;
    }
    
    .shop-item {
        padding: 8px 5px;
        font-size: 14px;
    }
    
    .shop-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Планшеты и средние экраны */
@media (min-width: 481px) {

    .number-buttons {
        grid-template-columns: repeat(10, minmax(40px, 1fr));
        gap: 5px;
    }
    
    .num-btn {
        min-height: 25px;
        font-size: 16px !important;
    }
    
    .num-btn.clear {
        font-size: 16px !important;
    }
        .game-header {
        gap: 100px;
        padding: 5px;
        margin-bottom: 1px;
    }
        .number-pad {
        margin-top: 5px;
    }
    
    
}
/* Большие мобильные устройства в альбомной ориентации */
@media (max-height: 500px) and (orientation: landscape) {
    .menu-container {
        padding: 15px 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    #gameScreen {
        padding: 5px;
        justify-content: flex-start;
    }
    
    .game-header {
        margin-bottom: 10px;
        padding: 8px 12px;
    }
    
    .board {
        max-width: 60vh;
        margin: 5px 0;
    }
    
    .number-pad {
        margin-top: 5px;
    }
    
    .compact-btn, .custom-btn {
        width: 40px !important;
        height: 35px !important;
    }
}

@media (max-height: 700px) {
    .menu-container {
        padding: 15px 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    .game-header {
        gap: 10px;
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .header-left, .header-right {
        justify-content: center;
    }
    
    .resources {
        justify-content: center;
        gap: 15px;
    }
    
    .resource {
        font-size: 12px;
        padding: 5px 8px;
    }
    
    .buy-btn {
        width: 18px !important;
        height: 18px !important;
        font-size: 12px !important;
    }
    #gameScreen {
        padding: 1px;
        justify-content: flex-start;
    }
    
    .game-header {
        margin-bottom: 10px;
        padding: 8px 12px;
    }
    
    .board {
        max-width: 60vh;
        margin: 5px 0;
    }
    
    .number-pad {
        margin-top: 10px;
    }
    
    .compact-btn, .custom-btn {
        width: 60px !important;
        height: 45px !important;
    }
}

/* Запрет прокрутки на игровых экранах */
.screen {
    overflow: hidden;
}

#gameScreen {
    overflow-x: hidden;
}

/* Гарантия что ничего не выходит за пределы экрана */
body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Улучшение касаний для мобилок */
.cell, .num-btn, .compact-btn, .custom-btn, .menu-btn, .level-btn {
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
}

/* Предотвращение масштабирования при двойном тапе */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Улучшение отзывчивости кнопок на тач-устройствах */
@media (hover: none) and (pointer: coarse) {
    .menu-btn:hover, .level-btn:hover, .control-btn:hover,
    .num-btn:hover, .compact-btn:hover, .custom-btn:hover {
        transform: none;
    }
    
    .menu-btn:active, .level-btn:active, .control-btn:active,
    .num-btn:active, .compact-btn:active, .custom-btn:active {
        transform: scale(0.95);
    }
}

/* Гарантия что цифровая клавиатура всегда в одну строку */
.number-buttons {
    display: grid !important;
    grid-template-columns: repeat(10, 1fr) !important;
    min-width: 0;
}

.num-btn {
    min-width: 0;
    overflow: hidden;
}

/* Адаптивные шрифты */
@media (max-width: 360px) {
    .cell {
        font-size: 14px;
    }
    
    .num-btn {
        font-size: 12px;
        padding: 6px 1px;
    }
    
    #timer {
        font-size: 16px;
    }
}


/* Фикс для очень высоких экранов */
@media (min-height: 800px) and (max-width: 480px) {
    #gameScreen {
        justify-content: center;
    }
}


@keyframes fadeInOut {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.8); 
    }
    20% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1.1); 
    }
    30% { 
        transform: translate(-50%, -50%) scale(1); 
    }
    70% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.8); 
    }
}

.game-notification {
    pointer-events: none;
}