/* Cross-page animation budget. Loaded after each page's own styles. */
html.endva-page-hidden :where(*, *::before, *::after) {
    animation-play-state: paused !important;
}

/* Touch devices use a lighter presentation while keeping essential state changes visible. */
html.endva-motion-lite {
    scroll-behavior: auto;
}

html.endva-motion-lite body.facility-theme {
    background-attachment: scroll !important;
}

html.endva-motion-lite body.facility-theme[data-theme-effect] > :where(
    .container, .panel, .facility-panel, .chat-panel, main, aside
),
html.endva-motion-lite body.facility-theme[data-theme-effect]::after,
html.endva-motion-lite .fire-icon,
html.endva-motion-lite .fire-glow,
html.endva-motion-lite #fullHealMsg,
html.endva-motion-lite #fairyPet,
html.endva-motion-lite .target-node {
    animation: none !important;
    filter: none !important;
}

html.endva-motion-lite .adventure-motion-layer .adventure-motion-cloud,
html.endva-motion-lite #rewardPanel.is-reward-drawing::before,
html.endva-motion-lite .reward-ritual,
html.endva-motion-lite .reward-ritual::before,
html.endva-motion-lite .reward-ritual::after,
html.endva-motion-lite .reward-ritual-core,
html.endva-motion-lite .reward-ritual-spark {
    animation: none !important;
}

html.endva-motion-lite .adventure-motion-layer .adventure-motion-cloud {
    display: none !important;
}

html.endva-motion-lite body.mmo-battle .atb-entry.is-current,
html.endva-motion-lite body.mmo-battle .grid-cell.has-portal::after,
html.endva-motion-lite body.mmo-battle .delayed-skill-marker,
html.endva-motion-lite body.mmo-battle .time-stop-zone-marker,
html.endva-motion-lite body.mmo-battle .grid-cell.escape-zone,
html.endva-motion-lite body.mmo-battle .grid-cell.skill-range-highlight,
html.endva-motion-lite body.mmo-battle .grid-cell.movement-highlight,
html.endva-motion-lite body.mmo-adventure #readyBtn {
    animation: none !important;
    filter: none !important;
}

/* 全螢幕遮罩在手機上不使用背景模糊；透明度與位移動畫仍能維持層級感。 */
html.endva-motion-lite :where(
    #menuBackdrop,
    #drawerOverlay,
    #echoNotesModal,
    #playerProfileModal,
    #inviteReceiveModal,
    #tradeInviteModal,
    .modal,
    .quest-dice-backdrop,
    .tutorial-overlay,
    .game-manual-overlay
) {
    backdrop-filter: none !important;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }

    :where(*, *::before, *::after) {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
        scroll-behavior: auto !important;
    }
}
