/* === GLASSMORPHISM UI v4.1 === */

:root {
    /* Основные цвета */
    --accent-color: #29C3FA;
    --danger-color: #FF3B30;
    
    /* Glassmorphism контейнеры */
    --glass-dark: rgba(10, 12, 15, 0.85);
    --glass-light: rgba(255, 255, 255, 0.85);
    --glass-overlay: rgba(0, 0, 0, 0.18);
    
    /* Типографика */
    --font-display: -apple-system, 'SF Pro Display', BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-text: -apple-system, 'SF Pro Text', BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Размеры и отступы */
    --border-radius: 24px;
    --blur-amount: 10px;
    --container-padding: 16px;
    --item-spacing: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-text);
    background: transparent;
    color: white;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Адаптивные классы для разной яркости фона */
.ui-theme-dark {
    --ui-text-primary: rgba(255, 255, 255, 0.95);
    --ui-text-secondary: rgba(255, 255, 255, 0.7);
    --ui-container: var(--glass-dark);
}

.ui-theme-light {
    --ui-text-primary: rgba(0, 0, 0, 0.95);
    --ui-text-secondary: rgba(0, 0, 0, 0.7);
    --ui-container: var(--glass-light);
}

/* === КОНТЕЙНЕР ИГРЫ === */
.game-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent;
}

/* === ВЕРХНЯЯ ПАНЕЛЬ (HUD) === */
.top-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px var(--container-padding);
    padding-top: max(20px, env(safe-area-inset-top, 20px));
    background: var(--glass-overlay);
    backdrop-filter: blur(var(--blur-amount));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    
    /* 🎯 АНИМАЦИЯ КАК У БОКОВЫХ СТАТ-КАРТ */
    opacity: 1;
    transform: translateY(0);
    transition: all 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94); /* ease-out-cubic */
}

/* 🎯 СКРЫТИЕ ВЕРХНЕГО HUD НА ДРУГИХ ВКЛАДКАХ */
.top-panel.hidden {
    opacity: 0;
    transform: translateY(-100%);
}

.location-info {
    display: flex;
    align-items: center;
    gap: var(--item-spacing);
    flex: 1;
}

.location-icon {
    font-size: 20px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 🔥 ИСПРАВЛЕНИЕ: Принудительные стили для правильного отображения эмодзи */
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols", sans-serif !important;
    text-rendering: auto !important;
    -webkit-font-feature-settings: "liga" off !important;
    font-feature-settings: "liga" off !important;
    font-variant-emoji: emoji !important;
    line-height: 1 !important;
}

.location-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.location-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: white !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст */
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); /* Добавляем тень для контраста */
}

.monster-level {
    font-size: 12px;
    opacity: 0.9; /* Увеличиваем непрозрачность */
    color: rgba(255, 255, 255, 0.9) !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); /* Добавляем тень для контраста */
}

