.desktop-background {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    contain: layout paint;
}

body.app-page:not(.reader-page-body):is(.phase5g-new-page, .processing-library-page, .account-options-page, .subscriptions-page) .desktop-background {
    display: block;
}
body.app-page:not(.reader-page-body) .app-frame {
    position: relative;
    z-index: 1;
}

.desktop-background-slide {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.desktop-background-slide img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
}
/* This supplied image includes mock navigation. Frame out its left 220px
   and top 65px while keeping the original 1672x941 artwork intact. */
.desktop-background-slide[data-crop="city"] img {
    inset: auto 0 0 auto;
    width: calc(100% * 1672 / 1452);
    height: calc(100% * 941 / 876);
    object-position: right bottom;
}
.desktop-background::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: color-mix(in srgb, var(--bg) 16%, transparent);
}

/* One bounded decorative layer behind the UI, including translucent panels.
   It is independent of artwork so other phone pages need no image downloads. */
.wallpaper-particles {
    --particle-color: #ad8a7b;
    --particle-opacity: .5;
    display: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    contain: layout paint;
    pointer-events: none;
}
body.app-page:not(.reader-page-body) .wallpaper-particles { display: block; }
.wallpaper-particles span {
    position: absolute; left: var(--particle-x); top: var(--particle-y);
    width: var(--particle-size); height: var(--particle-size); border-radius: 50%;
    background: var(--particle-color); opacity: 0;
    box-shadow: 0 0 9px color-mix(in srgb, var(--particle-color) 60%, transparent);
    animation: wallpaper-drift var(--particle-duration) var(--particle-delay) linear infinite;
}
.wallpaper-particles span:nth-child(3n + 2) { --particle-color: #8f829e; }
.wallpaper-particles span:nth-child(3n) { --particle-color: #7f9993; }
html[data-theme="light"] .wallpaper-particles { --particle-color: #ffe8a1; --particle-opacity: .78; }
html[data-theme="light"] .wallpaper-particles span { box-shadow: 0 0 7px color-mix(in srgb, var(--particle-color) 55%, transparent); }
html[data-theme="light"] .wallpaper-particles span:nth-child(3n + 2) { --particle-color: #d9c8ff; }
html[data-theme="light"] .wallpaper-particles span:nth-child(3n) {
    --particle-color: #c8efe8;
    width: calc(var(--particle-size) * 2.5);
    height: calc(var(--particle-size) * 2.5);
    border-radius: 0;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
@keyframes wallpaper-drift {
    0% { transform: translate3d(0, 35px, 0); opacity: 0; }
    20%, 70% { opacity: var(--particle-opacity); }
    100% { transform: translate3d(65px, -140px, 0); opacity: 0; }
}
.wallpaper-particles[data-paused="true"] span { animation-play-state: paused; }
@media (max-width: 1024px) { .wallpaper-particles span:nth-child(n + 9) { display: none; } }
@media (prefers-reduced-motion: reduce) { .wallpaper-particles { display: none !important; } }

@media (min-width: 1025px) {
    body.app-page:not(.reader-page-body) .desktop-background {
        display: block;
        inset: 0 0 0 240px;
    }
}
