* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0d10; }
body {
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "PingFang SC", serif;
  color: #f2ead8;
  -webkit-font-smoothing: antialiased;
}
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; }

/* 暗角 */
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(10, 12, 16, 0.42) 100%);
}

/* 标题卡 */
#title-card {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
  opacity: 0; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}
#title-main {
  font-size: clamp(52px, 10vw, 110px); letter-spacing: 0.42em;
  margin-left: 0.42em; /* 平衡字间距 */
}
#title-sub {
  margin-top: 14px; font-size: clamp(16px, 2.4vw, 26px);
  letter-spacing: 0.6em; margin-left: 0.6em; opacity: 0.85;
}

/* 章节标签 */
#chapter-tag {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  font-size: 15px; letter-spacing: 0.5em; margin-left: 0.5em;
  color: rgba(242, 234, 216, 0.8); text-shadow: 0 1px 8px rgba(0,0,0,0.6);
  transition: opacity 0.5s ease; pointer-events: none;
}

/* 字幕 */
#subtitle {
  position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%);
  max-width: min(86vw, 980px); text-align: center;
  font-size: clamp(18px, 2.6vw, 27px); line-height: 1.75;
  letter-spacing: 0.18em; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
  color: #f7f0de; pointer-events: none;
}

/* 观察模式提示 */
#hint-free {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%);
  font-size: 13px; letter-spacing: 0.2em; color: rgba(247, 240, 222, 0.75);
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
  transition: opacity 0.4s ease; opacity: 0; pointer-events: none;
}

/* 闪白（豁然开朗） */
#flash {
  position: absolute; inset: 0; background: #fffdf4; opacity: 0; pointer-events: none;
}

/* 结尾卡 */
#end-card {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: rgba(5, 6, 8, 0.94); opacity: 0; pointer-events: none;
  transition: opacity 1.4s ease;
}
#end-text { font-size: clamp(24px, 4vw, 40px); letter-spacing: 0.3em; margin-left: 0.3em; }
#end-fin { font-size: clamp(15px, 2vw, 22px); letter-spacing: 0.5em; margin-left: 0.5em; opacity: 0.7; }
#btn-replay {
  margin-top: 14px; padding: 12px 44px; font-size: 17px; letter-spacing: 0.3em;
  font-family: inherit; color: #f2ead8; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(242, 234, 216, 0.4); border-radius: 4px; cursor: pointer;
  transition: all 0.25s ease;
}
#btn-replay:hover { background: rgba(255,255,255,0.16); }

/* 控制条 */
#controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px 14px;
  background: linear-gradient(to top, rgba(6, 8, 10, 0.82), rgba(6, 8, 10, 0));
  pointer-events: none;
}
#controls > * { pointer-events: auto; }

#controls button {
  min-width: 40px; height: 36px; padding: 0 10px; font-size: 16px;
  font-family: inherit; color: #f2ead8; background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(242, 234, 216, 0.25); border-radius: 5px;
  cursor: pointer; transition: background 0.2s ease;
  white-space: nowrap;
}
#controls button:hover { background: rgba(255, 255, 255, 0.18); }

#progress-wrap { position: relative; flex: 1; min-width: 120px; height: 26px; }
#progress-zones { position: absolute; inset: 8px 0; pointer-events: none; }
#progress-zones .zone {
  position: absolute; top: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.08); border-left: 1px solid rgba(255,255,255,0.18);
}
#progress-zones .zone:first-child { border-left: none; border-radius: 3px 0 0 3px; }
#progress-zones .zone:last-child { border-radius: 0 3px 3px 0; }
#progress {
  position: absolute; inset: 0; width: 100%; margin: 0;
  appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer;
}
#progress::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.18);
}
#progress::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  margin-top: -4.5px; background: #f2ead8; box-shadow: 0 1px 6px rgba(0,0,0,0.6);
}
#time-label {
  font-size: 13px; letter-spacing: 0.08em; color: rgba(242, 234, 216, 0.85);
  min-width: 118px; text-align: center;
}

#chapters { display: flex; gap: 4px; overflow-x: auto; max-width: 34vw; }
#chapters .chap {
  min-width: auto; height: 30px; padding: 0 9px; font-size: 12.5px;
  letter-spacing: 0.05em; opacity: 0.7;
}
#chapters .chap.active {
  background: rgba(242, 234, 216, 0.28); opacity: 1;
  border-color: rgba(242, 234, 216, 0.6);
}

@media (max-width: 900px) {
  #chapters { max-width: 40vw; }
  #controls { flex-wrap: wrap; }
  #subtitle { bottom: 120px; }
}
