* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -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;
}
:root {
    --primary-gradient: linear-gradient(135deg, #ed9c55 0%, #ff6f00);
    --secondary-gradient: linear-gradient(135deg, #f093fb, #f5576c);
    --accent-gradient: linear-gradient(135deg, #4facfe, #00f2fe);
    --bg-gradient: linear-gradient(135deg,#ed9c55 0%, #ff6f00 100%);
    
    /* Новые переменные для игрового поля */
    --board-bg: rgba(102, 126, 234, 0.15);
    --cell-bg: white;
    --cell-shadow: rgba(0,0,0,0.1);
    --player-x-color: #ff4757;
    --player-o-color: #1e90ff;
    --win-glow: #ffd700;
    --badge-bg: #667eea;
    --turn-bg: rgba(102, 126, 234, 0.1);
}



/* Запрет прокрутки для iOS и всех устройств */
html, body {
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: none;
    touch-action: pan-y pinch-zoom; /* Разрешаем только зум, но не прокрутку */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}
/* Экраны */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    padding: 10px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Меню - для мобильных */
.menu-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 20px;
    width: 100%;
    max-width: 340px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    margin: 0 auto; /* Центрирование */
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .menu-container {
        padding: 15px;
        max-width: 300px;
    }
}

/* Скрываем скроллбар для Chrome/Safari */
.menu-container::-webkit-scrollbar {
    width: 4px;
}

.menu-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}
/* Объединенный блок ранга и монет */
.rank-combined {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    padding: 6px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    width: 100%;
    gap: 8px;
}
.rank-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 2;
}

.rank-section .rank-icon {
    font-size: 24px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 50%;
}

.rank-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rank-details .rank-name {
    font-weight: 700;
    color: #333;
    font-size: 13px;
    line-height: 1.2;
}

.rank-progress {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}


.rank-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #eaa466, #b45b16);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.rank-wins {
    font-size: 9px;
    color: #666;
    text-align: right;
}

.coins-section {
    display: flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(135deg, #ffd700, #ffa500);
    border-radius: 25px;
    padding: 4px 8px;
    font-weight: 700;
    color: #333;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex: 1;
    justify-content: center;
    max-width: 70px;
}
.coins-section .coins-icon {
    font-size: 12px;
}

.coins-section .coins-amount {
    font-weight: 700;
}

/* Убираем старые стили для монет */
.menu-coins {
    display: none; /* Скрываем старые монеты */
}



/* Стили для ранга в игре */
.game-rank {
    margin-top: 15px;
    width: 100%;
}

/* Стили для ранга в меню */
.menu-rank {
    margin-top: 20px;
    width: 100%;
}
.game-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    color: #333;
    margin-top: 5px; /* Уменьшаем отступ */
    margin-bottom: 15px;
    word-break: break-word;
    padding: 0 10px;
}


