.reward-celebration {
    --reward-pink: #ec4899;
    --reward-violet: #7c3aed;
    --reward-cyan: #06b6d4;
    --reward-yellow: #facc15;
    position: fixed;
    z-index: 10000;
    inset: 0;
}

.reward-celebration__backdrop {
    position: absolute;
    background:
        radial-gradient(circle at 18% 22%, rgb(236 72 153 / 55%), transparent 31%),
        radial-gradient(circle at 82% 18%, rgb(6 182 212 / 55%), transparent 29%),
        radial-gradient(circle at 72% 82%, rgb(250 204 21 / 50%), transparent 32%),
        linear-gradient(135deg, #312e81, #5b21b6 45%, #9d174d);
    inset: 0;
    animation: reward-backdrop-shift 5s ease-in-out infinite alternate;
}

.reward-celebration__backdrop::before,
.reward-celebration__backdrop::after {
    position: absolute;
    border: 3px solid rgb(255 255 255 / 22%);
    border-radius: 50%;
    content: "";
}

.reward-celebration__backdrop::before {
    width: 42vw;
    height: 42vw;
    top: -18vw;
    right: -10vw;
    animation: reward-orbit 9s linear infinite;
}

.reward-celebration__backdrop::after {
    width: 34vw;
    height: 34vw;
    bottom: -16vw;
    left: -8vw;
    animation: reward-orbit 12s linear infinite reverse;
}

.reward-celebration__confetti {
    position: absolute;
    overflow: hidden;
    pointer-events: none;
    inset: 0;
}

.reward-confetti-piece {
    position: absolute;
    width: var(--reward-confetti-width, 10px);
    height: var(--reward-confetti-height, 18px);
    top: -12vh;
    left: var(--reward-confetti-left);
    border-radius: 3px;
    background-color: var(--reward-confetti-color);
    opacity: 0;
    transform: rotate(var(--reward-confetti-rotation));
    animation: reward-confetti-fall var(--reward-confetti-duration)
        var(--reward-confetti-delay) cubic-bezier(0.16, 0.8, 0.35, 1)
        infinite;
}

.reward-celebration__dialog {
    position: relative;
    display: flex;
    width: min(760px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    box-sizing: border-box;
    align-items: center;
    flex-direction: column;
    margin: 16px auto;
    padding: 34px;
    overflow-y: auto;
    border: 1px solid rgb(255 255 255 / 50%);
    border-radius: 28px;
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 35px 100px rgb(15 23 42 / 45%);
    text-align: center;
    animation: reward-dialog-enter 650ms cubic-bezier(0.16, 1.25, 0.3, 1)
        both;
}

.reward-celebration__burst {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 26px;
    background: linear-gradient(
        135deg,
        var(--reward-yellow),
        var(--reward-pink),
        var(--reward-violet)
    );
    color: white;
    font-size: 48px;
    box-shadow:
        0 0 0 12px rgb(124 58 237 / 12%),
        0 18px 42px rgb(124 58 237 / 35%);
    animation: reward-burst 1.4s ease-in-out infinite alternate;
}

.reward-celebration__headline {
    margin-top: 20px;
    color: var(--reward-violet);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.reward-celebration__dialog > h2 {
    margin: 6px 0 18px;
    font-size: clamp(30px, 5vw, 52px);
    line-height: 1;
}

.reward-celebration__level {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 2px 12px;
    margin-bottom: 18px;
    padding: 12px 20px;
    border-radius: 18px;
    background: linear-gradient(135deg, #eef2ff, #fae8ff);
    color: var(--reward-violet);
    text-align: left;
}

.reward-celebration__level span {
    align-self: end;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.reward-celebration__level strong {
    grid-row: 1 / 3;
    grid-column: 2;
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 42px;
    line-height: 1;
}

.reward-celebration__level p {
    margin: 0;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
}

.reward-celebration__cards {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.reward-celebration-card {
    --reward-card-accent: #64748b;
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid color-mix(
        in srgb,
        var(--reward-card-accent) 28%,
        white
    );
    border-radius: 18px;
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--reward-card-accent) 13%, white),
        white 58%
    );
    text-align: left;
}

.reward-celebration-card--rare {
    --reward-card-accent: #4f46e5;
}

.reward-celebration-card--epic {
    --reward-card-accent: #7c3aed;
}

.reward-celebration-card--legendary {
    --reward-card-accent: #d97706;
}

.reward-celebration-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background-color: white;
    font-size: 30px;
    box-shadow: 0 8px 24px color-mix(
        in srgb,
        var(--reward-card-accent) 24%,
        transparent
    );
}

.reward-celebration-card span:not(.reward-celebration-card__icon) {
    color: var(--reward-card-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.reward-celebration-card h3 {
    margin: 3px 0 4px;
    font-size: 17px;
}

.reward-celebration-card p {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.4;
}

.reward-celebration-card > strong {
    position: absolute;
    right: 14px;
    bottom: 12px;
    color: var(--reward-card-accent);
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
}

.reward-celebration__form {
    margin-top: 24px;
}

.reward-celebration__form button {
    min-width: 220px;
    padding: 14px 26px;
    border-radius: 14px;
    background: linear-gradient(
        100deg,
        var(--reward-violet),
        var(--reward-pink)
    );
    box-shadow: 0 12px 30px rgb(124 58 237 / 35%);
    font-size: 16px;
    font-weight: 800;
}

.reward-celebration__form button:hover {
    background: linear-gradient(100deg, #6d28d9, #db2777);
    transform: translateY(-2px);
}

.reward-level-toast {
    position: fixed;
    z-index: 9999;
    display: grid;
    width: min(340px, calc(100% - 32px));
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    right: 20px;
    top: 20px;
    box-sizing: border-box;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--color-accent-border);
    border-radius: 18px;
    background: linear-gradient(135deg, #eef2ff, white 68%);
    box-shadow: 0 20px 55px rgb(15 23 42 / 24%);
    animation: reward-toast-enter 450ms cubic-bezier(0.16, 1, 0.3, 1)
        both;
}

.reward-level-toast--leaving {
    animation: reward-toast-leave 260ms ease-in both;
}

.reward-level-toast__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background-color: var(--color-accent);
    color: white;
    font-size: 27px;
}

.reward-level-toast__content span {
    color: var(--color-accent-active);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.reward-level-toast__content strong {
    display: block;
    margin: 2px 0;
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
    font-size: 27px;
    line-height: 1;
}

.reward-level-toast__content p {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 600;
}

.reward-level-toast__close {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background-color: transparent;
    color: var(--color-muted);
    font-size: 24px;
    line-height: 1;
}

.reward-level-toast__close:hover {
    background-color: var(--color-surface-secondary);
    color: var(--color-text);
}

.reward-level-toast__timer {
    position: absolute;
    height: 4px;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: var(--color-accent);
    transform-origin: left;
    animation: reward-toast-timer 6s linear both;
}

.reward-level-toast form {
    display: none;
}

body.reward-celebration-open {
    overflow: hidden;
}

@keyframes reward-backdrop-shift {
    from {
        filter: saturate(1);
    }
    to {
        filter: saturate(1.35) hue-rotate(12deg);
    }
}

@keyframes reward-orbit {
    to {
        transform: rotate(360deg) scale(1.08);
    }
}

@keyframes reward-dialog-enter {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.82) rotate(-2deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0);
    }
}

@keyframes reward-burst {
    from {
        transform: rotate(-8deg) scale(0.96);
    }
    to {
        transform: rotate(8deg) scale(1.08);
    }
}

@keyframes reward-confetti-fall {
    0% {
        opacity: 0;
        transform: translate3d(0, -10vh, 0)
            rotate(var(--reward-confetti-rotation));
    }
    8% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translate3d(var(--reward-confetti-drift), 120vh, 0)
            rotate(calc(var(--reward-confetti-rotation) + 780deg));
    }
}

@keyframes reward-toast-enter {
    from {
        opacity: 0;
        transform: translateX(45px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes reward-toast-leave {
    to {
        opacity: 0;
        transform: translateX(45px) scale(0.94);
    }
}

@keyframes reward-toast-timer {
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 600px) {
    .reward-celebration__dialog {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        margin: 10px auto;
        padding: 24px 18px;
        border-radius: 22px;
    }

    .reward-celebration__burst {
        width: 68px;
        height: 68px;
        border-radius: 21px;
        font-size: 38px;
    }

    .reward-celebration__cards {
        grid-template-columns: 1fr;
    }

    .reward-celebration-card {
        padding: 15px;
    }

    .reward-celebration__form,
    .reward-celebration__form button {
        width: 100%;
    }

    .reward-level-toast {
        right: 12px;
        top: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reward-celebration__backdrop,
    .reward-celebration__backdrop::before,
    .reward-celebration__backdrop::after,
    .reward-celebration__dialog,
    .reward-celebration__burst,
    .reward-level-toast,
    .reward-level-toast--leaving,
    .reward-level-toast__timer {
        animation: none;
    }

    .reward-celebration__confetti {
        display: none;
    }
}
