/* 动效层：一个被授权的焦点动作 + 状态反馈，不做页面加载编排。 */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in-soft { from { opacity: 0.75; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes mask-reveal { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

/* 内容默认可见；Operate 模式不做页面入场编排，动画失败也不会出现空白首屏 */
.motion-enter { animation: none; }
.motion-rise { animation: fade-in-soft 260ms var(--ease-out) both; }
.toast { animation: toast-in 240ms var(--ease-out) both; }
.toast.is-leaving { animation: toast-out 160ms var(--ease-in-out) both; }
.dialog { animation: dialog-in 300ms var(--ease-out) both; }
.dialog-backdrop { animation: fade-in 200ms var(--ease-out) both; }

/* 题型落位：由 JS FLIP 计算位移，这里只负责落定后的注意力提示 */
.qcard--landing { animation: rise-in 320ms var(--ease-out) both; }
.qcard--landing::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  border: 1px solid var(--accent); pointer-events: none;
  animation: land-ring 520ms var(--ease-out) both;
}
@keyframes land-ring {
  0% { opacity: 0.85; transform: scale(0.99); }
  100% { opacity: 0; transform: scale(1.015); }
}

/* 发布后的分享面板：遮罩揭示，解释状态跃迁 */
.reveal { animation: mask-reveal 460ms var(--ease-out) both; }
.share-hero__mark { animation: pop-in 420ms var(--ease-out) 120ms both; }

/* 统计条形默认就有宽度与颜色；入场只做柔和淡入，动画失败也不会隐藏数据 */
.bar-fill { animation: fade-in-soft 220ms var(--ease-out) both; }
.trend__bar { animation: fade-in-soft 220ms var(--ease-out) both; }

/* 填写题目切换：空间连续性由 JS 设置方向 */
.fill-question.is-entering { animation: q-in 300ms var(--ease-out) both; }
.fill-question.is-entering-back { animation: q-in-back 300ms var(--ease-out) both; }
@keyframes q-in { from { opacity: 0.75; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes q-in-back { from { opacity: 0.75; transform: translateX(-18px); } to { opacity: 1; transform: translateX(0); } }

/* 按钮反馈：只让图标承担运动，元素自身不动 */
.btn--primary:hover:not(:disabled) .icon--arrow { transform: translateX(2px); }
.btn .icon--arrow { transition: transform var(--t-state) var(--ease-out); }
.icon-btn:hover .icon { transform: scale(1.06); }
.icon-btn .icon { transition: transform var(--t-fast) var(--ease-out); }

/* 拖拽中的落点提示 */
.qcard.is-drop-target { box-shadow: 0 -2px 0 0 var(--accent), var(--shadow-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* 保留有意义的状态反馈：颜色与边框仍然变化 */
  .qcard.is-selected, .fill-option.is-checked, .flow-step.is-active { transition: none; }
  .bar-fill, .trend__bar { transform: none !important; }
  .reveal { clip-path: none !important; }
}