@media (max-width: 360px) {
    .game-title {
        font-size: 18px;
    }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.menu-btn {
    background: linear-gradient(135deg,#ed9c55 0%, #ff6f00);
    border: none;
    border-radius: 12px;
    padding: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (max-width: 360px) {
    .menu-btn {
        padding: 10px;
        font-size: 14px;
    }
}

.menu-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.menu-btn:disabled {
    opacity: 0.5;
    background: #999;
    cursor: not-allowed;
    transform: none;
}

.back-btn {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    margin-top: 8px;
}

.start-btn {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    margin-bottom: 8px;
}

/* Монеты */
.coins-display {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    border-radius: 30px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #333;
    font-size: 15px;
    margin-top: 8px;
}

.coins-icon {
    font-size: 16px;
}

/* Настройки */
.settings-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 16px;
    color: #333;
}

@media (max-width: 360px) {
    .settings-title {
        font-size: 18px;
    }
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.settings-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.toggle-btn {
    background: #667eea;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    min-width: 55px;
}

.toggle-btn.off {
    background: #ccc;
}

.language-switcher {
    display: flex;
    gap: 6px;
}

.lang-btn {
    background: none;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}

.lang-btn.active {
    border-color: #667eea;
    opacity: 1;
    background: rgba(102, 126, 234, 0.1);
}

/* Магазин - исправлено для мобильных */
.shop-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 10px;
    color: #333;
    flex-shrink: 0;
}

.shop-coins {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    border-radius: 30px;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    margin-bottom: 12px;
    flex-shrink: 0;
    font-size: 14px;
}

.shop-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.shop-tab {
    flex: 1;
    background: none;
    border: 2px solid #ddd;
    border-radius: 25px;
    padding: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
    touch-action: manipulation;
}

.shop-tab.active {
    background: var(--primary-gradient); /* Оранжевый градиент для активной */
    border-color: var(--primary-gradient);
    color: white; /* Белый текст на оранжевом фоне */
    font-weight: 700;
}

/* Контейнер для прокрутки только товаров */
.shop-items-container {
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px;
    flex-shrink: 1;
}

/* Стилизация скроллбара */
.shop-items-container::-webkit-scrollbar {
    width: 4px;
}

.shop-items-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.shop-tab-content {
    display: none;
}

.shop-tab-content.active {
    display: block;
}

/* Сами товары */
.shop-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px;
}

.shop-item {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shop-item.owned {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid #4CAF50;
}

.shop-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.shop-item-name {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.shop-item-price {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #ffa500;
    font-size: 12px;
}

.shop-item-buy {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    border: none;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: #333;
    transition: all 0.2s;
    touch-action: manipulation;
}

.shop-item-buy:active {
    transform: scale(0.95);
}

.shop-item-buy.owned {
    background: #4CAF50;
    color: white;
}

.shop-item-buy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Обучение */
.tutorial-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 16px;
    color: #333;
}

.tutorial-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.rule-item {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.rule-icon {
    font-size: 18px;
    min-width: 28px;
    text-align: center;
}

/* Выбор режима */
.mode-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 16px;
    color: #333;
}

.mode-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.mode-btn {
    flex: 1;
    background: none;
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
    touch-action: manipulation;
}

.mode-btn.selected {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.difficulty-selector, .friend-options {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.difficulty-selector.hidden, .friend-options.hidden {
    display: none;
}

.difficulty-buttons {
    display: flex;
    gap: 6px;
}

.difficulty-btn {
    flex: 1;
    background: white;
    border: 2px solid #ddd;
    border-radius: 25px;
    padding: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

.difficulty-btn.selected {
    background: #ffa500;
    border-color: #ffa500;
    color: white;
}

.friend-desc {
    text-align: center;
    font-size: 13px;
    color: #666;
}

/* Игровой экран - исправлен для мобильных */
.game-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 16px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin: 0 auto;
}
@media (max-width: 360px) {
    .rank-combined {
        padding: 4px 8px;
    }
    
    .rank-section .rank-icon {
        font-size: 20px;
        min-width: 30px;
        height: 30px;
    }
    
    .rank-details .rank-name {
        font-size: 11px;
    }
    
    .coins-section {
        padding: 3px 6px;
        font-size: 10px;
        max-width: 60px;
    }
    
    .rank-item {
        padding: 6px 8px;
    }
    
    .rank-item-icon {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .rank-item-name {
        font-size: 11px;
    }
    
    .rank-item-desc {
        font-size: 9px;
    }
}

/* Убираем старые стили для монет */
.menu-coins {
    display: none;
}

/* Стили для ранга в игре */
.game-rank {
    margin-top: 10px;
    width: 100%;
}

/* Стили для ранга в меню */
.menu-rank {
    margin-top: 15px;
    width: 100%;
}
@media (max-width: 360px) {
    .game-container {
        padding: 12px;
        max-width: 320px;
    }
}

/* Верхняя панель */
.game-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.panel-left {
    display: flex;
    gap: 8px;
}
.turn-box {
    background: var(--turn-bg);
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.3s ease;
}


.turn-label {
    font-size: 12px;
    color: #666;
}

.turn-value {
    font-size: 16px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.turn-value.symbol-x {
    color: #ff4757;
}

.turn-value.symbol-o {
    color: #1e90ff;
}

.coins-box {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: #333;
    font-size: 13px;
}

.panel-right {
    display: flex;
    gap: 5px;
}

.panel-btn {
    background: rgba(102, 126, 234, 0.1);
    border: none;
    border-radius: 20px;
    width: 38px;
    height: 38px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

@media (max-width: 360px) {
    .panel-btn {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }
}

.panel-btn:active {
    transform: scale(0.95);
    background: rgba(102, 126, 234, 0.2);
}

.ad-btn {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    width: auto;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

/* Панель игроков */
.players-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.player-badge {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 25px;
    padding: 6px 16px;
    opacity: 0.5;
    transition: all 0.3s;
}

.player-badge.active {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.player-symbol {
    font-size: 20px;
}

.mode-badge {
    background: var(--badge-bg);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}


/* Игровое поле */
.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: var(--board-bg);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 12px;
    aspect-ratio: 1;
    width: 100%;
    transition: background 0.3s ease;
}

.cell {
    aspect-ratio: 1;
    background: var(--cell-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: min(7vw, 48px);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 8px var(--cell-shadow);
    transition: all 0.2s;
    width: 100%;
    height: 100%;
    touch-action: manipulation;
}

@media (max-width: 360px) {
    .cell {
        font-size: 40px;
    }
}

.cell:active {
    transform: scale(0.95);
}

.cell.empty {
    background: rgba(255, 255, 255, 0.7);
}

.cell.symbol-x {
    color: var(--player-x-color);
}

.cell.symbol-o {
    color: var(--player-o-color);
}

.cell.winning-cell {
    animation: win-pulse 1s infinite;
    box-shadow: 0 0 15px var(--win-glow);
}

@keyframes win-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.cell.just-placed {
    animation: pop 0.2s ease;
}

@keyframes pop {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Кнопка рестарта */
.restart-btn {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border: none;
    border-radius: 25px;
    padding: 12px;
    width: 100%;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

@media (max-width: 360px) {
    .restart-btn {
        padding: 10px;
        font-size: 14px;
    }
}

.restart-btn:active {
    transform: translateY(2px);
    opacity: 0.9;
}

/* Оверлеи */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay.active {
    display: flex;
}

.overlay-content {
    background: white;
    border-radius: 24px;
    padding: 20px;
    width: 85%;
    max-width: 280px;
    text-align: center;
    pointer-events: auto;
    z-index: 1001;
}

@media (max-width: 360px) {
    .overlay-content {
        padding: 16px;
        max-width: 250px;
    }
}

.overlay-content.win {
    background: linear-gradient(135deg,#ed9c55 0%, #ff6f00);
    color: white;
}

.overlay-content.draw {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.overlay-content.lose {
    background: linear-gradient(135deg, #ff6b6b, #ee5253);
    color: white;
}

.overlay-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
}

@media (max-width: 360px) {
    .overlay-title {
        font-size: 20px;
    }
}

.overlay-stats {
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    font-size: 14px;
}

.stat-row:last-child {
    border-bottom: none;
}

.overlay-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.overlay-btn {
    background: white;
    border: none;
    border-radius: 25px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.overlay-btn:active {
    transform: scale(0.98);
}

.overlay-btn.secondary {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Уведомления */
.game-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    z-index: 2000;
    animation: fadeInOut 2s ease;
    border: 2px solid #ffd700;
    pointer-events: none;
    white-space: nowrap;
}

@media (max-width: 360px) {
    .game-notification {
        font-size: 12px;
        padding: 8px 16px;
    }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -40%); }
    15% { opacity: 1; transform: translate(-50%, -50%); }
    85% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -60%); }
}
/* Стили для отображения ранга - исправлено позиционирование */
.rank-display {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    padding: 8px 16px 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.3);
    z-index: 1000;
    font-size: 13px;
    min-width: 160px;
    pointer-events: none; /* Чтобы не мешать кликам */
}

.rank-icon {
    font-size: 28px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    padding: 4px;
}

.rank-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.rank-name {
    font-weight: 700;
    color: #333;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

.rank-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.rank-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #eaa466, #b45b16);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.rank-wins {
    font-size: 11px;
    color: #666;
    text-align: right;
    font-weight: 500;
}

/* Уведомление о повышении ранга */
.rank-up-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 30px;
    padding: 25px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 4px solid #ffd700;
    max-width: 320px;
    width: 90%;
}

.rank-up-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.rank-up-content {
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
}

.rank-up-icon {
    font-size: 64px;
    min-width: 80px;
    text-align: center;
    animation: rank-icon-spin 1s ease;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}

.rank-up-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rank-up-title {
    font-size: 20px;
    font-weight: 800;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.rank-up-old {
    font-size: 15px;
    opacity: 0.9;
    text-decoration: line-through;
    text-decoration-color: rgba(255,255,255,0.5);
}

.rank-up-new {
    font-size: 18px;
    font-weight: 700;
    color: #ffd700;
}

.rank-up-bonus {
    font-size: 16px;
    color: #ffd700;
    font-weight: 600;
    margin-top: 8px;
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
    align-self: flex-start;
}

@keyframes rank-icon-spin {
    0% { transform: rotate(0deg) scale(0.5); opacity: 0; }
    50% { transform: rotate(180deg) scale(1.3); opacity: 0.8; }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}


/* Монеты в правом верхнем углу */
.menu-coins {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #ffd700, #ffa500);
    border-radius: 30px;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: #333;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 10;
}

/* Ранг внизу меню */
.menu-rank, .game-rank {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid rgba(0,0,0,0.1);
}

.rank-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255,255,255,0.9);
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.rank-container .rank-icon {
    font-size: 36px;
    min-width: 50px;
    text-align: center;
}

.rank-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rank-details .rank-name {
    font-weight: 700;
    color: #333;
    font-size: 16px;
}

.rank-progress {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.rank-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #eaa466, #b45b16);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.mode-description {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0 15px 0;
    text-align: center;
}

.desc-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

@media (max-width: 360px) {
    .desc-text {
        font-size: 12px;
    }
}
.rank-wins {
    font-size: 12px;
    color: #666;
    text-align: right;
}
/* Специальные стили для контейнера рангов */
.ranks-container-flex {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 90vh;
}

.ranks-list-container {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    margin: 15px 0;
    padding: 5px;
}

/* Фикс для кнопки назад */
#ranksMenu .back-btn {
    margin-top: 10px;
    flex-shrink: 0;
    width: 100%;
}

/* Список рангов */
.ranks-container {
    max-height: 350px;
    overflow-y: auto;
    margin: 10px 0;
    padding: 3px;
    flex: 1;
}
#ranksMenu .menu-container {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 90vh;
}

#ranksMenu .back-btn {
    margin-top: 15px;
    flex-shrink: 0;
    position: relative;
    bottom: 0;
    width: 100%;
}

/* Обновляем стили для ранга в меню */
.menu-rank {
    margin-top: 15px;
    width: 100%;
    flex-shrink: 0;
}
.rank-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    position: relative;
}


.rank-item.unlocked {
    opacity: 1;
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #eaa466, #b45b16) border-box;
}

.rank-item.locked {
    opacity: 0.7;
    filter: grayscale(0.8);
}

.rank-item.current {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(233, 164, 102, 0.3);
}

.rank-item-icon {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.rank-item-info {
    flex: 1;
}

.rank-item-name {
    font-weight: 700;
    color: #333;
    font-size: 16px;
    margin-bottom: 4px;
}

.rank-item-desc {
    font-size: 11px;
    color: #666;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.rank-item-wins {
    font-size: 10px;
    color: #888;
}

.rank-current-badge {
    position: absolute;
    top: -3px;
    right: 5px;
    background: linear-gradient(135deg, #eaa466, #b45b16);
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 8px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Убираем кнопку рестарта */
.restart-btn {
    display: none;
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .menu-coins {
        top: 10px;
        right: 10px;
        padding: 5px 12px;
        font-size: 14px;
    }
    
.ranks-container {
    max-height: 350px;
    overflow-y: auto;
    margin: 10px 0;
    padding: 3px;
}
    
    .rank-container .rank-icon {
        font-size: 28px;
        min-width: 40px;
    }
    
    .rank-details .rank-name {
        font-size: 14px;
    }
.rank-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    position: relative;
}
    
.rank-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
    
    .rank-item-name {
        font-size: 14px;
    }
       .game-container {
        padding: 10px;
        max-width: 320px;
    }
    
    /* Уменьшаем верхнюю панель */
    .game-panel {
        margin-bottom: 8px;
    }
    
    .turn-box {
        padding: 4px 10px;
        gap: 4px;
    }
    
    .turn-label {
        font-size: 11px;
    }
    
    .turn-value {
        font-size: 14px;
        min-width: 18px;
    }
    
    .coins-box {
        padding: 4px 10px;
        font-size: 12px;
        gap: 3px;
    }
    
    .panel-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .ad-btn {
        width: auto;
        padding: 0 8px;
        font-size: 11px;
    }
    
    /* Уменьшаем панель игроков */
    .players-panel {
        margin-bottom: 10px;
    }
    
    .player-badge {
        padding: 4px 12px;
    }
    
    .player-symbol {
        font-size: 16px;
    }
    
    .mode-badge {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    /* Уменьшаем игровое поле */
    .game-board {
        gap: 4px;
        padding: 4px;
        margin-bottom: 8px;
    }
    
    .cell {
        font-size: 32px;
        border-radius: 10px;
    }
    
    /* Уменьшаем блок с рангом */
    .rank-combined {
        padding: 3px px;
        gap: 6px;
        margin-top: 5px;
    }
    
    .rank-section {
        gap: 6px;
    }
    
    .rank-section .rank-icon {
        font-size: 20px;
        min-width: 30px;
        height: 30px;
    }
    
    .rank-details .rank-name {
        font-size: 11px;
    }
    
    .rank-progress {
        height: 3px;
    }
    
    .rank-wins {
        font-size: 8px;
    }
    
    .coins-section {
        padding: 3px 6px;
        font-size: 10px;
        max-width: 55px;
        gap: 2px;
    }
    
    .coins-section .coins-icon {
        font-size: 10px;
    }
}

@media (max-width: 360px) {
    .game-container {
        padding: 8px;
        max-width: 280px;
    }
    
    .turn-box {
        padding: 3px 8px;
    }
    
    .turn-label {
        font-size: 10px;
    }
    
    .turn-value {
        font-size: 12px;
    }
    
    .coins-box {
        padding: 3px 8px;
        font-size: 10px;
    }
    
    .panel-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .ad-btn {
        padding: 0 6px;
        font-size: 10px;
    }
    
    .player-badge {
        padding: 3px 10px;
    }
    
    .player-symbol {
        font-size: 14px;
    }
    
    .mode-badge {
        padding: 3px 6px;
        font-size: 9px;
    }
    
    .cell {
        font-size: 28px;
    }
    
    .rank-combined {
        padding: 3px 6px;
    }
    
    .rank-section .rank-icon {
        font-size: 18px;
        min-width: 26px;
        height: 26px;
    }
    
    .rank-details .rank-name {
        font-size: 10px;
    }
    
    .rank-wins {
        font-size: 10px;
    }
    
    .coins-section {
        padding: 2px 5px;
        font-size: 9px;
        max-width: 48px;
    }
}

/* Темы для магазина - исправлено */
.theme-preview {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    margin-right: 8px;
    display: inline-block;
}

.theme-preview.classic { 
    background: linear-gradient(135deg, #eaa466, #b45b16); 
}
.theme-preview.vintage { 
    background: linear-gradient(135deg, #e6b980, #eacda3); 
}
.theme-preview.neon { 
    background: linear-gradient(135deg, #12c2e9, #c471ed, #f64f59); 
}
.theme-preview.pastel { 
    background: linear-gradient(135deg, #fbc2eb, #a6c1ee); 
}
.theme-preview.dark { 
    background: linear-gradient(135deg, #2c3e50, #3498db); 
}
/* Активная тема в списке */
.shop-item .theme-preview {
    border: 2px solid transparent;
}

.shop-item.owned .theme-preview {
    border-color: #4CAF50;
}
/* Делаем .menu-container для магазина flex-колонкой */
.shop-container {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

/* Кастомная подсказка для кнопки рекламы */
.ad-btn {
    position: relative;
}

.ad-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    border: 2px solid #ffd700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.ad-btn:hover .ad-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Стрелочка подсказки */
.ad-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #ffd700 transparent transparent transparent;
}

@media (hover: none) and (pointer: coarse) {
    .ad-tooltip {
        display: none;
    }
}