/* Отладочная информация о версии */
.debug-version {
    position: absolute;
    top: 24px;
    right: 16px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 10px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    z-index: 200;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.debug-version.show {
    opacity: 1;
    transform: translateY(0);
}

.debug-version-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.debug-version-line {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.currencies {
    display: flex;
    gap: var(--item-spacing);
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    min-width: 64px;
}

.currency-icon {
    font-size: 16px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.currency-value {
    font-family: var(--font-text);
    font-size: 14px;
    font-weight: 500;
    color: white !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст */
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); /* Добавляем тень для контраста */
}

/* Специальные стили для энергии */
.currency-item:has(.currency-icon:contains("⚡")) {
    border-color: rgba(41, 195, 250, 0.3);
}

.currency-item .currency-icon[data-type="energy"] {
    color: var(--accent-color);
}

/* === ИГРОВАЯ АРЕНА === */
.game-arena {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 50; /* Поверх фона, но под UI */
    padding-bottom: 120px; /* Отступ для нижнего HUD */
    transition: padding-bottom 240ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Уменьшенный отступ когда HUD свернут */
.bottom-menu.collapsed ~ .game-arena,
.game-arena.hud-collapsed {
    padding-bottom: 60px;
}

/* === СТАТ-КАРТЫ В БОЮ === */
.battle-stats-cards {
    position: absolute;
    right: 24px; /* Отступ от safe-area */
    top: 50%;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Зазор между картами */
    z-index: 60; /* Поверх Enemy, но под HUD */
    opacity: 1; /* Видимы по умолчанию */
    transform: translateY(-50%) translateX(0); /* На месте по умолчанию */
    transition: all 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94); /* ease-out-cubic */
}

/* Скрываем карты когда НЕ в режиме боя */
.battle-stats-cards.hidden {
    opacity: 0;
    transform: translateY(-50%) translateX(40px);
}

.stat-card {
    background: transparent; /* Убрали glassmorphism фон */
    border-radius: 8px;
    padding: 6px 8px; /* Уменьшили отступы в 2 раза */
    display: flex;
    align-items: center;
    gap: 6px; /* Уменьшили зазор в 2 раза */
    min-width: 60px; /* Уменьшили минимальную ширину в 2 раза */
    color: white !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст */
}

.stat-card-icon {
    font-size: 16px; /* Уменьшили размер иконки в 2 раза */
    width: 20px; /* Уменьшили размер в 2 раза */
    height: 20px; /* Уменьшили размер в 2 раза */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-content {
    display: flex;
    flex-direction: column;
    gap: 1px; /* Уменьшили зазор в 2 раза */
    min-width: 0;
}

.stat-card-label {
    font-family: var(--font-text);
    font-size: 8px; /* Читабельный размер */
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9) !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст */
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); /* Добавляем тень для контраста */
}

.stat-card-value {
    font-family: var(--font-display);
    font-size: 14px; /* Читабельный размер для значений */
    font-weight: 700;
    color: white !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст */
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8); /* Тень для контраста */
}

/* === ОТЗЫВЧИВОСТЬ === */
/* Мобильные устройства */
@media (max-width: 390px) {
    .battle-stats-cards {
        right: 16px; /* Меньший отступ */
    }
    
    .stat-card {
        min-width: 46vw; /* 46% экрана */
        padding: 10px 12px;
    }
    
    .stat-card-icon {
        font-size: 28px;
        width: 36px;
        height: 36px;
    }
    
    .stat-card-value {
        font-size: 28px; /* Уменьшенный шрифт */
        color: white !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст в мобильной версии */
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9); /* Усиленная тень на мобильных */
    }
    
    .stat-card-label {
        font-size: 10px;
        color: rgba(255, 255, 255, 0.9) !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст в мобильной версии */
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); /* Усиленная тень на мобильных */
    }
}

/* Планшеты */
@media (min-width: 600px) {
    .battle-stats-cards {
        right: 32px;
    }
    
    .stat-card {
        min-width: 240px; /* Фиксированная ширина */
        padding: 16px 20px;
    }
    
    .stat-card-icon {
        font-size: 56px; /* Большие иконки */
        width: 56px;
        height: 56px;
    }
    
    .stat-card-value {
        font-size: 24px;
        color: white !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст в планшетной версии */
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); /* Тень для контраста на планшетах */
    }
    
    .stat-card-label {
        font-size: 12px;
        color: rgba(255, 255, 255, 0.9) !important; /* 🎯 ИСПРАВЛЕНИЕ: Всегда светлый текст в планшетной версии */
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); /* Тень для контраста на планшетах */
    }
}

.arena-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.85; /* 🔥 ИСПРАВЛЕНО: Увеличил прозрачность для яркости PNG фонов */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0; /* За всеми элементами */
}

