/* 《快乐》网页阅读 · 月亮夜主题 */
:root {
  --bg: #0d1220;
  --bg-2: #131a2c;
  --ink: #d9dce4;
  --ink-dim: #9aa1b5;
  --moon: #e8e4d6;
  --amber: #e6b870;   /* 旧咖啡店暖光 */
  --amber-dim: #a8834a;
  --dead: #b9a0ff;    /* 死词标记 */
  --line: #26304a;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- 封面 ---------- */
.cover {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.cover-bg {
  position: absolute; inset: -4%;
  background-size: cover; background-position: center;
  filter: blur(2px) brightness(.9);
  transform: scale(1.04);
}
.cover-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,18,32,.15) 0%, rgba(13,18,32,.75) 78%);
}
.cover-inner {
  position: relative; z-index: 2;
  text-align: center;
  padding: 0 24px;
  transform: translateY(-6vh);
}
.cover-title {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: .5em;
  text-indent: .5em;
  color: var(--moon);
  margin: 0 0 14px;
}
.cover-sub {
  font-size: 15px;
  letter-spacing: .35em;
  text-indent: .35em;
  color: var(--ink-dim);
  margin: 0 0 40px;
}
.btn-start {
  appearance: none;
  border: 1px solid var(--amber);
  color: var(--amber);
  background: transparent;
  padding: 12px 34px;
  font-size: 15px;
  letter-spacing: .3em;
  text-indent: .3em;
  font-family: inherit;
  border-radius: 2px;
  cursor: pointer;
  transition: all .3s;
}
.btn-start:hover { background: var(--amber); color: var(--bg); }
.btn-start.small { padding: 10px 24px; font-size: 13px; }

/* ---------- 阅读器 ---------- */
.reader { position: fixed; inset: 0; display: flex; flex-direction: column; }
.bar {
  height: 48px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: rgba(13,18,32,.9);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.bar-progress { flex: 1; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--amber); transition: width .2s; }
.icon-btn {
  appearance: none; border: none; background: none;
  color: var(--ink-dim); font-size: 17px; cursor: pointer;
  font-family: inherit; padding: 4px 6px;
}
.icon-btn:hover { color: var(--amber); }

.stage { flex: 1; display: flex; overflow: hidden; position: relative; }
.toc {
  width: 260px; max-width: 78%;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 24px 20px;
  position: absolute; left: 0; top: 0; z-index: 15;
  transform: translateX(-100%);
  transition: transform .25s ease;
}
.toc.open { transform: translateX(0); }
.toc-title {
  font-size: 14px; letter-spacing: .3em; text-indent: .3em;
  color: var(--ink-dim); margin: 0 0 16px;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 4px; }
.toc a {
  display: block; color: var(--ink); text-decoration: none;
  font-size: 14px; padding: 8px 10px; border-radius: 3px;
}
.toc a:hover { background: rgba(230,184,112,.08); color: var(--amber); }
.toc a.current { color: var(--amber); }
.toc-note { margin-top: 22px; font-size: 11px; color: var(--ink-dim); letter-spacing: .08em; }

#book { flex: 1; overflow-y: auto; padding: 40px 24px 90px; }
.chapter { max-width: 660px; margin: 0 auto; }
.chapter-head {
  text-align: center;
  margin: 30px 0 44px;
}
.chapter-head h1 {
  font-size: 30px; font-weight: 700;
  letter-spacing: .35em; text-indent: .35em;
  color: var(--moon); margin: 0 0 18px;
}
.chapter-head .divider { width: 42px; height: 1px; background: var(--amber-dim); margin: 0 auto; }
.chapter h2 {
  text-align: center; font-size: 19px; font-weight: 700;
  letter-spacing: .3em; text-indent: .3em; color: var(--moon);
  margin: 48px 0 24px;
}
.chapter h3 { font-size: 16px; color: var(--amber); margin: 28px 0 14px; }
.chapter p {
  margin: 0 0 1.4em;
  font-size: 17px; line-height: 2.05;
  text-indent: 2em;
  text-align: justify;
  color: var(--ink);
}
.chapter p.first { text-indent: 0; }
.chapter blockquote {
  margin: 34px 12px;
  padding: 22px 18px;
  border-left: 1px solid var(--amber-dim);
  font-family: "Kaiti SC", "STKaiti", "Kai", serif;
  color: var(--moon);
  font-size: 16px; line-height: 2.1;
  background: rgba(230,184,112,.04);
}
.chapter blockquote p { text-indent: 0; }
.chapter hr { border: none; text-align: center; margin: 34px 0; }
.chapter hr::after { content: "· · ·"; letter-spacing: .8em; color: var(--ink-dim); font-size: 13px; }
.chapter li { font-size: 17px; line-height: 2; margin-bottom: .6em; }

