/* ==========================================================================
 * loader.css — 了了了游统一加载动画（全站共用）
 *
 * 用法：引入本文件 + loader.js，然后：
 *   <div data-loader></div>              → 自动注入统一加载动画（logo + 🎮 进度条）
 *   LeleleLoader.show(el, '加载中')      → 手动显示加载
 *   LeleleLoader.progress(45)            → 推进到 45%（只增不减）
 *   LeleleLoader.fail(el, '加载失败', fn)→ 失败态：🎮 转圈后摔下去 + 文案 + 重新加载按钮
 *   LeleleLoader.hide(el)                → 收起（恢复原内容）
 *
 * 视觉：了了了游 logo 在上，🎮 沿进度条往前跑、走过的路涂色，下方实时百分比。
 * 失败：🎮 原地转圈几下后「摔下去」（旋转+下坠+弹一下），显示失败文案与重新加载按钮。
 * 尊重 prefers-reduced-motion：关闭所有过渡/关键帧，直接终态。
 * 颜色只走 CSS 令牌（--primary / --text-main / --text-muted / --card-bg / --card-border）。
 * ========================================================================== */

/* ---------- 加载态 ---------- */
.ll-loader { text-align: center; padding: 44px 20px; color: var(--text-muted, #64748b); font-size: 1.05rem; }
.ll-loader .ll-logo { display: block; width: 84px; height: 84px; margin: 0 auto 12px; object-fit: contain; }
.ll-loader .ll-diag { max-width: 520px; margin: 0 auto 16px; font-size: .72rem; line-height: 1.6; color: var(--text-muted, #64748b); opacity: .78; word-break: break-all; }
.ll-loader .ll-diag b { color: var(--primary, #4f46e5); font-weight: 800; }
.ll-loader .ll-track { position: relative; width: min(340px, 78vw); height: 9px; border-radius: 99px; background: rgba(148,163,184,.25); margin: 0 auto 26px; }
.ll-loader .ll-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--primary, #4f46e5), #10b981); transition: width .4s cubic-bezier(.4,0,.2,1); }
.ll-loader .ll-runner { position: absolute; top: 50%; left: 0%; transform: translate(-50%, -50%); font-size: 1.55rem; line-height: 1; transition: left .4s cubic-bezier(.4,0,.2,1); filter: drop-shadow(0 2px 4px rgba(0,0,0,.22)); }
.ll-loader .ll-status { display: flex; align-items: center; justify-content: center; gap: 10px; }
.ll-loader .ll-pct { font-weight: 800; color: var(--primary, #4f46e5); font-variant-numeric: tabular-nums; }
.ll-loader.ll-compact { padding: 18px 12px; font-size: .9rem; }
.ll-loader.ll-compact .ll-logo { width: 52px; height: 52px; margin-bottom: 8px; }
.ll-loader.ll-compact .ll-track { margin-bottom: 16px; height: 7px; }
.ll-loader.ll-compact .ll-runner { font-size: 1.2rem; }

/* ---------- 失败态：🎮 转圈后摔下去 ---------- */
.ll-fail { text-align: center; padding: 40px 20px; color: var(--text-muted, #64748b); }
.ll-fail .ll-fall { display: block; width: 64px; height: 64px; margin: 0 auto 10px; font-size: 2.4rem; line-height: 64px; transform-origin: 50% 50%; animation: ll-spin-then-fall 1.15s cubic-bezier(.4,0,.2,1) forwards; }
.ll-fail .ll-fail-msg { color: var(--text-main, #1f2937); font-weight: 700; margin-bottom: 16px; }
.ll-fail .ll-retry { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 20px; border: none; border-radius: 999px; background: var(--primary, #4f46e5); color: #fff; font-size: .92rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.ll-fail .ll-retry:hover { filter: brightness(1.08); }
.ll-fail .ll-retry:focus-visible { outline: 2px solid var(--primary, #4f46e5); outline-offset: 2px; }

@keyframes ll-spin-then-fall {
  0%   { transform: rotate(0deg) translateY(0); opacity: 1; }
  45%  { transform: rotate(540deg) translateY(-6px); opacity: 1; }
  62%  { transform: rotate(650deg) translateY(0); opacity: 1; }
  100% { transform: rotate(720deg) translateY(34px); opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  .ll-loader .ll-fill, .ll-loader .ll-runner { transition: none; }
  .ll-fail .ll-fall { animation: none; transform: rotate(20deg) translateY(18px); opacity: .6; }
}

/* ---------- game.html 详情页专用加载类名（.load-*，统一收敛到本文件） ---------- */
.load-logo { display: block; width: 92px; height: 92px; margin: 0 auto 12px; object-fit: contain; }
.load-diag { max-width: 520px; margin: 0 auto 20px; font-size: .72rem; line-height: 1.6; color: var(--text-muted, #64748b); opacity: .8; word-break: break-all; }
.load-diag b { color: var(--primary, #4f46e5); font-weight: 800; }
.load-track { position: relative; width: min(360px, 78vw); height: 9px; border-radius: 99px; background: rgba(148,163,184,.25); margin: 0 auto 30px; }
.load-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--primary, #4f46e5), #10b981); transition: width .45s cubic-bezier(.4,0,.2,1); }
.load-runner { position: absolute; top: 50%; left: 0%; transform: translate(-50%, -50%); font-size: 1.6rem; line-height: 1; transition: left .45s cubic-bezier(.4,0,.2,1); filter: drop-shadow(0 2px 4px rgba(0,0,0,.22)); }
.load-status { display: flex; align-items: center; justify-content: center; gap: 12px; }
.load-pct { font-weight: 800; color: var(--primary, #4f46e5); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .load-fill, .load-runner { transition: none; } }
