/* ===== UPGRADE PAGE ===== */
.upgrade-page {
    padding: 20px;
    min-height: calc(100vh - 170px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Arena layout */
.upgrade-arena {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 40px;
    width: 100%;
    max-width: 1000px;
    padding: 40px 20px;
}

/* Slots */
.upgrade-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upgrade-slot__label {
    font-size: 12px;
    font-weight: 700;
    color: #5a5a6a;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.upgrade-slot__card {
    width: 220px;
    height: 260px;
    border-radius: 16px;
    background: #13131b;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.upgrade-slot__card:hover {
    border-color: rgba(245, 200, 66, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.upgrade-slot__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #5a5a6a;
    font-size: 14px;
}

.upgrade-slot__plus {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #5a5a6a;
    transition: color 0.2s, border-color 0.2s;
}

.upgrade-slot__card:hover .upgrade-slot__plus {
    color: #f5c842;
    border-color: rgba(245, 200, 66, 0.4);
}

.upgrade-slot__skin {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    border: 2px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #13131b;
    gap: 8px;
}

.upgrade-slot__skin img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.upgrade-slot__skin-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-align: center;
}

.upgrade-slot__price {
    font-size: 18px;
    font-weight: 700;
    color: #f5c842;
    min-height: 24px;
}

/* Balance input */
.upgrade-balance {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
}

.upgrade-balance__label {
    font-size: 10px;
    font-weight: 700;
    color: #5a5a6a;
    letter-spacing: 1.5px;
}

.upgrade-balance__input-wrap {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px 12px;
    gap: 6px;
    transition: border-color 0.2s;
    width: 160px;
}

.upgrade-balance__input-wrap:focus-within {
    border-color: rgba(245, 200, 66, 0.5);
}

.upgrade-balance__input {
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    width: 100%;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.upgrade-balance__input::-webkit-outer-spin-button,
.upgrade-balance__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.upgrade-balance__input::placeholder {
    color: #3a3a4a;
}

.upgrade-balance__currency {
    color: #5a5a6a;
    font-size: 14px;
    font-weight: 700;
}

.upgrade-balance__total {
    font-size: 13px;
    font-weight: 700;
    color: #f5c842;
    min-height: 18px;
}

/* Center wheel */
.upgrade-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
    padding-top: 56px;
}

/* Connector lines */
.upgrade-connector {
    display: none;
}

.upgrade-wheel {
    position: relative;
    width: 220px;
    height: 220px;
}

.upgrade-wheel__svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.upgrade-wheel__track-lose {
    fill: none;
    stroke: rgba(231, 76, 60, 0.25);
    stroke-width: 10;
}

.upgrade-wheel__progress {
    fill: none;
    stroke: #2ecc71;
    stroke-width: 10;
    stroke-dasharray: 565;
    stroke-dashoffset: 565;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease, stroke 0.3s;
    filter: drop-shadow(0 0 6px rgba(46, 204, 113, 0.3));
}

.upgrade-wheel__inner {
    fill: #0d0d14;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 1;
}

.upgrade-wheel__center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.upgrade-wheel__chance {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.upgrade-wheel__multiplier {
    font-size: 14px;
    font-weight: 700;
    color: #5a5a6a;
    letter-spacing: 1px;
}

.upgrade-wheel__pointer {
    position: absolute;
    top: 2px;
    left: 50%;
    width: 6px;
    height: 22px;
    margin-left: -3px;
    background: #fff;
    border-radius: 3px;
    transform-origin: 50% 108px;
    transition: transform 0.05s linear;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    z-index: 2;
}

/* Spinning animation */
.upgrade-wheel--spinning {
    animation: wheelPulse 0.5s ease-in-out infinite alternate;
}

@keyframes wheelPulse {
    from { filter: brightness(1); }
    to { filter: brightness(1.3); }
}

.upgrade-wheel--win .upgrade-wheel__progress {
    stroke: #2ecc71 !important;
    filter: drop-shadow(0 0 20px rgba(46, 204, 113, 0.6));
}

.upgrade-wheel--win .upgrade-wheel__center {
    animation: winFlash 0.3s ease infinite alternate;
}

@keyframes winFlash {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

.upgrade-wheel--lose .upgrade-wheel__progress {
    stroke: #e74c3c !important;
    filter: drop-shadow(0 0 20px rgba(231, 76, 60, 0.6));
}

/* Upgrade button */
.upgrade-btn {
    padding: 16px 56px;
    font-family: inherit;
    color: #1a1a1a;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s, opacity 0.3s;
    box-shadow: 0 4px 24px rgba(245, 200, 66, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.upgrade-btn__text {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.upgrade-btn__sub {
    font-size: 11px;
    font-weight: 600;
    color: rgba(26, 26, 26, 0.6);
}

.upgrade-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(245, 200, 66, 0.5);
}

.upgrade-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Result overlay */
.upgrade-result {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.upgrade-result.active {
    opacity: 1;
    pointer-events: auto;
}

.upgrade-result__content {
    background: #13131b;
    border-radius: 20px;
    padding: 40px 50px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: resultPop 0.4s ease;
}

@keyframes resultPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.upgrade-result__icon {
    font-size: 56px;
}

.upgrade-result__title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 2px;
}

.upgrade-result__title--win {
    color: #2ecc71;
    text-shadow: 0 0 30px rgba(46, 204, 113, 0.4);
}

.upgrade-result__title--lose {
    color: #e74c3c;
    text-shadow: 0 0 30px rgba(231, 76, 60, 0.4);
}

.upgrade-result__skin {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #ccc;
}

.upgrade-result__skin img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.6));
}

.upgrade-result__price {
    font-size: 22px;
    font-weight: 700;
    color: #f5c842;
}

.upgrade-result__lost-text {
    color: #8a8a9a;
    font-size: 14px;
    font-weight: 500;
}

.upgrade-result__btn {
    margin-top: 12px;
    padding: 14px 40px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    color: #1a1a1a;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: transform 0.2s, box-shadow 0.3s;
}

.upgrade-result__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 200, 66, 0.4);
}

/* Modals */
.upgrade-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(15vh + 80px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.upgrade-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.upgrade-modal__content {
    background: #13131b;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: resultPop 0.3s ease;
}

.upgrade-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.upgrade-modal__header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.upgrade-modal__close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #8a8a9a;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.upgrade-modal__close:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.upgrade-modal__filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.upgrade-filter {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: #8a8a9a;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.upgrade-filter:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.upgrade-filter.active {
    color: #f5c842;
    border-color: rgba(245, 200, 66, 0.4);
    background: rgba(245, 200, 66, 0.1);
}

.upgrade-modal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    overflow-y: auto;
    max-height: 50vh;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 200, 66, 0.3) rgba(255, 255, 255, 0.04);
}

.upgrade-modal__grid::-webkit-scrollbar {
    width: 6px;
}

.upgrade-modal__grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
}

.upgrade-modal__grid::-webkit-scrollbar-thumb {
    background: rgba(245, 200, 66, 0.3);
    border-radius: 3px;
}

.upgrade-modal__grid::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 200, 66, 0.5);
}

.upgrade-modal__card {
    background: #1a1a24;
    border-radius: 12px;
    border: 2px solid;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    overflow: hidden;
    min-width: 0;
}

.upgrade-modal__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.upgrade-modal__card img {
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.upgrade-modal__card-name {
    font-size: 11px;
    font-weight: 600;
    color: #ccc;
    text-align: center;
    line-height: 1.2;
}

.upgrade-modal__card-price {
    font-size: 13px;
    font-weight: 700;
}

.upgrade-modal__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #5a5a6a;
    font-size: 15px;
    padding: 40px;
}

/* Toast notification */
.upgrade-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #ff6b6b;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.35s, transform 0.35s;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

.upgrade-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.upgrade-toast__icon {
    font-size: 18px;
}
