/* ==========================================================================
   开屏动画（四端统一 · 毛玻璃遮盖式）
   · 进入系统即全屏覆盖，后方系统照常加载
   · 结尾快速淡化（0.26s）后移除，即展示系统界面
   · 头部/名称随端不同：平台端、机构端取「窄屏顶部栏」；教练端、学员端取机构信息
   · 跳过：链接后加 &nosplash=1
   性能约定：只动画 transform / opacity；backdrop-filter 保持静态（动画它会连续重算
   全屏模糊，正是抽动感的来源）；卡片在拿到名称后才显形，避免先占位再换字。
   ========================================================================== */

#kxSplash{
  position:fixed; inset:0; z-index:99990;
  display:flex; align-items:center; justify-content:center;
  background:rgba(247,250,255,.72);
  -webkit-backdrop-filter:blur(18px) saturate(150%);
  backdrop-filter:blur(18px) saturate(150%);
  overflow:hidden;
  touch-action:none; overscroll-behavior:contain;
  contain:paint;
  -webkit-tap-highlight-color:transparent;
  transform:translateZ(0);
  will-change:opacity;
  transition:opacity .26s cubic-bezier(.4,0,1,1);
}
#kxSplash.kx-out{ opacity:0; pointer-events:none; }
#kxSplash.kx-gone{ display:none !important; }

/* JS 没跑起来时的保险：3.4s 后自动消失，不至于把系统挡死 */
#kxSplash{ animation:kxFallback 0s linear 3.4s forwards; }
@keyframes kxFallback{ to{ opacity:0; visibility:hidden; } }

/* 开屏期间暂停后方骨架屏的流光：模糊层下面每帧重绘是另一大卡顿来源 */
html.kx-splashing .sk-line,
html.kx-splashing .sp{ animation-play-state:paused !important; }

/* ------------------------------- 玻璃卡片 ------------------------------- */
.kx-card{
  position:relative; width:min(70vw,252px); padding:24px 20px 20px;
  border-radius:26px; overflow:hidden;
  display:flex; flex-direction:column; align-items:center;
  background:linear-gradient(158deg,rgba(255,255,255,.92),rgba(255,255,255,.64));
  border:1px solid rgba(255,255,255,.94);
  box-shadow:0 24px 54px -26px rgba(23,43,77,.40),
             0 2px 10px rgba(23,43,77,.06),
             inset 0 1px 0 rgba(255,255,255,.95);
  opacity:0; transform:translateZ(0);
}
#kxSplash.kx-ready .kx-card{
  animation:kxCardIn .46s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes kxCardIn{
  from{ opacity:0; transform:translate3d(0,10px,0) scale(.965); }
  to  { opacity:1; transform:translate3d(0,0,0) scale(1); }
}

/* 卡面掠过的高光：位移用 transform，不触发布局 */
.kx-card::after{
  content:""; position:absolute; top:-40%; left:-46%; width:46%; height:180%;
  background:linear-gradient(100deg,transparent,rgba(255,255,255,.72),transparent);
  transform:translate3d(0,0,0) skewX(-16deg);
  pointer-events:none; opacity:0;
}
#kxSplash.kx-ready .kx-card::after{
  animation:kxSheen .9s .18s ease-out both;
}
@keyframes kxSheen{
  0%  { opacity:0; transform:translate3d(0,0,0) skewX(-16deg); }
  20% { opacity:1; }
  100%{ opacity:0; transform:translate3d(330%,0,0) skewX(-16deg); }
}

.kx-logo{
  width:70px; height:70px; border-radius:21px; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  font:700 28px/1 -apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  color:#fff; letter-spacing:-1px;
  background:linear-gradient(150deg,#4f8bff,#2f6bf6 55%,#1f8ceb);
  box-shadow:0 12px 24px -13px rgba(47,107,246,.76), inset 0 1px 0 rgba(255,255,255,.45);
  opacity:0; transform:translateZ(0);
}
#kxSplash.kx-ready .kx-logo{
  animation:kxLogoIn .56s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes kxLogoIn{
  from{ opacity:0; transform:scale(.86); }
  to  { opacity:1; transform:scale(1); }
}
/* 头像完整显示（cover 会把竖版队徽裁掉一截） */
.kx-logo img{ width:100%; height:100%; object-fit:contain; display:block; }
/* 有真实头像时用白底方块，避免头像边缘透出品牌渐变色 */
.kx-logo.has-img{
  background:#fff;
  box-shadow:0 10px 22px -14px rgba(23,43,77,.4), inset 0 0 0 1px rgba(23,43,77,.06);
}

.kx-name{
  margin-top:13px; max-width:100%;
  font:700 16px/1.35 -apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  color:#1b2437; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  opacity:0; transform:translateZ(0);
}
#kxSplash.kx-ready .kx-name{ animation:kxUp .42s .06s cubic-bezier(.22,.61,.36,1) both; }

.kx-sub{
  margin-top:5px; font-size:12px; letter-spacing:.3px; color:#7b879b;
  opacity:0; transform:translateZ(0);
}
#kxSplash.kx-ready .kx-sub{ animation:kxUp .42s .1s cubic-bezier(.22,.61,.36,1) both; }
@keyframes kxUp{
  from{ opacity:0; transform:translate3d(0,6px,0); }
  to  { opacity:1; transform:translate3d(0,0,0); }
}

.kx-bar{
  margin-top:15px; width:100%; height:4px; border-radius:99px;
  background:rgba(37,99,235,.13); overflow:hidden;
}
/* 用 scaleX 代替 width，避免每帧重排 */
.kx-bar i{
  display:block; height:100%; width:100%; border-radius:99px;
  background:linear-gradient(90deg,#5c96ff,#2f6bf6);
  transform:scaleX(0); transform-origin:0 50%;
}
#kxSplash.kx-ready .kx-bar i{
  animation:kxBar 1.05s .08s cubic-bezier(.28,.72,.32,1) forwards;
}
@keyframes kxBar{ to{ transform:scaleX(1); } }

.kx-brand{
  position:absolute; left:0; right:0;
  bottom:calc(24px + env(safe-area-inset-bottom,0px));
  text-align:center; pointer-events:none;
  font-size:11px; letter-spacing:2.2px; color:rgba(91,112,145,.55);
  opacity:0;
}
#kxSplash.kx-ready .kx-brand{ animation:kxUp .5s .16s ease both; }

/* 宽屏把卡片放大一档 */
@media (min-width:900px){
  .kx-card{ width:288px; padding:28px 24px 24px; border-radius:30px; }
  .kx-logo{ width:80px; height:80px; border-radius:24px; font-size:32px; }
  .kx-name{ margin-top:15px; font-size:17px; }
  .kx-sub{ font-size:12.5px; }
  .kx-bar{ margin-top:17px; height:5px; }
}

/* 低端机没有 backdrop-filter 时退化为半透明白，视觉不塌 */
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  #kxSplash{ background:rgba(246,249,255,.95); }
}

@media (prefers-reduced-motion:reduce){
  #kxSplash,.kx-card,.kx-card::after,.kx-logo,.kx-name,.kx-sub,.kx-bar i,.kx-brand{
    animation:none !important; opacity:1; transform:none;
  }
  .kx-card,.kx-logo,.kx-name,.kx-sub,.kx-brand{ opacity:1; }
  #kxSplash{ animation:kxFallback 0s linear 3.4s forwards; }
}
