﻿/* ============================================
   МОДАЛЬНЫЕ ОКНА - ЕДИНЫЙ ФАЙЛ
   ============================================ */

/* ============================================
   ОБЩИЕ СТИЛИ ДЛЯ ВСЕХ МОДАЛЬНЫХ ОКОН
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

    .modal.active {
        display: flex;
    }

/* Контейнер для содержимого модального окна - подстраивается под контент */
.modal-content {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: 90%;
    max-width: 450px;
    max-height: calc(100vh - 80px);
    background: rgba(26, 16, 34, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-modal);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: var(--color-text-primary);
    animation: modalAppear 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Для модальных окон с кастомной структурой */
.case-modal-content,
.item-detail-content,
.drop-detail-content,
.upgrade-modal-content,
.upgrade-result-content {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: 90%;
    max-width: 450px;
    max-height: calc(100vh - 80px);
    background: rgba(26, 16, 34, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-modal);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: var(--color-text-primary);
    animation: modalAppear 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
}

.modal-glass {
    background: rgba(26, 16, 34, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: var(--border-radius-modal) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    color: var(--color-text-primary) !important;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #b8a9c9;
    font-size: 22px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1;
}

    .modal-close-btn:hover {
        color: var(--color-text-accent);
        transform: scale(1.1);
        background: rgba(255, 255, 255, 0.2);
    }

/* Прокручиваемая область внутри модального окна */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* Защита контента от кнопки закрытия */
.modal-header,
.case-modal-header,
.item-detail-header,
.drop-detail-header,
.upgrade-result-header {
    padding-right: 50px !important;
    padding-left: 20px !important;
    padding-top: 16px !important;
    padding-bottom: 12px !important;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    flex-shrink: 0;
}

    .modal-header h2,
    .case-modal-header h2,
    .item-detail-header h2,
    .drop-detail-header h2,
    .upgrade-result-header h2 {
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.3;
        margin: 0;
    }

/* Блокировка скролла страницы при открытой модалке */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   МОДАЛЬНОЕ ОКНО КЕЙСА
   ============================================ */

.case-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--color-border-accent);
}

.case-modal-image {
    width: 50px;
    height: 50px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 10px;
    background-color: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.case-modal-header h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-text-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Прокручиваемая область для кейса */
.case-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
    -webkit-overflow-scrolling: touch;
}

/* Выбор количества */
.case-quantity-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    border-radius: var(--border-radius-card);
    padding: 10px 12px;
    margin: 12px;
}

.quantity-label {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 14px;
    background: var(--color-border-default);
    color: var(--color-text-primary);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-default);
}

    .quantity-btn:hover {
        background: var(--gradient-button-pink);
        color: var(--color-bg-primary);
        transform: scale(1.05);
    }

.quantity-value {
    font-size: 16px;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    color: var(--color-text-primary);
}

.max-quantity {
    font-size: 10px;
    color: var(--color-text-secondary);
}
/* Контейнер для всех анимаций открытия кейсов */
#case-opening-animation {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    margin: 10px 0;
    -webkit-overflow-scrolling: touch;
}

    #case-opening-animation::-webkit-scrollbar {
        width: 4px;
    }

    #case-opening-animation::-webkit-scrollbar-track {
        background: var(--color-bg-primary);
        border-radius: 4px;
    }

    #case-opening-animation::-webkit-scrollbar-thumb {
        background: var(--color-border-default);
        border-radius: 4px;
    }

        #case-opening-animation::-webkit-scrollbar-thumb:hover {
            background: var(--color-border-hover);
        }

/* Каждая отдельная анимация */
.case-opening-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border-accent);
    width: 100%;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

    .case-opening-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .case-opening-item .case-opening {
        position: relative;
        height: 130px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        border-radius: var(--border-radius-card);
        background: var(--color-bg-tertiary);
        width: 100%;
        border: 2px solid var(--color-border-default);
        margin: 5px 0;
        -webkit-overflow-scrolling: touch;
    }

        .case-opening-item .case-opening::-webkit-scrollbar {
            height: 4px;
        }

        .case-opening-item .case-opening::-webkit-scrollbar-track {
            background: var(--color-bg-primary);
            border-radius: 4px;
        }

        .case-opening-item .case-opening::-webkit-scrollbar-thumb {
            background: var(--color-border-default);
            border-radius: 4px;
        }

            .case-opening-item .case-opening::-webkit-scrollbar-thumb:hover {
                background: var(--color-border-hover);
            }

