/* ============================================================
 * 启动封面 Splash v7 —— 纯 CSS 模块方块拼合动画（≈2KB，秒开）
 * 替代 852KB 的 splash.mp4，移动端秒秒不会卡
 * ========================================================== */

html[data-skip-splash="1"] .splash { display: none; }

html[data-soft-enter="1"] body {
  animation: softEnter .75s cubic-bezier(.22,.8,.3,1) backwards;
}
@keyframes softEnter {
  from { opacity: 0; transform: translateY(14px) scale(.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
html[data-soft-enter="1"] body.soft-enter-done {
  animation: none;
  transform: none;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  overflow: hidden;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

/* 模块方块网格：4x4 共 16 个小方块，依次飞入 */
.splash-grid {
  position: absolute;
  width: 220px; height: 220px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 6px;
}
.splash-grid span {
  border-radius: 5px;
  background: #153A72;
  opacity: 0;
  transform: translateY(24px) scale(.6);
  animation: blockIn .42s cubic-bezier(.22,.8,.3,1) forwards;
}
/* 交错延迟：让 16 块像拼积木一样依次落位 */
.splash-grid span:nth-child(1)  { animation-delay: 0.00s; background: #153A72; }
.splash-grid span:nth-child(2)  { animation-delay: 0.05s; background: #2E6AB8; }
.splash-grid span:nth-child(3)  { animation-delay: 0.10s; background: #153A72; }
.splash-grid span:nth-child(4)  { animation-delay: 0.15s; background: #2E6AB8; }
.splash-grid span:nth-child(5)  { animation-delay: 0.20s; background: #F2A154; }
.splash-grid span:nth-child(6)  { animation-delay: 0.25s; background: #153A72; }
.splash-grid span:nth-child(7)  { animation-delay: 0.30s; background: #2DD4BF; }
.splash-grid span:nth-child(8)  { animation-delay: 0.35s; background: #153A72; }
.splash-grid span:nth-child(9)  { animation-delay: 0.40s; background: #2E6AB8; }
.splash-grid span:nth-child(10) { animation-delay: 0.45s; background: #14B8A6; }
.splash-grid span:nth-child(11) { animation-delay: 0.50s; background: #2E6AB8; }
.splash-grid span:nth-child(12) { animation-delay: 0.55s; background: #F2A154; }
.splash-grid span:nth-child(13) { animation-delay: 0.60s; background: #153A72; }
.splash-grid span:nth-child(14) { animation-delay: 0.65s; background: #2E6AB8; }
.splash-grid span:nth-child(15) { animation-delay: 0.70s; background: #153A72; }
.splash-grid span:nth-child(16) { animation-delay: 0.75s; background: #2DD4BF; }
@keyframes blockIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 拼完后整体收缩成 logo 位置：中心位置 80px（留 logo + 文案空间） */
.splash.splash-settled .splash-grid {
  animation: gridCollapse .35s cubic-bezier(.22,.8,.3,1) forwards;
  animation-delay: .5s;
}
@keyframes gridCollapse {
  to {
    width: 40px; height: 40px; gap: 2px;
    transform: translateY(30px);
    opacity: 0.3;
  }
}

/* ---------- 中心 logo + 文案 ---------- */
.splash-loading {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 2;
  opacity: 0;
  animation: splashLogoIn .5s ease-out .6s forwards;
}
.splash-logo-img {
  width: 48px; height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(47,90,245,.22));
  image-rendering: crisp-edges;
}
.splash-loading .txt {
  font-size: 12px;
  letter-spacing: .2em;
  color: #153A72;
  font-weight: 500;
}
@keyframes splashLogoIn {
  from { opacity: 0; transform: translateY(10px) scale(.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 跳过按钮：不想看动画 / 动画卡住时的逃生入口 ---------- */
.splash-skip {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  z-index: 3;
  padding: 8px 16px;
  border: 1px solid rgba(21, 58, 114, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  color: #153A72;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(21, 58, 114, .08);
  transition: background .2s, box-shadow .2s, transform .15s;
}
.splash-skip:hover { background: #fff; box-shadow: 0 6px 16px rgba(21, 58, 114, .16); }
.splash-skip:active { transform: scale(.96); }
.splash-skip:focus-visible { outline: 2px solid #2F5AF5; outline-offset: 2px; }

/* ---------- 整体淡出 ---------- */
.splash.splash-out {
  animation: splashFadeOut .42s ease-in forwards;
}
.splash.splash-skip-out {
  animation: splashFadeOut .2s ease-in forwards;
}
@keyframes splashFadeOut {
  to { opacity: 0; visibility: hidden; }
}
