:root {
    /*
   * 全屏遮罩背景
   */
    --arise-loader-background: #ffffff;

    /*
   * Lottie 外层容器尺寸
   *
   * 这里控制动画的基础显示区域。
   */
    --arise-loader-size-desktop: 210px;
    --arise-loader-size-mobile: 160px;
    --arise-loader-size-landscape: 128px;

    /*
   * 整体视觉放大比例
   *
   * 缩放作用于 Lottie 外层容器，
   * 不直接修改 SVG 和 SVG 子元素，
   * 避免 Mask、Path、ClipPath 错位。
   */
    --arise-loader-visual-scale: 5;

    /*
   * 全局位置微调
   */
    --arise-loader-offset-x: 0px;
    --arise-loader-offset-y: 0px;

    /*
   * 第三个动画的位置补偿。
   *
   * 只有 JS 给容器添加
   * .is-third-animation 类时才会生效。
   */
    --arise-loader-third-offset-x: -18px;
    --arise-loader-third-offset-y: -28px;

    /*
   * 动画淡入、遮罩淡出时间
   */
    --arise-loader-animation-fade-duration: 80ms;
    --arise-loader-fade-duration: 240ms;
}

/* ==================================================
   页面锁定
================================================== */

html.arise-page-loading,
html.arise-page-loading body {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

/* ==================================================
   全屏 Loader 遮罩
================================================== */

#arise-json-loader {
    position: fixed;
    inset: 0;

    z-index: 2147483000;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-width: 100%;

    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;

    margin: 0;
    padding: 0;

    background-color: var(--arise-loader-background);

    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translate3d(0, 0, 0);

    transition:
        opacity var(--arise-loader-fade-duration) linear,
        visibility 0s linear 0s;

    will-change: opacity;

    /*
   * Loader 与主题页面隔离，
   * 避免主题布局影响内部尺寸。
   */
    contain: layout paint style;

    /*
   * 防止主题样式加入异常裁切。
   */
    overflow: hidden;
    box-sizing: border-box;
}

/*
 * 固定显示时间结束后淡出。
 *
 * 不做 SVG 上滑或缩放，
 * 避免退出时蒙版发生偏移。
 */
#arise-json-loader.is-leaving {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity var(--arise-loader-fade-duration) linear,
        visibility 0s linear var(--arise-loader-fade-duration);
}

/* ==================================================
   Lottie 外层容器
================================================== */

#arise-json-loader-animation {
    /*
   * 当前帧的动态位置变量。
   * 默认使用全局位置。
   */
    --arise-loader-current-offset-x:
        var(--arise-loader-offset-x);

    --arise-loader-current-offset-y:
        var(--arise-loader-offset-y);

    position: relative;

    display: block;
    flex: 0 0 auto;

    width: var(--arise-loader-size-desktop);
    height: var(--arise-loader-size-desktop);

    min-width: 0;
    min-height: 0;

    max-width: none;
    max-height: none;

    margin: 0;
    padding: 0;

    /*
   * 允许动画本身超出基础容器，
   * 但最终仍受全屏遮罩边界控制。
   */
    overflow: visible;

    opacity: 0;
    visibility: hidden;

    /*
   * 只缩放外层容器。
   *
   * 不要把 transform 放在：
   * #arise-json-loader-animation svg
   *
   * 也不要给 svg * 设置 transform-box。
   */
    transform:
        translate3d(var(--arise-loader-current-offset-x),
            var(--arise-loader-current-offset-y),
            0) scale(var(--arise-loader-visual-scale));

    transform-origin: 50% 50%;

    transition:
        opacity var(--arise-loader-animation-fade-duration) linear,
        visibility 0s linear var(--arise-loader-animation-fade-duration);

    will-change: opacity, transform;

    /*
   * 创建独立层叠环境，
   * 不修改 SVG 内部坐标系统。
   */
    isolation: isolate;

    box-sizing: border-box;
}

/*
 * Lottie DOMLoaded 后添加。
 */
#arise-json-loader-animation.is-ready {
    opacity: 1;
    visibility: visible;

    transition:
        opacity var(--arise-loader-animation-fade-duration) linear,
        visibility 0s linear 0s;
}

