* {
    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;
    color: #333;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* Темы для 2048 */
body[data-theme="classic"] {
    background: linear-gradient(135deg, #e8f4fd 0%, #d4e9fa 50%, #c0def8 100%);
    color: #4a7bac;
}

body[data-theme="vintage"] {
    background: linear-gradient(135deg, #edc988 0%, #d2a679 100%);
}

body[data-theme="neon"] {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
    color: #ffffff;
}

body[data-theme="pastel"] {
    background: linear-gradient(135deg, #e2f0f9 0%, #b5ead7 100%);
}

body[data-theme="dark"] {
    background: linear-gradient(135deg, #2d3047 0%, #1a1a2e 100%);
    color: #ffffff;
}

/* Улучшаем сенсорные цели для мобильных */
@media (max-width: 768px) {
    .tile.selectable {
        min-height: 50px !important;
        min-width: 50px !important;
    }
    
    /* Увеличиваем область касания */
    .board.hammer-mode .tile {
        padding: 5px;
    }
    
    /* Более заметная анимация для мобильных */
    .board.hammer-mode .tile.selectable {
        animation: mobile-hammer-pulse 1.5s infinite;
        border: 3px solid #ff6b6b;
    }
    
    @keyframes mobile-hammer-pulse {
        0% { transform: scale(1); opacity: 1; }
        50% { transform: scale(1.05); opacity: 0.8; }
        100% { transform: scale(1); opacity: 1; }
    }
}

/* Улучшаем визуальную обратную связь */
.tile.selectable:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease;
}

/* Подсветка при касании на мобильных */
@media (hover: none) and (pointer: coarse) {
    .tile.selectable:active {
        background: rgba(255, 107, 107, 0.4) !important;
    }
}

/* Анимации плиток */
.tile {
    transition: all 0.15s ease-in-out;
    transform-origin: center;
    font-weight: bold;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    min-height: 100px;
    min-width: 100px;
    height: 100%;
    width: 100%;
}

/* ФИКСИРОВАННЫЙ РАЗМЕР ТЕКСТА ДЛЯ ВСЕХ ПЛИТОК */
.tile-2,
.tile-4,
.tile-8,
.tile-16,
.tile-32,
.tile-64,
.tile-128,
.tile-256,
.tile-512,
.tile-1024,
.tile-2048,
.tile-super {
    font-size: 35px !important;
}

/* Адаптивный размер текста для мобильных */
@media (max-width: 480px) {
    .tile {
        font-size: 20px !important;
        min-height: 70px;
        min-width: 70px;
    }
    
    .tile-2,
    .tile-4,
    .tile-8,
    .tile-16,
    .tile-32,
    .tile-64,
    .tile-128,
    .tile-256,
    .tile-512,
    .tile-1024,
    .tile-2048,
    .tile-super {
        font-size: 20px !important;
    }
}

@media (max-width: 360px) {
    .tile {
        font-size: 16px !important;
        min-height: 60px;
        min-width: 60px;
    }
    
    .tile-2,
    .tile-4,
    .tile-8,
    .tile-16,
    .tile-32,
    .tile-64,
    .tile-128,
    .tile-256,
    .tile-512,
    .tile-1024,
    .tile-2048,
    .tile-super {
        font-size: 16px !important;
    }
}

/* Цвета плиток для классической темы */
body[data-theme="classic"] .tile-2 { 
    background: #e8f4fd; 
    color: #4a7bac; 
    border-color: #d4e9fa; 
    box-shadow: inset 0 -2px 0 rgba(74, 123, 172, 0.1);
}

body[data-theme="classic"] .tile-4 { 
    background: #d4e9fa; 
    color: #3a6b9c; 
    border-color: #c0def8; 
    box-shadow: inset 0 -2px 0 rgba(58, 107, 156, 0.1);
}

body[data-theme="classic"] .tile-8 { 
    background: #c0def8; 
    color: #2a5b8c; 
    border-color: #acd3f6; 
    box-shadow: inset 0 -2px 0 rgba(42, 91, 140, 0.15);
}

body[data-theme="classic"] .tile-16 { 
    background: #acd3f6; 
    color: #1a4b7c; 
    border-color: #98c8f4; 
    box-shadow: inset 0 -3px 0 rgba(26, 75, 124, 0.15);
}

body[data-theme="classic"] .tile-32 { 
    background: #98c8f4; 
    color: #ffffff; 
    border-color: #84bdf2; 
    box-shadow: inset 0 -3px 0 rgba(132, 189, 242, 0.2);
}

body[data-theme="classic"] .tile-64 { 
    background: #84bdf2; 
    color: #ffffff; 
    border-color: #70b2f0; 
    box-shadow: inset 0 -3px 0 rgba(112, 178, 240, 0.2);
}

body[data-theme="classic"] .tile-128 { 
    background: #70b2f0; 
    color: #ffffff; 
    border-color: #5ca7ee; 
    box-shadow: 
        inset 0 -4px 0 rgba(92, 167, 238, 0.25),
        0 0 15px rgba(112, 178, 240, 0.4);
    font-size: 30px !important;
}

body[data-theme="classic"] .tile-256 { 
    background: #5ca7ee; 
    color: #ffffff; 
    border-color: #489cec; 
    box-shadow: 
        inset 0 -4px 0 rgba(72, 156, 236, 0.25),
        0 0 20px rgba(92, 167, 238, 0.5);
    font-size: 30px !important;
}

body[data-theme="classic"] .tile-512 { 
    background: #489cec; 
    color: #ffffff; 
    border-color: #3491ea; 
    box-shadow: 
        inset 0 -4px 0 rgba(52, 145, 234, 0.3),
        0 0 25px rgba(72, 156, 236, 0.6);
    font-size: 30px !important;
}

body[data-theme="classic"] .tile-1024 { 
    background: #3491ea; 
    color: #ffffff; 
    border-color: #2086e8; 
    box-shadow: 
        inset 0 -5px 0 rgba(32, 134, 232, 0.3),
        0 0 30px rgba(52, 145, 234, 0.7);
    font-size: 25px !important;
}

body[data-theme="classic"] .tile-2048 { 
    background: #2086e8; 
    color: #ffffff; 
    border-color: #0c7be6; 
    box-shadow: 
        inset 0 -5px 0 rgba(12, 123, 230, 0.35),
        0 0 35px rgba(32, 134, 232, 0.8);
    font-size: 25px !important;
}

body[data-theme="classic"] .tile-super { 
    background: linear-gradient(135deg, #0c7be6, #0066cc, #004499); 
    color: #ffffff; 
    border-color: #003366; 
    box-shadow: 
        inset 0 -6px 0 rgba(0, 51, 102, 0.4),
        0 0 45px rgba(12, 123, 230, 0.9);
}


/* Цвета плиток для винтажной темы */
body[data-theme="vintage"] .tile-2 { background: #f4e4bc; color: #8b7355; border-color: #e6d6ac; }
body[data-theme="vintage"] .tile-4 { background: #e8d5b5; color: #8b7355; border-color: #dac7a5; }
body[data-theme="vintage"] .tile-8 { background: #d4b483; color: #ffffff; border-color: #c6a675; }
body[data-theme="vintage"] .tile-16 { background: #c19a6b; color: #ffffff; border-color: #b38c5d; }
body[data-theme="vintage"] .tile-32 { background: #a87c4d; color: #ffffff; border-color: #9a6e41; }
body[data-theme="vintage"] .tile-64 { background: #8b5a3c; color: #ffffff; border-color: #7d4c30; }
body[data-theme="vintage"] .tile-128 { background: #e6c9a8; color: #8b7355; border-color: #d8bb9a; }
body[data-theme="vintage"] .tile-256 { background: #d9b38c; color: #8b7355; border-color: #cba57e; }
body[data-theme="vintage"] .tile-512 { background: #cc9d70; color: #ffffff; border-color: #be8f62; }
body[data-theme="vintage"] .tile-1024 { background: #bf8754; color: #ffffff; border-color: #b17946; }
body[data-theme="vintage"] .tile-2048 { background: #b27138; color: #ffffff; border-color: #a4632a; }
body[data-theme="vintage"] .tile-super { background: #5d4037; color: #ffffff; border-color: #4f3229; }

/* Цвета плиток для неоновой темы */
body[data-theme="neon"] .tile-2 { background: #4a4a8a; color: #ffffff; border-color: #3a3a7a; }
body[data-theme="neon"] .tile-4 { background: #5a5a9a; color: #ffffff; border-color: #4a4a8a; }
body[data-theme="neon"] .tile-8 { background: #6a6aaa; color: #ffffff; border-color: #5a5a9a; }
body[data-theme="neon"] .tile-16 { background: #7a7aba; color: #ffffff; border-color: #6a6aaa; }
body[data-theme="neon"] .tile-32 { background: #8a8aca; color: #ffffff; border-color: #7a7aba; }
body[data-theme="neon"] .tile-64 { background: #9a9ada; color: #ffffff; border-color: #8a8aca; }
body[data-theme="neon"] .tile-128 { background: #ff6b6b; color: #ffffff; border-color: #ff5b5b; }
body[data-theme="neon"] .tile-256 { background: #ff8e53; color: #ffffff; border-color: #ff7e43; }
body[data-theme="neon"] .tile-512 { background: #ffd166; color: #ffffff; border-color: #ffc156; }
body[data-theme="neon"] .tile-1024 { background: #06d6a0; color: #ffffff; border-color: #06c690; }
body[data-theme="neon"] .tile-2048 { background: #118ab2; color: #ffffff; border-color: #117aa2; }
body[data-theme="neon"] .tile-super { background: #ef476f; color: #ffffff; border-color: #df376f; }

/* Цвета плиток для пастельной темы */
body[data-theme="pastel"] .tile-2 { background: #e2f0f9; color: #5a7b9a; border-color: #d2e0e9; }
body[data-theme="pastel"] .tile-4 { background: #b5ead7; color: #4a6b8a; border-color: #a5dac7; }
body[data-theme="pastel"] .tile-8 { background: #c7ceea; color: #5a6b9a; border-color: #b7beda; }
body[data-theme="pastel"] .tile-16 { background: #ffdac1; color: #9a7b5a; border-color: #efcab1; }
body[data-theme="pastel"] .tile-32 { background: #ffb7b2; color: #9a5a5a; border-color: #efa7a2; }
body[data-theme="pastel"] .tile-64 { background: #e2f0cb; color: #6b8a4a; border-color: #d2e0bb; }
body[data-theme="pastel"] .tile-128 { background: #d8bfd8; color: #7a5a7a; border-color: #c8afc8; }
body[data-theme="pastel"] .tile-256 { background: #b5e48c; color: #5a7a3a; border-color: #a5d47c; }
body[data-theme="pastel"] .tile-512 { background: #99d98c; color: #4a6a3a; border-color: #89c97c; }
body[data-theme="pastel"] .tile-1024 { background: #76c893; color: #3a5a2a; border-color: #66b883; }
body[data-theme="pastel"] .tile-2048 { background: #52b69a; color: #2a4a1a; border-color: #42a68a; }
body[data-theme="pastel"] .tile-super { background: #34a0a4; color: #ffffff; border-color: #249094; }

/* Цвета плиток для темной темы */
body[data-theme="dark"] .tile-2 { background: #3d405b; color: #ffffff; border-color: #2d304b; }
body[data-theme="dark"] .tile-4 { background: #4a4e69; color: #ffffff; border-color: #3a3e59; }
body[data-theme="dark"] .tile-8 { background: #5a5e7a; color: #ffffff; border-color: #4a4e6a; }
body[data-theme="dark"] .tile-16 { background: #6a6e8a; color: #ffffff; border-color: #5a5e7a; }
body[data-theme="dark"] .tile-32 { background: #7a7e9a; color: #ffffff; border-color: #6a6e8a; }
body[data-theme="dark"] .tile-64 { background: #8a8eaa; color: #ffffff; border-color: #7a7e9a; }
body[data-theme="dark"] .tile-128 { background: #9a9eba; color: #ffffff; border-color: #8a8eaa; }
body[data-theme="dark"] .tile-256 { background: #aaaecc; color: #ffffff; border-color: #9a9ebc; }
body[data-theme="dark"] .tile-512 { background: #babedc; color: #2d3047; border-color: #aaaedc; }
body[data-theme="dark"] .tile-1024 { background: #caceec; color: #2d3047; border-color: #babeec; }
body[data-theme="dark"] .tile-2048 { background: #dae2ff; color: #2d3047; border-color: #cad2ff; }
body[data-theme="dark"] .tile-super { background: #f8f9fa; color: #2d3047; border-color: #e8e9fa; }

/* Анимация появления новой плитки */
@keyframes tileAppear {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.tile-new {
    animation: tileAppear 0.2s ease;
}

/* Анимация объединения плиток */
@keyframes tileMerge {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.tile-merged {
    animation: tileMerge 0.3s ease;
    z-index: 10;
}

/* Уведомления */
.game-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    z-index: 10000;
    animation: fadeInOut 3s ease-in-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 2px solid #ffd700;
    max-width: 80%;
    word-wrap: break-word;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -40%); }
    20% { opacity: 1; transform: translate(-50%, -50%); }
    80% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -60%); }
}

.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="neon"] .menu-container,
body[data-theme="dark"] .menu-container {
    background: rgba(15, 15, 35, 0.95);
    color: #ffffff;
}

body[data-theme="neon"] h1,
body[data-theme="neon"] h2,
body[data-theme="neon"] h3,
body[data-theme="neon"] p,
body[data-theme="neon"] span,
body[data-theme="neon"] label,
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] p,
body[data-theme="dark"] span,
body[data-theme="dark"] label {
    color: #ffffff;
}

h1, h2 {
    margin-bottom: 30px;
    color: #776e65;
}

.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, #a69ad8, #a1a0df);
    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(143, 122, 102, 0.3);
}

.back-btn {
    background: linear-gradient(135deg, #f78e6a, #f67c5f);
    margin-top: 20px;
}

.menu-btn.disabled {
    background: linear-gradient(135deg, #cccccc, #999999) !important;
    color: #666666 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.menu-btn.disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Игровой экран */
.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.9);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

body[data-theme="neon"] .game-header,
body[data-theme="dark"] .game-header {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

body[data-theme="neon"] .game-header .score-label,
body[data-theme="neon"] .game-header #score,
body[data-theme="neon"] .game-header #best,
body[data-theme="dark"] .game-header .score-label,
body[data-theme="dark"] .game-header #score,
body[data-theme="dark"] .game-header #best {
    color: #ffffff;
}

.game-info {
    display: flex;
    gap: 20px;
}

.score-container, .best-container {
    background: #a0a0bb;
    padding: 4px 8px;
    border-radius: 6px;
    text-align: center;
    min-width: 100px;
}

.score-label {
    color: #eee4da;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

#score, #best {
    color: white;
    font-size: 20px;
}

/* Компактные кнопки */
.compact-controls {
    display: flex !important;
    gap: 8px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    padding: 8px !important;
    border-radius: 10px !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

body[data-theme="neon"] .compact-controls,
body[data-theme="dark"] .compact-controls {
    background: rgba(255, 255, 255, 0.1) !important;
}

.compact-btn, .custom-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 60px !important;
    height: 50px !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    padding: 6px !important;
    font-size: 12px !important;
    background: linear-gradient(135deg, #66698f, #7e769f) !important;
    user-select: none !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;
}

.btn-icon {
    font-size: 18px !important;
    margin-bottom: 3px !important;
}

.btn-text {
    font-size: 9px !important;
    font-weight: bold !important;
}

/* Игровое поле */
.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: #a0a0bb;
    border: 10px solid #a0a0bb;
    border-radius: 10px;
    padding: 10px;
    max-width: 500px;
    width: 100%;
    aspect-ratio: 1;
}

body[data-theme="vintage"] .board {
    background: #d2a679;
    border-color: #d2a679;
}

body[data-theme="neon"] .board {
    background: #4a4a8a;
    border-color: #4a4a8a;
}

body[data-theme="pastel"] .board {
    background: #b5ead7;
    border-color: #b5ead7;
}

body[data-theme="dark"] .board {
    background: #2d3047;
    border-color: #2d3047;
}

/* Пустые ячейки */
.tile-empty {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    min-height: 100px;
    min-width: 100px;
    height: 100%;
    width: 100%;
}

body[data-theme="vintage"] .tile-empty {
    background: rgba(237, 194, 120, 0.35);
    border-color: rgba(139, 115, 85, 0.2);
}

body[data-theme="neon"] .tile-empty {
    background: rgba(106, 106, 158, 0.35);
    border-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="pastel"] .tile-empty {
    background: rgba(149, 217, 187, 0.35);
    border-color: rgba(90, 123, 154, 0.2);
}

body[data-theme="dark"] .tile-empty {
    background: rgba(69, 72, 107, 0.35);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Адаптивность для пустых плиток */
@media (max-width: 480px) {
    .tile-empty {
        min-height: 70px;
        min-width: 70px;
    }
}

@media (max-width: 360px) {
    .tile-empty {
        min-height: 60px;
        min-width: 60px;
    }
}



/* Подсказка управления */
.controls-hint {
    margin-top: 20px;
    text-align: center;
    color: #776e65;
    font-size: 14px;
    font-style: italic;
}

body[data-theme="neon"] .controls-hint,
body[data-theme="dark"] .controls-hint {
    color: #ffffff;
}

/* Настройки */
.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="neon"] .setting,
body[data-theme="dark"] .setting {
    background: rgba(255, 255, 255, 0.1);
}

body[data-theme="neon"] .setting label,
body[data-theme="dark"] .setting label {
    color: #ffffff;
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #939adb;
    color: white;
    cursor: pointer;
}

.toggle-btn.off {
    background: #a0a2bb;
}

.language-switcher {
    display: flex;
    gap: 10px;
}

.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);
}

/* Статистика */
.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="neon"] .stat-item,
body[data-theme="dark"] .stat-item {
    background: rgba(255, 255, 255, 0.1);
}

body[data-theme="neon"] .stat-item span,
body[data-theme="dark"] .stat-item span {
    color: #ffffff;
}

/* Оверлей */
.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="neon"] .overlay-content,
body[data-theme="dark"] .overlay-content {
    background: rgba(15, 15, 35, 0.95);
    color: #ffffff;
}

body[data-theme="neon"] .overlay-content h2,
body[data-theme="neon"] .overlay-content span,
body[data-theme="dark"] .overlay-content h2,
body[data-theme="dark"] .overlay-content span {
    color: #ffffff;
}

.win-content h2 {
    color: #edc22e;
    font-size: 28px;
}

.gameover-content h2 {
    color: #f78e6a;
    font-size: 28px;
}

.pause-stats, .win-stats, .gameover-stats {
    margin: 20px 0;
    text-align: left;
}

.pause-stat, .win-stat, .gameover-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="neon"] .pause-stat,
body[data-theme="neon"] .win-stat,
body[data-theme="neon"] .gameover-stat,
body[data-theme="dark"] .pause-stat,
body[data-theme="dark"] .win-stat,
body[data-theme="dark"] .gameover-stat {
    background: rgba(255, 255, 255, 0.1);
}

.pause-buttons, .win-buttons, .gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Адаптивность */
@media (max-width: 480px) {
    .menu-container {
        padding: 20px 15px;

    flex-direction: column;


    }
    
    .game-header {
        padding: 10px !important;
        flex-direction: column;
        gap: 5px;
    }
    
    .game-info {
        width: 100%;
        justify-content: space-around;
    }
    
    .compact-controls {
        gap: 5px !important;
    }
    
    .compact-btn, .custom-btn {
        width: 50px !important;
        height: 45px !important;
    }
    
    .btn-icon {
        font-size: 16px !important;
    }
    
    .board {
        gap: 7px;
        padding: 6px;
        border-width: 5px;
    }
}

.menu-btn, .compact-btn, .custom-btn {
    -webkit-tap-highlight-color: transparent !important;
    -moz-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
}

* {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Контейнер для игрового экрана */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 100%;
    max-width: 500px;
}

/* Скрываем кнопки навигации в обучении */
.tutorial-nav {
    display: flex;
    gap: 1px;
    justify-content: center;
    flex-wrap: wrap;
}

.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: #656577;
}

body[data-theme="neon"] .tutorial-step h3,
body[data-theme="dark"] .tutorial-step h3 {
    color: #ffffff;
}

body[data-theme="neon"] .tutorial-step p,
body[data-theme="neon"] .tutorial-step li,
body[data-theme="dark"] .tutorial-step p,
body[data-theme="dark"] .tutorial-step li {
    color: #ffffff;
}

.tutorial-step ul {
    margin: 10px 0 10px 20px;
}

.tutorial-step li {
    margin: 5px 0;
}

#prevTutorial, #nextTutorial {
    display: none !important;
}

/* Стили для кнопки молоточка */
.hammer-btn.active {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52) !important;
    animation: hammer-pulse 1.5s infinite;
}

@keyframes hammer-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Режим выбора для молоточка */
.board.hammer-mode .tile.selectable {
    animation: tile-selectable 2s infinite;
    cursor: pointer;
    position: relative;
}

@keyframes tile-selectable {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 107, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.board.hammer-mode .tile.selectable:hover {
    transform: scale(1.05);
    z-index: 5;
}

/* Подсветка выбранного ряда/столбца */
.tile.selectable.highlighted {
    background: rgba(255, 107, 107, 0.3) !important;
    border: 2px solid #ff6b6b;
}

/* Адаптивность для кнопки молоточка */
@media (max-width: 480px) {
    .compact-controls {
        gap: 4px !important;
        
    }
    
    .compact-btn, .custom-btn {
        width: 40px !important;
        height: 35px !important;
        
    }
    
    .btn-icon {
        font-size: 16px !important;
    }
    
    .hammer-btn .btn-text {
        font-size: 8px !important;
    }
}

/* Плавная анимация движения плиток */
.tile.moving {
    transition: transform 0.15s ease-out;
    z-index: 5;
}

/* Гарантия плавности на всех устройствах */
.tile {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Отключаем анимации для пользователей, которые их не любят */
@media (prefers-reduced-motion: reduce) {
    .tile.moving {
        transition: none !important;

    }
}



/* Индикатор "за рекламу" */
.hammer-btn.ad-required::after {
    content: 'AD';
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ffd700;
    color: #000;
    font-size: 8px;
    font-weight: bold;
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1;
}

/* Анимация подсветки для привлечения внимания */
@keyframes ad-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.hammer-btn.ad-required:not(.disabled) {
    animation: ad-pulse 2s infinite;
}

/* Стиль для отключенного молоточка */
.hammer-btn.disabled {
    background: linear-gradient(135deg, #cccccc, #999999) !important;
    animation: none;
}

/* Улучшенный тултип */
.hammer-btn {
    position: relative;
}



/* Для мобильных - более заметные стили */
@media (max-width: 768px) {
    .hammer-btn.ad-required::after {
        font-size: 7px;
        top: 1px;
        right: 1px;
    }
    
    .hammer-btn.ad-required:not(.disabled) {
        animation: ad-pulse 1.5s infinite;
    }
}

/* Счетчик использований */
.hammer-uses-counter {
    font-size: 9px !important;
    font-weight: bold;
    margin-top: 2px;
}

/* Цвета для разного количества использований */
.hammer-btn.uses-3 .hammer-uses-counter {
    color: #000000;
}

.hammer-btn.uses-2 .hammer-uses-counter {
    color: #FF9800;
}

.hammer-btn.uses-1 .hammer-uses-counter {
    color: #f44336;
}

.hammer-btn.uses-0 .hammer-uses-counter {
    color: #999;
}









@media (min-width: 1200px) and (max-width: 1400px) {
 html, body {
        touch-action: none !important;
        -ms-touch-action: none !important;
    }
    
     .tile {
        font-size: 100px !important;
        min-height: 50px;
        min-width: 50px;
    }
    .board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;

    border-radius: 10px;
    padding: 1px;
    max-width: 400px;
    width: 100%;
    aspect-ratio: 1;
}

    .tile-2,
    .tile-4,
    .tile-8,
    .tile-16,
    .tile-32,
    .tile-64,
    .tile-128,
    .tile-256,
    .tile-512,
    .tile-1024,
    .tile-2048,
    .tile-super {
        font-size: 22px !important;
    }

 
}

/* Гарантия что viewport не позволяет масштабирование */
@media screen and (max-width: 768px) {
    html, body {
        touch-action: none !important;
        -ms-touch-action: none !important;
    }
    
     .tile {
        font-size: 10px !important;
        min-height: 50px;
        min-width: 50px;
    }
    .board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;

    border-radius: 10px;
    padding: 1px;
    max-width: 400px;
    width: 100%;
    aspect-ratio: 1;
}

    .tile-2,
    .tile-4,
    .tile-8,
    .tile-16,
    .tile-32,
    .tile-64,
    .tile-128,
    .tile-256,
    .tile-512,
    .tile-1024,
    .tile-2048,
    .tile-super {
        font-size: 22px !important;
    }
}
/* Планшеты и средние экраны */
@media (min-width: 481px) {

    html, body {
        touch-action: none !important;
        -ms-touch-action: none !important;
    }
    
     .tile {
        font-size: 10px !important;
        min-height: 50px;
        min-width: 50px;
    }
    .board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;

    border-radius: 10px;
    padding: 1px;
    max-width: 400px;
    width: 100%;
    aspect-ratio: 1;
}

    .tile-2,
    .tile-4,
    .tile-8,
    .tile-16,
    .tile-32,
    .tile-64,
    .tile-128,
    .tile-256,
    .tile-512,
    .tile-1024,
    .tile-2048,
    .tile-super {
        font-size: 20px !important;
    }
    
}
/* Стили для счетчика использований молоточка */


.hammer-uses-counter {

    color: #000000;
    font-size: 7px !important;
    font-weight: bold;
    padding: 1px 3px;
    border-radius: 50%;
    min-width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.3s ease;
}

/* Цвета для разного количества использований */
.hammer-btn.uses-3 .hammer-uses-counter {
    color: #000000;
}

.hammer-btn.uses-2 .hammer-uses-counter {
    color: #000000;
}

.hammer-btn.uses-1 .hammer-uses-counter {
    color: #ffffff;
}

.hammer-btn.uses-0 .hammer-uses-counter {
    background: #999999;
    color: #666666;
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
    .hammer-uses-counter {
        font-size: 8px !important;
        min-width: 10px;
        height: 10px;
        top: 1px;
        right: 1px;
    }
}

/* Анимация при изменении счетчика */
.hammer-uses-counter.changed {
    animation: counter-pulse 0.5s ease;
}

@keyframes counter-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}