:root {
    --text: #f2f6ed;
    --muted: #aec0b6;
    --panel-strong: rgba(8, 18, 15, 0.8);
    --slot: rgba(9, 24, 20, 0.8);
    --gold: #f2ce74;
    --green: #79d79b;
    --shadow: rgba(0, 0, 0, 0.42);
    --scroll-fade-distance: 36px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: transparent !important;
    background-color: rgba(0, 0, 0, 0) !important;
}

body {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app {
    background: transparent !important;
    background-color: rgba(0, 0, 0, 0) !important;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 40px;
    border-radius: 7px;
    padding: 0 15px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 780;
    letter-spacing: 0;
    cursor: pointer;
}

button:disabled {
    cursor: default;
    opacity: 0.62;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    max-width: 520px;
    font-size: clamp(2rem, 4.2vw, 3.6rem);
    line-height: 1;
    font-weight: 850;
}

h3 {
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 0.94rem;
    line-height: 1.2;
}

.app-shell {
    width: min(980px, 100%);
    height: 100%;
    margin: 0 auto;
    padding: var(--scroll-fade-distance) 0;
    overflow: auto;
    background: transparent !important;
    background-color: rgba(0, 0, 0, 0) !important;
}

.app-shell [data-overlayscrollbars-viewport] {
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 var(--scroll-fade-distance), #000 calc(100% - var(--scroll-fade-distance)), transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 var(--scroll-fade-distance), #000 calc(100% - var(--scroll-fade-distance)), transparent 100%);
}

.interface-panel {
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.inventory-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon {
    display: inline-block;
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(84%) sepia(36%) saturate(571%) hue-rotate(357deg) brightness(99%) contrast(92%);
}

.inventory-section-title .icon {
    width: 16px;
    height: 16px;
}

button .icon {
    width: 15px;
    height: 15px;
}

.secondary-action .icon,
.inventory-section-title .icon {
    filter: brightness(0) invert(100%);
}

.inventory-check-icon {
    filter: brightness(0) saturate(100%) invert(78%) sepia(29%) saturate(667%) hue-rotate(82deg) brightness(94%) contrast(88%);
}

.reward-stage {
    position: relative;
    display: grid;
    gap: 32px;
    overflow: hidden;
    padding: 0;
    min-height: 314px;
}

.reward-stage::before {
    content: none;
}

.reward-stage-body {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 14px;
    min-height: 214px;
    perspective: 900px;
}

.reward-reveal-items {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 3vw, 28px);
    width: 100%;
}

.reward-stage-added-message {
    position: relative;
    z-index: 2;
    border: 1px solid rgba(242, 206, 116, 0.34);
    border-radius: 7px;
    padding: 7px 11px;
    color: #fff1bb;
    background: rgba(6, 17, 14, 0.8);
    font-size: 0.82rem;
    font-weight: 850;
    line-height: 1.2;
    text-align: center;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    will-change: color, border-color, background, box-shadow;
    animation: addedMessageGlow 1.8s ease-in-out infinite;
}

.reward-found-header {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 10px;
    width: 100%;
}

.reward-found-title {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: none;
    border: 1px solid rgba(242, 206, 116, 0.24);
    border-radius: 7px;
    padding: 8px 15px 10px;
    background: rgba(6, 17, 14, 0.8);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
    text-align: center;
}

.treasure-tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 29px;
    border: 1px solid rgba(242, 206, 116, 0.26);
    border-radius: 7px;
    padding: 0 10px;
    color: var(--text);
    background: rgba(6, 17, 14, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-size: 0.74rem;
    font-weight: 860;
    letter-spacing: 0;
    text-transform: uppercase;
}

.tier-icon {
    display: block;
    width: 15px;
    height: 15px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(84%) sepia(36%) saturate(571%) hue-rotate(357deg) brightness(99%) contrast(92%);
}

.treasure-tier-badge.tier-small {
    border-color: rgba(174, 192, 182, 0.28);
    color: var(--muted);
}

.treasure-tier-badge.tier-medium {
    border-color: rgba(138, 183, 220, 0.36);
    color: #dbeefd;
    box-shadow: 0 0 18px rgba(138, 183, 220, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.treasure-tier-badge.tier-large {
    border-color: rgba(242, 206, 116, 0.48);
    color: #fff1bb;
    background:
        linear-gradient(135deg, rgba(242, 206, 116, 0.14), rgba(121, 215, 155, 0.08)),
        rgba(6, 17, 14, 0.8);
    box-shadow: 0 0 24px rgba(242, 206, 116, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.treasure-tier-badge.tier-mega {
    border-color: rgba(255, 241, 187, 0.58);
    color: #fff7d6;
    background:
        linear-gradient(135deg, rgba(242, 206, 116, 0.18), rgba(138, 183, 220, 0.1)),
        rgba(6, 17, 14, 0.8);
    box-shadow: 0 0 30px rgba(242, 206, 116, 0.24), 0 0 18px rgba(138, 183, 220, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.reward-reveal-item {
    position: relative;
    display: grid;
    width: clamp(132px, 24vw, 210px);
    height: clamp(132px, 24vw, 210px);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: center;
    gap: 8px;
    border: 1px solid rgba(242, 206, 116, 0.28);
    border-radius: 7px;
    padding: 12px;
    background:
        linear-gradient(135deg, rgba(242, 206, 116, 0.08), transparent 42%),
        linear-gradient(45deg, rgba(121, 215, 155, 0.08), transparent 58%),
        rgba(6, 17, 14, 0.8);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: itemHover 5.6s ease-in-out infinite;
}

.reward-reveal-item::after {
    position: absolute;
    right: 18%;
    bottom: 12px;
    left: 18%;
    height: 16px;
    content: "";
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.34);
    filter: blur(12px);
}

.reward-reveal-image {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    object-fit: contain;
    filter: drop-shadow(0 0 16px rgba(121, 215, 155, 0.22)) drop-shadow(0 12px 22px var(--shadow));
}

.reward-reveal-name {
    position: relative;
    z-index: 1;
    max-width: 100%;
    overflow: hidden;
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 820;
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-count-2 .reward-reveal-item:first-child,
.item-count-3 .reward-reveal-item:first-child,
.item-count-4 .reward-reveal-item:first-child {
    transform: rotateZ(-4deg);
    animation-delay: -0.5s;
}

.item-count-2 .reward-reveal-item:last-child,
.item-count-3 .reward-reveal-item:last-child,
.item-count-4 .reward-reveal-item:last-child {
    transform: rotateZ(4deg);
    animation-delay: -1.2s;
}

.item-count-3 .reward-reveal-item:nth-child(2),
.item-count-4 .reward-reveal-item:nth-child(2) {
    transform: translateY(-8px);
    animation-delay: -1.8s;
}

.item-count-5 .reward-reveal-items {
    gap: clamp(7px, 1.4vw, 13px);
}

.item-count-5 .reward-reveal-item {
    width: clamp(112px, 17vw, 150px);
    height: clamp(126px, 17vw, 150px);
    padding: 9px;
}

.item-count-5 .reward-reveal-item:nth-child(1) {
    transform: rotateZ(-5deg);
    animation-delay: -0.5s;
}

.item-count-5 .reward-reveal-item:nth-child(2) {
    transform: translateY(-8px) rotateZ(-2deg);
    animation-delay: -1.3s;
}

.item-count-5 .reward-reveal-item:nth-child(4) {
    transform: translateY(-8px) rotateZ(2deg);
    animation-delay: -2.1s;
}

.item-count-5 .reward-reveal-item:nth-child(5) {
    transform: rotateZ(5deg);
    animation-delay: -2.7s;
}

.secondary-action {
    color: var(--text);
    border-color: rgba(138, 183, 220, 0.42);
    background: linear-gradient(135deg, rgba(45, 79, 91, 0.8), rgba(34, 83, 60, 0.8));
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
}

.inventory {
    margin-top: 28px;
    padding: 0;
}

.inventory:first-child {
    margin-top: 0;
}

.inventory-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    border: 1px solid rgba(199, 221, 208, 0.18);
    border-radius: 7px;
    padding: 10px;
    background: rgba(6, 17, 14, 0.8);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.inventory-counter-wrap {
    display: grid;
    gap: 5px;
    justify-self: start;
    min-width: 0;
}

.inventory-section-title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 830;
    line-height: 1.2;
}

.inventory-count,
.status {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.38;
}

.status {
    min-height: 22px;
    padding-top: 8px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
    gap: 10px;
    padding-top: 8px;
}

.inventory-item {
    position: relative;
    display: grid;
    grid-template-rows: 92px auto;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(199, 221, 208, 0.15);
    border-radius: 7px;
    padding: 9px;
    background: var(--panel-strong);
    will-change: border-color;
}

.inventory-image-slot,
.inventory-item h3 {
    position: relative;
    z-index: 1;
}

.inventory-item.is-locked {
    color: rgba(242, 246, 237, 0.56);
}

.inventory-image-slot {
    position: relative;
    display: grid;
    width: 100%;
    height: 92px;
    place-items: center;
    overflow: hidden;
    border-radius: 5px;
    background:
        linear-gradient(135deg, rgba(242, 206, 116, 0.06), rgba(138, 183, 220, 0.05)),
        var(--slot);
}

.inventory-image-slot.is-locked-slot {
    overflow: visible;
}

.inventory-image {
    position: relative;
    z-index: 1;
    max-width: calc(100% - 10px);
    max-height: 82px;
    object-fit: contain;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.3));
    transform: translateY(0);
    will-change: transform, filter;
}

.inventory-check-icon {
    position: absolute;
    z-index: 3;
    right: 7px;
    bottom: 7px;
    width: 17px;
    height: 17px;
    color: var(--green);
    transform: scale(1);
    transform-origin: center;
    will-change: transform, filter;
}

.lock-icon {
    position: relative;
    z-index: 1;
    display: block;
    box-sizing: content-box;
    width: 30px;
    height: 30px;
    padding: 8px;
    object-fit: contain;
    object-position: center;
    color: rgba(242, 246, 237, 0.3);
    opacity: 0.72;
    filter: brightness(0) invert(100%) drop-shadow(0 0 0 rgba(242, 246, 237, 0));
    transform: translateY(0);
    will-change: transform, opacity, filter;
}

@keyframes itemHover {
    0%,
    100% {
        translate: 0 0;
    }
    50% {
        translate: 0 -8px;
    }
}

@keyframes addedMessageGlow {
    0%,
    100% {
        color: #fff1bb;
        border-color: rgba(242, 206, 116, 0.34);
        background: rgba(6, 17, 14, 0.8);
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    }
    46% {
        color: #fff8d6;
        border-color: rgba(242, 206, 116, 0.72);
        background: rgba(27, 23, 11, 0.84);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), 0 0 18px rgba(242, 206, 116, 0.38);
    }
}

@keyframes collectionCardBorderPulse {
    0%,
    100% {
        border-color: rgba(199, 221, 208, 0.15);
    }
    42% {
        border-color: rgba(242, 206, 116, 0.28);
    }
}

@keyframes collectionPreviewFloat {
    0%,
    100% {
        filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.3));
        transform: translateY(0);
    }
    46% {
        filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.36)) drop-shadow(0 0 10px rgba(121, 215, 155, 0.18));
        transform: translateY(-7px);
    }
}

