/* Экран прокачки - современный UI */

#upgrade-screen {
    height: 100%;
    box-sizing: border-box;
    padding-top: 80px;
    padding-bottom: 20px;
    position: relative;
    overflow: hidden;
}

#upgrade-screen .bg-grid {
    z-index: 1;
    pointer-events: none;
}

.upgrade-title {
    flex-shrink: 0;
    padding-bottom: 2vh;
    position: relative;
    z-index: 20;
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #00ffff 0%, #00aaff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    margin-bottom: 5px;
    letter-spacing: 4px;
    animation: upgradeTitleGlow 2s ease-in-out infinite;
}

@keyframes upgradeTitleGlow {
    0%, 100% { filter: drop-shadow(0 0 15px rgba(0, 255, 255, 0.5)); }
    50% { filter: drop-shadow(0 0 25px rgba(0, 255, 255, 0.8)); }
}

.upgrade-subtitle {
    font-size: 1.1rem;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 2px;
}

.upgrade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
    padding: 0 20px;
    min-width: 0;
    overflow: hidden;
    position: relative;
    z-index: 5;
}

.upgrade-section-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

.upgrade-section {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, rgba(26, 26, 78, 0.85) 0%, rgba(10, 10, 46, 0.9) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    max-height: 69vh;
    overflow-x: hidden;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    min-width: 0;
    flex: 1;
}

.upgrade-section:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

/* Кастомный скроллбар */
.upgrade-section::-webkit-scrollbar {
    width: 8px;
}

.upgrade-section::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.upgrade-section::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00ffff, #00aaff);
    border-radius: 4px;
}

.upgrade-section::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00ffff, #00ccff);
}

.upgrade-section.skills-section {
    border-color: rgba(255, 107, 107, 0.4);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.1);
}

.upgrade-section.skills-section:hover {
    border-color: rgba(255, 107, 107, 0.6);
    box-shadow: 0 0 40px rgba(255, 107, 107, 0.2);
}

.upgrade-section.upgrades-section {
    border-color: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.1);
}

.upgrade-section.upgrades-section:hover {
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.2);
}

.upgrade-section.weapons-section {
    border-color: rgba(255, 0, 255, 0.4);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.1);
}

.upgrade-section.weapons-section:hover {
    border-color: rgba(255, 0, 255, 0.6);
    box-shadow: 0 0 40px rgba(255, 0, 255, 0.2);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin: 0 0 15px 0;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 10px 0 10px 0;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    flex-shrink: 0;
}

.upgrade-section-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
}

.upgrade-section {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, rgba(26, 26, 78, 0.85) 0%, rgba(10, 10, 46, 0.9) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    max-height: 60vh;
    overflow-x: hidden;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    min-width: 0;
    flex: 1;
    margin-top: 15px;
}

