#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    outline: none;
    border-radius: 0;
    color: #fff3f8;
    background: #211c42 url(/assets/loading-background.webp) center / cover no-repeat;
}

#loading-screen[open] {
    display: block;
}

#loading-screen::backdrop {
    background: #211c42;
}

.loading-panel {
    position: absolute;
    inset-inline: 0;
    bottom: max(12%, calc(env(safe-area-inset-bottom) + 28px));
    width: min(78vw, 720px);
    margin-inline: auto;
    text-align: center;
    font: 600 clamp(14px, 2vw, 20px) / 1.45 system-ui, sans-serif;
    text-shadow: 0 1px 6px #15102c, 0 1px 12px #15102c;
}

.loading-track {
    --progress: 12%;
    position: relative;
    aspect-ratio: 1675 / 126;
    margin-top: 12px;
    border-radius: 999px;
    background: url(/assets/loading-track.webp) center / 100% 100% no-repeat, rgba(255, 243, 248, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 243, 248, 0.25);
}

.loading-fill {
    position: absolute;
    inset: 13% 1.1%;
    border-radius: 999px;
    background: url(/assets/loading-fill.webp) center / 100% 100% no-repeat, linear-gradient(90deg, #b87cff, #ff9ed2);
    clip-path: inset(0 calc(100% - var(--progress)) 0 0 round 999px);
    transition: clip-path 200ms ease-out;
}

.loading-charm {
    position: absolute;
    top: 50%;
    left: clamp(3%, var(--progress), 97%);
    width: clamp(38px, 8.8%, 62px);
    aspect-ratio: 286 / 407;
    transform: translate(-58%, -29%);
    background: url(/assets/loading-charm.webp) center / contain no-repeat;
    transition: left 200ms ease-out;
}

@media (max-aspect-ratio: 1/1) {
    #loading-screen {
        background-position: 82% center;
    }

    .loading-panel {
        bottom: max(17%, calc(env(safe-area-inset-bottom) + 28px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-fill, .loading-charm {
        transition: none;
    }
}
