/* ============================================================
   loading.css —— 等待有反馈
   在 style.css / theme.css / polish.css 之后加载。
   只用主题变量取色，6 套主题均可用；尊重「减少动态效果」偏好。
   ============================================================ */

/* ---------- 1. 启动画面：三张牌发牌 ---------- */
.boot{
  position:fixed;inset:0;z-index:9999;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;
  /* 固定深色底：6 套主题下白色文字都清晰，启动瞬间不会因浅色主题发虚 */
  background:linear-gradient(160deg,#8d151a,#4d0a0e);
  color:#fff;
  transition:opacity .42s ease,visibility .42s ease;
}
.boot::after{
  content:"";position:absolute;inset:0;
  background:rgba(24,8,6,.26);pointer-events:none;
}
.boot>*{position:relative;z-index:1}
.boot.is-done{opacity:0;visibility:hidden;pointer-events:none}

.boot__cards{position:relative;width:150px;height:96px}
.boot__cards i{
  position:absolute;left:50%;top:8px;
  width:54px;height:78px;margin-left:-27px;
  border-radius:9px;
  background:linear-gradient(155deg,#fffdf6,#f0e2c4);
  border:2px solid rgba(255,214,130,.92);
  box-shadow:0 9px 22px rgba(0,0,0,.3);
  font-style:normal;
  transform:translate(var(--dx),0) rotate(var(--r));
  /* both：延迟期间也应用首帧，三张牌从一开始就分开，不会叠在一起 */
  animation:bootFlip 1.4s ease-in-out infinite both;
}
.boot__cards i::before{
  position:absolute;left:8px;top:5px;
  font-size:21px;line-height:1;font-weight:700;
  color:#c62828;
}
.boot__cards i:nth-child(1){--dx:-36px;--r:-17deg;animation-delay:0s}
.boot__cards i:nth-child(2){--dx:0px;--r:0deg;animation-delay:.12s;z-index:2}
.boot__cards i:nth-child(3){--dx:36px;--r:17deg;animation-delay:.24s}
.boot__cards i:nth-child(1)::before{content:"\2660"}
.boot__cards i:nth-child(2)::before{content:"\2665"}
.boot__cards i:nth-child(3)::before{content:"\2663"}
@keyframes bootFlip{
  0%,100%{transform:translate(var(--dx),0) rotate(var(--r)) scale(1);opacity:.88}
  50%{transform:translate(var(--dx),-13px) rotate(var(--r)) scale(1.05);opacity:1}
}

.boot__title{font-size:19px;font-weight:700;letter-spacing:3px;text-shadow:0 2px 10px rgba(0,0,0,.3)}
.boot__bar{width:148px;height:4px;border-radius:4px;background:rgba(255,255,255,.24);overflow:hidden}
.boot__bar span{
  display:block;height:100%;width:46%;border-radius:4px;
  background:linear-gradient(90deg,#ffd98a,#fff6df);
  animation:bootBar 1.15s ease-in-out infinite;
}
/* 来回滑动，任意时刻都有一段金色可见，不会整条变灰 */
@keyframes bootBar{
  0%,100%{transform:translateX(-25%)}
  50%{transform:translateX(120%)}
}
.boot__hint{font-size:12px;letter-spacing:1px;opacity:.8}

/* ---------- 2. 请求期间：顶部进度条 + 底部提示胶囊 ---------- */
.busy-bar{
  position:fixed;top:0;left:0;right:0;height:3px;z-index:9998;
  pointer-events:none;opacity:0;transition:opacity .2s ease;overflow:hidden;
}
.busy-bar.is-on{opacity:1}
.busy-bar i{
  display:block;height:100%;width:34%;border-radius:3px;
  background:linear-gradient(90deg,var(--gold-3,#ffd98a),var(--cta-hi,#ff8a4d));
  animation:busySlide 1s linear infinite;
}
@keyframes busySlide{from{transform:translateX(-100%)}to{transform:translateX(390%)}}

.busy-pill{
  /* 贴在顶部进度条下方：这一带是空白，不压顶栏按钮、卡片或公告 */
  position:fixed;left:50%;top:9px;
  z-index:9998;pointer-events:none;
  display:flex;align-items:center;gap:7px;
  padding:6px 12px;border-radius:999px;
  background:var(--panel,rgba(255,252,243,.96));color:var(--text,#43301a);
  border:1px solid var(--line,rgba(150,108,44,.22));
  box-shadow:0 4px 14px rgba(0,0,0,.16);
  font-size:12px;font-weight:600;white-space:nowrap;
  opacity:0;transform:translate(-50%,-8px);
  transition:opacity .22s ease,transform .22s ease;
}
.busy-pill.is-on{opacity:1;transform:translate(-50%,0)}
.busy-pill__dot{
  width:15px;height:15px;border-radius:50%;flex:none;
  border:2px solid var(--line-2,rgba(212,152,62,.55));
  border-top-color:var(--cta,#e8482f);
  animation:busySpin .72s linear infinite;
}
@keyframes busySpin{to{transform:rotate(360deg)}}

/* ---------- 3. 按钮加载态：文字淡出，中间转圈 ---------- */
button.is-busy,#btn-auth:disabled{position:relative;color:transparent!important;text-shadow:none!important}
button.is-busy>*,#btn-auth:disabled>*{opacity:0}
button.is-busy::after,#btn-auth:disabled::after{
  content:"";position:absolute;left:50%;top:50%;
  width:16px;height:16px;margin:-9px 0 0 -9px;
  border:2px solid rgba(255,255,255,.45);border-top-color:#fff;border-radius:50%;
  animation:busySpin .72s linear infinite;
}

/* ---------- 4. 列表骨架 ---------- */
.skel-list{display:flex;flex-direction:column;gap:9px;padding:16px 12px;width:100%}
.skel-list i{
  display:block;height:38px;border-radius:9px;
  background:linear-gradient(90deg,rgba(140,120,95,.11) 25%,rgba(140,120,95,.23) 37%,rgba(140,120,95,.11) 63%);
  background-size:400% 100%;
  animation:skelShine 1.25s ease-in-out infinite;
}
.skel-list i:nth-child(2){width:90%}
.skel-list i:nth-child(3){width:78%}
.skel-list i:nth-child(4){width:85%}
@keyframes skelShine{from{background-position:100% 0}to{background-position:-100% 0}}

/* ---------- 5. 房间同步等待 ---------- */
.co-wait{display:flex;align-items:center;justify-content:center;gap:9px}
.co-wait::before{
  content:"";width:15px;height:15px;border-radius:50%;flex:none;
  border:2px solid var(--line-2,rgba(212,152,62,.55));
  border-top-color:var(--cta,#e8482f);
  animation:busySpin .72s linear infinite;
}

/* ---------- 6. 无障碍：减少动态效果 ---------- */
@media (prefers-reduced-motion:reduce){
  .boot__cards i,.boot__bar span,.busy-bar i,.busy-pill__dot,
  button.is-busy::after,#btn-auth:disabled::after,.skel-list i,.co-wait::before{animation:none}
  .skel-list i{opacity:.5}
  .boot,.busy-pill,.busy-bar{transition:none}
}