/* Фоны для разных локаций */
.arena-background.light-forest {
    background: 
        url('/public/images/light-forest-bg.png'),
        url('/public/images/light-forest-bg.svg'),
        linear-gradient(135deg, #4a7c59 0%, #68bb59 100%); /* Fallback - светлые тона */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.forest {
    background: 
        url('/public/images/forest-bg.png'),
        url('/public/images/forest-bg.svg'),
        linear-gradient(135deg, #2d5016 0%, #4a7c59 100%); /* Fallback */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.cave {
    background: 
        url('/public/images/cave-bg.png'),
        url('/public/images/cave-bg.svg'),
        linear-gradient(135deg, #2c5f7c 0%, #1a4a5c 100%); /* Fallback - голубые тона пещер */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.volcano {
    background: 
        url('/public/images/volcano-bg.png'),
        url('/public/images/volcano-bg.svg'),
        linear-gradient(135deg, #ff4444 0%, #cc1100 100%); /* Fallback - огненные тона */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.mountain {
    background: 
        linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.3)),
        url('/public/images/ice-bg.svg'),
        linear-gradient(135deg, #87ceeb 0%, #4682b4 100%); /* Fallback - ледяные тона */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.space {
    background: 
        url('/public/images/space-bg.png'),
        url('/public/images/space-bg.svg'),
        linear-gradient(135deg, #4c1d95 0%, #1e1b4b 100%); /* Fallback - космические фиолетовые тона */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.ice {
    background: 
        url('/public/images/ice-bg.png'),
        url('/public/images/ice-bg.svg'),
        linear-gradient(135deg, #87ceeb 0%, #4682b4 100%); /* Fallback - ледяные голубые тона */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.heaven {
    background: 
        url('/public/images/heaven-bg.png'), /* Primary PNG */
        url('/public/images/heaven-bg.svg'), /* SVG Fallback */
        linear-gradient(135deg, #87ceeb 0%, #ffd700 100%); /* Color Fallback - небесные золотисто-голубые тона */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}

.arena-background.dungeon {
    background: 
        linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.2)),
        url('/public/images/legends-bg.svg'),
        linear-gradient(135deg, #ffd700 0%, #ffb347 100%); /* Fallback - золотые небесные тона */
    background-size: cover, cover, 100% 100%;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
}



/* === КОНТЕЙНЕР ПРОТИВНИКА === */
.monster-container {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 20px;
}

/* Принудительное отображение HP элементов */
#monsterHP, #monsterMaxHP {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-weight: bold !important;
    color: #ff6b6b !important;
}

.monster-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 3px 6px rgba(0,0,0,0.7);
    color: #fff;
}

/* HP противника */
.monster-hp-container {
    margin-bottom: 20px;
}

.monster-hp-bar {
    width: 300px;
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin: 0 auto 8px;
    overflow: hidden;
}

.monster-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444 0%, #cc0000 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

.monster-hp-text {
    font-size: 16px;
    font-weight: 600;
    color: #ffdddd;
    text-shadow: 0 2px 4px rgba(0,0,0,0.7);
}

/* Спрайт противника */
.monster-sprite {
    font-size: 159px; /* Уменьшено в 1.5 раза (было 239px) */
    cursor: pointer;
    transition: transform 0.1s ease;
    margin: 20px 0;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.6));
    animation: idle 2s ease-in-out infinite;
}

.monster-sprite:active {
    transform: scale(0.95);
}

/* Убираем увеличение при наведении мыши */

@keyframes idle {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

/* Дополнительные анимации для монстра */
@keyframes monsterFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes monsterHit {
    0% { transform: translateX(0px); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
    100% { transform: translateX(0px); }
}

/* 🎯 НОВАЯ АНИМАЦИЯ: Горизонтальная вибрация */
@keyframes monsterVibrate {
    0%, 100% { margin-left: 0px; }
    20% { margin-left: -3px; }
    40% { margin-left: 3px; }
    60% { margin-left: -2px; }
    80% { margin-left: 2px; }
}

/* Класс для применения вибрации поверх основной анимации */
.monster-sprite.vibrating {
    animation: idle 2s ease-in-out infinite, monsterVibrate 0.15s ease-out;
}

/* 🎯 НОВАЯ АНИМАЦИЯ: Пульсация энергии когда она закончилась */
@keyframes energyPulse {
    0%, 100% { 
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 0 30px rgba(255, 0, 0, 0.4);
        border: 2px solid rgba(255, 0, 0, 0.8);
    }
    50% { 
        box-shadow: 0 0 25px rgba(255, 0, 0, 1), 0 0 40px rgba(255, 0, 0, 0.6);
        border: 2px solid rgba(255, 0, 0, 1);
    }
}

@keyframes monsterDeathShake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-2deg) scale(1.05); }
    75% { transform: rotate(2deg) scale(0.95); }
}

@keyframes monsterDeathDisappear {
    0% { 
        opacity: 1; 
        transform: scale(1) rotate(0deg); 
    }
    100% { 
        opacity: 0; 
        transform: scale(0.3) rotate(45deg); 
    }
}

/* Эффекты атаки */
.attack-effects {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

/* === НИЖНЯЯ НАВИГАЦИЯ === */
.bottom-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    /* 🎯 УНИФИЦИРОВАННАЯ АНИМАЦИЯ КАК У ВЕРХНЕГО HUD */
    opacity: 1;
    transform: translateY(0);
    transition: all 180ms cubic-bezier(0.25, 0.46, 0.45, 0.94); /* ease-out-cubic - как у верхнего */
    color: white !important; /* 🎯 ИСПРАВЛЕНИЕ: Принудительный белый цвет для всего меню */
}

/* 🎯 ИСПРАВЛЕНИЕ: Принудительный белый цвет для всех элементов навигации */
.bottom-menu,
.bottom-menu *,
.expanded-hud,
.expanded-hud *,
.menu-tabs,
.menu-tabs * {
    color: white !important;
}

/* 🎯 ИСПРАВЛЕНИЕ: АНИМАЦИЯ ТОЛЬКО В РЕЖИМЕ БОЯ КОГДА СВЕРНУТ */
.bottom-menu.collapsed.battle-mode {
    opacity: 1; /* ИСПРАВЛЕНО: Полная видимость всегда */
    transform: translateY(50%); /* ИСПРАВЛЕНО: Меньше сворачивается, остается доступным */
}

/* УБИРАЕМ СТАРЫЕ ПРОБЛЕМНЫЕ СТИЛИ */
.bottom-menu.collapsed {
    /* Только скрываем/показываем элементы, без opacity изменений */
}

.bottom-menu.expanded {
    opacity: 1;
    transform: translateY(0);
}

/* === СВЕРНУТЫЙ HUD (только для боя) === */
.collapsed-hud {
    position: absolute; /* Принудительное позиционирование */
    bottom: 16px; /* Фиксация в нижней части */
    left: 50%;
    transform: translateX(-50%);
    height: 32px;
    width: 70%;
    background: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none; /* Скрыт по умолчанию */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 240ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 150; /* Под основным HUD но над игрой */
}

.collapsed-hud:hover {
    background: rgba(0, 0, 0, 0.18);
    transform: translateX(-50%) translateY(-2px); /* Сохраняем центрирование + поднимаем */
}

.expand-arrow {
    color: var(--accent-color);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* ИСПРАВЛЕНО: Принудительная яркость */
    opacity: 1 !important;
    filter: brightness(1.5); /* Делаем ярче */
}

/* === РАЗВЕРНУТЫЙ HUD === */
.expanded-hud {
    position: absolute; /* Принудительное позиционирование */
    bottom: 16px; /* Фиксация в нижней части */
    left: 16px;
    right: 16px;
    height: 96px;
    background: var(--glass-overlay);
    backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block; /* Видим по умолчанию */
    padding: var(--container-padding);
    z-index: 150; /* Под основным HUD но над игрой */
}

.menu-tabs {
    display: flex;
    padding: 0;
    height: 100%;
}

.menu-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 8px;
    color: rgba(255, 255, 255, 0.7) !important; /* 🎯 ИСПРАВЛЕНИЕ: Принудительный белый цвет */
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 0;
}

