.fragmentEl {
    z-index: 51;
    pointer-events: auto;
}

.fragment {
    width: 115px;
    height: 115px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    cursor: pointer;
    pointer-events: auto;
    transform-origin: center center;
    animation: fragmentFloat 1.8s ease-in-out infinite;
}

.fragmentEl.collected {
    pointer-events: none;
}

.fragmentEl.collected .fragment {
    animation: fragmentCollect 0.35s ease forwards;
}

@keyframes fragmentFloat {
    0%, 100% {
        transform: scale(0.5) translateY(0);
    }

    50% {
        transform: scale(0.5) translateY(-8px);
    }
}

@keyframes fragmentCollect {
    0% {
        opacity: 1;
        transform: scale(0.5) translateY(0);
    }

    100% {
        opacity: 0;
        transform: scale(0.9) translateY(-25px);
    }
}

/* collected popup */

.fragmentPopup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.fragmentPopup.hidden {
    display: none;
}

.fragmentPopupContent {
    position: relative;
    width: min(420px, 85vw);
    padding: 35px 28px;
    border-radius: 22px;
    background: rgba(20, 15, 35, .92);
    color: white;
    text-align: center;
    font-family: Georgia, serif;
    border: 2px solid rgba(255,255,255,.2);
    box-shadow: 0 18px 45px rgba(0,0,0,.35);
    animation: fragmentPopupIn .35s cubic-bezier(.2, 1.4, .4, 1);
}

.fragmentPopup.closing .fragmentPopupContent {
    animation: fragmentPopupOut .25s ease forwards;
}

#fragmentPreview {
    width: 115px;
    height: 115px;
    margin: 0 auto 15px;
    background-image: url("../assets/items/fragments.png");
    background-repeat: no-repeat;
    image-rendering: pixelated;
    transform: scale(.8);
}

#fragmentTitle {
    margin: 0 0 10px;
    color: #ffd966;
}

#fragmentText {
    margin: 0;
    line-height: 1.5;
}

#closeFragmentPopup {
    position: absolute;
    top: 12px;
    right: 16px;
    border: 0;
    background: transparent;
    color: white;
    font-size: 28px;
    cursor: pointer;
}

/* floating button */

#fragmentsButton {
    position: fixed;
    top: 88px;
    right: 18px;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.35);
    color: white;
    font-size: 26px;
    cursor: pointer;
    z-index: 99999;
    animation: musicFloat 3s ease-in-out infinite;
}

/* menu */

.fragmentsMenu {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.fragmentsMenu.hidden {
    display: none;
}

.fragmentsMenuContent {
    width: min(650px, 88vw);
    max-height: 80vh;
    border-radius: 22px;
    background: rgba(20, 15, 35, .94);
    color: white;
    font-family: Georgia, serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fragmentsHeader {
    flex-shrink: 0;
    position: relative;
    padding: 25px 60px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.12);
    background: rgba(20, 15, 35, .98);
}

.fragmentsHeader h2 {
    margin: 0;
}

#closeFragmentsMenu {
    position: absolute;
    top: 14px;
    right: 18px;
    border: 0;
    background: transparent;
    color: white;
    font-size: 28px;
    cursor: pointer;
}

.fragmentsBody {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 30px 30px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.fragmentsBody::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

#fragmentsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 18px;
}

.fragmentCard {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.08);
    text-align: center;
}

.fragmentIcon {
    width: 115px;
    height: 115px;
    margin: 0 auto 8px;
    background-image: url("../assets/items/fragments.png");
    background-repeat: no-repeat;
    image-rendering: pixelated;
    transform: scale(.55);
    transform-origin: center;
}

.fragmentCard.locked {
    opacity: .35;
    filter: grayscale(1);
}

@keyframes fragmentPopupIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(.85);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fragmentPopupOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(40px) scale(.85);
    }
}
.fragmentPopup {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(0,0,0,.55);

    z-index: 10000;

    animation: popupFadeIn .25s ease;
}

.fragmentPopup.hidden {
    display: none;
}

.fragmentPopup.closing {
    animation: popupFadeOut .25s ease forwards;
}

.fragmentPopupContent {
    position: relative;

    width: min(420px, 85vw);

    padding: 35px 28px;

    border-radius: 22px;

    background: rgba(20,15,35,.92);

    color: white;
    text-align: center;

    border: 2px solid rgba(255,255,255,.2);
    box-shadow: 0 18px 45px rgba(0,0,0,.35);

    animation: popupSlideIn .45s cubic-bezier(.2,1.3,.3,1);
}

.fragmentPopup.closing .fragmentPopupContent {
    animation: popupSlideOut .25s ease forwards;
}

@keyframes popupFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes popupFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes popupSlideIn {
    0% {
        opacity: 0;
        transform: translateY(80px) scale(.88);
    }

    70% {
        transform: translateY(-10px) scale(1.03);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes popupSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(80px) scale(.9);
    }
}