/* =========================================================
   V5.8 - Collector Rank Loot Box Reveal
   Kept in modules/loyalty-system for clean debugging.
========================================================= */
.ll-lootbox-hub {
    right: auto !important;
    left: 50% !important;
    top: 50% !important;
    width: min(92vw, 430px) !important;
    height: auto !important;
    max-height: min(86vh, 780px) !important;
    transform: translate(-50%, -46%) scale(.94) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    background:
        radial-gradient(circle at 50% -12%, rgba(212,175,55,.24), transparent 34%),
        radial-gradient(circle at 12% 16%, rgba(138,255,0,.08), transparent 24%),
        linear-gradient(180deg, #171c28 0%, #0b0f18 100%) !important;
    border: 1px solid rgba(212,175,55,.24) !important;
    box-shadow: 0 34px 90px rgba(0,0,0,.72), 0 0 0 1px rgba(255,255,255,.045) inset !important;
    transition: opacity .24s ease, visibility .24s ease, transform .34s cubic-bezier(.18,.9,.24,1.12) !important;
}

.ll-lootbox-hub.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

.ll-lootbox-close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    z-index: 10 !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 999px !important;
    display: grid !important;
    place-items: center !important;
    cursor: pointer !important;
    border: 1px solid rgba(212,175,55,.24) !important;
    background: rgba(11,15,24,.72) !important;
    color: #e6c96a !important;
    font-size: 24px !important;
    line-height: 1 !important;
    box-shadow: 0 10px 24px rgba(0,0,0,.28) !important;
}

.ll-lootbox-stage {
    position: relative;
    height: 178px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-bottom: 1px solid rgba(212,175,55,.13);
}

.ll-lootbox-rays {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, rgba(212,175,55,.20), transparent, rgba(138,255,0,.08), transparent);
    opacity: .24;
    animation: llLootboxSpin 9s linear infinite;
}

.ll-lootbox-chest {
    position: relative;
    width: 138px;
    height: 96px;
    transform: translateY(15px);
    animation: llLootboxBob 2.4s ease-in-out infinite;
}

.ll-lootbox-base,
.ll-lootbox-lid {
    position: absolute;
    left: 0;
    width: 138px;
    border: 1px solid rgba(212,175,55,.42);
    background:
        linear-gradient(135deg, rgba(212,175,55,.34), rgba(212,175,55,.08) 35%, rgba(18,23,34,.92) 36%),
        linear-gradient(180deg, #242b3d, #111722);
    box-shadow: 0 20px 34px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.10);
}

.ll-lootbox-base {
    bottom: 0;
    height: 60px;
    border-radius: 14px 14px 18px 18px;
}

.ll-lootbox-lid {
    top: 3px;
    height: 44px;
    border-radius: 20px 20px 10px 10px;
    transform-origin: 50% 100%;
    z-index: 2;
}

.ll-lootbox-lock {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: 30px;
    width: 34px;
    height: 34px;
    transform: translateX(-50%);
    border-radius: 12px;
    background: linear-gradient(180deg, #e6c96a, #9d7417);
    box-shadow: 0 0 24px rgba(212,175,55,.48), inset 0 1px 0 rgba(255,255,255,.38);
}

.ll-lootbox-hub.ll-lootbox-opening .ll-lootbox-lid,
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-lid {
    animation: llLootboxLidOpen .86s cubic-bezier(.17,.9,.18,1.2) forwards;
}

.ll-lootbox-hub.ll-lootbox-opening .ll-lootbox-lock,
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-lock {
    animation: llLootboxLockPop .58s ease forwards;
}

.ll-lootbox-sparkles span {
    position: absolute;
    left: 50%;
    top: 92px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #e6c96a;
    opacity: 0;
    box-shadow: 0 0 18px rgba(230,201,106,.9);
}

.ll-lootbox-hub.ll-lootbox-opening .ll-lootbox-sparkles span,
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-sparkles span {
    animation: llLootboxSpark .95s ease forwards;
}

.ll-lootbox-sparkles span:nth-child(1) { --x: -78px; --y: -56px; animation-delay: .16s; }
.ll-lootbox-sparkles span:nth-child(2) { --x: -36px; --y: -88px; animation-delay: .24s; }
.ll-lootbox-sparkles span:nth-child(3) { --x: 0px; --y: -104px; animation-delay: .20s; }
.ll-lootbox-sparkles span:nth-child(4) { --x: 42px; --y: -82px; animation-delay: .30s; }
.ll-lootbox-sparkles span:nth-child(5) { --x: 84px; --y: -48px; animation-delay: .18s; }

.ll-lootbox-content {
    padding: 18px 18px 20px !important;
    overflow: auto !important;
}

.ll-lootbox-kicker {
    margin: 0 0 4px !important;
    color: #e6c96a !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: .14em !important;
}

.ll-lootbox-content h3 {
    margin: 0 !important;
    color: #f3f3f3 !important;
    font-size: 25px !important;
    font-weight: 950 !important;
    letter-spacing: -.03em !important;
}

.ll-lootbox-copy {
    margin: 6px 0 14px !important;
    color: rgba(243,243,243,.72) !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
}

.ll-lootbox-progress-card {
    padding: 14px !important;
    border-radius: 18px !important;
    border: 1px solid rgba(212,175,55,.16) !important;
    background: rgba(255,255,255,.04) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.055) !important;
}

