/* ============================================================
   mzmudang.css — 开屏页（对应原站 /mzmudang-tw）
   背景动图：原创 AI 插画 + 图生视频，转成动态 WebP
             540×1080 / 15fps / 4.5s 无缝循环（首尾帧字节一致）/ 1.84MB
             封面图 80KB 秒开
   说明：不用原站素材（避免侵权）；同规格 GIF 要 20MB+，
        动态 WebP 用帧间差分，所有移动端浏览器（iOS 14+）都支持。
   动效清单：
     1) 人物动图   呼吸 / 发丝 / 衣摆 / 香烟 / 烛火 / 火星（真无缝循环）
     2) 余烬上浮   canvas 粒子 15~26 颗
     3) 颗粒       SVG feTurbulence（静态，不耗 GPU）
     4) CTA 入场   ob-cta-enter  .5s ease-out .5s both   ← 原站同名同参
     5) 文字点燃   ob-ignite     1.1s cubic-bezier(.22,1,.36,1) 1.05s both
     6) 牌匾呼吸   ob-breathe    3.4s infinite
     7) 点击等待   ob-spin       .8s linear infinite
   ============================================================ */

.ob-page {
  background: #0b0303;
  overflow: hidden;
  overscroll-behavior: none;
}

.ob {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
  background: #0b0303;
  isolation: isolate;
}

/* ---------- 媒体层 ---------- */
.ob-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #120303;
}

/* 封面图：秒开占位（126KB） */
.ob-poster,
.ob-anim,
.ob-anim-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;   /* 覆盖 style.css 的 img{max-width:100%} */
  object-fit: cover;
  object-position: 50% 30%;
}
.ob-poster { filter: saturate(.96) contrast(1.02) brightness(.9); }
/* 动态 WebP 兜底层：位于封面之上、视频之下；视频真正开始播放后被盖住 */
.ob-anim-gif {
  object-position: 50% 20%;
  opacity: 1;
  filter: saturate(.88) contrast(1.06) brightness(.8);
  -webkit-mask-image: linear-gradient(180deg, #000 52%, rgba(0, 0, 0, .55) 76%, rgba(0, 0, 0, .12) 92%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 52%, rgba(0, 0, 0, .55) 76%, rgba(0, 0, 0, .12) 92%, transparent 100%);
  z-index: 1;
}
.ob-anim { z-index: 2; }

/* 动态图：加载完成后淡入盖住封面图 */
.ob-anim {
  opacity: 0;
  transition: opacity .55s ease;
  filter: saturate(.96) contrast(1.02) brightness(.9);
}
.ob-anim.is-ready { opacity: 1; }

/* 巫女人物动态视频：底部融入暗色神坛（视频自带动作，不再加 CSS 推近） */
.ob-portrait {
  object-position: 50% 20%;
  filter: saturate(.88) contrast(1.06) brightness(.8);
  -webkit-mask-image: linear-gradient(180deg, #000 52%, rgba(0, 0, 0, .55) 76%, rgba(0, 0, 0, .12) 92%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 52%, rgba(0, 0, 0, .55) 76%, rgba(0, 0, 0, .12) 92%, transparent 100%);
}

/* ---------- 余烬粒子 ---------- */
.ob-embers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* ---------- 颗粒 + 暗角 ---------- */
.ob-grain {
  position: absolute;
  inset: 0;
  opacity: .07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}
.ob-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(96% 74% at 50% 42%, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, .62) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 52%, rgba(28, 2, 2, .92) 100%);
}

/* ---------- 顶栏 ---------- */
.ob-hdr {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
  animation: ob-fade-in .7s ease-out .1s both;
}
.ob-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  color: #fff;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: .9;
  transition: opacity .2s ease, transform .2s ease;
}
.ob-back:hover { opacity: 1; }
.ob-back:active { transform: scale(.92); }
.ob-logo {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .32em;
  text-indent: .32em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .9);
}
.ob-spacer { width: 30px; }

