/* ========================================
   KURILABOT GAME STYLES - ОРГАНИЗОВАННАЯ ВЕРСИЯ
   ======================================== */

/* ===== ОСНОВНЫЕ СТИЛИ ===== */
.game-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #000000;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 0;
    margin: 0;
}

/* ===== ИНДИКАТОРЫ ЖИДКОСТИ И ИСПАРИТЕЛЯ ===== */
.liquid-evaporator-info {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.liquid-info, .evaporator-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 300px;
}

.liquid-bar, .evaporator-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 255, 0.3);
    position: relative;
}

.liquid-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #0080ff);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 100%;
}

.evaporator-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #80ff00);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 100%;
}

/* Эффект восстановления испарителя */
.evaporator-fill.repair-effect {
    animation: repairPulse 1s ease-in-out;
}

@keyframes repairPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(0, 255, 0, 0.3);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0);
        transform: scale(1);
    }
}

.liquid-text, .evaporator-text {
    font-size: 14px;
    color: #ffffff;
    text-align: center;
    font-weight: 500;
}

/* ===== КНОПКИ УПРАВЛЕНИЯ ===== */
.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.game-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 150px;
}

.refill-btn {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    color: #000000;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.refill-btn:hover {
    background: linear-gradient(135deg, #00cccc, #0066cc);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 255, 0.4);
}

.repair-btn {
    background: linear-gradient(135deg, #00ff00, #80ff00);
    color: #000000;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
}

.repair-btn:hover {
    background: linear-gradient(135deg, #00cc00, #66cc00);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 0, 0.4);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.game-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ===== ЗАГОЛОВОК ИГРЫ ===== */
.game-header {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
    padding: 8px 15px;
    border-bottom: 2px solid;
    border-image: linear-gradient(90deg, #00ffff, #ff00ff, #00ff00) 1;
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Убрали анимацию shine для производительности */
.game-header::before {
    display: none;
}

@keyframes headerShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===== ИНФОРМАЦИЯ О ПОЛЬЗОВАТЕЛЕ ===== */
.user-info {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 15px;
}

.user-avatar {
    position: relative;
    flex-shrink: 0;
}

.avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #00ffff;
    object-fit: cover;
    background: #333333;
}

.user-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    height: 100%;
}

.balance-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 5px 10px;
    background: transparent;
    flex: 1;
    width: 100%;
    gap: 8px;
}

.level-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 5px 10px;
    background: transparent;
    flex: 1;
    width: 100%;
}

.balance-value {
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.8), 0 0 30px rgba(0, 255, 255, 0.3);
    background: linear-gradient(45deg, #00ffff, #0080ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.balance-label {
    font-size: 10px;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    font-weight: 600;
    white-space: nowrap;
}

.level-info {
    display: flex;
    align-items: center;
    gap: 5px;
}

.level-value {
    font-size: 14px;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.8), 0 0 25px rgba(0, 255, 255, 0.3);
    background: linear-gradient(45deg, #00ffff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.level-label {
    font-size: 10px;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.6);
    font-weight: 600;
}

.level-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.level-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #ff00ff, #00ff00);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

/* Убрали анимацию shine для производительности */
.level-fill::after {
    display: none;
}

@keyframes levelShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===== ИГРОВАЯ ОБЛАСТЬ ===== */
.game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    background: #0a0a0a;
    min-height: 300px;
}

#game-canvas {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.2);
    overflow: hidden;
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid rgba(0, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #00ffff;
    text-align: center;
    transition: transform 0.1s ease;
    min-height: 200px;
    width: 100%;
    max-width: 500px;
}

#game-canvas:hover {
    background: rgba(0, 255, 255, 0.1);
    transform: scale(1.02);
}

#game-canvas:active {
    transform: scale(0.98);
}

/* ===== СЛАЙД МЕНЮ ===== */
.slide-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: flex-end;
    will-change: transform; /* Оптимизация для GPU */
    backface-visibility: hidden; /* Предотвращает мерцание */
}

.slide-menu.active {
    transform: translateY(0);
}

/* ОПТИМИЗАЦИЯ: Скрытые меню не рендерятся браузером */
.slide-menu:not(.active) {
    display: none !important;
}