/* ==================================================
   第三个动画视觉中心补偿
================================================== */

/*
 * 这条规则只修正整个动画容器的位置，
 * 不触碰 SVG 内部的 Mask、Path、Group。
 *
 * 后续 JS 根据帧范围添加：
 * .is-third-animation
 */
#arise-json-loader-animation.is-third-animation {
    --arise-loader-current-offset-x:
        var(--arise-loader-third-offset-x);

    --arise-loader-current-offset-y:
        var(--arise-loader-third-offset-y);
}

/* ==================================================
   Lottie 生成的 SVG
================================================== */

#arise-json-loader-animation>svg {
    position: relative;

    display: block !important;

    width: 100% !important;
    height: 100% !important;

    min-width: 100% !important;
    min-height: 100% !important;

    max-width: none !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow: visible !important;

    /*
   * 保持 Lottie 自己生成的 SVG 坐标系统。
   *
   * 这里绝对不要加入：
   *
   * transform: scale(...);
   * transform-origin: ...;
   * transform-box: fill-box;
   */
}

/*
 * 不对 g、path、mask、clipPath、use
 * 或其他 SVG 子元素设置 transform。
 *
 * Lottie 会自行生成正确的矩阵和锚点。
 */

/* ==================================================
   防止 Arise 主题全局图片/SVG样式干扰
================================================== */

#arise-json-loader-animation svg,
#arise-json-loader-animation svg path,
#arise-json-loader-animation svg g,
#arise-json-loader-animation svg mask,
#arise-json-loader-animation svg clipPath,
#arise-json-loader-animation svg defs,
#arise-json-loader-animation svg use {
    max-width: none;
    max-height: none;

    margin: 0;
    padding: 0;

    /*
   * 不设置 transform-box。
   */
}

/*
 * 防止主题给 SVG 统一添加
 * object-fit 或 vertical-align 后产生偏移。
 */
#arise-json-loader-animation svg {
    object-fit: contain;
    object-position: center;
    vertical-align: top;
}

/* ==================================================
   无障碍文本
================================================== */

.arise-loader-accessible-text {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;

    padding: 0 !important;
    margin: -1px !important;

    overflow: hidden !important;

    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;

    white-space: nowrap !important;

    border: 0 !important;
}

/* ==================================================
   移动端
================================================== */

@media screen and (max-width: 749px) {
    :root {
        /*
     * 移动端避免视觉主体过大。
     */
        --arise-loader-visual-scale: 5;

        /*
     * 第三个动画移动端补偿。
     */
        --arise-loader-third-offset-x: -12px;
        --arise-loader-third-offset-y: -20px;
    }

    #arise-json-loader-animation {
        width: var(--arise-loader-size-mobile);
        height: var(--arise-loader-size-mobile);
    }
}

/* ==================================================
   手机横屏、小高度屏幕
================================================== */

@media screen and (orientation: landscape) and (max-height: 500px) {
    :root {
        --arise-loader-visual-scale: 5;

        --arise-loader-third-offset-x: -10px;
        --arise-loader-third-offset-y: -14px;
    }

    #arise-json-loader-animation {
        width: var(--arise-loader-size-landscape);
        height: var(--arise-loader-size-landscape);
    }
}

/* ==================================================
   超小屏设备
================================================== */

@media screen and (max-width: 374px) {
    :root {
        --arise-loader-size-mobile: 142px;
        --arise-loader-visual-scale: 5;

        --arise-loader-third-offset-x: -10px;
        --arise-loader-third-offset-y: -17px;
    }
}

/* ==================================================
   减少动态效果
================================================== */

@media (prefers-reduced-motion: reduce) {
    #arise-json-loader {
        transition-duration: 120ms;
    }

    #arise-json-loader-animation {
        transition-duration: 60ms;
    }
}

/* ==================================================
   打印
================================================== */

@media print {

    html.arise-page-loading,
    html.arise-page-loading body {
        overflow: visible !important;
    }

    #arise-json-loader {
        display: none !important;
    }
}