/* =============================================================
 * xw-mobile-motion2.css —— 手机端动画增强·第二批（仅 ≤768px）
 * 新增：数字滚动 / 进度条填充 / 点赞飘心 / 评论飞入 / 图片淡入 /
 *       下拉刷新 / 骨架屏微光（礼包撒花在游戏中心独立页内联）
 * 设计原则同第一批：全部只在 body.xw-motion-on 下生效；
 * JS 不加 class = 无动画 = 内容照常显示；尊重 prefers-reduced-motion。
 * 更新标识：v=20261130b
 * ============================================================= */

@media (max-width: 768px) {

  /* ---------- 1. 进度条填充：目标宽度由 JS 读取 inline width 后归零再动画 ---------- */
  body.xw-motion-on .xwm-prog-fill {
    transition: width 1s cubic-bezier(.22,.61,.36,1) !important;
  }

  /* ---------- 2. 图片淡入：只对待加载图加 pending，加载完成加 in ---------- */
  body.xw-motion-on img.xwm-img-pending {
    opacity: 0;
    transform: scale(1.06);
    filter: blur(6px);
  }
  body.xw-motion-on img.xwm-img-pending.xwm-img-in {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
    transition: opacity .55s ease, transform .55s ease, filter .55s ease;
  }

  /* ---------- 3. 点赞飘心（JS 动态创建，仅手机+未减动时生成） ---------- */
  .xwm-fheart {
    position: fixed; z-index: 9999; pointer-events: none;
    font-size: 18px; line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255,80,120,.6));
    animation: xwmFloatUp 1s ease-out forwards;
  }
  @keyframes xwmFloatUp {
    0%   { opacity: 0; transform: translateY(0) scale(.5); }
    20%  { opacity: 1; transform: translateY(-4px) scale(1.15); }
    100% { opacity: 0; transform: translateY(-62px) translateX(var(--dx,0px)) scale(1.3); }
  }

  /* ---------- 4. 评论/发送飞入气泡（JS 动态创建） ---------- */
  .xwm-flybub {
    position: fixed; z-index: 9999; pointer-events: none;
    background: linear-gradient(135deg,#4da3ff,#6b8bff);
    color: #fff; font-size: 12px; padding: 7px 12px;
    border-radius: 13px 13px 13px 3px;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
    max-width: 62vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    animation: xwmFlyBub .72s cubic-bezier(.34,1.56,.64,1) forwards;
  }
  @keyframes xwmFlyBub {
    0%   { opacity: 0; transform: translateY(20px) scale(.72); }
    60%  { opacity: 1; transform: translateY(-6px) scale(1); }
    100% { opacity: 0; transform: translateY(-24px) scale(.94); }
  }

  /* ---------- 5. 下拉刷新指示器（JS 动态创建 + 手势控制位移） ---------- */
  .xwm-ptr {
    position: fixed; z-index: 9998; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 22px;
    background: rgba(28,30,36,.92); color: #fff; font-size: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,.32);
    pointer-events: none; opacity: 0; transition: opacity .16s ease;
  }
  .xwm-ptr.show { opacity: 1; }
  .xwm-ptr i {
    width: 15px; height: 15px; display: inline-block;
    border: 2px solid rgba(255,255,255,.25); border-top-color: #4da3ff;
    border-radius: 50%;
  }
  .xwm-ptr.spin i { animation: xwmSpinPtr .7s linear infinite; }
  @keyframes xwmSpinPtr { to { transform: rotate(360deg); } }

  /* ---------- 6. 骨架屏微光：加载占位元素 shimmer ---------- */
  body.xw-motion-on .white-loading,
  body.xw-motion-on .xw-loading,
  body.xw-motion-on .xwap-loading,
  body.xw-motion-on .gd-loading,
  body.xw-motion-on .chat-loading-spinner {
    background: linear-gradient(100deg, #f2f3f5 20%, #e6e8ec 42%, #f2f3f5 64%);
    background-size: 220% 100%;
    animation: xwmShimmer 1.4s linear infinite;
  }
  @keyframes xwmShimmer { to { background-position: -220% 0; } }

  /* ---------- 兜底：减少动态时全部关闭 ---------- */
  @media (prefers-reduced-motion: reduce) {
    body.xw-motion-on .xwm-prog-fill { transition: none !important; }
    body.xw-motion-on img.xwm-img-pending { opacity: 1 !important; transform: none !important; filter: none !important; }
    .xwm-fheart, .xwm-flybub, .xwm-ptr,
    body.xw-motion-on .white-loading,
    body.xw-motion-on .xw-loading,
    body.xw-motion-on .xwap-loading,
    body.xw-motion-on .gd-loading,
    body.xw-motion-on .chat-loading-spinner { animation: none !important; }
  }
}