.spinning-items {
    display: inline-flex;
    gap: 8px;
    padding: 10px;
    align-items: center;
    pointer-events: none;
    white-space: nowrap;
}

.selector {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-text-accent), var(--color-border-hover));
    transform: translateX(-50%);
    z-index: 10;
    box-shadow: var(--shadow-pink);
    pointer-events: none;
}

/* Итого */
.case-total-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 107, 157, 0.1);
    border: 2px solid var(--color-border-hover);
    border-radius: var(--border-radius-card);
    padding: 10px 12px;
    margin: 0 12px 0 12px;
}

.total-price-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-text-accent);
}

/* Кнопка открытия */
.open-case-btn {
    width: 90%;
    padding: 12px;
    border: none;
    border-radius: var(--border-radius-card);
    background: var(--gradient-button-pink);
    color: var(--color-bg-primary);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    margin: 10px auto;
    transition: var(--transition-default);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow-card);
}

    .open-case-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-card-hover);
    }

/* Предметы в кейсе */
.possible-items-section {
    margin: 15px;
}

    .possible-items-section h3 {
        font-size: 14px;
        margin-bottom: 10px;
        color: var(--color-text-accent);
        text-align: left;
    }

.possible-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 5px;
}

.possible-item-card {
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    border-radius: var(--border-radius-card);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition-default);
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

    .possible-item-card:hover {
        border-color: var(--color-border-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

.possible-item-chance {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--color-text-accent);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid var(--color-border-hover);
}

.possible-item-image {
    width: 70px;
    height: 70px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.possible-item-name {
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 6px;
    color: var(--color-text-primary);
    word-break: break-word;
    line-height: 1.3;
    width: 100%;
    padding: 0 2px;
}

.possible-item-price {
    font-size: 14px;
    color: var(--color-text-price);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

    .possible-item-price .currency-coin {
        width: 16px;
        height: 16px;
    }
/* Результат открытия */
#case-result {
    margin: 15px;
    border-top: 1px solid var(--color-border-accent);
}

    #case-result h3 {
        font-size: 14px;
        font-weight: 600;
        color: var(--color-text-accent);
        margin-bottom: 12px;
        text-align: center;
    }

/* Выигранные предметы */
#won-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin: 15px 0;
    max-height: 35vh;
    overflow-y: auto;
    padding: 5px;
}

.won-item-card {
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    border-radius: var(--border-radius-card);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition-default);
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

    .won-item-card:hover {
        border-color: var(--color-border-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

    .won-item-card[data-sold="true"] {
        opacity: 0.5;
        filter: grayscale(0.8);
    }

.won-item-image {
    width: 70px;
    height: 70px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.won-item-name {
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    color: var(--color-text-primary);
    word-break: break-word;
    line-height: 1.3;
    width: 100%;
}

/* Кнопка продажи */
.sell-item-btn {
    background: var(--gradient-button-pink);
    border: none;
    border-radius: var(--border-radius-button);
    padding: 6px 8px;
    color: var(--color-bg-primary);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-default);
    width: 100%;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

    .sell-item-btn span.sell-text {
        font-size: 10px;
        opacity: 0.9;
    }

    .sell-item-btn span.price-text {
        font-size: 12px;
        font-weight: 800;
        color: var(--color-bg-primary);
    }

    .sell-item-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

    .sell-item-btn.sold {
        background: var(--color-border-default);
        color: var(--color-text-disabled);
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

/* Футер с кнопками */
.result-footer {
    margin: 10px;
    gap: 5px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.result-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-text-accent), transparent);
}

.try-again-btn {
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    border-radius: var(--border-radius-button);
    padding: 5px;
    color: var(--color-text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-default);
    flex: 1;
    text-align: center;
}

    .try-again-btn:hover {
        border-color: var(--color-border-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

.sell-all-btn {
    background: var(--gradient-button-pink);
    border: none;
    border-radius: var(--border-radius-button);
    padding: 10px;
    color: var(--color-bg-primary);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-default);
    flex: 1;
    text-align: center;
}

    .sell-all-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

    .sell-all-btn.sold {
        background: var(--color-border-default);
        color: var(--color-text-disabled);
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

/* ============================================
   МОДАЛЬНОЕ ОКНО УСПЕХА
   ============================================ */
#success-modal .modal-content {
    padding: 25px;
    text-align: center;
    max-width: 300px;
}

#success-modal h3 {
    color: var(--color-text-accent);
    font-size: 22px;
    margin-bottom: 15px;
}

#success-modal p {
    color: var(--color-text-primary);
    font-size: 16px;
    margin-bottom: 20px;
}

#success-modal span {
    color: var(--color-text-accent);
    font-weight: 800;
}

