/* ===== 基础重置与适配 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: calc(100vw / 7.5);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (min-width: 750px) {
  html { font-size: 100px; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #1a1410;
  color: #fff8e7;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

button {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

/* ===== 加载层 ===== */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #1a1410;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner { text-align: center; }

.loader-text {
  display: block;
  font-family: "STSong", "SimSun", serif;
  font-size: 0.48rem;
  color: #c9a227;
  letter-spacing: 0.2em;
  margin-bottom: 0.3rem;
}

.loader-bar {
  display: block;
  width: 1.2rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, #c9a227, transparent);
  animation: loaderPulse 1.2s ease infinite;
}

@keyframes loaderPulse {
  0%, 100% { opacity: 0.3; transform: scaleX(0.6); }
  50% { opacity: 1; transform: scaleX(1); }
}

/* ===== 滚动容器 ===== */
.scroller {
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.screen {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}

/* ===== 背景层 ===== */
/* 替换 AI 切图：将 url 改为 images/bg_p1.jpg 等 */
.bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.02);
  transition: transform 8s ease-out;
}

.screen.is-visible .bg {
  transform: scale(1);
}

.bg-p1 { background-image: url("../images/bg_p1.svg"); }
.bg-p2 { background-image: url("../images/bg_p2.svg"); }
.bg-p3 { background-image: url("../images/bg_p3.svg"); }
.bg-p4 { background-image: url("../images/bg_p4.svg"); }
.bg-p5 { background-image: url("../images/bg_p5.svg"); }
.bg-p6 { background-image: url("../images/bg_p6.svg"); }
.bg-p7 { background-image: url("../images/bg_p7.svg"); }
.bg-p8 { background-image: url("../images/bg_p8.svg"); }

.vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 8, 6, 0.55) 0%,
    rgba(10, 8, 6, 0.05) 35%,
    rgba(10, 8, 6, 0.1) 60%,
    rgba(10, 8, 6, 0.75) 100%
  );
  pointer-events: none;
}

.vignette-light {
  background: linear-gradient(
    180deg,
    rgba(255, 248, 240, 0.5) 0%,
    rgba(255, 248, 240, 0) 30%,
    rgba(30, 20, 15, 0.15) 70%,
    rgba(30, 20, 15, 0.55) 100%
  );
}

/* ===== 装饰元素 ===== */
.decor {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease 0.3s;
}

.screen.is-visible .decor { opacity: 1; }

.decor-mask {
  width: 5rem;
  right: 0.4rem;
  top: 28%;
  opacity: 0.7;
}

.decor-emb {
  width: 6rem;
  left: 0.3rem;
  top: 25%;
  opacity: 0.55;
}

.decor-dragon {
  width: 7rem;
  left: 0;
  top: 30%;
  opacity: 0.75;
}

.decor-pottery {
  width: 4.5rem;
  right: 0.5rem;
  top: 28%;
  opacity: 0.65;
}

.decor-map {
  width: 100%;
  top: 18%;
  left: 0;
  opacity: 0.85;
}

.decor-lantern {
  width: 3.5rem;
  right: 0.6rem;
  top: 22%;
  opacity: 0.7;
  animation: lanternSwing 3s ease-in-out infinite;
}

@keyframes lanternSwing {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.decor-lacquer {
  width: 4rem;
  left: 0.4rem;
  top: 24%;
  opacity: 0.6;
}

/* ===== 内容区 ===== */
.content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2rem;
  padding: 0 0.56rem;
  z-index: 2;
}

.content-finale {
  bottom: 1.2rem;
  text-align: center;
}

.eyebrow {
  font-size: 0.22rem;
  letter-spacing: 0.15em;
  color: #c9a227;
  opacity: 0.8;
  margin-bottom: 0.16rem;
}

.title-main {
  font-family: "STSong", "SimSun", "Songti SC", serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.divider {
  width: 1.2rem;
  height: auto;
  margin: 0.24rem 0;
}

.subtitle {
  font-size: 0.28rem;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.title-section {
  font-family: "STSong", "SimSun", "Songti SC", serif;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
}

.title-dark {
  color: #2a1810;
  text-shadow: 0 1px 8px rgba(255, 248, 240, 0.5);
}

.tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 0.56rem;
  margin-bottom: 0.24rem;
}

.tag img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tag span {
  position: relative;
  z-index: 1;
  font-size: 0.22rem;
  color: #ffd700;
  letter-spacing: 0.05em;
}

.tag-dark span { color: #8b2020; }

.desc {
  font-size: 0.28rem;
  line-height: 1.75;
  opacity: 0.9;
  max-width: 6.2rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.desc-dark {
  color: #3a2820;
  text-shadow: none;
  opacity: 0.85;
}

.desc-center {
  max-width: 5.8rem;
  margin: 0 auto 0.3rem;
}

/* ===== 上滑引导 ===== */
.scroll-hint {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  opacity: 0.7;
}

.scroll-hint img {
  width: 0.48rem;
  height: 0.48rem;
}

.scroll-hint span {
  font-size: 0.22rem;
  letter-spacing: 0.06em;
}

.anim-bounce img {
  animation: bounceUp 2s ease infinite;
}

@keyframes bounceUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.12rem); }
}