/* 死词 */
.deadword {
  color: var(--dead);
  text-decoration: underline dotted rgba(185,160,255,.55);
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color .2s;
}
.deadword:hover { color: #d7c8ff; }

.dead-tip {
  position: fixed; z-index: 40;
  max-width: 300px;
  background: #1a2236;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 13px; line-height: 1.9;
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.dead-tip .dt-word { color: var(--dead); font-weight: 700; letter-spacing: .2em; }
.dead-tip .dt-note { margin-top: 4px; color: var(--ink-dim); }
.dead-tip .dt-hint { margin-top: 8px; font-size: 11px; color: var(--amber-dim); }

/* 页脚导航 */
.foot {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  background: rgba(13,18,32,.95);
  border-top: 1px solid var(--line);
  position: relative; z-index: 20;
}
.nav-btn {
  appearance: none; border: none; background: none;
  color: var(--ink-dim); font-size: 14px; letter-spacing: .1em;
  font-family: inherit; cursor: pointer; padding: 8px 10px;
}
.nav-btn:hover { color: var(--amber); }
.nav-btn:disabled { opacity: .3; cursor: default; }
.pos-label { font-size: 11px; color: var(--ink-dim); letter-spacing: .1em; }

/* 终页 */
.finale {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg);
  text-align: center; padding: 0 24px;
}
.finale-script { font-size: 16px; line-height: 2.2; color: var(--ink-dim); margin: 0 0 36px; }
.finale-word {
  font-size: 72px; font-weight: 700; letter-spacing: .4em; text-indent: .4em;
  color: var(--moon); margin-bottom: 36px;
  animation: fadein 1.6s ease;
}
.finale-line { font-size: 14px; color: var(--amber); letter-spacing: .2em; margin: 0 0 44px; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 校准态：死词灰掉 ---------- */
body.calibrated .deadword {
  color: #4a5166;
  text-decoration: none;
  pointer-events: none;
  cursor: default;
}

/* ---------- 词库面板 ---------- */
.words {
  width: 280px; max-width: 82%;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  padding: 24px 20px;
  position: absolute; right: 0; top: 0; z-index: 15;
  transform: translateX(100%);
  transition: transform .25s ease;
}
.words.open { transform: translateX(0); }
.words-title {
  font-size: 14px; letter-spacing: .3em; text-indent: .3em;
  color: var(--ink-dim); margin: 0 0 6px;
}
.words-progress { font-size: 12px; color: var(--amber); margin: 0 0 16px; letter-spacing: .05em; }
.words-list { list-style: none; margin: 0; padding: 0; }
.words-list .word {
  padding: 9px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  background: rgba(255,255,255,.02);
  border: 1px solid transparent;
}
.words-list .word.has { border-color: rgba(185,160,255,.25); }
.w-name {
  display: inline-block;
  font-size: 15px; font-weight: 700;
  letter-spacing: .15em;
  color: var(--ink-dim);
  margin-right: 8px;
}
.word.has .w-name { color: var(--dead); }
.w-name.locked { color: var(--ink-dim); font-weight: 400; font-size: 13px; }
.w-note { font-size: 11.5px; color: var(--ink-dim); line-height: 1.7; }
.words-hint { margin-top: 16px; font-size: 11px; color: var(--amber-dim); line-height: 1.8; }
.words-reset {
  margin-top: 10px;
  appearance: none; border: 1px solid var(--amber-dim);
  background: none; color: var(--amber);
  font-family: inherit; font-size: 12px; padding: 7px 14px;
  border-radius: 2px; cursor: pointer; letter-spacing: .1em;
}
.words-reset:hover { background: var(--amber); color: var(--bg); }

/* ---------- 校准弹窗（光屏风） ---------- */
.calib {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6,9,18,.82);
  display: flex; align-items: center; justify-content: center;
  padding: 0 22px;
}
.calib-box {
  width: 100%; max-width: 360px;
  background: #0f1526;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 30px 26px 24px;
  text-align: center;
  box-shadow: 0 20px 70px rgba(0,0,0,.6);
}
.calib-head {
  font-size: 15px; letter-spacing: .2em;
  color: var(--amber); margin: 0 0 8px;
}
.calib-body { font-size: 13px; color: var(--ink-dim); margin: 0 0 24px; }
.calib-btns { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; }
.calib-btn {
  flex: 1;
  appearance: none;
  border: 1px solid var(--amber);
  background: transparent; color: var(--amber);
  font-family: inherit; font-size: 14px;
  letter-spacing: .3em; text-indent: .3em;
  padding: 10px 0; border-radius: 3px; cursor: pointer;
}
.calib-btn:hover { background: var(--amber); color: var(--bg); }
.calib-btn.alt { border-color: var(--line); color: var(--ink-dim); }
.calib-btn.alt:hover { background: var(--line); color: var(--ink); }
.calib-sub { font-size: 10.5px; color: #565f78; line-height: 1.8; margin: 0; }

/* ---------- 终页命名 ---------- */
.finale-name {
  margin: 30px 0 26px;
  max-width: 320px; width: 100%;
}
.finale-ask {
  font-size: 14px; color: var(--ink-dim);
  letter-spacing: .12em; margin: 0 0 14px;
}
.name-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--amber-dim);
  color: var(--moon);
  font-family: inherit;
  font-size: 20px; text-align: center;
  letter-spacing: .3em; text-indent: .3em;
  padding: 8px 0;
  outline: none;
  margin-bottom: 16px;
}
.name-input::placeholder { color: #3c4560; font-size: 13px; letter-spacing: .1em; }
.name-count { font-size: 12px; color: var(--amber); margin: 14px 0 6px; letter-spacing: .05em; }
.name-board { font-size: 13px; color: var(--ink-dim); line-height: 2.2; min-height: 2.2em; }
.replay { margin-top: 8px; }

/* 移动端 */
@media (max-width: 480px) {
  .cover-title { font-size: 44px; }
  .chapter { padding-top: 10px; }
  .chapter p { font-size: 16px; }
  .chapter-head h1 { font-size: 24px; }
}
