/* =========================================================
   杏鲍菇 XBG · H5/App WebView 启动页
   - 仅样式层；DOM 钩子与控制器契约（.is-hidden/.is-failed/
     .is-degraded、data-startup-role）保持不变。
   - 暗色品牌底 / 暖金高光 / 抽象轮廓 / 丝绸流光。
   - 全机型自适配：100dvh + safe-area + clamp()，无横向滚动。
   ========================================================= */

.entry-h5-startup {
  --cx-bg-main: #070202;
  --cx-bg-end: #1f0707;
  --cx-gold: #e6c2b4;
  --cx-gold-soft: rgba(230, 194, 180, .42);
  --cx-crimson: #ff122b;
  --cx-crimson-soft: rgba(255, 18, 43, .32);
  --cx-text: #ffffff;
  --cx-muted: rgba(255, 255, 255, .66);
  --cx-dim: rgba(255, 255, 255, .3);

  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 430px;
  min-width: 0;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100svh;
  height: 100dvh;
  padding:
    max(16px, env(safe-area-inset-top, 0px)) clamp(16px, 5vw, 26px)
    max(18px, env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  overflow-x: hidden;
  color: var(--cx-text);
  background:
    radial-gradient(circle at 50% 38%, var(--cx-bg-end) 0%, var(--cx-bg-main) 118%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  opacity: 1;
  visibility: visible;
  backface-visibility: hidden;
  will-change: opacity;
  transition: opacity .55s cubic-bezier(.25, 1, .5, 1), visibility .55s;
}

.entry-h5-startup.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 退出后彻底停帧、释放移动端 WebView 合成层 */
.entry-h5-startup.is-dismissed {
  display: none !important;
}

/* 背景柔和镜头光晕 */
.entry-h5-startup-flare {
  position: absolute;
  top: 34%;
  left: 50%;
  width: 112%;
  height: 112%;
  max-width: 760px;
  max-height: 760px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--cx-crimson-soft) 0%, transparent 68%);
  opacity: .72;
  pointer-events: none;
}

/* 顶部留白占位，使主视觉视觉居中偏上 */
.entry-h5-startup::before {
  content: "";
  flex: 0 0 clamp(8px, 4vh, 48px);
}

.entry-h5-startup-card {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  max-width: 430px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(6px, 1.4vh, 14px);
}

/* ===== 3D 抽象主视觉（纯 SVG 堆叠，无外部大图） ===== */
.entry-h5-startup-hero {
  position: relative;
  width: clamp(128px, 40vw, 198px);
  height: clamp(128px, 40vw, 198px);
  display: grid;
  place-items: center;
  perspective: 1200px;
  margin-bottom: clamp(4px, 2vh, 18px);
}

.entry-h5-startup-matrix {
  display: none;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: cx-matrix-rotate 7s ease-in-out infinite alternate;
  will-change: transform;
}

.entry-h5-startup-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
}

.entry-h5-startup-layer svg { width: 100%; height: 100%; }

.entry-h5-startup-layer-1 { transform: translateZ(-58px) scale(.9); opacity: .4; filter: blur(7px); }
.entry-h5-startup-layer-2 { transform: translateZ(0); filter: drop-shadow(0 0 18px var(--cx-crimson-soft)); }
.entry-h5-startup-layer-3 { transform: translateZ(48px) scale(1.04); filter: drop-shadow(0 0 14px var(--cx-gold-soft)); }

/* 品牌字符 / Logo（控制器写入 data-startup-role="logo"） */
.entry-h5-startup-logo {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: var(--cx-text);
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 800;
  letter-spacing: .04em;
  background: linear-gradient(150deg, rgba(255, 18, 43, .9), rgba(120, 14, 28, .92));
  box-shadow: 0 14px 40px rgba(255, 18, 43, .34), inset 0 0 18px rgba(230, 194, 180, .25);
  overflow: hidden;
}