/* ===== 变脸彩蛋 ===== */
.mask-toggle {
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.12rem 0.24rem;
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 2rem;
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.mask-toggle:active {
  transform: scale(0.95);
}

.mask-face {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.25s ease;
  border: 1px solid rgba(255, 215, 0, 0.3);
  flex-shrink: 0;
}

.mf-1 { background: linear-gradient(135deg, #8b2020, #c9a227); }
.mf-2 { background: linear-gradient(135deg, #1a4a6a, #2a8a8a); }
.mf-3 { background: linear-gradient(135deg, #2a6a3a, #8bc9a0); }
.mf-4 { background: linear-gradient(135deg, #6a2a8a, #c98bd0); }

.mask-toggle.is-changed .mf-1 {
  transform: translateY(-0.15rem) scale(1.3);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.6);
  border-color: #ffd700;
}
.mask-toggle.is-changed .mf-2 {
  transform: translateY(0.08rem) scale(0.85);
  opacity: 0.6;
}
.mask-toggle.is-changed .mf-3 {
  transform: translateY(0.15rem) scale(0.7);
  opacity: 0.4;
}
.mask-toggle.is-changed .mf-4 {
  transform: translateY(0.05rem) scale(0.9);
  opacity: 0.5;
}

.mask-label {
  font-size: 0.24rem;
  color: #ffd700;
  opacity: 0.85;
  margin-left: 0.08rem;
}

/* ===== p6 按钮 ===== */
.seal {
  width: 1.6rem;
  height: 1.6rem;
  margin: 0 auto 0.16rem;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: center;
  margin-top: 0.2rem;
}

.btn {
  position: relative;
  width: 4.8rem;
  height: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.btn span {
  position: relative;
  z-index: 1;
  font-size: 0.3rem;
  letter-spacing: 0.08em;
}

.btn:active { transform: scale(0.97); }

.footer-note {
  margin-top: 0.3rem;
  font-size: 0.2rem;
  opacity: 0.5;
  color: #3a2820;
}

/* ===== 导航点 ===== */
.nav-dots {
  position: fixed;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
}

.dot {
  width: 0.12rem;
  height: 0.12rem;
  border-radius: 50%;
  background: rgba(255, 248, 231, 0.25);
  border: 1px solid rgba(201, 162, 39, 0.4);
  transition: all 0.3s ease;
  padding: 0;
}

.dot.active {
  background: #c9a227;
  transform: scale(1.3);
  box-shadow: 0 0 6px rgba(201, 162, 39, 0.6);
}

/* ===== 入场动画 ===== */
.anim-group > * {
  opacity: 0;
  transform: translateY(0.3rem);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.screen.is-visible .anim-group > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0.1s; }
.screen.is-visible .anim-group > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 0.2s; }
.screen.is-visible .anim-group > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 0.3s; }
.screen.is-visible .anim-group > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 0.4s; }
.screen.is-visible .anim-group > *:nth-child(5) { opacity: 1; transform: none; transition-delay: 0.5s; }
.screen.is-visible .anim-group > *:nth-child(6) { opacity: 1; transform: none; transition-delay: 0.6s; }

.screen-p1 .anim-group > * { opacity: 1; transform: none; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  z-index: 10000;
  padding: 0.2rem 0.4rem;
  background: rgba(20, 15, 10, 0.88);
  border: 1px solid rgba(201, 162, 39, 0.5);
  border-radius: 0.08rem;
  font-size: 0.26rem;
  color: #fff8e7;
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ===== 音乐控制 ===== */
.music-btn {
  position: fixed;
  top: 0.3rem;
  right: 0.7rem;
  z-index: 200;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(201, 162, 39, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c9a227;
  transition: all 0.3s ease;
}

.music-btn:active { transform: scale(0.92); }

.music-icon {
  width: 0.48rem;
  height: 0.48rem;
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.music-off { opacity: 0; transform: scale(0.5); }
.music-btn.is-muted .music-on { opacity: 0; transform: scale(0.5); }
.music-btn.is-muted .music-off { opacity: 1; transform: scale(1); }

/* ===== 屏幕互动叠加层 ===== */
.interact-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15%;
  pointer-events: none;
}

.interact-hint {
  font-size: 0.22rem;
  color: rgba(255, 248, 231, 0.5);
  letter-spacing: 0.08em;
  padding: 0.1rem 0.24rem;
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.15);
  animation: hintPulse 2.5s ease infinite;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 0.85; transform: translateY(-0.06rem); }
}

/* ===== 蜀绣针脚 ===== */
.stitch-strand {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 4;
  transform-origin: left center;
  width: 0;
  opacity: 0.9;
}

/* ===== 龙舞火星 ===== */
.fire-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
}

/* ===== 无障碍：减少动画 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .bg { transform: none !important; }
}