.menu-tab:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.menu-tab:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.menu-tab.active {
    color: var(--accent-color) !important; /* 🎯 ИСПРАВЛЕНИЕ: Принудительный акцентный цвет */
    background: rgba(41, 195, 250, 0.08);
}

.menu-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    right: 8px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), #00B4DB);
    border-radius: 2px;
}

.menu-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.9) !important; /* 🎯 ИСПРАВЛЕНИЕ: Принудительный светлый цвет при ховере */
    background: rgba(255, 255, 255, 0.05);
}

.tab-icon {
    font-size: 24px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    stroke-width: 2px;
    color: inherit !important; /* 🎯 ИСПРАВЛЕНИЕ: Наследуем цвет от родителя */
}

.tab-label {
    font-family: var(--font-text);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    color: inherit !important; /* 🎯 ИСПРАВЛЕНИЕ: Наследуем цвет от родителя */
}

/* === СОСТОЯНИЯ HUD === */
.bottom-menu.collapsed .collapsed-hud {
    display: flex;
}

.bottom-menu.collapsed .expanded-hud {
    display: none;
}

.bottom-menu.expanded .collapsed-hud {
    display: none;
}

.bottom-menu.expanded .expanded-hud {
    display: block;
}

/* 🎯 ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ ПЛАВНОЙ АНИМАЦИИ */
.collapsed-hud,
.expanded-hud {
    transition: inherit; /* Наследуем анимацию от родителя */
}

