/* ============================================================
   MOTION LAYER —— 全局交互动效
   原则：只动 opacity / transform / filter，不改布局
         所有入场动画都用 backwards 填充 + 基础态可见
         → 动画不跑也不会出现「元素消失」
   兼容 prefers-reduced-motion
   ============================================================ */

:root{
  --ease-out:cubic-bezier(.22,.8,.3,1);
  --ease-spring:cubic-bezier(.32,1.24,.36,1);
  --ease-in-out:cubic-bezier(.4,0,.2,1);
  --dur-fast:.16s;
  --dur:.3s;
  --dur-slow:.5s;
}

/* ---------- 1. 页面转场 ---------- */
.view{will-change:transform,opacity}
@keyframes fxPageFwd{
  from{opacity:0;transform:translate3d(26px,0,0) scale(.994)}
  to{opacity:1;transform:none}
}
@keyframes fxPageBack{
  from{opacity:0;transform:translate3d(-26px,0,0) scale(.994)}
  to{opacity:1;transform:none}
}

/* 转场时的一层薄幕，让切换不“闪” */
.fx-veil{
  position:fixed;inset:0;z-index:70;pointer-events:none;
  background:radial-gradient(60% 60% at 50% 40%,rgba(120,170,255,.10),transparent 70%),
             linear-gradient(180deg,rgba(4,7,12,.42),rgba(4,7,12,.18));
  opacity:0;
}
.fx-veil.run{animation:fxVeil .42s var(--ease-out) both}
@keyframes fxVeil{
  0%{opacity:0}
  22%{opacity:1}
  100%{opacity:0}
}

/* 标题切换 */
#pageTitle.fx-txt-out{animation:fxTxtOut .16s ease-in both}
#pageTitle.fx-txt-in{animation:fxTxtIn .34s var(--ease-out) both}
@keyframes fxTxtOut{to{opacity:0;transform:translateY(-6px)}}
@keyframes fxTxtIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* 导航项点击/选中的弹一下 */
.nav-item.fx-pop .ico{animation:fxPop .34s var(--ease-spring) both}
@keyframes fxPop{
  0%{transform:scale(1)}
  45%{transform:scale(1.22)}
  100%{transform:scale(1)}
}

