:root {
  --bg: #07070a;
  --fg: #cfcfd6;
  --dim: #6a6a76;
  --accent: #b89b5e;
  --blood: #7a1f1f;
  --glow: rgba(184,155,94,0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  line-height: 2;
  letter-spacing: 0.06em;
  overflow-x: hidden;
  transition: background 2.5s ease, color 2.5s ease;
}

/* 暗角 */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0.35) 18%,
    rgba(0,0,0,0.68) 62%,
    rgba(0,0,0,0.99) 100%);
  transition: background 2.5s ease;
}

/* 序幕 */
#intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.title {
  font-size: clamp(3rem, 14vw, 7rem);
  font-weight: 400;
  letter-spacing: 0.4em;
  color: var(--fg);
  text-shadow: 0 0 24px var(--glow);
  animation: flicker 6s infinite;
}

.subtitle {
  margin-top: 1.5rem;
  font-size: clamp(0.9rem, 3.4vw, 1.1rem);
  color: var(--dim);
  letter-spacing: 0.3em;
}

.hint {
  position: absolute;
  bottom: 3rem;
  font-size: 0.8rem;
  color: var(--dim);
  letter-spacing: 0.3em;
  animation: breathe 3s infinite;
}

/* 幕 */
.act {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18vh 10vw;
  max-width: 820px;
  margin: 0 auto;
}

.act-title {
  font-size: clamp(1.3rem, 5vw, 2rem);
  font-weight: 400;
  color: var(--accent);
  margin-bottom: 3rem;
  letter-spacing: 0.25em;
}

.act p {
  font-size: clamp(1rem, 4.2vw, 1.25rem);
  margin-bottom: 1.4rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.4s ease, transform 1.4s ease;
}

.act p.show {
  opacity: 1;
  transform: translateY(0);
}

/* 终章 */
#outro {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.endline {
  font-size: clamp(1.2rem, 5.5vw, 2rem);
  letter-spacing: 0.2em;
  color: var(--dim);
  opacity: 0;
  transition: opacity 3s ease;
}

.endline.show { opacity: 1; }

/* 进度条 */
#progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.05);
  z-index: 1000;
}

#progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--blood));
  transition: width 0.15s linear;
}

/* 色调状态 */
body.mood-dawn  { background: #0a0a0f; }
body.mood-dusk  { background: #0b0708; }
body.mood-blood { background: #0d0505; }
body.mood-void  { background: #020203; }
body.mood-void  { --fg: #8a8a92; --accent: #4a4a52; }

body.mood-blood #vignette {
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0) 30%,
    rgba(40,0,0,0.5) 70%,
    rgba(0,0,0,0.98) 100%);
}
body.mood-void #vignette {
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0.3) 0%,
    rgba(0,0,0,0.9) 60%,
    #000 100%);
}


/* 第一章模式：隐藏序章界面 */
body.chapter1-mode #game,
body.chapter1-mode #memory,
body.chapter1-mode #ending,
body.chapter1-mode #narration,
body.chapter1-mode #hud {
  display: none !important;
}
body.chapter1-mode 


/* 内容层浮于字符背景之上 */
#game, #chapter1, #menu, #ending { position: relative; z-index: 2; }

#progress { z-index: 1300; }

/* ============================================================
   让菜单/章节背景半透明, 透出底层字符
   ============================================================ */
#menu {
  background: radial-gradient(ellipse at 50% 40%,
    rgba(10,10,20,0.72) 0%, rgba(2,2,4,0.9) 78%) !important;
}
#chapter1 {
  background: rgba(2,2,3,0.82) !important;
}
#game {
  background: transparent !important;
}
#ending {
  background: rgba(2,2,3,0.94) !important;
}

/* 背景层明确固定在所有内容之下 */
#bg-layer {
  z-index: 0 !important;
}
#menu, #game, #chapter1 { z-index: 10 !important; }

/* 菜单模式下, 暗角让位于菜单 */
body.menu-open #vignette { opacity: 0 !important; }


/* 全局禁止文字选中 —— 避免触发系统输入法报错 */
body, .token, .c1-cell, .c1-narr, .menu-btn, #ending, .c2-char, .c2-npc {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 错误栏改成顶部小标签, 不挡方向键 */
#errbox {
}

/* ---------- 氛围灯过渡（body 底色渐变） ---------- */
body { transition: background-color 1.8s ease; }

/* ---------- 章节容器淡入 ---------- */
@keyframes chapter-fade-in {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
body.chapter1-mode #chapter1,
body.chapter2-mode #chapter2 {
  animation: chapter-fade-in 1.2s ease both;
}
