/* ============================================================================
   性能层（2026-10-01）· 针对「打开网页 CPU 立刻 100%」
   ----------------------------------------------------------------------------
   实测归因（脚本 _qctest/cpu-scan.cjs）：
     · app.css 里有 16+ 条 `animation: … infinite`（脉冲/描边/流光/旋转），
       其中 `.mqz-head::after` 是一条 **300px 径向渐变**在 10s 循环漂移 ——
       大尺寸模糊层的持续重绘是 GPU/CPU 最贵的一类动画；
     · 机台卡在机状态的 `.dv-ico` / `.dv-hd::before` 也各自 1.6~1.9s 无限脉冲；
     · 页面切到后台（或最小化）后，以上动画**仍在跑**，这是"挂在后台也烧 CPU"的主因。
   本文件做三件低风险的事：
     ① 尊重系统"减少动态效果"设置；
     ② 页面不可见时**暂停所有动画**（回到前台自动恢复）；
     ③ 关掉"纯装饰 + 大面积"的无限动画（保留有语义的 6px 状态点呼吸）。
   ========================================================================== */

/* ① 系统级偏好：用户在 Windows「辅助功能 → 视觉效果 → 动画效果」关掉时，这里一并关 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ② 页面不可见（切标签 / 最小化）时暂停全部动画：由 perf.js 给 <html> 加 .perf-idle */
html.perf-idle *, html.perf-idle *::before, html.perf-idle *::after {
  animation-play-state: paused !important;
}

/* ③ 关掉"大面积纯装饰"的无限动画（这些每帧都要重绘模糊层，最费 CPU） */
html:not(.perf-keep-motion) .mqz-head::after { animation: none !important; }          /* 300px 径向渐变漂移 */
html:not(.perf-keep-motion) .mqz-head::before { animation: none !important; }
html:not(.perf-keep-motion) .pd3-dev .dv-ico,
html:not(.perf-keep-motion) .pd3-dev .dv-hd::before { animation: none !important; }   /* 机台卡图标光环 */
html:not(.perf-keep-motion) .pd3-rack .pd3-dev.sel::before { animation: none !important; }
html:not(.perf-keep-motion) .ldOrbit, html:not(.perf-keep-motion) .ldShimmer,
html:not(.perf-keep-motion) .ldHalo, html:not(.perf-keep-motion) .ldCorePulse { animation: none !important; }
/* 超宽图表/大画布不做入场动画（图表本身仍正常渲染） */
html:not(.perf-keep-motion) .ov3-h240, html:not(.perf-keep-motion) .bp-chart { animation: none !important; }

/* ④ ★ 最重要的一条：关掉 backdrop-filter（毛玻璃）。
   任务管理器实测：Edge 的 **GPU 进程 42.5% GPU**、ToDesk 远程控制 47.2% GPU、GPU 总占用 99%。
   根因是页面上有多处 `backdrop-filter: blur(...)`（中间质检的 hero/页签/状态胶囊/工具条、
   各模块的浮层与吸顶栏）—— 它要求合成器**每帧重新采样背后的像素**，是最贵的一类 GPU 效果；
   再叠加 ToDesk 的逐帧抓屏编码，就把 GPU 直接顶满。
   关掉后只是"玻璃感变实底"，颜色与布局完全不变。真想要毛玻璃：给 <html> 加 .perf-keep-motion。 */
html:not(.perf-keep-motion) * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ⑤ 其余无限脉冲（状态点/状态灯）也一并停掉：它们虽小，但会让合成器持续产帧，
   远程桌面下每帧都要被 ToDesk 抓取+编码，代价被放大数十倍。状态本身仍由**颜色与文字**表达。 */
html:not(.perf-keep-motion) .pd3-dev .dv-st .dv-std,
html:not(.perf-keep-motion) .pd3-mc3 .mc3-st u,
html:not(.perf-keep-motion) .dv-grp.g-run .g-dot,
html:not(.perf-keep-motion) .mqz-status i,
html:not(.perf-keep-motion) .fqc-hero-live i,
html:not(.perf-keep-motion) .pd-dev-dot,
html:not(.perf-keep-motion) .pd2-dev-st i { animation: none !important; }
/* 滚动容器开启合成层提示，减少滚动时的重绘（不改视觉） */
html:not(.perf-keep-motion) .view, html:not(.perf-keep-motion) .mp-tbl, html:not(.perf-keep-motion) .mqz-tblwrap {
  will-change: scroll-position;
}
