/* KH88 v0.8.2.3 — 低内存手机渐进加载；不为每张卡片强制创建 GPU 图层。 */
.tw-gallery-page,
.tw-gallery-page .tw-inner-shell,
.tw-gallery-page .tw-inner-main,
.tw-gallery-page .tw-gallery-grid{overflow-anchor:none}

.tw-gallery-page .image-open:focus{outline:none}
.tw-gallery-page .image-modal{
  position:fixed!important;
  inset:0!important;
  z-index:1000!important;
  display:flex!important;
  visibility:visible;
  opacity:1;
  pointer-events:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  transform:translateZ(0);
  -webkit-transform:translateZ(0);
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  transition:opacity .12s linear,visibility 0s linear;
}
.tw-gallery-page .image-modal.hidden{
  display:flex!important;
  visibility:hidden!important;
  opacity:0!important;
  pointer-events:none!important;
  transition:opacity .12s linear,visibility 0s linear .12s;
}
.tw-gallery-page .image-modal-scroll{
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.tw-gallery-page .image-modal-stage{touch-action:none}


/* 渐进加载：先保留数据库记录的真实比例，再按视口分批加载，避免低内存手机一次解码40张图。 */
.tw-gallery-page .template-image-stage[data-template-stage]{
  min-height:1px;
  contain:layout paint;
}
.tw-gallery-page .template-image-stage>img[data-progressive-image]{
  width:100%!important;
  height:100%!important;
  object-fit:contain;
  opacity:0;
  visibility:hidden;
  transition:none;
}
.tw-gallery-page .template-image-stage.template-composite-ready>img[data-progressive-image]{opacity:1;visibility:visible}
.tw-gallery-page .template-image-stage.template-image-pending,
.tw-gallery-page .template-image-stage.template-image-loading{
  background:linear-gradient(100deg,#f3f5f7 20%,#fff 38%,#f3f5f7 56%);
  background-size:220% 100%;
  animation:kh88-image-placeholder 1.25s linear infinite;
}
.tw-gallery-page .template-image-stage.template-composite-ready{animation:none;background:#fff}
@keyframes kh88-image-placeholder{to{background-position:-220% 0}}
@media (prefers-reduced-motion:reduce){
  .tw-gallery-page .template-image-stage.template-image-pending,
  .tw-gallery-page .template-image-stage.template-image-loading{animation:none}
}
