/*
 * xw-mobile-motion5.css —— 第五批手机端动画增强（11 项，无彩旗横幅）
 * 门控：所有规则仅在 body.xw-motion5-on 下生效；
 *      由 xw-mobile-motion5.js 判定「手机端 + 未开启减少动态效果」后添加。
 * 原则：只动 opacity / transform / box-shadow / height，不碰布局，不动业务逻辑。
 * 独立门控，与前 4 批完全解耦。
 */
@media (max-width: 768px) {
  body.xw-motion5-on { --m5-brand: #ff7a1a; }

  /* ① 烟花绽放：活动节点全屏放射烟花（JS 生成粒子） */
  .m5-firework {
    position: fixed;
    z-index: 9994;
    pointer-events: none;
    width: 3px; height: 14px;
    margin: -7px 0 0 -1px;
    border-radius: 2px;
    transform-origin: 50% 50%;
    animation: m5Firework 1.3s ease-out forwards;
  }
  @keyframes m5Firework {
    0%   { opacity: 0; transform: rotate(var(--m5-a,0deg)) translateY(0) scale(.2); }
    22%  { opacity: 1; transform: rotate(var(--m5-a,0deg)) translateY(-30px) scale(1); }
    100% { opacity: 0; transform: rotate(var(--m5-a,0deg)) translateY(-46px) scale(.4); }
  }

  /* ② 金币掉落：奖励到账金币弹跳落下（JS 生成） */
  .m5-coin {
    position: fixed;
    top: -20px;
    z-index: 9993;
    pointer-events: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff3a0, #ffb400 60%, #e69500);
    border: 2px solid #ffd93d;
    color: #8a5a00;
    font-size: 9px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    animation: m5CoinFall var(--m5-dur, 2.2s) cubic-bezier(.3,.7,.5,1) forwards;
    animation-delay: var(--m5-delay, 0s);
  }
  @keyframes m5CoinFall {
    0%   { opacity: 0; transform: translateY(0) rotate(0); }
    10%  { opacity: 1; }
    82%  { opacity: 1; transform: translateY(78vh) rotate(460deg); }
    92%  { transform: translateY(72vh) rotate(480deg); }
    100% { opacity: 0; transform: translateY(78vh) rotate(490deg); }
  }

  /* ③ 表情弹幕：评论发送后表情从右飘过（JS 生成） */
  .m5-danmu {
    position: fixed;
    z-index: 9992;
    pointer-events: none;
    white-space: nowrap;
    font-size: 13px;
    text-shadow: 0 1px 3px rgba(0,0,0,.3);
    animation: m5Danmu var(--m5-dur, 3.4s) linear forwards;
  }
  @keyframes m5Danmu {
    0%   { left: 100%; transform: translateX(0); opacity: 1; }
    90%  { opacity: 1; }
    100% { left: -80px; transform: translateX(0); opacity: .9; }
  }

  /* ④ 语音波形：语音消息播放时跳动 */
  body.xw-motion5-on .m5-wave {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    vertical-align: middle;
  }
  body.xw-motion5-on .m5-wave i {
    width: 3px;
    background: var(--m5-brand);
    border-radius: 2px;
    animation: m5Wave .9s ease-in-out infinite;
    animation-delay: var(--m5-delay, 0s);
  }
  @keyframes m5Wave {
    0%, 100% { height: 7px; }
    50%      { height: 24px; }
  }

  /* ⑤ 错误抖动：表单校验失败左右抖 */
  body.xw-motion5-on .m5-shake {
    animation: m5Shake .5s ease-in-out both;
  }
  @keyframes m5Shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
  }

  /* ⑥ 心跳关注：关注按钮心跳 */
  body.xw-motion5-on .m5-heartbeat {
    animation: m5Heartbeat 1.9s ease-in-out infinite;
  }
  @keyframes m5Heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.22); }
    30% { transform: scale(1); }
    45% { transform: scale(1.14); }
    60% { transform: scale(1); }
  }

  /* ⑦ 图片放大预览：点击弹性放大 */
  body.xw-motion5-on .m5-zoom {
    transition: transform .34s cubic-bezier(.2,.8,.3,1), box-shadow .34s ease;
    cursor: zoom-in;
  }
  body.xw-motion5-on .m5-zoom.m5-zoomed {
    transform: scale(1.28);
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    z-index: 20;
    position: relative;
    cursor: zoom-out;
  }

  /* ⑧ 步骤条推进：多步骤依次点亮（JS 加 class + delay） */
  body.xw-motion5-on .m5-step {
    transition: background-color .4s ease, color .4s ease, transform .4s cubic-bezier(.2,.8,.3,1);
  }
  body.xw-motion5-on .m5-step.m5-step-on {
    background-color: var(--m5-brand);
    color: #fff;
    transform: scale(1.1);
  }

  /* ⑨ 星星评分：星级依次点亮（JS 加 class + delay） */
  body.xw-motion5-on .m5-star {
    transition: color .3s ease, transform .3s cubic-bezier(.2,.8,.3,1);
  }
  body.xw-motion5-on .m5-star.m5-star-on {
    color: #ffd93d;
    transform: scale(1.2);
  }

  /* ⑪ 书页翻页：文章/公告 3D 翻页 */
  body.xw-motion5-on .m5-bookflip {
    perspective: 700px;
  }
  body.xw-motion5-on .m5-bookflip .m5-book {
    position: relative;
    transform-style: preserve-3d;
    transition: transform .7s cubic-bezier(.2,.7,.3,1);
  }
  body.xw-motion5-on .m5-bookflip.m5-flipped .m5-book {
    transform: rotateY(-168deg);
  }
  body.xw-motion5-on .m5-bookflip .m5-face {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
  body.xw-motion5-on .m5-bookflip .m5-face-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
  }

  /* ⑫ 磁力按钮：主按钮悬停微浮 + 光泽扫过 */
  body.xw-motion5-on .m5-magnetic {
    position: relative;
    overflow: hidden;
    animation: m5MagnetFloat 2.8s ease-in-out infinite;
  }
  body.xw-motion5-on .m5-magnetic::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent);
    transform: skewX(-20deg);
    animation: m5MagnetShine 2.8s linear infinite;
    pointer-events: none;
  }
  @keyframes m5MagnetFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }
  @keyframes m5MagnetShine {
    0% { left: -50%; }
    60%, 100% { left: 130%; }
  }

  /* 系统开启「减少动态效果」→ 全部停掉，内容保持可见 */
  @media (prefers-reduced-motion: reduce) {
    body.xw-motion5-on *,
    .m5-firework, .m5-coin, .m5-danmu {
      animation: none !important;
      transition: none !important;
    }
    .m5-firework, .m5-coin, .m5-danmu { display: none !important; }
  }
}