.skills-container, .upgrades-container, .weapons-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Карточки навыков */
.skill-card, .upgrade-card, .weapon-card {
    position: relative;
    z-index: 11;
    background: linear-gradient(135deg, rgba(26, 26, 78, 0.9) 0%, rgba(10, 10, 46, 0.95) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 15px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow: visible;
    min-height: 70px;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
}

.skill-card::before, .upgrade-card::before, .weapon-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.skill-card:hover::before, .upgrade-card:hover::before, .weapon-card:hover::before {
    transform: translateX(100%);
}

.card-left {
    flex: 0 0 33.33%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.card-left .skill-icon, .card-left .upgrade-icon, .card-left .weapon-icon {
    font-size: 2rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.card-right {
    flex: 1 1 66.67%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 0;
    max-width: 66.67%;
    overflow: hidden;
    padding: 4px;
    box-sizing: border-box;
}

.card-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.card-info h4 {
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.1;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.card-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.card-actions p {
    white-space: nowrap;
    margin: 0;
    font-size: 0.75rem;
    flex-shrink: 1;
    min-width: fit-content;
    line-height: 2.2;
    height: 34px;
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.skill-btn, .upgrade-btn, .weapon-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    margin: 2px;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    white-space: nowrap;
    height: 34px;
    display: flex;
    align-items: center;
}

/* Прогресс-бар: каждый кубик = 1 уровень */
.progress-bar {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: rgba(30, 30, 50, 0.9);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    justify-content: center;
    flex-wrap: nowrap;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
    min-height: 20px;
}

.progress-fill {
    display: flex;
    gap: 3px;
    width: 100%;
    justify-content: center;
    flex-wrap: nowrap;
    overflow: hidden;
    max-width: 100%;
}

.progress-segment {
    width: 32px;
    height: 30px;
    min-width: 16px;
    min-height: 16px;
    max-width: 32px;
    max-height: 32px;
    background: rgba(80, 80, 100, 0.5);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    flex-shrink: 1;
    flex-grow: 0;
}

.progress-segment.filled {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 
        0 0 8px rgba(255, 215, 0, 0.6),
        0 0 15px rgba(255, 215, 0, 0.3),
        inset 0 0 5px rgba(255, 255, 255, 0.3);
    animation: segmentPulse 2s ease-in-out infinite;
}

@keyframes segmentPulse {
    0%, 100% { 
        box-shadow: 
            0 0 8px rgba(255, 215, 0, 0.6),
            0 0 15px rgba(255, 215, 0, 0.3),
            inset 0 0 5px rgba(255, 255, 255, 0.3);
    }
    50% { 
        box-shadow: 
            0 0 12px rgba(255, 215, 0, 0.8),
            0 0 20px rgba(255, 215, 0, 0.5),
            inset 0 0 5px rgba(255, 255, 255, 0.3);
    }
}

.weapon-card .progress-bar {
    display: none;
}

.skill-card {
    border-color: rgba(255, 107, 107, 0.4);
}

.skill-card:hover {
    border-color: rgba(255, 107, 107, 0.8);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.3);
    transform: translateY(-3px);
}

.upgrade-card {
    border-color: rgba(0, 255, 255, 0.4);
}

.upgrade-card:hover {
    border-color: rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    transform: translateY(-3px);
}

.weapon-card {
    border-color: rgba(255, 0, 255, 0.4);
}

.weapon-card:hover {
    border-color: rgba(255, 0, 255, 0.8);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.3);
    transform: translateY(-3px);
}

.weapon-card.selected {
    border-color: rgba(76, 175, 80, 0.8);
    box-shadow: 0 0 40px rgba(76, 175, 80, 0.5);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(45, 125, 50, 0.3) 100%);
    transform: none;
}

.weapon-card.purchased {
    cursor: pointer;
}

.weapon-card.inactive {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(85, 85, 85, 0.5);
    box-shadow: none;
}

.weapon-card.inactive:hover {
    transform: none;
    box-shadow: none;
}

.skill-card.max-level, .upgrade-card.purchased {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: rgba(85, 85, 85, 0.5);
}

.skill-card.inactive, .upgrade-card.inactive {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(85, 85, 85, 0.5);
    box-shadow: none;
}

.skill-card.inactive:hover, .upgrade-card.inactive:hover {
    transform: none;
    box-shadow: none;
}

.skill-card.max-level:hover, .upgrade-card.purchased:hover {
    transform: none;
    box-shadow: none;
}

.card-info h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #00ffff;
    margin: 0;
    padding: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.weapon-card .card-info h4 {
    color: #ff00ff;
}

.card-info p {
    font-size: 0.85rem;
    color: #aaa;
    margin: 5px 0 0 0;
    line-height: 1.4;
}

.skill-level, .skill-cost, .upgrade-cost, .upgrade-count, .upgrade-status {
    font-size: 0.85rem;
    color: #ffd700;
    margin: 0;
    font-weight: 600;
    background: rgba(255, 215, 0, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.weapon-cost, .weapon-status {
    font-size: 0.85rem;
    color: #ffd700;
    margin: 0;
    font-weight: 600;
    background: rgba(255, 215, 0, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.skill-card.max-level .skill-cost,
.upgrade-card.max-level .upgrade-cost,
.weapon-card.purchased .weapon-cost {
    display: none;
}

.skill-level, .upgrade-count {
    background: rgba(50, 50, 80, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.skill-desc, .upgrade-desc {
    color: #888;
    font-style: italic;
    font-size: 0.8rem;
}

.weapon-desc {
    color: #888;
    font-style: italic;
    font-size: 0.8rem;
}

.skill-btn, .upgrade-btn, .weapon-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    margin: 2px;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    white-space: nowrap;
}

.skill-btn::before, .upgrade-btn::before, .weapon-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.skill-btn:hover::before, .upgrade-btn:hover::before, .weapon-btn:hover::before {
    width: 200px;
    height: 200px;
}

.skill-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.upgrade-btn {
    background: linear-gradient(135deg, #00ffff 0%, #00aaff 100%);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.4);
}

.weapon-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.skill-btn:hover:not(:disabled), .upgrade-btn:hover:not(:disabled), .weapon-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
}

.skill-btn.active, .upgrade-btn.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.weapon-btn.active {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
}

.weapon-card.selected .card-info h4 {
    color: #4CAF50;
}

.skill-btn:disabled, .upgrade-btn:disabled, .weapon-btn:disabled {
    background: linear-gradient(135deg, #555 0%, #444 100%);
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-continue {
    padding: 18px 50px;
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 50%, #00ff88 100%);
    background-size: 200% 200%;
    border: 2px solid rgba(0, 255, 136, 0.5);
    border-radius: 50px;
    color: #000;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow:
        0 5px 25px rgba(0, 255, 136, 0.4),
        0 0 40px rgba(0, 255, 136, 0.2),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    animation: continueGradient 3s ease infinite;
    position: relative;
    overflow: hidden;
}

.btn-continue::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.btn-continue:hover:not(:disabled)::before {
    left: 100%;
}

.btn-continue:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 10px 45px rgba(0, 255, 136, 0.6),
        0 0 60px rgba(0, 255, 136, 0.4),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
    border-color: rgba(0, 255, 136, 0.8);
}

.btn-continue:active:not(:disabled) {
    transform: translateY(-1px) scale(1.02);
}

@keyframes continueGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-continue:disabled {
    background: linear-gradient(135deg, #555 0%, #444 100%);
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
    border-color: rgba(85, 85, 85, 0.5);
    animation: none;
}

/* Анимация появления карточек */
@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.skill-card, .upgrade-card, .weapon-card {
    animation: cardSlideIn 0.4s ease-out forwards;
}

.skill-card:nth-child(1) { animation-delay: 0.05s; }
.skill-card:nth-child(2) { animation-delay: 0.1s; }
.skill-card:nth-child(3) { animation-delay: 0.15s; }
.skill-card:nth-child(4) { animation-delay: 0.2s; }
.skill-card:nth-child(5) { animation-delay: 0.25s; }

.upgrade-card:nth-child(1) { animation-delay: 0.05s; }
.upgrade-card:nth-child(2) { animation-delay: 0.1s; }
.upgrade-card:nth-child(3) { animation-delay: 0.15s; }
.upgrade-card:nth-child(4) { animation-delay: 0.2s; }
.upgrade-card:nth-child(5) { animation-delay: 0.25s; }

.weapon-card { animation-delay: 0.05s; }

/* Адаптивность для экрана прокачки */
@media (max-width: 1024px) {
    .upgrade-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 15px;
    }

    .upgrade-section-wrapper {
        width: 100%;
    }

    .upgrade-section {
        max-height: none;
    }
    
    .progress-segment {
        width: 10px;
        height: 10px;
        min-width: 6px;
        min-height: 6px;
        max-width: 10px;
        max-height: 10px;
    }
    
    .card-right {
        gap: 4px;
    }
    
    .card-actions {
        gap: 4px;
    }
    
    .skill-btn, .upgrade-btn, .weapon-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
        height: 30px;
    }
    
    .card-actions p {
        height: 30px;
        line-height: 2;
    }
}

@media (max-width: 768px) {
    .upgrade-title {
        font-size: 1.5rem;
        padding-top: 10px;
    }

    .upgrade-subtitle {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 0.95rem;
    }

    .skill-card, .upgrade-card, .weapon-card {
        padding: 10px 12px;
        gap: 8px;
        min-height: 60px;
        overflow: hidden;
    }

    .card-left {
        flex: 0 0 30%;
        padding-right: 5px;
    }

    .card-right {
        flex: 0 0 70%;
        padding: 2px;
    }

    .card-left .skill-icon, .card-left .upgrade-icon, .card-left .weapon-icon {
        font-size: 1.8rem;
    }

    .card-info h4 {
        font-size: 0.85rem;
    }

    .card-info p {
        font-size: 0.7rem;
    }
    
    .progress-segment {
        width: 8px;
        height: 8px;
        min-width: 5px;
        min-height: 5px;
        max-width: 8px;
        max-height: 8px;
    }

    .skill-btn, .upgrade-btn, .weapon-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        height: 28px;
    }
    
    .card-actions p {
        font-size: 0.68rem;
        height: 28px;
        line-height: 1.8;
    }

    .btn-continue {
        padding: 15px 40px;
        font-size: 1rem;
    }

    #upgrade-hud {
        padding: 10px 20px;
    }

    .hud-item {
        font-size: 0.85rem;
    }

    #health-bar-container, #energy-bar-container,
    #upgrade-health-bar-container, #upgrade-energy-bar-container {
        width: 150px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .skill-card, .upgrade-card, .weapon-card {
        padding: 8px 10px;
        gap: 6px;
        min-height: 55px;
        overflow: hidden;
    }

    .card-left {
        flex: 0 0 28%;
        padding-right: 3px;
    }

    .card-right {
        flex: 0 0 72%;
        padding: 2px;
        gap: 3px;
    }

    .card-left .skill-icon, .card-left .upgrade-icon, .card-left .weapon-icon {
        font-size: 1.5rem;
    }

    .card-info h4 {
        font-size: 0.8rem;
    }

    .card-info p {
        font-size: 0.65rem;
    }
    
    .progress-bar {
        padding: 2px;
        gap: 2px;
        min-height: 16px;
    }
    
    .progress-segment {
        width: 6px;
        height: 6px;
        min-width: 4px;
        min-height: 4px;
        max-width: 6px;
        max-height: 6px;
    }

    .skill-btn, .upgrade-btn, .weapon-btn {
        padding: 5px 8px;
        font-size: 0.6rem;
        height: 26px;
    }
    
    .card-actions p {
        font-size: 0.6rem;
        height: 26px;
        line-height: 1.6;
    }

    .btn-continue {
        padding: 12px 30px;
        font-size: 0.9rem;
    }

    #upgrade-hud {
        flex-wrap: wrap;
        padding: 8px 15px;
    }

    .hud-left, .hud-right {
        gap: 5px;
    }

    #health-bar-container, #energy-bar-container,
    #upgrade-health-bar-container, #upgrade-energy-bar-container {
        width: 120px;
        height: 18px;
    }

    .hud-center {
        font-size: 1.5rem;
    }
    
    .card-actions {
        gap: 3px;
    }
}
