/**
 * 移动端性能降温：暂停不可见层动画、降低 GPU 合成开销，不影响功能与交互。
 * 配合 html.is-mobile / html.is-low-end（index.html 注入）分级生效。
 */

html.miya-tab-hidden *,
html.miya-tab-hidden *::before,
html.miya-tab-hidden *::after {
  animation-play-state: paused !important;
}

.miya-mode-layer:not(.is-active) *,
.miya-mode-layer:not(.is-active) *::before,
.miya-mode-layer:not(.is-active) *::after {
  animation-play-state: paused !important;
}

body.miya-app-open .phone__wall,
body.miya-app-open .phone__wall *,
body.miya-app-open .desk-shell,
body.miya-app-open .desk-shell * {
  animation-play-state: paused !important;
}

[hidden] *,
[hidden] *::before,
[hidden] *::after {
  animation-play-state: paused !important;
}

/* 非活跃玩法层跳过绘制（切换过渡时 is-leaving 仍保留） */
.miya-mode-layer:not(.is-active):not(.is-leaving) {
  content-visibility: hidden;
  contain: layout style paint;
}

/* ── 移动端：降低合成与毛玻璃开销 ── */

html.is-mobile .glass,
html.is-mobile .foot__dock.glass,
html.is-mobile .modal__card.glass {
  backdrop-filter: blur(10px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.06) !important;
}

/* 主屏空闲：图标区去掉毛玻璃（十余个 blur 叠加是主要发热源之一） */
html.is-mobile body.miya-mode-phone:not(.miya-app-open) :is(
  .ic__box.glass,
  .foot__dock.glass
) {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(255, 255, 255, 0.82) !important;
  box-shadow: 0 2px 10px rgba(100, 110, 125, 0.08) !important;
}

html.is-mobile .wg-player:not(.has-custom-player-bg) {
  backdrop-filter: blur(12px) saturate(1.05) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.05) !important;
}

html.is-mobile .phone__snow,
html.is-mobile .phone__curtain {
  filter: none !important;
}

html.is-mobile .wg-player__grain {
  display: none !important;
}

html.is-mobile .wg-player__orb {
  filter: blur(16px) !important;
}

html.is-mobile .qq-room__head,
html.is-mobile .qq-room__foot {
  backdrop-filter: blur(12px) saturate(1.12) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.12) !important;
}

html.is-mobile :is(
  .fr-back,
  .fr-nav__bar,
  .fr-compose__veil,
  .fr-note-editor__head
) {
  backdrop-filter: blur(10px) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.08) !important;
}

html.is-mobile :is(
  .ins-atelier-rail,
  .ins-vault-topbar,
  .ncm-mini-player,
  .miya-dialog-backdrop,
  .miya-dialog-card
) {
  backdrop-filter: blur(10px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.06) !important;
}

html.is-mobile .desk--p1,
html.is-mobile .desk--p2,
html.is-mobile .desk--p3,
html.is-mobile .qq-room-scroll,
html.is-mobile .ncm-scroll,
html.is-mobile .sim-root {
  contain: layout style;
}

html.is-mobile .desk-track:not(.is-dragging) {
  will-change: auto;
}

/* ── 主屏空闲：关闭纯装饰无限动画 ── */

html.is-mobile body.miya-mode-phone:not(.miya-app-open) .wg-polaroid__card--1 {
  animation: none !important;
}

html.is-mobile body.miya-mode-phone:not(.miya-app-open) :is(
  .wg-player__orb,
  .wg-player__scan,
  .wg-player__ring,
  .wg-player__marquee span,
  .wg-polaroid__card--1,
  .ins-atelier-orb,
  .mdl__aurora,
  .mdl__scan,
  .mdl__frame::before,
  .mc-room-deco__grain,
  .fr-orb,
  .fr-ticker
) {
  animation: none !important;
}

/* ── 主屏分页：非当前页跳过绘制与动画 ── */

html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="0"] .desk--p2,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="0"] .desk--p3,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="1"] .desk--p1,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="1"] .desk--p3,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="2"] .desk--p1,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="2"] .desk--p2 {
  content-visibility: hidden;
  contain: strict;
}

html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="0"] .desk--p2 *,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="0"] .desk--p3 *,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="1"] .desk--p1 *,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="1"] .desk--p3 *,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="2"] .desk--p1 *,
html.is-mobile .desk-viewport:not(.is-swiping)[data-desk-page="2"] .desk--p2 * {
  animation-play-state: paused !important;
}

/* 移动端关闭 SVG 噪点纹理（feTurbulence 持续占 GPU） */
html.is-mobile :is(
  .p2f-board__grain,
  .wg-folio__grain,
  .wg-ledger__grain
) {
  display: none !important;
}

html.is-mobile .mc-room-deco {
  opacity: 0.35;
}

html.is-mobile .fr-orb {
  filter: blur(20px);
  opacity: 0.7;
}

/* ── 低端机：进一步降级 ── */

html.is-mobile.is-low-end .wg-player__orb,
html.is-mobile.is-low-end .wg-player__scan,
html.is-mobile.is-low-end .wg-player__ring,
html.is-mobile.is-low-end .wg-player__marquee span,
html.is-mobile.is-low-end .wg-polaroid__card--1,
html.is-mobile.is-low-end .ins-atelier-orb,
html.is-mobile.is-low-end .mdl__aurora,
html.is-mobile.is-low-end .mdl__scan,
html.is-mobile.is-low-end .mdl__frame::before,
html.is-mobile.is-low-end .mc-room-deco__grain {
  animation: none !important;
}

html.is-mobile.is-low-end .glass,
html.is-mobile.is-low-end .wg-player:not(.has-custom-player-bg),
html.is-mobile.is-low-end .qq-room__head,
html.is-mobile.is-low-end .qq-room__foot,
html.is-mobile.is-low-end .foot__dock.glass {
  backdrop-filter: blur(6px) saturate(1.02) !important;
  -webkit-backdrop-filter: blur(6px) saturate(1.02) !important;
}

html.is-mobile.is-low-end .fr-orb {
  filter: blur(14px);
  opacity: 0.55;
}
