:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --accent-primary: #0f3460;
    --accent-secondary: #e94560;
    --text-primary: #ffffff;
    --text-secondary: #b8b8b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dragon-gold: #ffd700;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Предотвращает масштабирование на iOS */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}

/* Улучшенная обработка touch событий */
button, .nav-btn, .action-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#app {
    min-height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 10px 70px;
    box-sizing: border-box;
}

/* Навигация */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid var(--accent-primary);
    margin-bottom: 20px;
}

.nav-brand {
    font-weight: bold;
    color: var(--dragon-gold);
    font-size: 1.2em;
}

.nav-stats {
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* Нижняя навигация */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    display: flex;
    padding: 8px 0;
    border-top: 2px solid var(--accent-primary);
    z-index: 1000;
    max-width: 100%;
    margin: 0 auto;
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.7em;
    cursor: pointer;
    padding: 8px 2px;
    transition: all 0.3s ease;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--dragon-gold);
}

.nav-btn span {
    display: block;
    font-size: 1.2em;
    margin-bottom: 2px;
}

/* Экраны */
.screen {
    display: none;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    box-sizing: border-box;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Карточка героя */
.hero-card {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.hero-avatar {
    width: 80px;
    height: 80px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    margin: 0 auto 10px;
    border: 3px solid var(--dragon-gold);
}

.hero-avatar.large {
    width: 100px;
    height: 100px;
    font-size: 2.5em;
}

.hero-class {
    color: var(--dragon-gold);
    font-weight: bold;
    margin-bottom: 5px;
}

.level-info {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.energy-info {
    margin-top: 10px;
    color: var(--dragon-gold);
    font-weight: bold;
}

/* Статистика */
.stats-grid {
    display: grid;
    gap: 10px;
    margin: 15px 0;
}

.main-stats {
    grid-template-columns: 1fr 1fr;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    padding: 15px;
}

.stat-card h3 {
    color: var(--dragon-gold);
    margin-bottom: 10px;
    text-align: center;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9em;
}

/* Характеристики */
.characteristics {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.characteristics h3 {
    color: var(--dragon-gold);
    margin-bottom: 15px;
    text-align: center;
}

/* Кнопки действий */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}

.action-btn {
    background: var(--accent-primary);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 15px;
    color: white;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    border-color: var(--dragon-gold);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--accent-secondary), #c1121f);
}

.action-btn.dungeon {
    background: linear-gradient(135deg, #0f3460, #1a1a2e);
    border: 2px solid var(--dragon-gold);
}

.action-btn.dungeon:hover {
    background: linear-gradient(135deg, #e94560, #0f3460);
    transform: translateY(-2px);
}

.back-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    padding: 12px 20px;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    border-color: var(--dragon-gold);
}

/* Выбор класса */
.classes-grid {
    display: grid;
    gap: 15px;
    margin: 20px 0;
}

.class-card {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.class-card:hover {
    border-color: var(--dragon-gold);
    transform: scale(1.02);
}

.class-avatar {
    font-size: 3em;
    margin-bottom: 10px;
}

.class-bonuses {
    text-align: left;
    font-size: 0.9em;
    margin-top: 10px;
}

.class-bonuses div {
    margin-bottom: 3px;
}

/* Смена класса */
.change-class-section {
    margin: 15px 0;
}

.change-class-btn {
    background: linear-gradient(135deg, var(--warning), #d97706);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    color: white;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.change-class-btn:hover {
    transform: translateY(-2px);
}

/* Профиль */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    color: var(--dragon-gold);
    margin-bottom: 5px;
}

/* Ресурсы профиля */
.profile-resources {
    display: flex;
    justify-content: space-around;
    margin: 15px 0;
    padding: 15px;
    background: var(--accent-primary);
    border-radius: 8px;
}

.resource {
    color: var(--text-primary);
    font-weight: bold;
}

/* Загрузка */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--accent-primary);
    border-top: 4px solid var(--dragon-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Уведомления */
#notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.notification {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

.notification.error {
    border-color: var(--danger);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Инвентарь - УНИФИЦИРОВАННЫЕ СТИЛИ */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    justify-items: center;
    align-items: start;
    padding: 0 5px;
}

.inventory-slot {
    width: 100%;
    max-width: 170px;
    height: 170px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    aspect-ratio: 1 / 1;
}

.inventory-slot.has-item {
    border-color: var(--dragon-gold);
    background: linear-gradient(135deg, var(--bg-secondary), var(--accent-primary));
}

.inventory-slot.locked {
    background: var(--accent-primary);
    border: 2px dashed var(--text-secondary);
    color: var(--text-secondary);
    cursor: pointer;
}

.inventory-slot.locked:hover {
    border-color: var(--dragon-gold);
    color: var(--dragon-gold);
}

.inventory-item {
    text-align: center;
    padding: 8px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.item-name {
    font-size: 0.8em;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: bold;
    text-align: center;
    word-break: break-word;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    padding: 0 5px;
}

.item-count {
    background: var(--dragon-gold);
    color: var(--bg-primary);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.7em;
    font-weight: bold;
    position: absolute;
    top: 5px;
    right: 5px;
}

.inventory-empty {
    color: var(--text-secondary);
    font-size: 0.8em;
}

.lock-icon {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.expand-inventory-btn {
    background: linear-gradient(135deg, var(--warning), #d97706);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    color: white;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.expand-inventory-btn:hover {
    transform: translateY(-2px);
}

.price {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 5px;
    font-weight: bold;
}

/* Убрана кнопка назад в инвентаре */
#inventory .back-btn {
    display: none;
}

/* Поиск PVP */
.search-container {
    text-align: center;
    padding: 20px;
}

.search-timer {
    margin: 20px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 2px solid var(--accent-primary);
}

.timer-text {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--dragon-gold);
    margin-bottom: 10px;
}

.searching-animation {
    font-size: 1.1em;
    color: var(--warning);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.search-info {
    text-align: left;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid var(--dragon-gold);
}

.search-info p {
    margin-bottom: 8px;
    font-size: 0.9em;
}

.cancel-search-btn {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    color: white;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.cancel-search-btn:hover {
    transform: translateY(-2px);
}

/* Рейтинг */
.leaderboard-tabs {
    display: flex;
    margin-bottom: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 5px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--accent-primary);
    color: var(--text-primary);
    font-weight: bold;
}

.leaderboard-tab {
    display: none;
}

.leaderboard-tab.active {
    display: block;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 30px 50px 1fr 60px 50px;
    gap: 5px;
    padding: 10px;
    background: var(--accent-primary);
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    font-size: 0.8em;
}

.leaderboard-content {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid var(--accent-primary);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 30px 50px 1fr 60px 50px;
    gap: 5px;
    padding: 10px;
    border-bottom: 1px solid var(--bg-secondary);
    font-size: 0.8em;
    align-items: center;
}

.leaderboard-row:nth-child(even) {
    background: var(--bg-secondary);
}

.leaderboard-rank {
    font-weight: bold;
    color: var(--dragon-gold);
    text-align: center;
    font-size: 0.75em;
}

.leaderboard-class, .leaderboard-name, .leaderboard-rating,
.leaderboard-damage, .leaderboard-health, .leaderboard-floor,
.leaderboard-wins {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-name {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8em;
    max-width: 120px;
}

.leaderboard-floor {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75em;
}

.leaderboard-wins {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75em;
    font-weight: bold;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Объединенный лог боя */
.battle-log {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    padding: 10px;
    max-height: 300px;
    height: 300px;
    overflow-y: auto;
    margin: 15px 0;
}

.log-entry {
    padding: 5px 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 0.8em;
    word-break: break-word;
    animation: fadeIn 0.5s ease;
}

.log-entry.player {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-left: 3px solid var(--success);
    text-align: right;
}

.log-entry.monster {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-left: 3px solid var(--danger);
}

.log-entry.info {
    background: rgba(255, 215, 0, 0.2);
    color: var(--dragon-gold);
    border-left: 3px solid var(--dragon-gold);
    text-align: center;
    font-style: italic;
}

/* Уменьшенный блок VS */
.battle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 2px solid var(--accent-primary);
}

.battle-player, .battle-monster {
    text-align: center;
    flex: 1;
}

.battle-vs {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--dragon-gold);
    margin: 0 10px;
}

.battle-avatar {
    font-size: 2em;
    margin-bottom: 5px;
}

.battle-health {
    margin: 5px 0;
}

.battle-name {
    font-weight: bold;
    color: var(--dragon-gold);
    font-size: 0.9em;
}

/* Анимация появления */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Стили для экрана подземелья */
.dungeon-container {
    max-height: 60vh;
    overflow-y: auto;
    margin: 15px 0;
    border: 2px solid var(--accent-primary);
    border-radius: 10px;
    padding: 10px;
}

.dungeon-floor {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--dragon-gold);
}

.dungeon-floor.current {
    background: var(--accent-primary);
    border-left-color: var(--accent-secondary);
}

.floor-header {
    font-weight: bold;
    color: var(--dragon-gold);
    margin-bottom: 8px;
    font-size: 1.1em;
}

.main-menu-lock .action-btn {
    background: linear-gradient(135deg, var(--accent-secondary), #c1121f);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    color: white;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    width: 100%;
}

.main-menu-lock .action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

.main-menu-lock .action-btn:active {
    transform: translateY(0);
}

.floor-levels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-left: 15px;
}

.level-item {
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 0.85em;
    background: rgba(255,255,255,0.05);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-item.completed {
    color: var(--success);
    border-color: var(--success);
}

.level-item.current {
    color: var(--dragon-gold);
    border-color: var(--dragon-gold);
    background: rgba(255,215,0,0.1);
    font-weight: bold;
}

.level-item.failed {
    color: var(--danger);
    border-color: var(--danger);
}

.level-item.locked {
    color: var(--text-secondary);
    opacity: 0.6;
    cursor: not-allowed;
}

.level-item.available {
    cursor: pointer;
}

.level-item.available:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--text-secondary);
}

.level-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-name {
    flex: 1;
}

.level-status {
    margin-left: 5px;
    font-size: 0.9em;
}

.dungeon-battle-btn {
    background: linear-gradient(135deg, var(--accent-secondary), #c1121f);
    border: none;
    border-radius: 8px;
    padding: 15px;
    color: white;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.dungeon-battle-btn:hover {
    transform: translateY(-2px);
}

.dungeon-battle-btn:disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Стили для информации о текущем монстре */
.current-monster-card {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
}

.monster-header {
    color: var(--dragon-gold);
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.monster-name {
    font-size: 1em;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: bold;
}

.monster-stats {
    text-align: left;
    font-size: 0.9em;
}

/* Адаптивность для маленьких экранов */
@media (max-width: 380px) {
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .main-stats {
        grid-template-columns: 1fr;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .nav-stats {
        font-size: 0.8em;
    }
    
    .inventory-grid {
        grid-template-columns: 1fr;
    }
    
    .inventory-slot {
        width: 100%;
        max-width: 140px;
        height: 140px;
    }
    
    .item-name {
        font-size: 0.7em;
        -webkit-line-clamp: 2;
    }
    
    .profile-resources {
        flex-direction: column;
        gap: 10px;
    }
    
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 25px 45px 1fr 55px 45px;
        font-size: 0.7em;
        gap: 3px;
        padding: 8px 5px;
    }
    
    .battle-container {
        padding: 8px;
    }
    
    .battle-avatar {
        font-size: 1.5em;
    }
    
    .battle-vs {
        font-size: 1em;
        margin: 0 5px;
    }
    
    .battle-log {
        max-height: 250px;
        height: 250px;
        padding: 8px;
    }
    
    .log-entry {
        padding: 3px 5px;
        font-size: 0.7em;
    }
    
    .floating-text {
        font-size: 0.9em;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 320px) {
    .inventory-slot {
        height: 130px;
        max-width: 130px;
    }
    
    .item-name {
        font-size: 0.65em;
    }
}

/* Анимация пульсации для низкого здоровья */
@keyframes lowHealthPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.health-bar.low-health {
    animation: lowHealthPulse 1s infinite;
}

/* Улучшенные стили для экрана боя */
#battle-screen {
    padding-bottom: 20px;
}

#battleBackBtn {
    margin: 15px 0;
    transition: all 0.3s ease;
}

.main-menu-lock .action-btn {
    background: linear-gradient(135deg, var(--accent-secondary), #c1121f);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    color: white;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.main-menu-lock .action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

#battleBackBtn:hover {
    transform: translateY(-2px);
    border-color: var(--dragon-gold);
}

@keyframes damageFlash {
    0% { background-color: rgba(239, 68, 68, 0.3); }
    50% { background-color: rgba(239, 68, 68, 0.6); }
    100% { background-color: transparent; }
}

.health-bar.damage-taken {
    animation: damageFlash 0.3s ease-in-out;
}

/* Улучшенные стили для полосок здоровья */
.health-bar {
    width: 100%;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.health-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-in-out, background 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Градиенты для полосок здоровья */
.health-fill.player {
    background: linear-gradient(90deg, #10b981, #34d399, #10b981);
    background-size: 200% 100%;
    animation: shimmer 3s infinite linear;
}

.health-fill.monster {
    background: linear-gradient(90deg, #ef4444, #f87171, #ef4444);
    background-size: 200% 100%;
    animation: shimmer 3s infinite linear;
}

/* Анимация мерцания для градиента */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Анимация пульсации для низкого здоровья */
@keyframes lowHealthPulse {
    0% { 
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
        transform: scale(1.02);
    }
    100% { 
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
        transform: scale(1);
    }
}

.battle-health {
    text-align: center;
    margin: 5px 0;
}

.health-bar {
    width: 100%;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.health-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-in-out, background 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


.health-fill {
    transition: width 0.5s ease-in-out !important;
    will-change: width;
}



/* Гарантия синхронизации полосок здоровья */
.battle-health {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 5px 0;
}

.health-bar {
    width: 100%;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.health-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-in-out !important;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    will-change: width;
}

/* Принудительная анимация */
.health-bar .health-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.health-text {
    font-size: 0.8em;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    min-width: 80px;
    text-align: center;
}

/* Блокировка только для главной вкладки */
.main-menu-lock {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 100;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.5s ease;
    border-radius: 10px;
}

.main-menu-lock.active {
    display: flex;
}

.battle-lock-content {
    background: var(--bg-secondary);
    border: 2px solid var(--dragon-gold);
    border-radius: 15px;
    padding: 30px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.battle-lock-title {
    color: var(--dragon-gold);
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.battle-lock-info {
    font-size: 1.1em;
    margin-bottom: 15px;
    line-height: 1.5;
}

.battle-lock-monster {
    color: var(--accent-secondary);
    font-weight: bold;
    font-size: 1.2em;
    margin: 10px 0;
}

.battle-lock-waiting {
    color: var(--warning);
    font-style: italic;
    margin-top: 20px;
    font-size: 0.9em;
}

.battle-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-top: 3px solid var(--dragon-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* Анимация тряски */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

/* Всплывающий текст */
.floating-text {
    position: fixed;
    font-weight: bold;
    font-size: 1.1em;
    z-index: 1000;
    transition: all 0.8s ease;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.floating-text.critical {
    color: #ff6b6b;
    font-size: 1.2em;
}

.floating-text.dodge {
    color: #4ecdc4;
}