/* === ПАНЕЛИ МЕНЮ (аналогично нижнему HUD) === */
.shop-panel,
.achievements-panel,
.profile-panel,
.settings-panel {
    position: fixed;
    bottom: 160px; /* УВЕЛИЧЕН отступ: выше нижнего HUD для полной видимости */
    left: 16px;
    right: 16px;
    background: var(--glass-overlay);
    backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--container-padding);
    z-index: 160; /* Выше нижнего HUD (150) */
    
    /* По умолчанию скрыт */
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: all 320ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    /* УВЕЛИЧЕНА высота для большего содержимого */
    height: 300px;
    overflow-y: auto;
}

/* Показать панель */
.shop-panel.show,
.achievements-panel.show,
.profile-panel.show,
.settings-panel.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* === ОБЩИЕ СТИЛИ ДЛЯ ВСЕХ ПАНЕЛЕЙ === */

/* Заголовки панелей */
.shop-header,
.achievements-header, 
.profile-header,
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shop-title,
.achievements-title,
.profile-title, 
.settings-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin: 0;
}

/* Кнопки закрытия */
.shop-close,
.achievements-close,
.profile-close,
.settings-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.shop-close:hover,
.achievements-close:hover,
.profile-close:hover,
.settings-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Табы в панелях */
.shop-tabs,
.achievements-tabs,
.profile-tabs,
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.shop-tab,
.achievements-tab,
.profile-tab,
.settings-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.shop-tab.active,
.achievements-tab.active,
.profile-tab.active,
.settings-tab.active {
    background: rgba(41, 195, 250, 0.2);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.shop-tab:hover:not(.active),
.achievements-tab:hover:not(.active),
.profile-tab:hover:not(.active),
.settings-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Контент панелей */
.shop-content,
.achievements-content,
.profile-content,
.settings-content {
    flex: 1;
    overflow-y: auto;
}

/* Сетка товаров */
.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* УВЕЛИЧЕНА минимальная ширина */
    gap: 10px; /* УМЕНЬШЕН зазор для экономии места */
    max-height: calc(100% - 80px); /* Ограничиваем высоту для прокрутки */
    overflow-y: auto;
    padding-right: 4px; /* Отступ для скроллбара */
}

/* Карточка товара */
.shop-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shop-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.shop-item-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.shop-item-name {
    font-size: 12px;
    font-weight: 500;
    color: white;
    margin-bottom: 4px;
}

.shop-item-level {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

.shop-item-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.shop-item-price-icon {
    font-size: 10px;
}

/* Кнопка покупки */
.shop-buy-btn {
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 6px;
    width: 100%;
}

.shop-buy-btn:hover {
    background: #0A9BD8;
    transform: translateY(-1px);
}

.shop-buy-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    transform: none;
}

/* === СТАРЫЕ СТИЛИ МАГАЗИНА (удаляем) === */
.menu-content {
    display: none !important; /* Отключаем старое полноэкранное меню */
}

.menu-panel {
    display: none !important; /* Отключаем старые панели */
}

/* === СТИЛИ ДЛЯ ДОСТИЖЕНИЙ === */
.achievement-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.achievement-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(41, 195, 250, 0.3);
}

.achievement-icon {
    font-size: 24px;
    margin-right: 12px;
    width: 40px;
    text-align: center;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
    font-size: 14px;
}

.achievement-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.achievement-progress {
    font-size: 11px;
    color: var(--accent-color);
    font-weight: 600;
}

/* === СТИЛИ ДЛЯ ПРОФИЛЯ === */
.profile-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-stat:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.profile-section {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-section:last-child {
    border-bottom: none;
}

.profile-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 12px;
}

