/* ============================================================
   幽冥地府接引页 · netherworld.css
   空山 · 沿用主页配色
   ============================================================ */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  font-family: "Noto Serif SC", "KaiTi", "楷体", serif;
  color: #c8a882;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== 2. 场景容器 ===== */
.scene {
  position: fixed;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s ease;
  z-index: 1;
}

.scene.active {
  opacity: 1;
  visibility: visible;
}

/* ===== 3. 加载页 ===== */
#loading {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-text {
  font-family: "STXingkai", "华文行楷", "Ma Shan Zheng", "KaiTi", "楷体", serif;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  letter-spacing: 0.3em;
  color: #c8a882;
  text-indent: 0.3em; /* 补偿末尾字间距视觉居中 */
  animation: breathe 2s infinite ease-in-out;
  will-change: opacity;
}

@keyframes breathe {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

/* ===== 4. intro 眨眼层 ===== */
#intro {
  z-index: 1;
}

.intro-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #1a1410;
  filter: blur(10px);
  z-index: 1;
  will-change: filter, opacity;
}

.blink-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 100;
  transition: background .2s ease;
}

.blink-overlay.white {
  background: #fff;
}

/* ===== 5. 场景背景 ===== */
.scene-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #1a1410;
  z-index: 0;
  will-change: opacity;
}

#scene1-bg {
  background-image: url(images/bg1.jpg);
}

#scene2-bg {
  background-image: url(images/bg2.jpg);
}

/* ===== 6. 向前走按钮 ===== */
.walk-btn {
  position: fixed;
  bottom: 8vh;
  right: 8vw;
  border: 1px solid rgba(160, 40, 35, 0.6);
  background: radial-gradient(circle, rgba(20, 15, 10, 0.92), rgba(45, 25, 18, 0.88));
  color: #d4a574;
  font-family: "STXingkai", "华文行楷", "Ma Shan Zheng", "KaiTi", "楷体", serif;
  font-size: 1.2rem;
  padding: 12px 32px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 0 12px rgba(160, 40, 35, 0.25), inset 0 0 8px rgba(0, 0, 0, 0.4);
  transition: all 0.4s ease;
  z-index: 10;
  will-change: transform, opacity;
}

.walk-btn:hover {
  border-color: rgba(190, 55, 45, 0.9);
  box-shadow: 0 0 24px rgba(190, 55, 45, 0.6), inset 0 0 8px rgba(0, 0, 0, 0.4);
  transform: scale(1.05);
}

/* ===== 7. 大门热区 ===== */
.door-hotzone {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 50vw;
  height: 60vh;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  z-index: 5;
  transition: all 0.4s ease;
  will-change: transform, opacity;
}

.door-hotzone:hover {
  border-color: rgba(190, 55, 45, 0.3);
  box-shadow: inset 0 0 40px rgba(190, 55, 45, 0.25), 0 0 20px rgba(190, 55, 45, 0.2);
}

/* ===== 8. 场景3 ===== */
#scene3 {
  overflow: hidden;
}

#bg3-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.scene3-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a1410, #0a0806);
  display: none;
  z-index: 0;
}

.scene3-fallback.active {
  display: block;
}

.wuchang-img {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  max-height: 70vh;
  z-index: 2;
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.wuchang-img.entering {
  top: -30%;
  filter: blur(20px);
  opacity: 0;
  transform: translate(-50%, -80px);
}

.wuchang-img.entered {
  top: 10%;
  filter: blur(0);
  opacity: 1;
  transform: translateX(-50%);
  transition: all 3s ease-out;
}

#paper-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.75) 100%);
}

.candle-flicker {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  animation: flicker 2s infinite ease-in-out;
}

/* ===== 9. 烛火闪烁 ===== */
@keyframes flicker {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
  25%, 75% { filter: brightness(0.92); }
}

/* ===== 10. 立绘入场动画（见上方 .wuchang-img.entering / .entered） ===== */

