/* 阅读页 */
/* 翻章要立刻到位：全站平滑滚动会让长章节的回顶滑行好几秒，看着像按钮失灵 */
html { scroll-behavior: auto }
.rd-top {
  position: fixed; inset: 0 0 auto 0; height: var(--head-h); z-index: 60;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  transition: transform .28s ease, opacity .28s ease;
}
html.no-topbar .rd-top { transform: translateY(-100%); opacity: .02; pointer-events: none }
html.no-topbar .rd-bar { transform: translateY(120%) }
.rd-top .bk { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; color: var(--ink-2); font-size: 13px }
.rd-top .bk:hover { background: var(--paper-2); color: var(--ink) }
.rd-title { font-family: var(--serif); font-size: 15px; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw }
.rd-ch { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
@media (max-width: 640px) { .rd-ch { display: none } }
.rd-prog { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--accent); width: 0; transition: width .12s linear }
.rd-top .act { display: flex; gap: 4px; margin-left: auto }

.sheet { position: fixed; inset: 0; z-index: 95; pointer-events: none }
.sheet-in {
  position: absolute; top: 0; right: 0; bottom: 0; width: 330px; max-width: 88vw;
  background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.7,.3,1);
}
.sheet.on { pointer-events: auto }
.sheet.on .sheet-in { transform: none }
.sheet-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); font-family: var(--serif) }
.sheet-h .spacer { flex: 1 }
.toc { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 0 40px; flex: 1 }
.toc a {
  display: block; padding: 8px 18px; font-size: 13.5px; color: var(--ink-2); border-left: 2px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toc a:hover { color: var(--ink); background: var(--paper-2) }
.toc a.on { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft) }
.toc a.lv2 { padding-left: 34px; font-size: 13px; opacity: .92 }
.toc a.lv3 { padding-left: 48px; font-size: 12.5px; opacity: .8 }
.toc-search { padding: 10px 16px; border-bottom: 1px solid var(--line-2) }
.toc-count { font-size: 12px; color: var(--ink-3); padding: 6px 18px 2px }

/* 正文 */
.rd-body { padding: calc(var(--head-h) + 26px) 18px 120px }
.rd-art { margin: 0 auto; max-width: var(--rdw, 720px) }
.rd-head { margin: 0 0 30px; padding-bottom: 18px; border-bottom: 1px solid var(--line) }
.rd-head .w { font-size: 12.5px; color: var(--ink-3); letter-spacing: 1px; margin-bottom: 6px }
.rd-head h1 { font-family: var(--serif); font-size: 1.5em; line-height: 1.4; margin: 0 0 8px; font-weight: 600 }
.rd-head .sub { color: var(--ink-2); font-size: .92em }
.rd-text { font-size: calc(var(--rdf, 19) * 1px); line-height: var(--rdlh, 1.9); color: var(--ink) }
.rd-text p { margin: 0 0 var(--rdgap, 1em); text-align: justify; text-justify: inter-ideograph }
.rd-text p.indent { text-indent: 2em }
/* 正文中的小标题（由构建脚本从段落中识别并提升） */
.rd-text h2.rd-h {
  font-family: var(--serif); font-size: 1.08em; font-weight: 600; line-height: 1.5;
  margin: 1.9em 0 .9em; padding-left: 11px; border-left: 3px solid var(--accent);
  text-align: left; text-indent: 0; letter-spacing: .3px; scroll-margin-top: 80px;
}
.rd-text h2.rd-h:first-child { margin-top: 0 }
/* 表格行（Word 表格里的分镜表、人物表、场景表，每行压成一段） */
.rd-text p.rd-row {
  font-family: var(--sans); font-size: .82em; line-height: 1.7; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 13px; margin: 0 0 6px; text-align: left; text-indent: 0;
  word-break: break-word;
}
.rd-text p.rd-row + p.rd-row { margin-top: -2px }
.rd-text.no-justify p { text-align: left }
.rd-text.sans { font-family: var(--sans) }
.rd-text.serif { font-family: var(--serif) }
.rd-note { font-size: 13px; color: var(--ink-3); margin-top: 26px }
.rd-nav { display: flex; gap: 10px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line) }
.rd-nav a { flex: 1; text-align: center; padding: 12px 10px; border: 1px solid var(--line); border-radius: var(--r-s); font-size: 13.5px; color: var(--ink-2); background: var(--card) }
.rd-nav a:hover { color: var(--ink); border-color: var(--ink-3) }
.rd-nav a.dis { opacity: .4; pointer-events: none }

/* 底栏 */
.rd-bar {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 55;
  display: flex; align-items: center; gap: 4px; padding: 6px 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg);
  transition: transform .28s ease;
}
.rd-bar button, .rd-bar a.rb { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--ink-2) }
.rd-bar button:hover, .rd-bar a.rb:hover { background: var(--paper-2); color: var(--ink) }
.rd-bar button.on { color: var(--accent); background: var(--accent-soft) }
.rd-bar button.dis, .rd-bar a.rb.dis { opacity: .32; pointer-events: none }
.rd-bar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px }
.rd-bar .pc { font-size: 12px; color: var(--ink-3); padding: 0 6px; min-width: 40px; text-align: center }

/* 设置面板 */
.opts {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%) translateY(10px); z-index: 58;
  width: min(420px, 92vw); background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 14px 16px; opacity: 0; pointer-events: none; transition: .2s ease;
}
.opts.on { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0) }
.opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px }
.opt-row:last-child { margin-bottom: 0 }
.opt-row .k { width: 52px; font-size: 12.5px; color: var(--ink-2); flex: none }
.seg { display: flex; gap: 4px; flex: 1 }
.seg button { flex: 1; padding: 7px 4px; font-size: 12.5px; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; cursor: pointer; color: var(--ink-2) }
.seg button.on { background: var(--ink); color: var(--paper); border-color: var(--ink) }
.slider { flex: 1; -webkit-appearance: none; appearance: none; height: 3px; background: var(--line); border-radius: 2px; outline: none }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.2) }
.slider::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--card); border-radius: 50%; background: var(--accent); cursor: pointer }

/* 章节首屏淡入 */
.rd-fade { animation: rdfade .38s ease both }
@keyframes rdfade { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
html.rd-static .rd-fade { animation: none }

/* 提示浮层：点击屏中央 */
.ui-hint {
  position: fixed; left: 50%; top: calc(var(--head-h) + 12px); transform: translate(-50%,-8px); z-index: 80;
  background: var(--ink); color: var(--paper); font-size: 12.5px; padding: 6px 14px; border-radius: 999px;
  opacity: 0; transition: .25s; pointer-events: none;
}
.ui-hint.on { opacity: .92; transform: translate(-50%, 0) }
