/* ============================================================
   系统打开动效体系：Splash 启动画面 + 主界面入场编排
   配合 /static/opening.js 使用；动画只用 transform / opacity
   ============================================================ */

/* ================= Splash 启动画面 ================= */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer;
  background: #05060f;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* 星云底（渐变放 ::before，避免覆盖 JS 注入的兜底底色） */
.splash::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(1100px 780px at 50% 40%, rgba(26, 34, 96, .55) 0%, rgba(8, 10, 26, .2) 46%, transparent 72%),
    radial-gradient(1400px 900px at 82% 100%, rgba(28, 20, 92, .35) 0%, transparent 60%);
}
.splash canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---- 中心舞台 ---- */
.splash-core {
  position: relative; width: 230px; height: 230px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 36px;
}
.splash-ring, .splash-wave, .splash-arc {
  position: absolute; left: 50%; top: 50%; border-radius: 50%;
  transform: translate(-50%, -50%) scale(.35);
}
.splash-ring {
  border: 1px solid rgba(102, 126, 255, .4); opacity: 0;
  animation: sp-ring .85s cubic-bezier(.22, .61, .36, 1) forwards;
}
.splash-ring.r1 { width: 230px; height: 230px; border-color: rgba(96, 116, 255, .28); animation-delay: .1s; }
.splash-ring.r2 { width: 172px; height: 172px; border-color: rgba(96, 116, 255, .4);  animation-delay: .24s; }
.splash-ring.r3 { width: 116px; height: 116px; border-color: rgba(108, 132, 255, .55); animation-delay: .38s; }
@keyframes sp-ring {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.35); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 旋转光弧（环上高光扫过） */
.splash-arc {
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
}
.splash-arc.a1 {
  width: 230px; height: 230px; opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 305deg, rgba(120, 150, 255, .85) 338deg, rgba(190, 210, 255, .95) 350deg, transparent 360deg);
  animation: sp-arc-in .6s ease .7s forwards, sp-spin 2.6s linear 1.3s infinite;
}
.splash-arc.a2 {
  width: 172px; height: 172px; opacity: 0;
  background: conic-gradient(from 180deg, transparent 0 310deg, rgba(96, 124, 255, .7) 342deg, transparent 360deg);
  animation: sp-arc-in .6s ease .8s forwards, sp-spin 3.6s linear 1.4s infinite reverse;
}
@keyframes sp-arc-in { to { opacity: 1; } }
@keyframes sp-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 扩散波（由内向外穿过所有环） */
.splash-wave {
  width: 116px; height: 116px; border: 1.5px solid rgba(120, 145, 255, .6); opacity: 0;
  animation: sp-wave 1.5s cubic-bezier(.2, .5, .4, 1) .95s infinite;
}
@keyframes sp-wave {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
  22%  { opacity: .7; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.05); }
}

/* Logo（弹入 + 辉光呼吸） */
.splash-logo {
  position: relative; z-index: 2; font-size: 62px; line-height: 1;
  opacity: 0; transform: translateY(-2px) scale(.2);
  filter: drop-shadow(0 0 22px rgba(104, 132, 255, .85));
  animation: sp-logo .75s cubic-bezier(.34, 1.56, .64, 1) .45s forwards,
             sp-glow 2.3s ease-in-out 1.25s infinite;
}
@keyframes sp-logo { to { opacity: 1; transform: translateY(-2px) scale(1); } }
@keyframes sp-glow {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(104, 132, 255, .7)); }
  50%      { filter: drop-shadow(0 0 36px rgba(130, 155, 255, 1)); }
}

/* 标题 / 副标题 */
.splash-title {
  position: relative; z-index: 2; font-size: 26px; font-weight: 600;
  color: #edf0ff; letter-spacing: .14em; text-indent: .14em;
  text-shadow: 0 0 22px rgba(104, 132, 255, .5);
  opacity: 0; transform: translateY(14px); filter: blur(6px);
  animation: sp-title .8s cubic-bezier(.22, .61, .36, 1) .85s forwards;
}
@keyframes sp-title { to { opacity: 1; transform: translateY(0); filter: blur(0); } }
.splash-sub {
  position: relative; z-index: 2; margin-top: 12px;
  font-size: 11px; letter-spacing: .46em; text-indent: .46em; text-transform: uppercase;
  color: rgba(150, 168, 240, .5); opacity: 0;
  animation: sp-sub .9s ease 1.02s forwards;
}
@keyframes sp-sub { from { opacity: 0; letter-spacing: .22em; } to { opacity: 1; letter-spacing: .46em; } }