.slide-menu-content {
    background: rgba(10, 10, 10, 0.98);
    width: 100%;
    height: 100%;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    will-change: transform; /* Оптимизация для GPU */
    transform: translateZ(0); /* Принудительное использование GPU */
}

/* Убрали анимацию shine для производительности */
.slide-menu-content::before {
    display: none;
}

.slide-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.5);
}

.slide-menu-header h3 {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
}

.close-btn {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 6px 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.slide-menu-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    scroll-behavior: smooth; /* Плавный скролл */
    contain: layout style paint; /* Оптимизация рендеринга */
}

.menu-item {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    justify-content: space-between;
}

.menu-item:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.menu-item i {
    font-size: 1rem;
    color: #ffffff;
}

.menu-item span {
    font-weight: 600;
    font-size: 1rem;
}

.upgrade-cost {
    color: #00ffff;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    margin-left: auto;
}

.menu-item:hover .upgrade-cost {
    color: #ffffff;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.8);
}

/* ===== СИСТЕМА ПРОКАЧЕК ===== */
.upgrade-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px 0;
}

.upgrade-row {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

.upgrade-block {
    background: linear-gradient(135deg, 
        rgba(15, 15, 25, 0.95) 0%, 
        rgba(25, 25, 35, 0.9) 50%, 
        rgba(20, 20, 30, 0.95) 100%);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
}

.upgrade-block-large {
    width: 100%;
    min-height: 85px;
    padding: 16px;
}

.upgrade-block-small {
    flex: 1;
    min-height: 80px;
    padding: 14px;
}

.upgrade-block:hover {
    background: linear-gradient(135deg, 
        rgba(0, 255, 255, 0.08) 0%, 
        rgba(0, 128, 255, 0.05) 50%, 
        rgba(0, 200, 255, 0.06) 100%);
    border-color: rgba(0, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(0, 255, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.upgrade-block:active {
    transform: translateY(0);
}

.upgrade-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    z-index: 2;
}

.upgrade-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.upgrade-level {
    font-size: 11px;
    color: #00ffff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    background: linear-gradient(45deg, #00ffff, #0080ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upgrade-name {
    font-size: 16px;
    color: #ffffff;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin-bottom: 2px;
    word-break: break-word;
    hyphens: auto;
}

.upgrade-progress {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.progress-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-amount {
    color: #00ffff;
    font-weight: 700;
    font-size: 12px;
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upgrade-cost {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    z-index: 2;
}

.cost-amount {
    font-size: 18px;
    color: #00ffff;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
    background: linear-gradient(45deg, #00ffff, #0080ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== СОСТОЯНИЯ ПРОКАЧЕК ===== */
.upgrade-block.affordable {
    border-color: rgba(0, 255, 0, 0.4);
    background: linear-gradient(135deg, 
        rgba(0, 255, 0, 0.08) 0%, 
        rgba(0, 200, 0, 0.05) 50%, 
        rgba(0, 255, 100, 0.06) 100%);
    box-shadow: 
        0 4px 15px rgba(0, 255, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.upgrade-block.affordable .progress-text {
    color: #00ff00 !important;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
}

.upgrade-block.affordable:hover {
    background: linear-gradient(135deg, 
        rgba(0, 255, 0, 0.1) 0%, 
        rgba(0, 200, 0, 0.08) 50%, 
        rgba(0, 255, 100, 0.09) 100%);
    border-color: rgba(0, 255, 0, 0.5);
    box-shadow: 
        0 4px 12px rgba(0, 255, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.upgrade-block:disabled,
.upgrade-block.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(135deg, 
        rgba(40, 40, 40, 0.8) 0%, 
        rgba(30, 30, 30, 0.9) 100%);
    border-color: rgba(100, 100, 100, 0.3);
}

.upgrade-block:disabled:hover,
.upgrade-block.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ===== УПРОЩЕННЫЕ ЭФФЕКТЫ ===== */
.upgrade-block::before {
    display: none;
}

.upgrade-block:hover::before {
    display: none;
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ===== */
@media (max-width: 768px) {
    .game-wrapper {
        flex-direction: column;
    }
    
    .user-info {
        flex-direction: row;
        gap: 8px;
        text-align: center;
        padding: 5px;
    }
    
    .user-stats {
        flex-direction: column;
        gap: 5px;
        height: auto;
    }
    
    .balance-container, .level-container {
        flex: 1;
        padding: 4px 8px;
        width: 100%;
    }
    
    .avatar-img {
        width: 40px;
        height: 40px;
    }
    
    .game-container {
        padding: 15px;
        min-height: 250px;
    }
    
    #game-canvas {
        width: 100%;
        max-width: 100%;
        min-height: 180px;
        font-size: 18px;
        padding: 20px;
    }
    
    .game-header {
        padding: 8px;
    }
    
    .balance-value {
        font-size: 14px;
    }
    
    .level-value {
        font-size: 12px;
    }
    
    /* Upgrade блоки для мобильных */
    .upgrade-grid {
        gap: 10px;
        padding: 12px 0;
    }
    
    .upgrade-row {
        gap: 8px;
        flex-wrap: nowrap !important;
    }
    
    .upgrade-block-small {
        flex: 1 1 50% !important;
        max-width: 50% !important;
    }
    
    .upgrade-block-large {
        min-height: 75px;
        padding: 14px;
    }
    
    .upgrade-block-small {
        min-height: 70px;
        padding: 12px;
    }
    
    .upgrade-name {
        font-size: 15px;
        line-height: 1.3;
    }
    
    .cost-amount {
        font-size: 16px;
    }
    
    .progress-text {
        font-size: 11px;
    }
    
    .progress-amount {
        font-size: 11px;
    }
    
    .upgrade-level {
        font-size: 10px;
        letter-spacing: 0.6px;
    }
    
    .upgrade-block:hover {
        transform: translateY(-1px);
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 5px;
    }
    
    .user-info {
        gap: 8px;
    }
    
    .balance-container, .level-container {
        flex: 1;
        padding: 3px 6px;
        width: 100%;
    }
    
    .balance-value {
        font-size: 12px;
    }
    
    .level-value {
        font-size: 10px;
    }
    
    .avatar-img {
        width: 35px;
        height: 35px;
    }
    
    #game-canvas {
        min-height: 150px;
        font-size: 16px;
        padding: 15px;
    }
    
    /* Upgrade блоки для маленьких экранов */
    .upgrade-grid {
        gap: 8px;
        padding: 10px 0;
    }
    
    .upgrade-block-large {
        min-height: 70px;
        padding: 12px;
    }
    
    .upgrade-block-small {
        min-height: 65px;
        padding: 10px;
    }
    
    .upgrade-name {
        font-size: 14px;
        line-height: 1.3;
    }
    
    .cost-amount {
        font-size: 15px;
    }
    
    .progress-text {
        font-size: 10px;
    }
    
    .progress-amount {
        font-size: 10px;
    }
    
    .upgrade-level {
        font-size: 9px;
        letter-spacing: 0.5px;
    }
    
    .upgrade-block {
        border-radius: 10px;
    }
    
    .upgrade-block:hover {
        transform: translateY(-1px);
    }
}
@media (max-width: 360px) {
    .upgrade-block-large {
        min-height: 65px;
        padding: 10px;
    }
    
    .upgrade-block-small {
        min-height: 60px;
        padding: 8px;
    }
    
    .upgrade-name {
        font-size: 13px;
    }
    
    .cost-amount {
        font-size: 14px;
    }
    
    .upgrade-level {
        font-size: 8px;
    }
}

/* ===== PHASER GAME CONTAINER ===== */
.phaser-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
    max-height: 600px;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.2),
        0 0 40px rgba(0, 255, 255, 0.1),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.phaser-container canvas {
    display: block !important;
    margin: 0 auto;
    border-radius: 15px;
}

/* Оверлей для дополнительной информации */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    padding: 20px;
}

.game-overlay > * {
    pointer-events: auto;
}

.game-stats-compact {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-radius: 20px;
    width: fit-content;
}

.game-stats-compact span {
    font-weight: 500;
}

/* Адаптивность для Phaser */
@media (max-width: 768px) {
    .phaser-container {
        min-height: 300px;
        max-height: 500px;
    }
    
    .game-stats-compact {
        font-size: 12px;
        padding: 6px 12px;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .phaser-container {
        min-height: 250px;
        max-height: 400px;
        border-radius: 10px;
    }
    
    .game-overlay {
        padding: 15px;
    }
    
    .game-stats-compact {
        font-size: 11px;
        padding: 5px 10px;
        gap: 8px;
    }
}