@keyframes collectionCheckPulse {
    0%,
    100% {
        filter: brightness(0) saturate(100%) invert(78%) sepia(29%) saturate(667%) hue-rotate(82deg) brightness(94%) contrast(88%);
        transform: scale(1);
    }
    42% {
        filter: brightness(0) saturate(100%) invert(88%) sepia(55%) saturate(513%) hue-rotate(74deg) brightness(104%) contrast(96%) drop-shadow(0 0 8px rgba(121, 215, 155, 0.68));
        transform: scale(1.22);
    }
}

@keyframes collectionLockPulse {
    0%,
    100% {
        filter: brightness(0) invert(100%) drop-shadow(0 0 0 rgba(242, 246, 237, 0));
        opacity: 0.66;
        transform: translateY(0);
    }
    48% {
        filter: brightness(0) invert(100%) drop-shadow(0 0 8px rgba(242, 246, 237, 0.42));
        opacity: 0.92;
        transform: translateY(-2px);
    }
}

.inventory-item {
    animation: collectionCardBorderPulse 6.8s ease-in-out infinite;
    animation-delay: calc(var(--item-index, 0) * -0.28s);
}

.inventory-image {
    animation: collectionPreviewFloat 4.6s ease-in-out infinite;
    animation-delay: calc(var(--item-index, 0) * -0.31s);
}

.inventory-check-icon {
    animation: collectionCheckPulse 3.8s ease-in-out infinite;
    animation-delay: calc(var(--item-index, 0) * -0.24s);
}

.lock-icon {
    animation: collectionLockPulse 4.2s ease-in-out infinite;
    animation-delay: calc(var(--item-index, 0) * -0.27s);
}

@media (max-width: 600px) {
    .reward-stage-body {
        min-height: auto;
        gap: 10px;
    }

    .reward-reveal-items {
        flex-wrap: wrap;
        gap: 10px;
    }

    .reward-reveal-item {
        width: min(42vw, 150px);
        height: min(42vw, 150px);
    }

    .inventory {
        margin-top: 24px;
        padding: 0;
    }

    .inventory-header {
        grid-template-columns: 1fr;
    }

    .secondary-action {
        width: 100%;
    }

    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    }
}
