/**
 * Apple 式加载 — web / mobile-web 共用（index.html 首屏 + SPA 路由占位）
 * 参考 apple.com.cn/iphone：白幕 · 顶栏微光 · 内容交叉淡入 · 无灰色骨架
 */
html {
  scrollbar-gutter: stable;
  background: #fbfbfd;
}

body {
  background: #fbfbfd;
}

#root {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

html.is-app-ready #root,
html[data-boot-splash='off'] #root {
  opacity: 1;
}

/* ── 首屏 boot splash ── */

#app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: #fbfbfd;
}

#app-splash .brand-boot-curtain {
  position: absolute;
  inset: 0;
  background: #fbfbfd;
  opacity: 1;
  transition: opacity 0.68s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: opacity;
}

#app-splash.is-exiting .brand-boot-curtain {
  opacity: 0;
}

#app-splash .brand-boot-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  opacity: 0.9;
  transition: opacity 0.35s ease;
}

#app-splash.is-exiting .brand-boot-progress {
  opacity: 0;
}

#app-splash .brand-boot-progress::after {
  content: '';
  display: block;
  height: 100%;
  width: 34%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(225, 29, 72, 0.35) 45%,
    rgba(225, 29, 72, 0.55) 50%,
    rgba(225, 29, 72, 0.35) 55%,
    transparent 100%
  );
  animation: brand-boot-progress 1.35s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

#app-splash .brand-boot-shimmer {
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  height: 1px;
  overflow: hidden;
  opacity: 0.5;
  transition: opacity 0.35s ease;
}

#app-splash.is-exiting .brand-boot-shimmer {
  opacity: 0;
}

#app-splash .brand-boot-shimmer::after {
  content: '';
  display: block;
  height: 100%;
  width: 28%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.06) 42%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.06) 58%,
    transparent 100%
  );
  animation: brand-boot-shimmer 1.85s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes brand-boot-progress {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(320%);
  }
}

@keyframes brand-boot-shimmer {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(320%);
  }
}

/* ── SPA 路由占位（Suspense / 数据等待） ── */

.apple-route-hold {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background: #fbfbfd;
}

.apple-route-hold--compact {
  min-height: 60vh;
}

.apple-route-hold__shimmer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  opacity: 0.75;
}

.apple-route-hold__shimmer::after {
  content: '';
  display: block;
  height: 100%;
  width: 34%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(225, 29, 72, 0.28) 45%,
    rgba(225, 29, 72, 0.45) 50%,
    rgba(225, 29, 72, 0.28) 55%,
    transparent 100%
  );
  animation: brand-boot-progress 1.35s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* ── 客户端路由切换：仅 opacity，无位移 ── */

@keyframes apple-page-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.apple-page-enter {
  animation: apple-page-in 0.68s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

.mweb-boot-retry {
  margin: 0;
  border: 0;
  border-radius: 980px;
  background: #e11d48;
  color: #fff;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', system-ui, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  #root {
    transition: none;
    opacity: 1;
  }

  #app-splash .brand-boot-progress::after,
  #app-splash .brand-boot-shimmer::after,
  .apple-route-hold__shimmer::after {
    animation: none;
    transform: none;
    width: 100%;
    opacity: 0.06;
  }

  #app-splash.is-exiting .brand-boot-curtain {
    transition-duration: 0.01ms;
  }

  .apple-page-enter {
    animation: none;
  }
}

html[data-boot-splash='off'] #app-splash {
  display: none !important;
}
