.upgrade-page {
    display: flex;
    gap: 20px;
    min-height: 700px;
}
.upgrade-panel {
    width: 380px;
    flex-shrink: 0;
    background: #1e1f25;
    border-radius: 8px;
    padding: 18px;
    display: flex;
    flex-direction: column;
}
.upgrade-panel__title {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 12px;
}
.upgrade-panel__search {
    margin-bottom: 12px;
}
.upgrade-search {
    width: 100%;
    background: #15161b;
    border: 1px solid #2a2b33;
    border-radius: 4px;
    color: #fff;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.upgrade-search:focus {
    border-color: #e18d20;
}
.upgrade-panel__items {
    flex: 1;
    overflow-y: auto;
    max-height: 550px;
}

/* --- Item cards with rarity backgrounds --- */
.upgrade-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s, box-shadow .2s;
    border-left: 4px solid #555;
    margin-bottom: 6px;
    background: #22232b;
    position: relative;
}
/* Rarity gradient backgrounds */
.upgrade-item.common { border-left-color: #b0c3d9; background: linear-gradient(135deg, #22232b 60%, rgba(176,195,217,.1)); }
.upgrade-item.uncommon { border-left-color: #5e98d9; background: linear-gradient(135deg, #22232b 60%, rgba(94,152,217,.12)); }
.upgrade-item.milspec { border-left-color: #4b69ff; background: linear-gradient(135deg, #22232b 60%, rgba(75,105,255,.12)); }
.upgrade-item.restricted { border-left-color: #8847ff; background: linear-gradient(135deg, #22232b 60%, rgba(136,71,255,.12)); }
.upgrade-item.classified { border-left-color: #d32ce6; background: linear-gradient(135deg, #22232b 60%, rgba(211,44,230,.12)); }
.upgrade-item.covert { border-left-color: #eb4b4b; background: linear-gradient(135deg, #22232b 60%, rgba(235,75,75,.12)); }
.upgrade-item.rare { border-left-color: #ffd700; background: linear-gradient(135deg, #22232b 60%, rgba(255,215,0,.12)); }

.upgrade-item:hover {
    background: linear-gradient(135deg, #2a2b35 60%, rgba(100,100,100,.1));
}
.upgrade-item.common:hover { background: linear-gradient(135deg, #2a2b35 60%, rgba(176,195,217,.18)); }
.upgrade-item.uncommon:hover { background: linear-gradient(135deg, #2a2b35 60%, rgba(94,152,217,.2)); }
.upgrade-item.milspec:hover { background: linear-gradient(135deg, #2a2b35 60%, rgba(75,105,255,.2)); }
.upgrade-item.restricted:hover { background: linear-gradient(135deg, #2a2b35 60%, rgba(136,71,255,.2)); }
.upgrade-item.classified:hover { background: linear-gradient(135deg, #2a2b35 60%, rgba(211,44,230,.2)); }
.upgrade-item.covert:hover { background: linear-gradient(135deg, #2a2b35 60%, rgba(235,75,75,.2)); }
.upgrade-item.rare:hover { background: linear-gradient(135deg, #2a2b35 60%, rgba(255,215,0,.2)); }

/* Selected: bright background + thick rarity border, no extra outlines */
.upgrade-item.selected {
    background: #363844;
    border-left-width: 6px;
    padding-left: 10px;
}
.upgrade-item.selected.common { background: linear-gradient(90deg, rgba(176,195,217,.2) 0%, #363844 30%); }
.upgrade-item.selected.uncommon { background: linear-gradient(90deg, rgba(94,152,217,.25) 0%, #363844 30%); }
.upgrade-item.selected.milspec { background: linear-gradient(90deg, rgba(75,105,255,.25) 0%, #363844 30%); }
.upgrade-item.selected.restricted { background: linear-gradient(90deg, rgba(136,71,255,.25) 0%, #363844 30%); }
.upgrade-item.selected.classified { background: linear-gradient(90deg, rgba(211,44,230,.25) 0%, #363844 30%); }
.upgrade-item.selected.covert { background: linear-gradient(90deg, rgba(235,75,75,.25) 0%, #363844 30%); }
.upgrade-item.selected.rare { background: linear-gradient(90deg, rgba(255,215,0,.25) 0%, #363844 30%); }

.upgrade-item.hidden {
    display: none;
}

.upgrade-item__image {
    width: 75px;
    height: 75px;
    flex-shrink: 0;
    margin-right: 12px;
}
.upgrade-item__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.upgrade-item__info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.upgrade-item__name {
    font-size: 14px;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upgrade-item__name .stattrak {
    color: #cf6a32;
    font-weight: 700;
}
.upgrade-item__desc {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upgrade-item__price {
    font-size: 15px;
    color: #e18d20;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
}

/* --- Center zone --- */
.upgrade-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
}
.upgrade-slot {
    width: 240px;
    height: 220px;
    border: 2px dashed #2a2b33;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1e1f25;
    position: relative;
    overflow: hidden;
}
.upgrade-slot.filled {
    border-style: solid;
}
.upgrade-slot--from.filled { border-color: #4b69ff; }
.upgrade-slot--to.filled { border-color: #e18d20; }
/* Rarity backgrounds for center slots */
.upgrade-slot.slot-common { background: linear-gradient(180deg, #1e1f25 40%, rgba(176,195,217,.12)); }
.upgrade-slot.slot-uncommon { background: linear-gradient(180deg, #1e1f25 40%, rgba(94,152,217,.15)); }
.upgrade-slot.slot-milspec { background: linear-gradient(180deg, #1e1f25 40%, rgba(75,105,255,.15)); }
.upgrade-slot.slot-restricted { background: linear-gradient(180deg, #1e1f25 40%, rgba(136,71,255,.15)); }
.upgrade-slot.slot-classified { background: linear-gradient(180deg, #1e1f25 40%, rgba(211,44,230,.15)); }
.upgrade-slot.slot-covert { background: linear-gradient(180deg, #1e1f25 40%, rgba(235,75,75,.15)); }
.upgrade-slot.slot-rare { background: linear-gradient(180deg, #1e1f25 40%, rgba(255,215,0,.15)); }

.upgrade-slot__placeholder {
    color: #555;
    font-size: 16px;
    text-align: center;
}
.upgrade-slot__item {
    text-align: center;
    padding: 15px;
    position: relative;
}
.upgrade-slot__item img {
    width: 130px;
    height: 130px;
    object-fit: contain;
    position: relative;
    z-index: 1;
}
/* Rarity glow circle behind item image */
.upgrade-slot__rarity-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 110px;
    height: 110px;
    border-radius: 50%;
    filter: blur(25px);
    opacity: .35;
    z-index: 0;
}
.upgrade-slot__rarity-glow.glow-common { background: #b0c3d9; }
.upgrade-slot__rarity-glow.glow-uncommon { background: #5e98d9; }
.upgrade-slot__rarity-glow.glow-milspec { background: #4b69ff; }
.upgrade-slot__rarity-glow.glow-restricted { background: #8847ff; }
.upgrade-slot__rarity-glow.glow-classified { background: #d32ce6; }
.upgrade-slot__rarity-glow.glow-covert { background: #eb4b4b; }
.upgrade-slot__rarity-glow.glow-rare { background: #ffd700; }
.upgrade-slot__item-name {
    font-size: 14px;
    color: #ddd;
    margin-top: 8px;
}
.upgrade-slot__item-price {
    font-size: 16px;
    color: #e18d20;
    font-weight: 700;
    margin-top: 4px;
}
/* Multi-item slot */
.upgrade-slot__multi {
    text-align: center;
    padding: 10px;
}
.upgrade-slot__multi-count {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 6px;
}
.upgrade-slot__multi-total {
    font-size: 18px;
    color: #e18d20;
    font-weight: 700;
}
.upgrade-slot__multi-images {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}
.upgrade-slot__multi-images img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* --- Chance ring --- */
.upgrade-chance {
    position: relative;
    width: 160px;
    height: 160px;
}
.upgrade-chance__ring {
    width: 100%;
    height: 100%;
}
.upgrade-chance__fill {
    transition: stroke-dashoffset .5s ease, stroke .3s ease;
}
.upgrade-chance__text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

/* Spin: rotate the fill arc around the circle center using CSS on the <circle> */
@keyframes upgrade-fill-spin {
    0% { transform: rotate(-90deg); }
    50% { transform: rotate(270deg); }
    100% { transform: rotate(630deg); }
}
.upgrade-chance.spinning .upgrade-chance__fill {
    animation: upgrade-fill-spin 2s cubic-bezier(.4, 0, .2, 1);
    transform-origin: 60px 60px;
}

/* --- Button --- */
.upgrade-btn {
    background: linear-gradient(135deg, #e18d20, #d47b10);
    color: #fff;
    border: none;
    padding: 16px 60px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: opacity .2s;
}
.upgrade-btn:disabled {
    opacity: .4;
    cursor: default;
}
.upgrade-btn:not(:disabled):hover {
    opacity: .85;
}
.upgrade-btn--repeat {
    margin-top: 15px;
    background: linear-gradient(135deg, #4b69ff, #3b59ef);
}
.upgrade-btn--sell {
    margin-top: 10px;
    padding: 12px 40px;
    font-size: 15px;
}

/* --- Result overlay --- */
.upgrade-result {
    position: absolute;
    inset: 0;
    background: rgba(20, 21, 27, .95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.upgrade-result__content {
    text-align: center;
}
.upgrade-result__title {
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
}
.upgrade-result__title.win { color: #4caf50; }
.upgrade-result__title.lose { color: #f44336; }
.upgrade-result__image img {
    width: 180px;
    height: 180px;
    object-fit: contain;
}
.upgrade-result__name {
    font-size: 16px;
    color: #ddd;
    margin-top: 10px;
}
.upgrade-result__price {
    font-size: 20px;
    color: #e18d20;
    font-weight: 700;
    margin-top: 5px;
}
.upgrade-result__autosold {
    font-size: 13px;
    color: #888;
    margin-top: 6px;
}
.upgrade-result__actions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upgrade-empty {
    color: #888;
    text-align: center;
    padding: 20px;
    font-size: 14px;
}
.upgrade-empty a {
    color: #e18d20;
}

/* --- Auth message for non-logged-in users --- */
.upgrade-auth-message {
    text-align: center;
    padding: 60px 20px;
}
.upgrade-auth-message__text {
    font-size: 20px;
    color: #aaa;
    margin-bottom: 20px;
}
.upgrade-auth-message__buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.upgrade-auth-message__buttons a {
    display: block;
    width: 225px;
    height: 55px;
    border-radius: 5px;
    line-height: 53px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    font-family: 'Montserrat', serif;
    padding-left: 24px;
}
.upgrade-auth-message__buttons .btn-steam {
    background: #3a3a3a;
    border: 2px solid #595a5c;
    border-radius: 28px 28px 0 28px;
    box-shadow: inset 0 0 1px 1px #4f4848;
}
.upgrade-auth-message__buttons .btn-steam:hover { background: #bd9c18; }
.upgrade-auth-message__buttons .btn-vk {
    background: #2f7daa;
    border: 2px solid #595a5c;
    border-radius: 28px 0 28px 28px;
    box-shadow: inset 0 0 1px 1px #52a1ce;
}
.upgrade-auth-message__buttons .btn-vk:hover { background: #3079cd; }
.upgrade-auth-message__buttons .ico-steam {
    background: url(../images/ico-steam.png);
    width: 47px;
    height: 22px;
    margin: -3px 10px 0 0;
    display: inline-block;
    vertical-align: middle;
}
.upgrade-auth-message__buttons .ico-vk {
    background: url(../images/ico-vk.png);
    width: 41px;
    height: 24px;
    margin: -4px 10px 0 8px;
    display: inline-block;
    vertical-align: middle;
}

@media (max-width: 1024px) {
    .upgrade-page {
        flex-direction: column;
    }
    .upgrade-panel {
        width: 100%;
    }
    .upgrade-panel__items {
        max-height: 300px;
    }
    .upgrade-center {
        gap: 15px;
    }
    .upgrade-slot {
        width: 80%;
        max-width: 280px;
        height: auto;
        min-height: 200px;
        padding-bottom: 10px;
        overflow: visible;
    }
    .upgrade-slot__item {
        padding: 10px;
    }
    .upgrade-slot__item img {
        width: 110px;
        height: 110px;
    }
    .upgrade-slot__item-name {
        font-size: 13px;
    }
    .upgrade-slot__item-price {
        font-size: 15px;
    }
    .upgrade-chance {
        width: 130px;
        height: 130px;
    }
    .upgrade-btn {
        padding: 14px 40px;
        font-size: 16px;
    }
}