/* ===== 11. 弹窗系统 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 12, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  width: min(500px, 90vw);
  max-width: 90vw;
  padding: 2rem 2.5rem;
  background: rgba(15, 12, 8, 0.92);
  border: 1px solid rgba(180, 150, 130, 0.3);
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(80, 130, 110, 0.08);
}

/* ===== 12. 打字机文字 ===== */
.dialog-text {
  color: #e8ddd0;
  font-family: "Noto Serif SC", "KaiTi", "楷体", serif;
  font-size: clamp(1rem, 3vw, 1.25rem);
  line-height: 2;
  margin-bottom: 1.5rem;
  min-height: 3em;
}

/* ===== 13. 输入框 ===== */
.name-input {
  background: rgba(10, 8, 6, 0.6);
  border: 1px solid rgba(180, 150, 130, 0.3);
  color: #e8ddd0;
  padding: 10px 16px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  transition: all 0.3s ease;
}

.name-input::placeholder {
  color: rgba(180, 160, 120, 0.5);
}

.name-input:focus {
  outline: none;
  border-color: rgba(80, 130, 110, 0.6);
  box-shadow: 0 0 12px rgba(80, 130, 110, 0.35);
}

.name-input:disabled {
  opacity: 0.5;
}

/* ===== 14. 古风按钮 ===== */
.ancient-btn {
  padding: 10px 32px;
  border: 1px solid rgba(160, 40, 35, 0.6);
  background: radial-gradient(circle, rgba(20, 15, 10, 0.92), rgba(45, 25, 18, 0.88));
  color: #d4a574;
  cursor: pointer;
  border-radius: 4px;
  font-family: "STXingkai", "华文行楷", "Ma Shan Zheng", "KaiTi", "楷体", serif;
  font-size: 1.1rem;
  min-height: 44px;
  transition: all 0.3s ease;
  will-change: transform, opacity;
}

.ancient-btn:hover {
  border-color: rgba(190, 55, 45, 0.9);
  box-shadow: 0 0 20px rgba(190, 55, 45, 0.5);
  transform: scale(1.03);
}

.ancient-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ===== 15. 输入行 ===== */
.input-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ===== 16. 空山提示 ===== */
.kongshan-hint {
  margin-top: 1rem;
  color: rgba(180, 160, 120, 0.6);
  font-size: 0.9rem;
  min-height: 1.5em;
  font-style: italic;
}

/* ===== 17. 通用弹窗文字 ===== */
.modal-text {
  color: #e8ddd0;
  font-family: "Noto Serif SC", "KaiTi", "楷体", serif;
  font-size: clamp(1rem, 3vw, 1.25rem);
  line-height: 2;
  margin-bottom: 1.5rem;
  min-height: 3em;
}

/* ===== 17.1 通用弹窗按钮居中（scene2 进入按钮等） ===== */
#modal .modal-box {
  text-align: center;
}
#modal .modal-text {
  text-align: center;
}
#modal .ancient-btn {
  display: inline-block;
  width: auto;
}

/* ===== 18. 黑屏转场 ===== */
.transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===== 19. 响应式 ===== */
@media (max-width: 600px) {
  .modal-box {
    padding: 1.4rem 1.6rem;
  }

  .dialog-text,
  .modal-text {
    font-size: clamp(0.9rem, 4vw, 1.1rem);
    line-height: 1.85;
  }

  .door-hotzone {
    width: 78vw;
    height: 72vh;
    top: 10%;
  }

  .walk-btn {
    left: 8vw;
    right: 8vw;
    bottom: 4vh;
    width: calc(100vw - 16vw);
    font-size: 1.1rem;
    padding: 12px 20px;
  }

  .ancient-btn {
    width: 100%;
  }

  #modal .ancient-btn {
    width: auto;
  }

  .input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .input-row .name-input,
  .input-row .ancient-btn {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .modal-box {
    padding: 1rem 1.1rem;
  }

  .dialog-text,
  .modal-text {
    font-size: 0.85rem;
    line-height: 1.75;
  }

  .wuchang-img {
    max-height: 55vh;
  }

  .loading-text {
    letter-spacing: 0.2em;
  }
}

/* ===== 20. GPU 加速 ===== */
.wuchang-img,
.candle-flicker,
.scene-bg,
.intro-bg,
.loading-text,
.walk-btn,
.ancient-btn,
.transition-overlay {
  will-change: transform, opacity;
}

/* ===== 21. prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