/* 扫光进度条 / 跳过提示 */
.splash-bar {
  position: absolute; bottom: 74px; width: 190px; height: 2px; border-radius: 2px;
  background: rgba(96, 116, 220, .16); overflow: hidden; opacity: 0;
  animation: sp-fade .35s ease .95s forwards;
}
.splash-bar i {
  display: block; width: 42%; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #6d8bff, #eef1ff, #6d8bff, transparent);
  transform: translateX(-130%);
  animation: sp-bar 1.05s cubic-bezier(.35, .55, .35, 1) .95s forwards;
}
@keyframes sp-bar { to { transform: translateX(240%); } }
@keyframes sp-fade { to { opacity: 1; } }
.splash-skip {
  position: absolute; bottom: 36px; font-size: 12px; letter-spacing: .12em;
  color: rgba(150, 166, 225, .42); opacity: 0;
  animation: sp-fade .5s ease 1.35s forwards;
}

/* 光爆揭幕 */
.splash.flash-x::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 44%, #fff 0%, rgba(190, 205, 255, .9) 16%, rgba(90, 120, 255, .5) 34%, transparent 62%);
  opacity: 0;
  animation: sp-flash .38s ease-out forwards;
}
@keyframes sp-flash { 0% { opacity: 0; } 40% { opacity: .95; } 100% { opacity: 0; } }
.splash.splash-out {
  animation: sp-out .44s cubic-bezier(.4, 0, .6, 1) forwards;
  pointer-events: none;
}
.splash.splash-out.fast { animation-duration: .22s; }
@keyframes sp-out { from { opacity: 1; } to { opacity: 0; transform: scale(1.05); } }

/* 小屏适配 */
@media (max-width: 480px) {
  .splash-core { width: 186px; height: 186px; margin-bottom: 30px; }
  .splash-ring.r1, .splash-arc.a1 { width: 186px; height: 186px; }
  .splash-ring.r2, .splash-arc.a2 { width: 140px; height: 140px; }
  .splash-ring.r3, .splash-wave { width: 94px; height: 94px; }
  .splash-logo { font-size: 50px; }
  .splash-title { font-size: 22px; }
}

/* ================= 主界面入场编排 =================
   body.app-reveal 由 opening.js 添加（约 1.5s 后移除，防止切换视图重播）；
   #app:not([v-cloak]) 与 Vue 挂载时机天然衔接（挂载移除 v-cloak 时匹配生效） */
@keyframes enter-left { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
@keyframes enter-down { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes enter-up   { from { opacity: 0; transform: translateY(18px); }  to { opacity: 1; transform: none; } }

body.app-reveal #app:not([v-cloak]) .sidebar {
  animation: enter-left .5s cubic-bezier(.22, .61, .36, 1) both;
}
body.app-reveal #app:not([v-cloak]) .topbar {
  animation: enter-down .5s cubic-bezier(.22, .61, .36, 1) .06s both;
}
body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card {
  animation: enter-up .55s cubic-bezier(.22, .61, .36, 1) both;
}
body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card:nth-child(1) { animation-delay: .10s; }
body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card:nth-child(2) { animation-delay: .16s; }
body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card:nth-child(3) { animation-delay: .22s; }
body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card:nth-child(4) { animation-delay: .28s; }
body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card:nth-child(5) { animation-delay: .34s; }
body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card:nth-child(6) { animation-delay: .40s; }
body.app-reveal #app:not([v-cloak]) main.container > .panel {
  animation: enter-up .55s cubic-bezier(.22, .61, .36, 1) .46s both;
}
body.app-reveal #app:not([v-cloak]) main.container > .dash-grid {
  animation: enter-up .55s cubic-bezier(.22, .61, .36, 1) .54s both;
}

/* 减少动态偏好：全部关闭 */
@media (prefers-reduced-motion: reduce) {
  .splash, .splash *, .splash::before, .splash::after { animation: none !important; }
  body.app-reveal #app:not([v-cloak]) .sidebar,
  body.app-reveal #app:not([v-cloak]) .topbar,
  body.app-reveal #app:not([v-cloak]) .kpi-grid .kpi-card,
  body.app-reveal #app:not([v-cloak]) main.container > .panel,
  body.app-reveal #app:not([v-cloak]) main.container > .dash-grid { animation: none !important; }
}