.ll-lootbox-progress-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 10px !important;
}

.ll-lootbox-progress-top span {
    color: rgba(243,243,243,.62) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
}

.ll-lootbox-progress-top strong {
    color: #e6c96a !important;
    font-size: 18px !important;
}

.ll-lootbox-benefits {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    margin-top: 14px !important;
}

.ll-lootbox-benefit {
    position: relative !important;
    padding: 12px 12px 12px 86px !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    background: rgba(255,255,255,.035) !important;
    transform: translateY(8px) scale(.98) !important;
    opacity: 0 !important;
}

.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit {
    animation: llLootboxBenefitIn .36s ease forwards;
}

.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit:nth-child(1) { animation-delay: .02s; }
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit:nth-child(2) { animation-delay: .10s; }
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit:nth-child(3) { animation-delay: .18s; }
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit:nth-child(4) { animation-delay: .26s; }

.ll-lootbox-benefit span {
    position: absolute !important;
    left: 12px !important;
    top: 12px !important;
    width: 58px !important;
    min-height: 26px !important;
    display: inline-grid !important;
    place-items: center !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    font-weight: 950 !important;
    text-transform: uppercase !important;
}

.ll-lootbox-benefit strong {
    display: block !important;
    color: #f3f3f3 !important;
    font-size: 13px !important;
    font-weight: 900 !important;
}

.ll-lootbox-benefit em {
    display: block !important;
    margin-top: 2px !important;
    color: rgba(243,243,243,.64) !important;
    font-style: normal !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
}

.ll-lootbox-benefit.is-unlocked {
    border-color: rgba(212,175,55,.18) !important;
    background: linear-gradient(180deg, rgba(212,175,55,.08), rgba(255,255,255,.032)) !important;
}

.ll-lootbox-benefit.is-unlocked span {
    color: #091018 !important;
    background: linear-gradient(135deg, #e6c96a, #d4af37) !important;
}

.ll-lootbox-benefit.is-locked {
    opacity: .78 !important;
}

.ll-lootbox-benefit.is-locked span {
    color: rgba(243,243,243,.68) !important;
    background: rgba(255,255,255,.07) !important;
    border: 1px solid rgba(255,255,255,.09) !important;
}

@keyframes llLootboxSpin { to { transform: rotate(360deg); } }
@keyframes llLootboxBob { 0%,100% { transform: translateY(15px); } 50% { transform: translateY(8px); } }
@keyframes llLootboxLidOpen { 0% { transform: rotateX(0deg) translateY(0); } 100% { transform: rotateX(64deg) translateY(-13px); } }
@keyframes llLootboxLockPop { 0% { transform: translateX(-50%) scale(1); opacity: 1; } 100% { transform: translateX(-50%) translateY(-22px) scale(.55); opacity: 0; } }
@keyframes llLootboxSpark { 0% { opacity: 0; transform: translate(0,0) scale(.4); } 36% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.35); } }
@keyframes llLootboxBenefitIn { to { transform: translateY(0) scale(1); opacity: 1; } }

@media (max-width: 480px) {
    .ll-lootbox-stage { height: 156px; }
    .ll-lootbox-content { padding: 16px 14px 18px !important; }
    .ll-lootbox-content h3 { font-size: 22px !important; }
}

/* =========================================================
   V6.3 - Lootbox fit improvements for mobile bottom nav
   Kept in modules/loyalty-system for clean debugging.
========================================================= */
@media (max-width: 782px) {
    .ll-lootbox-hub {
        top: calc(50% - 36px) !important;
        width: min(94vw, 420px) !important;
        max-height: calc(100dvh - 122px - env(safe-area-inset-bottom)) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    .ll-lootbox-hub.active {
        transform: translate(-50%, -50%) scale(1) !important;
    }

    .ll-lootbox-stage {
        height: 132px !important;
    }

    .ll-lootbox-chest {
        transform: translateY(10px) scale(.82) !important;
    }

    .ll-lootbox-content {
        padding: 14px 14px calc(18px + env(safe-area-inset-bottom)) !important;
    }

    .ll-lootbox-content h3 {
        font-size: 21px !important;
        margin-bottom: 5px !important;
    }

    .ll-lootbox-copy {
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }

    .ll-lootbox-progress-card {
        padding: 12px !important;
        margin-bottom: 10px !important;
    }

    .ll-lootbox-benefits {
        gap: 8px !important;
    }

    .ll-lootbox-benefit {
        min-height: 72px !important;
        padding: 12px 12px 12px 80px !important;
    }
}

/* =========================================================
   V6.4 - Loyalty reveal persistence fix
   Keeps the unlocked reward rows visible after their intro animation finishes.
========================================================= */
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit,
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit.is-unlocked,
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit.is-locked {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    animation-fill-mode: forwards !important;
}

.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit span,
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit strong,
.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit em {
    opacity: 1 !important;
    visibility: visible !important;
}

.ll-lootbox-hub.ll-lootbox-opened .ll-lootbox-benefit.is-unlocked span {
    color: #091018 !important;
    background: linear-gradient(135deg, #e6c96a, #d4af37) !important;
    box-shadow: 0 0 18px rgba(212,175,55,.22) !important;
}