.profile-section p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.profile-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.profile-btn:hover {
    background: #1fa8d9;
    transform: translateY(-1px);
}

/* === СТИЛИ ДЛЯ НАСТРОЕК === */
.settings-section {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* Стили для переключателей */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

input:checked + .slider:hover {
    background-color: #1fa8d9;
}

/* === СТИЛИ ДЛЯ ЗВУКОВЫХ НАСТРОЕК === */
.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #1fa8d9;
    transform: scale(1.1);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    background: #1fa8d9;
    transform: scale(1.1);
}

.volume-value {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.test-sound-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.test-sound-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: var(--accent-color);
}

.test-sound-btn:active {
    transform: translateY(1px);
}

.test-sound-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Стили для отключенных переключателей */
.toggle input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.setting-item:has(input:disabled) span {
    opacity: 0.6;
}

/* === СЕТКА ТОВАРОВ МАГАЗИНА === */

/* === 🆕 BALANCE V5 STYLES === */

/* Анимация для успешной покупки улучшения */
.shop-item.purchase-success {
    background: rgba(41, 195, 250, 0.6) !important;
    border-color: #29C3FA !important;
    transform: scale(1.05);
    transition: all 150ms ease-out;
}

/* Эффект обратной связи при покупке */
@keyframes upgradeFeedback {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-30px) scale(1);
    }
}

.upgrade-feedback {
    animation: upgradeFeedback 1s ease-out;
}

/* Стили для улучшенных карточек магазина v5 */
.shop-item-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    line-height: 1.3;
}

.shop-item-level {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

/* Анимация для критического удара */
@keyframes criticalHit {
    0% {
        transform: scale(1);
        color: #fff;
    }
    50% {
        transform: scale(1.3);
        color: #ff4444;
        text-shadow: 0 0 10px #ff4444;
    }
    100% {
        transform: scale(1);
        color: #fff;
    }
}

.critical-hit {
    animation: criticalHit 300ms ease-out;
}

/* Эффект недостатка энергии */
@keyframes noEnergyShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.no-energy-feedback {
    animation: noEnergyShake 400ms ease-out;
    background: rgba(255, 59, 48, 0.3) !important;
    border-color: #FF3B30 !important;
}

/* Отображение больших чисел с форматированием */
.formatted-number {
    font-weight: 600;
    color: var(--accent-color);
}

.number-large {
    font-size: 1.1em;
    text-shadow: 0 0 8px rgba(41, 195, 250, 0.3);
}

/* Индикатор локации и прогресса */
.location-progress {
    background: var(--glass-dark);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.location-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.location-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.location-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #4CAF50);
    transition: width 300ms ease-out;
    border-radius: 3px;
}

.location-counter {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    text-align: center;
}

/* Улучшенное отображение энергии для v5 */
.energy-display-v5 {
    position: relative;
}

.energy-regen-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

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

/* Эффекты для различных типов улучшений */
.upgrade-effect-damage {
    border-left: 3px solid #ff4444;
}

.upgrade-effect-energy {
    border-left: 3px solid #4CAF50;
}

.upgrade-effect-critical {
    border-left: 3px solid #ff9800;
}

.upgrade-effect-boost {
    border-left: 3px solid #9c27b0;
}

/* Адаптация для мобильных устройств */
@media (max-width: 480px) {
    .shop-item-description {
        font-size: 11px;
    }
    
    .location-progress {
        padding: 6px 10px;
    }
    
    .upgrade-feedback {
        font-size: 20px;
    }
}

/* === КОНЕЦ BALANCE V5 STYLES === */

/* Анимации урона для v5 */
@keyframes damageNormalV5 {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-40px) scale(0.9);
    }
}

@keyframes damageCriticalV5 {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
        text-shadow: 0 0 20px #ff4444;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        text-shadow: 0 0 15px #ff4444;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-60px) scale(0.8);
        text-shadow: 0 0 5px #ff4444;
    }
}

.damage-popup-v5 {
    user-select: none;
    -webkit-user-select: none;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
    font-family: var(--font-display);
}

.damage-popup-v5.critical {
    color: #ff4444 !important;
    text-shadow: 0 0 20px #ff4444, 0 0 40px #ff2222;
}