/* ============================================
   МОДАЛЬНОЕ ОКНО ДЕТАЛЕЙ ПРЕДМЕТА
   ============================================ */
.item-detail-header {
    text-align: center;
    border-bottom: 1px solid var(--color-border-accent);
}

    .item-detail-header h2 {
        font-size: 16px;
        font-weight: 600;
    }

.item-detail-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.item-detail-image-container {
    width: 140px;
    height: 140px;
    margin: 15px auto 15px;
    border-radius: var(--border-radius-card);
    background: var(--color-bg-tertiary);
    border: 3px solid var(--color-border-default);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-detail-image {
    width: 120px;
    height: 120px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.item-detail-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-text-accent);
    text-align: center;
    margin-bottom: 15px;
}

.item-detail-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 15px;
    width: 90%;
    flex-wrap: wrap;
}

.item-detail-btn {
    flex: 1;
    min-width: 90px;
    padding: 10px 8px;
    border: none;
    border-radius: var(--border-radius-button);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-default);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    color: var(--color-text-primary);
    text-align: center;
}

    .item-detail-btn:hover {
        border-color: var(--color-border-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

    .item-detail-btn.sell-btn:hover {
        border-color: #4caf50;
    }

    .item-detail-btn.upgrade-btn:hover {
        border-color: #ff9800;
    }

    .item-detail-btn.withdraw-btn:hover {
        border-color: #2196f3;
    }

/* Статус вывода */
#withdraw-status-message {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
}

    #withdraw-status-message p {
        margin-bottom: 10px;
        font-size: 14px;
        color: var(--color-text-secondary);
    }

#withdraw-timer {
    font-size: 28px;
    font-weight: bold;
    color: var(--color-text-accent);
    margin: 10px 0;
}

.accept-trade-btn {
    background: var(--gradient-button-pink);
    border: none;
    color: white;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0;
    cursor: pointer;
    border-radius: 8px;
    width: 100%;
}

    .accept-trade-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    }

/* ============================================
   МОДАЛЬНОЕ ОКНО ДЕТАЛЕЙ ЛУЧШЕГО ДРОПА
   ============================================ */
.drop-detail-header {
    text-align: center;
    border-bottom: 1px solid var(--color-border-accent);
}

    .drop-detail-header h2 {
        font-size: 16px;
        font-weight: 600;
    }

.drop-detail-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.drop-detail-image-container {
    width: 140px;
    height: 140px;
    margin: 15px auto 15px;
    border-radius: var(--border-radius-card);
    background: var(--color-bg-tertiary);
    border: 3px solid var(--color-border-default);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-detail-image {
    width: 120px;
    height: 120px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.drop-detail-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-text-accent);
    text-align: center;
    margin-bottom: 15px;
}

.drop-detail-source-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.drop-detail-source {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 10px;
    padding: 10px 12px;
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    border-radius: var(--border-radius-card);
    cursor: pointer;
    transition: var(--transition-default);
    width: 90%;
}

    .drop-detail-source:hover {
        border-color: var(--color-border-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

.drop-source-image {
    width: 45px;
    height: 45px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    flex-shrink: 0;
}

.drop-source-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-accent);
    text-align: left;
}

/* ============================================
   МОДАЛЬНЫЕ ОКНА АПГРЕЙДА
   ============================================ */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border-default);
    flex-shrink: 0;
}

    .modal-header h3 {
        color: var(--color-text-primary);
        margin: 0;
        font-size: 16px;
    }

.upgrade-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    padding: 15px;
    height: 600px;
    overflow-y: auto;
}

