.yume-qr-loading-frame {
    position: relative;
    padding: 0;
    overflow: hidden;
    background: #fff;
}

.yume-qr-loading-frame > img {
    grid-area: 1 / 1;
    animation: yume-qr-loading-reveal .28s ease-out both;
}

.yume-qr-loading-placeholder {
    position: absolute;
    inset: 12px;
    overflow: hidden;
    border-radius: 8px;
    background: #fff url('/images/qr-login-loading.svg') center / contain no-repeat;
    pointer-events: none;
}

.yume-qr-loading-placeholder::before {
    content: "";
    position: absolute;
    inset: -18%;
    z-index: 3;
    background:
        linear-gradient(#fff, #fff) 24% 28% / 1px 13px,
        linear-gradient(#fff, #fff) 24% 28% / 13px 1px,
        linear-gradient(#fff, #fff) 76% 70% / 1px 9px,
        linear-gradient(#fff, #fff) 76% 70% / 9px 1px,
        radial-gradient(circle, transparent 35%, rgba(255, 255, 255, .7) 35.3% 35.6%, transparent 36%),
        radial-gradient(circle, transparent 48%, rgba(206, 239, 255, .6) 48.3% 48.5%, transparent 49%),
        linear-gradient(118deg, transparent 36%, rgba(174, 248, 255, .25) 42%, rgba(255, 255, 255, .62) 46%, rgba(255, 195, 229, .35) 50%, transparent 58%);
    background-repeat: no-repeat;
    animation: yume-qr-loading-prism 1.4s ease-out both;
}

.yume-qr-loading-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        radial-gradient(circle at 18% 24%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .85) 0 2px, transparent 3px),
        radial-gradient(circle at 72% 82%, rgba(255, 244, 205, .8) 0 3px, transparent 4px),
        radial-gradient(ellipse at 0% 15%, rgba(111, 231, 247, .8), transparent 65%),
        radial-gradient(ellipse at 100% 85%, rgba(255, 150, 208, .75), transparent 65%),
        radial-gradient(ellipse at 85% 0%, rgba(255, 222, 158, .7), transparent 60%),
        linear-gradient(150deg, rgba(189, 181, 255, .3), rgba(255, 255, 255, .15) 45%, rgba(173, 195, 255, .45)),
        url('/images/qr-login-chibi.png') center / cover;
    animation: yume-qr-loading-intro 1.4s cubic-bezier(.22, .61, .36, 1) both;
}

.yume-qr-loading-mascot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26%;
    aspect-ratio: 1;
    box-sizing: border-box;
    border: 6px solid #fff;
    border-radius: 50%;
    background: #e9e2f5 url('/images/qr-login-chibi.png') center / cover no-repeat;
    transform: translate(-50%, -50%);
    animation: yume-qr-loading-breathe 1.8s ease-in-out infinite;
}

.yume-qr-loading-mascot::after {
    content: "";
    position: absolute;
    inset: -8px;
    border: 2px solid #eee7f7;
    border-top-color: #8b5cf6;
    border-right-color: #e6a0c4;
    border-radius: 50%;
    animation: yume-qr-loading-spin 1.2s linear infinite;
}

.yume-qr-loading-frame > img[hidden],
.yume-qr-loading-placeholder[hidden] {
    display: none;
}

@keyframes yume-qr-loading-spin {
    to { transform: rotate(360deg); }
}

@keyframes yume-qr-loading-breathe {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes yume-qr-loading-reveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes yume-qr-loading-intro {
    0% { opacity: 1; transform: scale(1.12); }
    78% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0; transform: scale(1.06); visibility: hidden; }
}

@keyframes yume-qr-loading-prism {
    0% { opacity: 0; transform: translateX(-16%) rotate(-14deg) scale(.94); }
    25% { opacity: .9; }
    65% { opacity: .65; }
    100% { opacity: 0; transform: translateX(16%) rotate(14deg) scale(1.08); visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .yume-qr-loading-placeholder::before,
    .yume-qr-loading-placeholder::after {
        display: none;
        animation: none;
    }

    .yume-qr-loading-frame > img,
    .yume-qr-loading-mascot,
    .yume-qr-loading-mascot::after {
        animation: none;
    }
}