/* ---------- 2. 点击反馈：涟漪 + 提亮 ---------- */
.fx-ripple{
  position:fixed;z-index:9999;pointer-events:none;
  width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;
  border:2px solid rgba(255,255,255,.85);
  box-shadow:0 0 18px rgba(160,200,255,.9), inset 0 0 12px rgba(255,255,255,.6);
  animation:fxRipple .5s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes fxRipple{
  0%{opacity:.95;transform:scale(.4)}
  100%{opacity:0;transform:scale(4.6)}
}
.fx-ripple.gold{border-color:rgba(255,214,130,.9);box-shadow:0 0 22px rgba(240,180,41,.95)}

/* 按下提亮（不用 transform，避免和 hover 冲突） */
.fx-down{filter:brightness(1.24) saturate(1.06)}
.fx-up{animation:fxRelease .26s var(--ease-out)}
@keyframes fxRelease{
  0%{filter:brightness(1.18)}
  100%{filter:brightness(1)}
}

/* ---------- 3. 列表错峰入场 ---------- */
@keyframes fxIn{
  from{opacity:0;transform:translate3d(0,16px,0) scale(.985)}
  to{opacity:1;transform:none}
}
@keyframes fxInSoft{
  from{opacity:0;transform:translate3d(0,10px,0)}
  to{opacity:1;transform:none}
}

/* ---------- 4. 标签页切换 ---------- */
@keyframes fxTabBody{
  from{opacity:0;transform:translate3d(0,10px,0) scale(.995)}
  to{opacity:1;transform:none}
}
/* 标签自身：选中的滑一下 */
.shop-tab,.tab{transition:background var(--dur-fast) ease,color var(--dur-fast) ease,transform var(--dur-fast) var(--ease-spring),box-shadow var(--dur-fast) ease}
@keyframes fxTabOn{
  0%{transform:translateY(0) scale(1)}
  45%{transform:translateY(-2px) scale(1.05)}
  100%{transform:none}
}

/* ---------- 5. 活动中心：主题 / 子活动切换 ---------- */
.evx[data-fx="theme"] .evx-ghost{animation:fxGhostIn .7s var(--ease-out) backwards}
.evx[data-fx="theme"] .evx-titlebox{animation:fxTitleIn .55s var(--ease-out) .06s backwards}
.evx[data-fx="theme"] .evx-hero{animation:fxHeroIn .7s var(--ease-spring) .1s backwards}
.evx[data-fx="theme"] .evx-side{animation:fxSlideL .45s var(--ease-out) backwards}
.evx[data-fx="theme"] .evx-rail{animation:fxSlideL .45s var(--ease-out) .04s backwards}
.evx[data-fx="theme"] .evx-panel{animation:fxPanelUp .5s var(--ease-out) .12s backwards}
.evx[data-fx="theme"] .evx-cta{animation:fxCtaIn .5s var(--ease-spring) .18s backwards}
.evx[data-fx="theme"] .evx-bottom{animation:fxInSoft .5s var(--ease-out) .16s backwards}

@keyframes fxGhostIn{
  from{opacity:0;transform:scale(1.14);filter:blur(16px)}
  to{opacity:.85;transform:scale(1);filter:blur(0)}
}
@keyframes fxTitleIn{
  from{opacity:0;transform:translate3d(0,18px,0);filter:blur(8px)}
  to{opacity:1;transform:none;filter:blur(0)}
}
@keyframes fxHeroIn{
  from{opacity:0;transform:translate3d(0,26px,0) rotate(-4deg) scale(.9)}
  to{opacity:1;transform:none}
}
@keyframes fxSlideL{
  from{opacity:0;transform:translate3d(-16px,0,0)}
  to{opacity:1;transform:none}
}
@keyframes fxPanelUp{
  from{opacity:0;transform:translate3d(0,26px,0)}
  to{opacity:1;transform:none}
}
@keyframes fxCtaIn{
  from{opacity:0;transform:translateY(18px) scale(.96)}
  to{opacity:1;transform:none}
}

/* 子活动切换：只动面板和标题 */
.evx[data-fx="sub"] .evx-panel-in{animation:fxSubIn .42s var(--ease-out) backwards}
.evx[data-fx="sub"] .evx-titlebox h1{animation:fxSubTitle .42s var(--ease-out) backwards}
.evx[data-fx="sub"] .evx-hero{animation:fxPop2 .5s var(--ease-spring) backwards}
@keyframes fxSubIn{
  from{opacity:0;transform:translate3d(0,20px,0)}
  to{opacity:1;transform:none}
}
@keyframes fxSubTitle{
  from{opacity:0;transform:translate3d(0,10px,0);filter:blur(6px)}
  to{opacity:1;transform:none;filter:blur(0)}
}
@keyframes fxPop2{
  from{transform:scale(.98)}
  60%{transform:scale(1.006)}
  to{transform:none}
}

/* 活动左侧栏选中指示条 */
.evx-subitem{transition:color var(--dur-fast) ease,background var(--dur-fast) ease,padding-left var(--dur) var(--ease-out)}
.evx-subitem.on{padding-left:18px !important}
.evx-major{transition:background var(--dur) ease,color var(--dur) ease,transform var(--dur) var(--ease-spring)}
.evx-major:active{transform:scale(.96)}

/* ---------- 6. 抽卡：开包阶段 ---------- */
@keyframes fxStageIn{
  from{opacity:0;transform:scale(1.04)}
  to{opacity:1;transform:none}
}
.open-pack{transition:transform .2s var(--ease-spring),filter .2s ease}
.open-pack:hover{transform:scale(1.03)}
.open-pack.op-charge{animation:fxCharge .62s var(--ease-in-out) both}
@keyframes fxCharge{
  0%{transform:scale(1)}
  28%{transform:scale(.94) rotate(-1.5deg)}
  52%{transform:scale(1.06) rotate(1.5deg)}
  76%{transform:scale(.97)}
  100%{transform:scale(1.1)}
}
.gacha-stage.opening{animation:fxStageOut .62s cubic-bezier(.4,0,.7,1) both}
@keyframes fxStageOut{
  0%{opacity:1;transform:scale(1);filter:blur(0)}
  100%{opacity:0;transform:scale(1.16);filter:blur(16px)}
}
/* 白闪 */
.fx-flash{
  position:fixed;inset:0;z-index:61;pointer-events:none;background:#fff;
  opacity:0;
}
.fx-flash.run{animation:fxFlash .5s ease-out both}
@keyframes fxFlash{
  0%{opacity:0}
  12%{opacity:.92}
  100%{opacity:0}
}

/* ---------- 7. 抽卡：翻牌 ---------- */
@keyframes fxRvIn{
  from{opacity:0}
  to{opacity:1}
}
@keyframes fxRvHead{
  from{opacity:0;transform:translateY(16px);filter:blur(6px)}
  to{opacity:1;transform:none;filter:blur(0)}
}

/* 发牌：dealt 类由 JS 立刻加，backwards 保证延迟期不闪 */
.rv-slot.dealt{animation:fxDeal .62s var(--ease-out) backwards;animation-delay:calc(var(--i,0) * 72ms)}
@keyframes fxDeal{
  from{transform:translate3d(0,26px,0) scale(.955)}
  60%{transform:translate3d(0,-3px,0) scale(1.005)}
  to{transform:none}
}

/* 翻面：更柔的缓动 + 轻微回弹 */
.rv-inner{transition:transform .7s cubic-bezier(.3,1.06,.32,1)}
.rv-stage.is-single .rv-inner{transition:transform .92s cubic-bezier(.28,1.05,.3,1)}

/* 卡背淡出，避免“啪”地切开 */
.rv-back{transition:opacity .34s ease .1s}
.rv-slot.flipped .rv-back{opacity:0}

/* 翻面时的柔光扫过 */
.rv-front::after{
  content:"";position:absolute;inset:0;border-radius:12px;pointer-events:none;
  background:linear-gradient(115deg,transparent 32%,rgba(255,255,255,.55) 46%,transparent 60%);
  opacity:0;
}
.rv-slot.flipped .rv-front::after{animation:fxSheen .82s var(--ease-out) both}
@keyframes fxSheen{
  0%{opacity:0;transform:translateX(-30%)}
  30%{opacity:.75}
  100%{opacity:0;transform:translateX(30%)}
}

/* 结果按钮 */
.rv-actions{transition:opacity .42s var(--ease-out),transform .42s var(--ease-out)}

/* 抽卡根节点的淡出 */
.gacha-root.fx-closing{animation:fxRootOut .26s ease-in both}
.reward-root.fx-closing{animation:fxRootOut .24s ease-in both}
@keyframes fxRootOut{
  to{opacity:0;transform:scale(1.02)}
}

/* ---------- 8. 弹层 ---------- */
.modal-root.fx-closing .modal{animation:fxModalOut .2s ease-in both}
.modal-root.fx-closing .modal-mask{animation:fxMaskOut .2s ease-in both}
@keyframes fxModalIn{
  from{opacity:0;transform:translateY(22px) scale(.955)}
  to{opacity:1;transform:none}
}
@keyframes fxModalOut{
  to{opacity:0;transform:translateY(10px) scale(.985)}
}
@keyframes fxMaskIn{from{opacity:0}to{opacity:1}}
@keyframes fxMaskOut{to{opacity:0}}

/* 弹层里的内容再错峰一点 */

/* ---------- 9. 奖励弹层 ---------- */
@keyframes fxRewardPanel{
  from{opacity:0;transform:translateY(28px) scale(.94)}
  to{opacity:1;transform:none}
}
@keyframes fxRewardItem{
  from{opacity:0;transform:translateY(18px) scale(.8) rotate(-6deg)}
  to{opacity:1;transform:none}
}
@keyframes fxRewardCard{
  from{opacity:0;transform:translateY(30px) rotate(-8deg) scale(.85)}
  to{opacity:1;transform:none}
}

/* ---------- 10. Toast ---------- */
.toast{
  transition:opacity .22s ease,transform .34s var(--ease-spring);
  transform:translate(-50%,16px) scale(.96);opacity:0;
}
.toast.on{transform:translate(-50%,0) scale(1);opacity:1}

/* ---------- 11. 货币跳动 ---------- */
.cur-body b{display:inline-block;transition:color .3s ease}
.cur.fx-bump .cur-body b{animation:fxBump .44s var(--ease-spring) both}
.cur.fx-bump .cur-mark{animation:fxMarkSpin .5s var(--ease-spring) both}
@keyframes fxBump{
  0%{transform:scale(1)}
  40%{transform:scale(1.18);color:#ffe9a8}
  100%{transform:scale(1)}
}
@keyframes fxMarkSpin{
  0%{transform:rotate(0) scale(1)}
  50%{transform:rotate(-12deg) scale(1.14)}
  100%{transform:rotate(0) scale(1)}
}

/* ---------- 12. 通用：卡片悬浮/按下 ---------- */
.player-wrap,.tr-card,.shop-card,.product-card,.ms-card,.shortcut,.event-card{
  transition:transform .22s var(--ease-spring),box-shadow .22s ease,filter .16s ease;
}
.player-wrap:active,.tr-card:active,.shop-card:active,.ms-card:active{
  transform:scale(.985);
}

/* ---------- 13. 滚动条淡入 ---------- */
.view::-webkit-scrollbar-thumb{transition:background .2s}

/* ---------- 14. 减少动效 ---------- */
@media (prefers-reduced-motion: reduce){
  /* 减弱而不是禁用：保留淡入/位移，去掉高频与大位移特效 */
  .fx-ripple,.fx-flash,.fx-veil{display:none !important}
  .rv-slot.dealt{animation-duration:.3s !important}
  .fx-anim-page-fwd,.fx-anim-page-back{animation-name:fxPageFade !important}
  .sport-card .sc-shine,.sc-rays{animation:none !important}
  @keyframes fxPageFade{from{opacity:0}to{opacity:1}}
}


/* ============================================================
   JS 驱动的一次性动画类
   —— 加类播放，到点由 JS 删除；即使动画被环境冻结也会恢复可见
   ============================================================ */
.fx-anim-page-fwd{animation:fxPageFwd .4s var(--ease-out)}
.fx-anim-page-back{animation:fxPageBack .4s var(--ease-out)}
.fx-anim-tab{animation:fxTabBody .38s var(--ease-out)}
.fx-anim-tab-on{animation:fxTabOn .34s var(--ease-spring)}
.fx-anim-in{animation:fxIn .46s var(--ease-out);animation-delay:calc(var(--i,0) * 24ms)}
.fx-anim-in-soft{animation:fxInSoft .5s var(--ease-out);animation-delay:calc(var(--i,0) * 18ms)}
.fx-anim-modal{animation:fxModalIn .34s var(--ease-spring)}
.fx-anim-mask{animation:fxMaskIn .26s ease}
.fx-anim-panel{animation:fxRewardPanel .6s var(--ease-spring)}
.fx-anim-item{animation:fxRewardItem .5s var(--ease-spring);animation-delay:calc(var(--i,0) * 70ms)}
.fx-anim-rcard{animation:fxRewardCard .7s var(--ease-spring)}
.fx-anim-stage{animation:fxStageIn .45s var(--ease-out)}
.fx-anim-head{animation:fxRvHead .55s var(--ease-out)}

@keyframes fxPageFade{from{opacity:0}to{opacity:1}}