@keyframes ob-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 底部 CTA ---------- */
.ob-cta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: 0 20px calc(env(safe-area-inset-bottom, 0px) + 26px);
  animation: ob-cta-enter .5s ease-out .5s both;
}
/* 原站同名 keyframes，时长/延迟一致 */
@keyframes ob-cta-enter {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: none; }
}

.ob-cap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(22, 5, 5, .42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: rgba(255, 255, 255, .86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: ob-fade-up .6s ease-out .34s both;
}
.ob-cap-emoji { font-size: 12px; line-height: 1; }

@keyframes ob-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 牌匾按钮（位置定稿：仅此贴图质感升级，布局/回纹不变） ---------- */
.ob-plaque {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(336px, 82vw);
  aspect-ratio: 56 / 19;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 12px 26px rgba(110, 0, 0, .55)) drop-shadow(0 0 16px rgba(255, 82, 30, .18));
  transition: transform .16s cubic-bezier(.2, .8, .3, 1), filter .3s ease;
}
.ob-plaque:active { transform: scale(.972); }
.ob-plaque:hover { filter: drop-shadow(0 14px 30px rgba(140, 0, 0, .6)) drop-shadow(0 0 22px rgba(255, 96, 40, .3)); }

/* 四角金饰（原站 png 匾额上的包角，这里用渐变线画） */
.ob-plaque::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 2;
  border-radius: 6px;
  pointer-events: none;
  opacity: .6;
  filter: drop-shadow(0 0 3px rgba(255, 190, 120, .55));
  background:
    linear-gradient(#f2cd8d, #f2cd8d) left top / 15px 1.5px no-repeat,
    linear-gradient(#f2cd8d, #f2cd8d) left top / 1.5px 15px no-repeat,
    linear-gradient(#f2cd8d, #f2cd8d) right top / 15px 1.5px no-repeat,
    linear-gradient(#f2cd8d, #f2cd8d) right top / 1.5px 15px no-repeat,
    linear-gradient(#f2cd8d, #f2cd8d) left bottom / 15px 1.5px no-repeat,
    linear-gradient(#f2cd8d, #f2cd8d) left bottom / 1.5px 15px no-repeat,
    linear-gradient(#f2cd8d, #f2cd8d) right bottom / 15px 1.5px no-repeat,
    linear-gradient(#f2cd8d, #f2cd8d) right bottom / 1.5px 15px no-repeat;
}

/* 背后呼吸血光 */
.ob-plaque__glow {
  position: absolute;
  inset: -10px -6px;
  border-radius: 14px;
  background: radial-gradient(60% 120% at 50% 50%, rgba(255, 60, 24, .55), rgba(255, 60, 24, 0) 72%);
  filter: blur(14px);
  opacity: .6;
  z-index: 0;
  animation: ob-breathe 3.4s ease-in-out infinite;
}
@keyframes ob-breathe { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }

/* 匾额主体：满幅雕刻纹理（零拉伸）+ 顶部受光 + 四周渐暗，营造浮雕进深 */
.ob-plaque__frame {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 9px;
  background:
    /* 顶部受光，压出凸面 */
    linear-gradient(180deg, rgba(255, 226, 184, .17) 0%, rgba(255, 226, 184, 0) 22%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .42) 100%),
    url("../assets/mzmudang/gen/plaque_texture.jpg") center / 100% 100% no-repeat,
    linear-gradient(180deg, #4c0909, #1a0101);
  box-shadow:
    /* 外沿雕刻斜面：顶受光 / 底落影 */
    inset 0 3px 2px rgba(255, 226, 184, .42),
    inset 0 -4px 3px rgba(0, 0, 0, .95),
    inset 4px 0 3px rgba(255, 196, 140, .2),
    inset -4px 0 3px rgba(0, 0, 0, .6),
    inset 0 0 0 1.5px rgba(255, 206, 150, .45),
    inset 0 0 26px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(20, 3, 3, .95),
    0 4px 3px rgba(0, 0, 0, .55),
    0 10px 24px rgba(0, 0, 0, .5);
}
/* 内框：双凹槽（雕出的一道槽线） */
.ob-plaque__frame::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 4px;
  border: 1px solid rgba(246, 198, 132, .3);
  box-shadow:
    inset 0 1px 1px rgba(255, 232, 196, .22),
    inset 0 -1.5px 2px rgba(0, 0, 0, .75),
    inset 0 0 14px rgba(0, 0, 0, .45);
}
.ob-plaque__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background:
    radial-gradient(circle at 10px 50%, rgba(255, 216, 152, .95) 0 1.4px, rgba(255, 216, 152, 0) 2.4px),
    radial-gradient(circle at calc(100% - 10px) 50%, rgba(255, 216, 152, .95) 0 1.4px, rgba(255, 216, 152, 0) 2.4px),
    repeating-linear-gradient(90deg, rgba(255, 206, 148, .26) 0 1px, rgba(255, 206, 148, 0) 1px 6px) top center / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 206, 148, .22) 0 1px, rgba(255, 206, 148, 0) 1px 6px) bottom center / 100% 3px no-repeat;
}

/* 文字：鎏金阴刻（金面渐变 + 上暗下亮的凿刻浮雕） */
.ob-plaque__txt {
  position: relative;
  z-index: 2;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-size: clamp(21px, 6.2vw, 25px);
  font-weight: 700;
  letter-spacing: .06em;
  text-indent: .06em;
  background: linear-gradient(180deg, #f9e3b6 8%, #eabf72 46%, #b97f2e 78%, #e3b967 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1.5px 1px rgba(0, 0, 0, .85)) drop-shadow(0 -0.5px 0 rgba(0, 0, 0, .6));
  animation: ob-ignite 1.1s cubic-bezier(.22, 1, .36, 1) 1.05s both;
}
/* 原站同名 keyframes（1.1s / 先亮后收） */
@keyframes ob-ignite {
  0% {
    opacity: 0;
    filter: blur(5px);
    text-shadow: 0 0 rgba(255, 90, 30, 0), 0 0 rgba(255, 200, 120, 0);
    transform: translateY(3px);
  }
  45% {
    opacity: 1;
    filter: blur(.5px);
    text-shadow: 0 0 12px rgba(255, 90, 30, .85), 0 0 3px rgba(255, 200, 120, .7);
    transform: none;
  }
  100% {
    opacity: 1;
    filter: blur(0);
    text-shadow: 0 0 3px rgba(255, 60, 20, .35), 0 0 rgba(255, 200, 120, 0);
    transform: none;
  }
}

/* 点击等待态：原站 [data-onboarding-cta][data-pending] 的等价实现 */
.ob-plaque__spin {
  display: none;
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 999px;
}
.ob-plaque[data-pending] { pointer-events: none; }
.ob-plaque[data-pending] .ob-plaque__txt,
.ob-plaque[data-pending] .ob-plaque__frame { opacity: .35; transition: opacity .15s; }
.ob-plaque[data-pending] .ob-plaque__spin { display: block; animation: ob-spin .8s linear infinite; }
@keyframes ob-spin { to { transform: rotate(360deg); } }

/* ---------- 降级：尊重「减少动态效果」 ---------- */
@media not all { /* 动效照常播放：忽略系统「减少动态效果」（原 reduce 降级规则保留，改回此行即可恢复） */
  .ob-embers, .ob-anim { display: none; }   /* 只留封面图 */
  .ob-plaque__glow { animation: none !important; }
  .ob-cta, .ob-cap, .ob-plaque__txt, .ob-hdr { animation: none !important; }
}

/* 极短屏兜底 */
@media (max-height: 620px) {
  .ob-cta { gap: 9px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); }
  .ob-plaque { width: min(300px, 76vw); }
}