.upgrade-item-card {
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border-default);
    border-radius: var(--border-radius-card);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-default);
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

    .upgrade-item-card:hover {
        border-color: var(--color-border-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

.upgrade-item-image {
    width: 70px;
    height: 70px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.upgrade-item-name {
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 6px;
    color: var(--color-text-primary);
    word-break: break-word;
    line-height: 1.3;
    width: 100%;
}

.upgrade-item-value {
    font-size: 12px;
    color: var(--color-text-price);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

    .upgrade-item-value .currency-coin {
        width: 14px;
        height: 14px;
    }

/* ============================================
   МОДАЛЬНОЕ ОКНО РЕЗУЛЬТАТА АПГРЕЙДА
   ============================================ */
.upgrade-status-image-container {
    padding: 5px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.upgrade-status-image {
    width: 350px;
    height: 180px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    animation: slowPulse 2.5s ease-in-out infinite;
}

.upgrade-item-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: -25px auto;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.upgrade-item-image-result {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    animation: itemPulse 3s ease-in-out infinite;
}

    /* Свечение по data-rarity */
    .upgrade-item-image-result[data-rarity="consumer"] {
        filter: drop-shadow(0 0 12px #b0c3d9);
    }

    .upgrade-item-image-result[data-rarity="industrial"] {
        filter: drop-shadow(0 0 12px #5e98d9);
    }

    .upgrade-item-image-result[data-rarity="milspec"] {
        filter: drop-shadow(0 0 15px #4b69ff);
    }

    .upgrade-item-image-result[data-rarity="restricted"] {
        filter: drop-shadow(0 0 18px #8847ff);
    }

    .upgrade-item-image-result[data-rarity="classified"] {
        filter: drop-shadow(0 0 20px #d32ce6);
    }

    .upgrade-item-image-result[data-rarity="covert"] {
        filter: drop-shadow(0 0 25px #eb4b4b);
    }

    .upgrade-item-image-result[data-rarity="special"] {
        filter: drop-shadow(0 0 30px #ffe74b);
    }

@keyframes slowPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.95;
    }

    50% {
        transform: scale(1.03);
        opacity: 1;
    }
}

@keyframes itemPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.upgrade-result-content.victory .upgrade-status-image {
    filter: drop-shadow(0 0 20px #4caf50);
}

.upgrade-result-content.defeat .upgrade-status-image {
    filter: drop-shadow(0 0 20px #f44336);
}

.upgrade-result-details {
    margin: 10px 0 15px;
    text-align: center;
    padding: 0 20px;
    flex-shrink: 0;
}

.upgrade-result-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 6px;
    word-break: break-word;
}

.upgrade-result-price {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-text-price);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

    .upgrade-result-price .currency-coin {
        width: 20px;
        height: 20px;
    }

.upgrade-result-message {
    font-size: 13px;
    color: #ffd700;
    font-style: italic;
}

.upgrade-result-btn {
    width: calc(100% - 40px);
    margin: 0 20px 20px 20px;
    padding: 12px;
    background: var(--gradient-button-pink);
    border: none;
    border-radius: var(--border-radius-card);
    color: var(--color-bg-primary);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
}

    .upgrade-result-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

/* ============================================
   АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ
   ============================================ */

@media (max-width: 550px) {
    .modal-content,
    .case-modal-content,
    .item-detail-content,
    .drop-detail-content,
    .upgrade-modal-content,
    .upgrade-result-content {
        width: 95%;
        max-width: 400px;
        max-height: calc(100vh - 70px);
    }

    .case-modal-scroll,
    .item-detail-scroll,
    .drop-detail-scroll {
        padding: 12px 15px;
    }

    .possible-items-grid,
    #won-items-grid,
    .upgrade-items-grid {
        max-height: 35vh;
    }

    .possible-item-image,
    .won-item-image,
    .upgrade-item-image {
        width: 60px;
        height: 60px;
    }

    .item-detail-image-container,
    .drop-detail-image-container {
        width: 120px;
        height: 120px;
    }

    .item-detail-image,
    .drop-detail-image {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 380px) {
    .possible-items-grid,
    #won-items-grid,
    .upgrade-items-grid {
        max-height: 30vh;
        gap: 8px;
    }

    .possible-item-card,
    .won-item-card,
    .upgrade-item-card {
        padding: 8px 6px;
    }

    .possible-item-image,
    .won-item-image,
    .upgrade-item-image {
        width: 50px;
        height: 50px;
    }

    .item-detail-btn {
        min-width: 75px;
        padding: 8px 4px;
        font-size: 10px;
    }

    .upgrade-status-image {
        width: 140px;
        height: 140px;
    }
}

/* Безопасная зона для iPhone */
@supports (padding: max(0px)) {
    .modal-content {
        margin-top: env(safe-area-inset-top, 0);
        margin-bottom: env(safe-area-inset-bottom, 0);
    }
}