.entry-h5-startup-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== 品牌文案 ===== */
.entry-h5-startup-title {
  margin: clamp(6px, 1.6vh, 14px) 0 0;
  font-size: clamp(40px, 11vw, 60px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: .22em;
  text-indent: .22em;
  color: var(--cx-text);
  text-shadow: 0 0 24px rgba(255, 255, 255, .28);
}

.entry-h5-startup-eyebrow {
  margin: clamp(6px, 1.4vh, 12px) 0 0;
  font-size: clamp(12px, 3.4vw, 16px);
  font-weight: 500;
  letter-spacing: .28em;
  text-indent: .28em;
  text-transform: uppercase;
  color: var(--cx-gold);
}

.entry-h5-startup-subtitle {
  margin: clamp(8px, 1.8vh, 16px) 0 0;
  max-width: min(86vw, 420px);
  font-size: clamp(14px, 4.4vw, 18px);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: .12em;
  color: var(--cx-muted);
}

/* ===== 底部玻璃拟态加载面板 ===== */
.entry-h5-startup-panel {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: min(100%, 360px);
  margin-top: clamp(12px, 3vh, 26px);
  padding: clamp(14px, 4vw, 24px);
  border-radius: clamp(16px, 5vw, 28px);
  background: rgba(25, 10, 10, .42);
  border: 1px solid rgba(255, 255, 255, .06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .58);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.entry-h5-startup-text {
  margin: 0;
  font-size: clamp(12px, 3.4vw, 14px);
  line-height: 1.5;
  letter-spacing: .06em;
  color: var(--cx-muted);
}

.entry-h5-startup-progress {
  position: relative;
  width: clamp(140px, 46vw, 200px);
  height: 4px;
  margin-top: clamp(12px, 2.4vh, 18px);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .07);
}

.entry-h5-startup-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--cx-crimson), var(--cx-gold), transparent);
  animation: cx-flow 1.6s cubic-bezier(.4, 0, .2, 1) infinite;
}

.entry-h5-startup-copyright {
  margin-top: clamp(12px, 2.2vh, 18px);
  font-size: clamp(9px, 2.6vw, 10px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cx-dim);
}

/* ===== 失败兜底态（同一暗黑壳，不回退浅色页） ===== */
.entry-h5-startup-actions {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%;
  gap: 10px;
  margin-top: clamp(14px, 2.6vh, 20px);
}

.entry-h5-startup.is-failed .entry-h5-startup-progress { display: none; }
.entry-h5-startup.is-failed .entry-h5-startup-actions { display: grid; }

.entry-h5-startup.is-degraded .entry-h5-startup-text { color: var(--cx-gold); }

.entry-h5-startup-action {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--cx-text);
  background: linear-gradient(135deg, rgba(255, 18, 43, .92), rgba(140, 16, 32, .94));
  box-shadow: 0 10px 26px rgba(255, 18, 43, .28);
}

.entry-h5-startup-action.is-secondary {
  color: var(--cx-gold);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(230, 194, 180, .24);
  box-shadow: none;
}

/* ===== 动画 ===== */
@keyframes cx-matrix-rotate {
  0%   { transform: rotateX(10deg) rotateY(-18deg) rotateZ(-2deg); }
  100% { transform: rotateX(-8deg) rotateY(18deg) rotateZ(2deg); }
}

@keyframes cx-flow {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(110%); }
}

@keyframes cx-pulse {
  0%, 100% { transform: scale(.95); opacity: .4; }
  50%      { transform: scale(1.05); opacity: .85; }
}

.entry-h5-startup-particle { animation: cx-pulse 2.4s ease-in-out infinite; transform-origin: center; }
.entry-h5-startup-particle-2 { animation-duration: 3.2s; animation-delay: .5s; }

/* ===== 超小屏：隐藏装饰，保留品牌/标语/加载/退出 ===== */
@media (max-height: 620px), (max-width: 330px) {
  .entry-h5-startup-hero { width: clamp(120px, 34vw, 170px); height: clamp(120px, 34vw, 170px); margin-bottom: 4px; }
  .entry-h5-startup-flare { opacity: .5; }
  .entry-h5-startup-particle { display: none; }
}

/* ===== 横屏兜底：横向排布，不崩版 ===== */
@media (orientation: landscape) and (max-height: 540px) {
  .entry-h5-startup { flex-direction: row; justify-content: center; gap: clamp(16px, 5vw, 48px); }
  .entry-h5-startup::before { display: none; }
  .entry-h5-startup-card { flex-direction: column; gap: 4px; }
  .entry-h5-startup-hero { width: clamp(110px, 34vh, 170px); height: clamp(110px, 34vh, 170px); }
  .entry-h5-startup-title { font-size: clamp(32px, 9vh, 54px); }
  .entry-h5-startup-panel { margin-top: 12px; }
}

/* ===== 无障碍：关闭动画时展示静态高级版 ===== */
@media (prefers-reduced-motion: reduce) {
  .entry-h5-startup,
  .entry-h5-startup-matrix,
  .entry-h5-startup-progress span,
  .entry-h5-startup-particle {
    animation: none !important;
    transition: opacity .2s linear, visibility .2s linear !important;
  }
  .entry-h5-startup-matrix { transform: rotateX(6deg) rotateY(-6deg); }
  .entry-h5-startup-progress span {
    width: 100%;
    transform: none;
    background: var(--cx-gold);
  }
}
