/* 番茄小说个人阅读站 v1 — 样式：参考起点中文网网页版阅读器（只要版式，不要广告/登录） */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --accent: #c0392b;          /* 番茄红 */
  --accent-soft: rgba(192, 57, 43, .08);
  --radius: 10px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--page-bg, #f2f2f2);
  color: var(--text, #1a1a1a);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

/* ---------- 主题（阅读页）：白底 / 米色护眼 / 夜间 ---------- */
body[data-theme="white"]  { --page-bg: #f0f0f0; --paper: #ffffff; --text: #1a1a1a; --muted: #8a8a8a; --line: #e6e6e6; --bubble-bg: #f5f5f5; }
body[data-theme="gray"]   { --page-bg: #e8e8e8; --paper: #f5f5f5; --text: #333333; --muted: #888888; --line: #dddddd; --bubble-bg: #ececec; }
body[data-theme="beige"]  { --page-bg: #e9e2cf; --paper: #faf6e9; --text: #433d2b; --muted: #9a8f74; --line: #e2d9bf; --bubble-bg: #f1ebda; }
body[data-theme="night"]  { --page-bg: #161616; --paper: #222222; --text: #b3b3b3; --muted: #777777; --line: #333333; --bubble-bg: #2c2c2c; }
body[data-theme="yellow"] { --page-bg: #ece5cd; --paper: #fdf6dc; --text: #4a4433; --muted: #9a8f74; --line: #e5dcbb; --bubble-bg: #f4eed2; }
body[data-theme="green"]  { --page-bg: #dbe7d2; --paper: #eaf5e3; --text: #37422f; --muted: #7d8a72; --line: #cfdcc2; --bubble-bg: #dfeeda; }
body[data-theme="blue"]   { --page-bg: #d7e1ea; --paper: #e8f1f8; --text: #33414f; --muted: #7d8ea0; --line: #c9d8e6; --bubble-bg: #dce9f3; }
body[data-theme="white"], body[data-theme="beige"], body[data-theme="night"], body[data-theme="yellow"], body[data-theme="green"], body[data-theme="blue"], body[data-theme="gray"] { background: var(--page-bg); }

/* ---------- 通用顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper, #fff);
  border-bottom: 1px solid var(--line, #e6e6e6);
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.topbar-inner {
  max-width: 1060px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 800; color: var(--accent); white-space: nowrap; }
/* 品牌也是 <a>，全站 a:hover 会加下划线；这里所有状态都明确去掉 */
.brand, .brand:hover, .brand:active, .brand:focus, .brand:visited { text-decoration: none; }
.brand small { font-size: 12px; color: var(--muted, #8a8a8a); font-weight: 400; margin-left: 6px; }
.topbar .spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 13px; border: 1px solid var(--line, #ddd); border-radius: 999px;
  background: var(--paper, #fff); color: var(--text, #1a1a1a); font-size: 14px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { color: #fff; opacity: .9; }
.btn:disabled { opacity: .4; cursor: default; }
/* .btn 的 display:inline-flex 会盖掉 hidden 属性（退出/登录按钮、二维码刷新按钮
   的显隐都靠 hidden），必须显式让 hidden 生效 */
.btn[hidden] { display: none; }
.btn.settings-btn {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 700; box-shadow: 0 2px 8px rgba(192,57,43,.35);
}
.btn.settings-btn:hover { color: #fff; opacity: .92; }

/* ---------- 首页 ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 20px 16px 60px; }
.search-box { display: flex; gap: 8px; margin: 18px 0 8px; }
.search-box input {
  flex: 1; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line, #ddd); border-radius: var(--radius);
  background: var(--paper, #fff); color: var(--text, #1a1a1a); outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box button {
  padding: 0 22px; border: none; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 16px;
}
.hint { color: var(--muted, #8a8a8a); font-size: 13px; margin: 6px 0 18px; }
.section-title { font-size: 17px; font-weight: 700; margin: 26px 0 12px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.book-card {
  display: flex; gap: 12px; padding: 12px;
  background: var(--paper, #fff); border: 1px solid var(--line, #e6e6e6);
  border-radius: var(--radius); cursor: pointer;
}
.book-card:hover { border-color: var(--accent); }
.book-card img { width: 64px; height: 86px; object-fit: cover; border-radius: 6px; background: #ddd; flex: none; }
.book-card .info { min-width: 0; }
.book-card .title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card .meta { font-size: 13px; color: var(--muted, #8a8a8a); margin: 4px 0; }
.book-card .abs { font-size: 13px; color: var(--muted, #8a8a8a); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shelf-item { display: flex; gap: 12px; align-items: center; padding: 12px;
  background: var(--paper, #fff); border: 1px solid var(--line, #e6e6e6); border-radius: var(--radius); margin-bottom: 10px; }
.shelf-item img { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; background: #ddd; flex: none; }
.shelf-item .info { flex: 1; min-width: 0; }
.shelf-item .title { font-size: 16px; font-weight: 700; }
.shelf-item .sub { font-size: 13px; color: var(--muted, #8a8a8a); margin-top: 3px; }
.empty { color: var(--muted, #8a8a8a); font-size: 14px; padding: 14px 0; }
.error { color: #c0392b; background: rgba(192,57,43,.08); border: 1px solid rgba(192,57,43,.25);
  padding: 10px 12px; border-radius: var(--radius); font-size: 14px; margin: 12px 0; }
.loading { color: var(--muted, #8a8a8a); font-size: 14px; padding: 16px 0; text-align: center; }

/* ---------- 书籍页 ---------- */
.book-head { display: flex; gap: 18px; padding: 20px; background: var(--paper, #fff);
  border: 1px solid var(--line, #e6e6e6); border-radius: var(--radius); }
.book-head img { width: 120px; height: 160px; object-fit: cover; border-radius: 8px; background: #ddd; flex: none; }
.book-head .title { font-size: 22px; font-weight: 800; }
.book-head .meta { font-size: 14px; color: var(--muted, #8a8a8a); margin: 8px 0; line-height: 1.7; }
.book-head .abs { font-size: 14px; line-height: 1.8; color: var(--text, #1a1a1a); }
.book-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; margin: 22px 0 0; border-bottom: 1px solid var(--line, #e6e6e6); }
.tabs button { padding: 10px 16px; border: none; background: none; font-size: 15px; color: var(--muted, #8a8a8a); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.volume { margin: 16px 0; }
.volume h3 { font-size: 15px; color: var(--muted, #8a8a8a); margin-bottom: 8px; cursor: pointer; }
.chapter-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; }
.chapter-list li a { display: block; padding: 7px 8px; font-size: 14px; color: var(--text, #1a1a1a);
  border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-list li a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.review { padding: 14px 0; border-bottom: 1px solid var(--line, #e6e6e6); }
.review .rhead { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted, #8a8a8a); }
.review .rhead .stars { color: #e6a817; letter-spacing: 1px; }
.review .rtext { font-size: 15px; line-height: 1.7; margin-top: 6px; }
.review .rfoot { font-size: 12px; color: var(--muted, #8a8a8a); margin-top: 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #ccc; flex: none; }
.avatar-fallback { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }

/* ---------- 阅读页 ---------- */
.reader-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* 正文块是整块阅读区的一节（不再是单独的圆角卡片）：无圆角、无阴影、无单独底色，
   跟书卡/横幅共用 .reader-col 的纸色；顶部只留一条横线跟横幅分隔 */
.reader {
  max-width: var(--reader-width, 760px);
  margin: 0 auto 40px; padding: 24px 48px 48px;
  border-top: 1px solid var(--line, #e6e6e6);
}
.reader h1.chapter-title {
  text-align: center; font-size: calc(var(--reader-size, 18px) + 6px);
  font-weight: 800; margin-bottom: 8px; line-height: 1.4;
}
.reader .chapter-sub { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.reader .chapter-sub .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.reader .chapter-sub .meta-ico { flex: none; vertical-align: -2px; }
.reader .chapter-sub .meta-sep { color: var(--muted); }
.reader .para {
  font-family: var(--reader-font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif);
  font-size: var(--reader-size, 18px);
  line-height: var(--reader-lineheight, 1.9);
  margin-bottom: calc(var(--reader-lineheight, 1.9) * 0.55em);
  text-indent: 2em;
  word-break: break-word;
}
.reader .para .bubble {
  display: inline-block; vertical-align: middle; margin-left: 8px; text-indent: 0;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bubble-bg); color: var(--muted); font-size: 12px; line-height: 1.6;
}
.reader .para .bubble:hover { border-color: var(--accent); color: var(--accent); }
.reader .para .bubble.has-many { color: var(--accent); border-color: rgba(192,57,43,.4); }
.reader-nav { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 10px 0 30px; }
/* 章末三段导航条（起点式）：上一章 | 目录 | 下一章，等宽三段，竖线分隔 */
.reader-nav .nav-bar { display: flex; width: 100%; background: var(--paper); border: 1px solid var(--line, #e6e6e6); border-radius: 10px; overflow: hidden; }
.reader-nav .nav-bar button, .reader-nav .nav-bar a { flex: 1; min-width: 0; padding: 13px 0; border: none; background: none; color: var(--text, #1a1a1a); font-size: 15px; text-align: center; cursor: pointer; text-decoration: none; }
.reader-nav .nav-bar button:hover, .reader-nav .nav-bar a:hover { color: var(--accent); text-decoration: none; }
.reader-nav .nav-bar button:disabled { opacity: .35; cursor: default; }
.reader-nav .nav-bar button + button, .reader-nav .nav-bar button + a, .reader-nav .nav-bar a + button { border-left: 1px solid var(--line, #e6e6e6); }
.reader-nav .sync-mini { padding: 8px 18px; font-size: 13px; }

/* ---------- 面包屑 + 书籍信息卡 + 讨论热烈横幅（起点式） ---------- */
.crumb { font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); text-decoration: none; }
.crumb a:last-child { color: var(--text); font-weight: 700; }
.crumb .crumb-sep { margin: 0 8px; color: var(--muted); }
/* 书籍信息是整块阅读区的第一节（不再是单独的圆角卡片）：无边框、无圆角、无阴影、无单独底色，
   跟正文共用 .reader-col 的纸色；顶上就是首栏的底边横线，不再另画线、不留空隙 */
.book-info-card {
  position: relative; display: flex; gap: 16px; margin-top: 0; padding: 20px;
}
.bi-cover { width: 84px; height: 112px; object-fit: cover; border-radius: 8px; background: #ddd; flex: none; }
.bi-main { flex: 1; min-width: 0; }
.bi-title { font-size: 20px; font-weight: 800; line-height: 1.3; }
.bi-author { font-size: 14px; color: var(--muted); margin-top: 6px; }
.bi-cols { display: flex; gap: 0; margin-top: 14px; }
.bi-col { flex: 1; min-width: 0; padding: 0 12px; border-left: 1px solid var(--line, #e6e6e6); }
.bi-col:first-child { padding-left: 0; border-left: none; }
.bi-col-k { display: block; font-size: 12px; color: var(--muted); }
.bi-col-v { display: block; font-size: 15px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-journey { font-size: 13px; color: var(--muted); margin-top: 12px; line-height: 1.6; }
.bi-tags { font-size: 12px; color: var(--muted); margin-top: 6px; }
.bi-copy { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.6; padding-right: 28px; }
.bi-bookmark { position: absolute; right: 14px; bottom: 14px; border: none; background: none; font-size: 20px; cursor: pointer; opacity: .7; }
.bi-bookmark:hover { opacity: 1; }
/* 讨论热烈横幅是整块阅读区的一节：无边框、无圆角、无单独底色，只留一条顶边横线跟书卡分隔 */
.hot-banner { display: flex; align-items: center; gap: 8px; margin-top: 0; padding: 10px 16px;
  border-top: 1px solid var(--line, #e6e6e6);
  font-size: 14px; color: var(--text); }
.hot-banner[hidden] { display: none; }
.hot-banner .hot-ico { font-size: 16px; }

/* ---------- 阅读页首栏：只在滑到顶时出现，其他时候上滑也不出现 ---------- */
/* 首栏底色只落在正文列宽里：.topbar 本身用页边底色（--page-bg），纸色只给里面的
   .topbar-inner 和 .crumb，这样首栏左右的页边跟下面的页边是同一个底色、竖向统一，
   而首栏内容（品牌行 + 面包屑行）跟正文是一整块纸色 */
body.reader-page .topbar { transition: transform .25s ease; background: var(--page-bg); border-bottom: none; box-shadow: none; }
body.reader-page .topbar-inner { max-width: var(--reader-width, 760px); padding: 10px 48px; background: var(--paper); }
@media (max-width: 640px) {
  body.reader-page .topbar-inner { padding: 10px 20px; }
}
/* 面包屑是首栏里单独的一栏：比原来放大（13px → 15px），上下留出行高，
   跟品牌行之间用一条横线隔开，底边再画一条横线跟正文分隔；
   跟 .topbar-inner 同宽同缩进，文字跟品牌对齐；书名没加载出来前先占位，避免首栏高度跳变 */
body.reader-page .topbar .crumb { max-width: var(--reader-width, 760px); margin: 0 auto; padding: 8px 48px 10px; font-size: 15px; background: var(--paper); border-top: 1px solid var(--line, #e6e6e6); border-bottom: 1px solid var(--line, #e6e6e6); }
body.reader-page .topbar .crumb[hidden] { display: block; visibility: hidden; }
@media (max-width: 640px) {
  body.reader-page .topbar .crumb { padding: 8px 20px 8px; }
}
/* 窄屏首栏是 fixed 单行：面包屑在窄屏不显示，避免首栏变高盖住正文；
   品牌行自己带底边横线跟正文分隔（面包屑那条线窄屏没有） */
@media (max-width: 1180px) {
  body.reader-page .topbar .crumb,
  body.reader-page .topbar .crumb[hidden] { display: none; }
  body.reader-page .topbar-inner { border-bottom: 1px solid var(--line, #e6e6e6); }
}
.topbar-account { font-size: 14px; color: var(--muted, #8a8a8a); white-space: nowrap; }
body.reader-page.topbar-hidden .topbar { transform: translateY(-100%); }

/* ---------- 右侧控件组：图标翻章按钮 + 悬浮工具栏（起点式，宽屏才显示） ---------- */
/* 右侧群组贴着正文/段评区（JS 按正文或段评面板的右缘定 right）；right:16px 只是 JS 未跑时的兜底 */
.side-cluster { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column; gap: 10px; align-items: center; transition: right .2s ease; }
/* 工具栏：一个按钮一个容器（每个按钮自己是带边框圆角的独立小方块，之间留空隙，不用分隔线） */
.side-toolbar { display: flex; flex-direction: column; width: 68px; gap: 10px; }
.tool-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 68px; height: 68px; padding: 0; border: 1px solid var(--line, #e6e6e6); border-radius: 12px; background: var(--paper, #fff); box-shadow: 0 2px 10px rgba(0,0,0,.08); color: var(--text, #1a1a1a); font-size: 12px; cursor: pointer; }
.tool-btn:hover { border-color: var(--accent); color: var(--accent); }
.tool-btn.active { color: var(--accent); }
/* 工具栏拖动排序：拖起的按钮半透明，目标位置上方/下方出现一条红线 */
.tool-btn.dragging { opacity: .45; }
.tool-btn.drop-before { box-shadow: 0 2px 10px rgba(0,0,0,.08), 0 -3px 0 0 var(--accent, #e4393c); }
.tool-btn.drop-after { box-shadow: 0 2px 10px rgba(0,0,0,.08), 0 3px 0 0 var(--accent, #e4393c); }
/* 起点式线形图标：23px 细线 SVG，跟着按钮颜色走（active 时变红） */
.tool-btn .t-ico { line-height: 1; display: flex; align-items: center; justify-content: center; }
.tool-btn .t-ico svg { width: 23px; height: 23px; display: block; }
.tool-btn .t-txt { line-height: 1; white-space: nowrap; }
/* 夜间/日间图标切换：月亮、太阳两副 SVG 都在，靠 active 显隐（JS 不再改 textContent） */
.tool-btn .t-ico .ico-sun { display: none; }
.tool-btn.active .t-ico .ico-sun { display: block; }
.tool-btn.active .t-ico .ico-moon { display: none; }
/* 回到顶部：跟工具栏同宽的纸面小方块，图标在上、“顶部”在下，滚下去才出现 */
.side-top { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 68px; height: 64px; padding: 0; flex: none; background: var(--paper, #fff); color: var(--text, #1a1a1a); border: 1px solid var(--line, #e6e6e6); border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.08); font-size: 12px; line-height: 1; cursor: pointer; }
.side-top .t-ico { line-height: 1; display: flex; align-items: center; justify-content: center; }
.side-top .t-ico svg { width: 22px; height: 22px; display: block; }
.side-top .t-txt { line-height: 1; white-space: nowrap; }
.side-top:hover { border-color: var(--accent); color: var(--accent); }
.side-top[hidden] { display: none; }
@media (max-width: 1180px) {
  .side-cluster { display: none; }
  /* 窄屏：章末导航栏由底部呼出栏代替 */
  #bottomNav { display: none; }
  /* 窄屏：点段落文字不再打开段评（只点气泡才开） */
  .reader .para.has-comments { cursor: default; }
}
/* 宽屏：目录是起点式居中大面板（不是贴工具栏按钮的浮层）：屏幕正中 840px 宽，
   高最多 80vh，内部滚动；位置由 CSS 居中定，JS 不再定位它 */
@media (min-width: 1181px) {
  #catalogDrawer {
    left: 50%; top: 50%; right: auto; bottom: auto;
    transform: translate(-50%, -50%);
    width: min(840px, 92vw); max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,.25);
  }
  /* 居中面板高度由内容定、上限 80vh：首栏不压缩、列表区可缩才能内部滚动 */
  #catalogDrawer header { flex: none; }
  #catalogDrawer .drawer-body { min-height: 0; }
}

/* 续在下面的章节（滚动翻页）：跟上一章之间画一条明显的分界线 */
.chapter-block + .chapter-block {
  margin-top: 40px;
  padding-top: 36px;
  border-top: 2px solid var(--line, #e6e6e6);
}

/* ---------- 窄屏呼出式工具栏（官方 App 式）：点正文中间呼出/收起 ---------- */
.mobile-bar { display: none; }
@media (max-width: 1180px) {
  .mobile-bar {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: var(--paper, #fff); color: var(--text, #1a1a1a);
    border-top: 1px solid var(--line, #e6e6e6);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    transition: transform .25s ease;
  }
  /* 收起时：底部栏滑下去，首栏滑上去 */
  body.chrome-hidden .mobile-bar { transform: translateY(110%); }
  body.chrome-hidden .topbar { transform: translateY(-100%); }
  .m-nav { display: flex; align-items: center; gap: 12px; }
  .m-btn { background: none; border: none; color: var(--text, #1a1a1a); font-size: 15px; padding: 4px 2px; white-space: nowrap; }
  .m-btn:disabled { opacity: .35; }
  #mSlider { flex: 1; accent-color: var(--accent); min-width: 0; }
  .m-page { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .m-tools { display: flex; justify-content: space-around; margin-top: 12px; }
  .m-tool { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; color: var(--text, #1a1a1a); font-size: 12px; padding: 2px 8px; }
  .m-tool.active { color: var(--accent); }
  .m-tool .m-ico { font-size: 20px; line-height: 1; }
  /* 窄屏首栏改 fixed：收起时不占地方，标题上方的空白跟着消失 */
  body.reader-page .topbar { position: fixed; left: 0; right: 0; top: 0; }
  body.reader-page { padding-top: 56px; transition: padding-top .25s ease; }
  body.reader-page.chrome-hidden { padding-top: 0; }
  /* 窄屏设置面板改成 App 式半屏底部抽屉（带把手，上下滑出；选择器加 body.reader-page 提到基规则前面） */
  body.reader-page .settings-panel {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; max-width: none;
    max-height: 62vh; border: none; border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,.25);
    animation: sheetUp .25s ease;
  }
  body.reader-page .settings-panel::before {
    content: ""; display: block; width: 40px; height: 4px; border-radius: 2px;
    background: var(--line, #ddd); margin: 2px auto 10px;
  }
  body.reader-page .settings-panel h2 { margin: 0 -20px 12px; }
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
/* 打开设置 / 打开段评时的入场动画（淡入 + 轻微位移，不再突兀出现）；
   设置面板现在相对工具栏按钮浮现（不再屏幕居中），所以入场/退场只横向轻移，
   不再用 translate(-50%,-50%)（那是居中定位用的，会跟 JS 定的行内位置打架） */
@keyframes settingsIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes commentIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@media (min-width: 1181px) {
  .settings-panel { animation: settingsIn .18s ease; }
  .comment-panel { animation: commentIn .2s ease; }
}
/* 目录打开的入场动画 + 段评关闭的退出动画（与入场方向相反）；
   目录是居中面板，动画里也要带上 translate(-50%,-50%) 居中，否则动画期间会偏离中心 */
@keyframes catalogIn { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes drawerIn { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes commentOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(16px); } }
@keyframes sheetDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(30px); } }
@keyframes maskOut { from { opacity: 1; } to { opacity: 0; } }
@media (min-width: 1181px) {
  #catalogDrawer { animation: catalogIn .18s ease; }
  .comment-panel.closing { animation: commentOut .18s ease forwards; }
}
@media (max-width: 1180px) {
  #catalogDrawer { animation: drawerIn .2s ease; }
  .comment-panel.closing { animation: sheetDown .18s ease forwards; }
  .drawer-mask.closing { animation: maskOut .18s ease forwards; }
}
/* 目录关闭 / 设置关闭的退出动画 + 字体三级菜单的入场动画 */
@keyframes catalogOut { from { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -48%); } }
@keyframes drawerOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-24px); } }
@keyframes settingsOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(10px); } }
@keyframes fontMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 1181px) {
  #catalogDrawer.closing { animation: catalogOut .18s ease forwards; }
  .settings-panel.closing { animation: settingsOut .18s ease forwards; }
}
@media (max-width: 1180px) {
  #catalogDrawer.closing { animation: drawerOut .18s ease forwards; }
  body.reader-page .settings-panel.closing { animation: sheetDown .18s ease forwards; }
}
.font-menu { animation: fontMenuIn .15s ease; }

/* 段评气泡关闭时：气泡隐藏，段落不可点 */
body.hide-comments .reader .para .bubble { display: none !important; }
body.hide-comments .reader .para.has-comments { cursor: default; }
/* 设置面板里的开关 */
.switch { width: 44px; height: 24px; border-radius: 999px; border: none; background: #bbb; position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s ease; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 23px; }
.toggle-row { display: flex; align-items: center; gap: 12px; }
.toggle-row .toggle-desc { flex: 1; font-size: 13px; color: var(--muted); line-height: 1.5; }
/* 宽屏：多项控件两端对齐，撑满整行（跟起点一样；窄屏不撑，避免换行后散开） */
@media (min-width: 1181px) {
  .theme-opts { justify-content: space-between; }
  .font-opts.spread { justify-content: space-between; }
}
/* 被点开段评的那段：浅底高亮 + 虚线下划线只画在文字下方（不整行） */

/* ---------- 阅读布局：正文 + 段评侧栏（起点式停靠，不遮挡） ---------- */
/* 阅读区布局：正文列 + 段评区（380px）并排；上限跟着正文宽走（正文 + 间隙 24 + 段评区 380 + 内边距 32），
   再留 96px 不贴屏幕边（窄屏那条 max-width:none 会把这条顶掉） */
.reader-layout { display: flex; align-items: flex-start; justify-content: center; gap: 24px; max-width: min(calc(var(--reader-width, 760px) + 436px), calc(100% - 96px)); margin: 0 auto; padding: 0 16px; }
/* 正文列就是那一整块：整列共用一个纸色底，各节（书卡/横幅/正文）只是里面的段落，
   之间只用横线分隔，不再各带边框圆角 */
.reader-col { flex: 0 1 var(--reader-width, 760px); min-width: 0; background: var(--paper); }
.reader-col .reader { max-width: none; margin: 0 0 40px; }
.comment-panel {
  flex: 0 0 380px; width: 380px; position: sticky; top: 64px; max-height: calc(100vh - 80px);
  margin-top: 24px; background: var(--paper, #fff); color: var(--text, #1a1a1a);
  border: 1px solid var(--line, #e6e6e6); border-radius: 10px;
  box-shadow: 0 1px 8px rgba(0,0,0,.06); display: flex; flex-direction: column;
}
.comment-panel[hidden] { display: none; }
.comment-panel header { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line, #e6e6e6); }
.comment-panel header h2 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comment-panel header button { width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--bubble-bg, #f0f0f0); color: var(--muted); font-size: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.comment-panel .drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px 16px; min-height: 0; }
/* 被点开段评的那段：浅底高亮 + 虚线下划线只画在文字下方（不整行） */
.reader .para.para-active { background: var(--accent-soft); text-decoration: underline dashed rgba(192,57,43,.55); text-underline-offset: 4px; text-decoration-thickness: 1px; }
/* 有段评的段落：点文字也能打开段评 */
.reader .para.has-comments { cursor: pointer; }

/* 屏不够宽时：段评变成官方 App 式的底部抽屉（八分屏高），正文恢复居中单栏 */
@media (max-width: 1180px) {
  .reader-layout { display: block; padding: 0; max-width: none; }
  .reader-col .reader { margin: 0 auto 40px; max-width: var(--reader-width, 760px); }
  .comment-panel {
    /* 层级：评论区跟正文同一层（只比正文高一点），低于底部工具栏(70)/遮罩/二级菜单；
       窄屏底部抽屉要盖住底部栏(70)，所以这里用 72，高于 70、低于设置遮罩(75)/设置面板(80) */
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 72;
    width: auto; max-width: none; height: 80vh; max-height: 80vh;
    margin-top: 0; border: none; border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,.25);
    animation: sheetUp .25s ease;
  }
  /* 底部抽屉顶部的把手 */
  .comment-panel::before {
    content: ""; flex: none; width: 40px; height: 4px; border-radius: 2px;
    background: var(--line, #ddd); margin: 10px auto 0;
  }
}
/* 宽屏停靠时不需要遮罩 */
@media (min-width: 1181px) {
  #commentMask { display: none !important; }
  /* 起点式评论栏：固定在屏幕右侧整栏（满高），只留一条左边框跟正文分隔；
     右边给工具栏留位：面板右缘离屏边 108px（工具栏 68px 宽 + 右边 24px + 间隙 16px），
     工具栏留在最右侧、一直可见，不会被面板盖住。
     不再是正文旁边的悬浮圆角卡片 */
  .comment-panel {
    /* 层级：评论区跟正文同一层（z-index 20），低于首栏(50)/工具栏(40)/遮罩(75/90)/二级菜单(80/95)；
       工具栏的二级菜单（设置/目录）永远在最顶层，不会被评论区遮住。
       跟着正文：不再 fixed 在屏边，而是 reader-layout 里的 flex 项，紧贴正文列右边，
       跟正文列一起居中；sticky 让它滚动时留在视口内 */
    position: sticky; top: 0; z-index: 20;
    flex: 0 0 360px; width: 360px; max-width: 360px; height: 100vh; max-height: 100vh;
    margin-top: 0; border: none; border-left: 1px solid var(--line, #e6e6e6);
    border-radius: 0; box-shadow: none;
  }
  /* 面板打开时：正文列 + 评论区作为一个整体居中（评论区紧贴正文列右边，跟着正文走）；
     body 不再留 468px 右边距（面板已在文档流里占位，不再是 fixed 悬浮）；
     首栏跟正文列左对齐（左 margin 算出面板占的 360px，让首栏左缘跟正文列左缘对齐）；
     工具栏保持可见、留在最右侧（right:24px，离屏边更远），由 positionSideControls 定位，
     不再藏起来 */
  body.comments-open .reader-layout { max-width: none; padding: 0; justify-content: center; gap: 0; }
  body.comments-open .reader-col .reader { padding-right: 24px; }
  body.comments-open .topbar-inner { margin-left: calc((100% - var(--reader-width, 760px) - 360px) / 2); margin-right: auto; }
  body.comments-open .topbar .crumb { margin-left: calc((100% - var(--reader-width, 760px) - 360px) / 2); margin-right: auto; }
}

/* 设置遮罩：点外面关面板（轻遮，改设置时正文还能看清） */
#settingsMask { z-index: 75; background: rgba(0,0,0,.12); }
/* 设置面板 */
.settings-panel {
  position: fixed; z-index: 80; top: 56px; right: 16px; width: 460px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--paper, #fff); color: var(--text, #1a1a1a);
  border: 1px solid var(--line, #ddd); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22); padding: 20px;
}
.settings-panel[hidden] { display: none; }
/* 宽屏设置面板不再屏幕居中，改由 JS 相对工具栏按钮定位（positionPanelByAnchor）；
   这里只定宽高，位置全由 JS 的行内样式定，避免 CSS 跟 JS 打架。
   注意：这条必须放在基规则后面——同特异度下后写的才赢。 */
@media (min-width: 1181px) {
  .settings-panel { width: min(460px, 92vw); max-height: 88vh; }
}
/* 标题栏：不吸顶（吸顶会挡住第一行阅读主题），跟内容一起滚动 */
.settings-panel h2 { background: var(--paper, #fff);
  font-size: 18px; margin: -20px -20px 14px; padding: 20px 20px 10px; border-radius: 14px 14px 0 0;
  display: flex; justify-content: space-between; align-items: center; }
/* ✕ 做成灰色圆钮（跟起点一样） */
.settings-panel h2 button { width: 28px; height: 28px; border: none; border-radius: 50%;
  background: var(--bubble-bg, #f0f0f0); color: var(--muted); font-size: 15px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
/* 起点式：每行左边是标签，右边是控件 */
.settings-panel .row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.settings-panel .row label { flex: 0 0 72px; font-size: 14px; color: var(--muted); margin: 0; }
.settings-panel .row .ctl { flex: 1; min-width: 0; }
.font-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.font-opts button { padding: 10px 9px; border: 1px solid var(--line, #ddd); border-radius: 8px; background: none; color: var(--text); font-size: 13px; transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
.font-opts button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
/* 正文字体行要两端对齐：四个按钮等宽撑满，但每只最多 76px，不至于撑得过大 */
#fontOpts button { flex: 1; max-width: 76px; }
/* 翻页模式行：两个按钮拉长对齐，各占一半宽度 */
#pageModeOpts button { flex: 1; }
/* 字体“…”三级菜单：点 … 在按钮下方展开，列出其余字体 */
.settings-panel .row .ctl { flex: 1; min-width: 0; position: relative; }
.font-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; min-width: 132px;
  background: var(--paper); border: 1px solid var(--line, #ddd); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px; }
.font-menu button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: none;
  background: none; color: var(--text); font-size: 13px; border-radius: 6px; cursor: pointer; }
.font-menu button:hover { color: var(--accent); background: var(--accent-soft); }
.font-menu button.active { color: var(--accent); font-weight: 700; }
.font-menu button.active::after { content: "✓"; float: right; }
/* 起点式悬停：没选中的药丸按钮放上去变粉底红字（不加红边，红边只给已选中的） */
.font-opts button:not(.active):hover { color: var(--accent); background: var(--accent-soft); }
/* 主题按钮只留色块（不加字，颜色本身就是标识；文字保留在 title 里，悬停可见） */
.theme-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-opts button { flex: none; width: 44px; height: 44px; padding: 2px; border: 2px solid transparent; border-radius: 50%; background: none; font-size: 0; position: relative; transition: border-color .15s ease; }
.theme-opts button.active { border-color: var(--accent); background: none; }
/* 起点式悬停：没选中的主题圆点放上去出一圈细红环（不加对勾，对勾只给已选中的） */
.theme-opts button:not(.active):hover { border-color: var(--accent); }
/* 选中的主题圆点里打个红 ✓（跟起点一样） */
.theme-opts button.active::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 19px; font-weight: 700; }
.theme-opts .sw { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1px solid #ccc; }
/* 起点式分段控件：一个圆角灰底条，左减、中间数值、右加，中间用竖线隔开 */
.seg { display: flex; align-items: stretch; width: 100%; background: var(--bubble-bg, #f5f5f5); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: none; background: none; color: var(--text); font-size: 17px; padding: 12px 0; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.seg button:hover { background: rgba(0,0,0,.06); color: var(--accent); }
.seg span { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 56px; font-size: 17px; color: var(--muted); border-left: 1px solid var(--line, #e6e6e6); border-right: 1px solid var(--line, #e6e6e6); }

/* 抽屉：段评 / 目录 */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
.drawer-mask[hidden] { display: none; }
.drawer {
  position: fixed; z-index: 95; top: 0; right: 0; bottom: 0; width: 420px; max-width: 94vw;
  background: var(--paper, #fff); color: var(--text, #1a1a1a);
  box-shadow: -8px 0 32px rgba(0,0,0,.2); display: flex; flex-direction: column;
}
.drawer[hidden] { display: none; }
.drawer.left { right: auto; left: 0; box-shadow: 8px 0 32px rgba(0,0,0,.2); }
.drawer header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line, #e6e6e6); }
.drawer header h2 { font-size: 16px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer header button { border: none; background: none; font-size: 20px; color: var(--muted); }
.drawer .drawer-body { flex: 1; overflow-y: auto; padding: 8px 16px 20px; }
/* 起点式评论：头像一列（36px 圆），右边名字/正文/meta 一列；评论之间画浅分隔线 */
.comment { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line, #e6e6e6); }
.comment .c-avatar { flex: none; padding-top: 2px; }
.comment .c-avatar .avatar, .comment .c-avatar .avatar-fallback { width: 36px; height: 36px; font-size: 16px; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comment .c-head .uname { font-size: 14px; font-weight: 700; }
.comment .c-head .tag { font-size: 11px; color: var(--accent); border: 1px solid rgba(192,57,43,.4); border-radius: 4px; padding: 0 4px; }
.comment .c-head .tag-badge { color: var(--muted); border-color: var(--line, #ddd); }
.comment .c-head .reply-to { font-size: 12px; color: var(--muted); }
.comment .ctext { font-size: 15px; line-height: 1.7; margin: 6px 0; word-break: break-word; }
.comment .c-img { max-width: 100%; border-radius: 8px; margin: 2px 0 6px; display: block; cursor: zoom-in; }
/* 番茄表情码转成的 Emoji：比正文稍大一点 */
.fq-emoji { font-size: 1.25em; }
/* 图片灯箱：点评论图放大看原图，点任意处或按 Esc 关 */
.img-lightbox { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.85); cursor: zoom-out; }
.img-lightbox[hidden] { display: none; }
.img-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.comment .c-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; align-items: center; }
.comment .c-meta button { border: none; background: none; color: var(--muted); font-size: 12px; padding: 0; cursor: pointer; }
.comment .c-meta button:hover { color: var(--accent); }
.comment .c-meta .c-like { margin-left: auto; }
.comment .replies-btn { border: none; background: none; color: var(--muted); font-size: 12px; padding: 0; margin-top: 8px; cursor: pointer; }
.comment .replies-btn:hover { color: var(--accent); }
.comment .no-replies { font-size: 12px; color: var(--muted); margin-top: 8px; display: inline-block; }
.comment .replies { margin-top: 12px; }
.comment .replies .comment { border-bottom: none; padding: 10px 0; }
.comment .replies .comment + .comment { border-top: 1px solid var(--line, #e6e6e6); }
/* 面板底部输入栏（起点式）：输入框 + 红色“发表评论”按钮，贴在面板最下面 */
.comment-input { flex: none; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line, #e6e6e6); background: var(--paper, #fff); }
.comment-input input { flex: 1; min-width: 0; padding: 9px 12px; font-size: 14px; border: 1px solid var(--line, #ddd); border-radius: 8px; background: var(--paper, #fff); color: var(--text); outline: none; font-family: inherit; }
.comment-input input:focus { border-color: var(--accent); }
.comment-input button { flex: none; padding: 9px 18px; border: none; border-radius: 8px; background: #e4393c; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.comment-input button:disabled { opacity: .6; cursor: default; }
.comment-input .comment-err { flex: 1 1 100%; font-size: 12px; color: #c0392b; }
/* 回复输入框（段评回复用）：跟随面板字体与配色，窄屏也全宽 */
.reply-composer { margin: 10px 0 2px; }
.reply-composer .reply-hint { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.reply-composer textarea { width: 100%; box-sizing: border-box; padding: 9px 12px; font-size: 14px; line-height: 1.6;
  border: 1px solid var(--line, #ddd); border-radius: 8px; background: var(--paper, #fff); color: var(--text);
  outline: none; resize: vertical; font-family: inherit; }
.reply-composer textarea:focus { border-color: var(--accent); }
.reply-composer .reply-err { font-size: 12px; color: #c0392b; margin: 6px 0 0; }
.reply-composer .reply-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.reply-composer .reply-actions button { padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer; }
.reply-composer .reply-cancel { border: 1px solid var(--line, #e6e6e6); background: var(--surface-muted, #f4f4f4); color: var(--text, #1a1a1a); }
.reply-composer .reply-send { border: 0; background: linear-gradient(135deg, var(--accent), #e67e22); color: #fff; }
.reply-composer .reply-send:disabled { opacity: .6; cursor: default; }
.more-btn { display: block; width: 100%; margin: 14px 0; padding: 10px; border: 1px solid var(--line, #ddd);
  border-radius: 8px; background: none; color: var(--text); font-size: 14px; }
.more-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 手机适配 ---------- */
@media (max-width: 640px) {
  .reader { padding: 16px 20px 36px; margin: 0 0 24px; }
  .reader-col .reader { margin: 0 0 24px; }
  .book-head { flex-direction: column; }
  .book-head img { width: 96px; height: 128px; }
  .drawer { width: 100vw; max-width: 100vw; }
  .comment-panel { width: 100vw; max-width: 100vw; }
  .chapter-list { grid-template-columns: 1fr 1fr; }
}

.brand-icon { width: 24px; height: 24px; border-radius: 6px; vertical-align: -5px; margin-right: 8px; }

/* ---------- 全屏登录墙（照官方作家专区登录页布局：深色背景，左标语、右扫码卡片） ---------- */
#loginWall {
  position: fixed; inset: 0; z-index: 200; color: #fff;
  background:
    radial-gradient(1100px 600px at 72% 18%, rgba(255,255,255,.09), transparent 60%),
    radial-gradient(900px 520px at 12% 82%, rgba(192,57,43,.28), transparent 62%),
    linear-gradient(160deg, #1b1b1e 0%, #2b2b30 55%, #191919 100%);
  display: flex; flex-direction: column;
}
#loginWall[hidden] { display: none; }
.login-bg { position: absolute; inset: 0; overflow: hidden; }
.login-bg-layer { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1s ease; }
.login-bg-layer.on { opacity: 1; }
.login-bg-shade { position: absolute; inset: 0; background: linear-gradient(160deg, rgba(0,0,0,.45), rgba(0,0,0,.25) 55%, rgba(0,0,0,.55)); }
.login-wall-top, .login-wall-body, .login-wall-foot { position: relative; z-index: 1; }
.login-wall-top { padding: 20px 32px; display: flex; align-items: center; }
.login-wall-brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: #fff; }
.login-wall-brand img { width: 28px; height: 28px; border-radius: 7px; }
.login-wall-brand small { font-size: 13px; font-weight: 400; opacity: .75; }
/* 登录墙右上角关闭按钮：不登录也能关掉墙继续逛 */
.login-wall-close {
  margin-left: auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.login-wall-close:hover { background: rgba(255, 255, 255, 0.25); }
.login-wall-body { flex: 1; display: flex; align-items: center; justify-content: center; gap: 64px; padding: 24px 32px; max-width: 1080px; width: 100%; margin: 0 auto; }
.login-slogan { flex: 1; min-width: 0; }
.slogan-cn { font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif; font-size: 54px; font-weight: 700; line-height: 1.3; letter-spacing: 2px; }
.slogan-en { margin-top: 26px; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.55; opacity: .85; font-style: italic; }
.login-card { flex: 0 0 360px; background: #fff; color: #1a1a1a; border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.35); padding: 28px 28px 24px; text-align: center; }
.login-card h2 { font-size: 19px; margin-bottom: 6px; }
.login-note { font-size: 13px; color: #8a8a8a; margin: 0 0 18px; line-height: 1.55; }
.login-qr { width: 200px; height: 200px; margin: 0 auto; border: 1px solid #e6e6e6; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.login-qr img { width: 200px; height: 200px; }
.login-hint { font-size: 13px; color: #8a8a8a; margin: 16px 0 8px; line-height: 1.55; }
.login-status { font-size: 14px; margin: 0 0 12px; }
.login-wall-foot { text-align: center; padding: 16px; font-size: 12px; color: rgba(255,255,255,.5); }
/* 顶栏登录态 */
.auth-area { display: flex; align-items: center; gap: 8px; }
.auth-area[hidden] { display: none; }
.auth-name { font-size: 14px; color: var(--muted, #8a8a8a); white-space: nowrap; }
/* 书架来源徽标 */
.shelf-badge { display: inline-block; font-size: 11px; color: var(--accent); border: 1px solid rgba(192,57,43,.4); border-radius: 999px; padding: 1px 7px; vertical-align: middle; margin-left: 6px; }
/* 书架“有更新”角标：实心红底白字，比描边的来源 badge 更显眼，一眼看到哪本有新章 */
.update-badge { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent, #e4393c); border-radius: 999px; padding: 1px 7px; vertical-align: middle; margin-left: 6px; }
/* 宫格模式的角标：默认隐藏，只在宫格里显示在封面左上角 */
.badge-corner { display: none; }
/* 窄屏：上下叠，标语在上（字小一点）、二维码卡片在下，背景仍是深色 */
@media (max-width: 720px) {
  .login-wall-top { padding: 16px 20px; }
  .login-wall-body { flex-direction: column; gap: 28px; padding: 12px 20px; justify-content: flex-start; }
  .slogan-cn { font-size: 34px; }
  .slogan-en { font-size: 16px; margin-top: 14px; }
  .login-card { flex: none; width: 100%; max-width: 360px; padding: 24px 20px 20px; }
  .login-qr { width: 180px; height: 180px; }
  .login-qr img { width: 180px; height: 180px; }
}

/* 官方进度不一致提示弹窗（阅读页） */
.prog-modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 120; }
.prog-modal-mask[hidden] { display: none; }
.prog-modal { position: fixed; z-index: 121; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 420px); background: var(--card, #fff); color: var(--text, #222);
  border: 1px solid var(--border, #e5e5e5); border-radius: 14px; padding: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.prog-modal[hidden] { display: none; }
.prog-modal h3 { margin: 0 0 10px; font-size: 17px; }
.prog-modal p { margin: 0 0 16px; font-size: 14px; line-height: 1.7; color: var(--muted, #666); }
.prog-modal-btns { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 左缘竖排标签（宽屏） ---------- */
.edge-labels { position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; }
.edge-label { writing-mode: vertical-rl; letter-spacing: 4px; padding: 12px 6px; border: 1px solid var(--line, #e6e6e6); border-left: none; border-radius: 0 8px 8px 0; background: var(--paper, #fff); color: var(--muted); font-size: 13px; cursor: pointer; }
.edge-label:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 1180px) { .edge-labels { display: none; } }

/* ---------- 通用居中弹窗（指南 / 反馈） ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 120; }
.modal-mask[hidden] { display: none; }
.modal { position: fixed; z-index: 121; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 460px); background: var(--paper, #fff); color: var(--text, #222); border: 1px solid var(--line, #e5e5e5); border-radius: 14px; padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal[hidden] { display: none; }
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal .hint { margin: 0 0 12px; }
.modal textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 14px; line-height: 1.6; border: 1px solid var(--line, #ddd); border-radius: 8px; background: var(--paper, #fff); color: var(--text); outline: none; resize: vertical; font-family: inherit; }
.modal textarea:focus { border-color: var(--accent); }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.guide-keys { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.guide-keys div { display: flex; align-items: center; gap: 6px; }
.guide-keys kbd { padding: 2px 8px; border: 1px solid var(--line, #ddd); border-bottom-width: 2px; border-radius: 6px; background: var(--bubble-bg, #f5f5f5); font-size: 12px; font-family: inherit; }
.guide-keys span { color: var(--muted); margin-left: 4px; }
.feedback-done { font-size: 13px; color: var(--accent); margin: 10px 0 0; }
.feedback-done[hidden] { display: none; }

/* ---------- 轻提示 ---------- */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 130; background: rgba(0,0,0,.85); color: #fff; font-size: 14px; padding: 10px 18px; border-radius: 999px; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.toast[hidden] { display: none; }

/* ========== 书架新样式：胶囊续读按钮 + 章节芯片 + 悬停上浮 ========== */
:root{
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-pop: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 150ms;
  --t-base: 200ms;
}
.section-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.shelf-view-toggle { display: inline-flex; margin-left: auto; border: 1px solid var(--line, #e6e6e6);
  border-radius: 999px; overflow: hidden; background: var(--paper, #fff); }
.shelf-view-toggle button { border: 0; background: none; padding: 6px 12px; font-size: 13px;
  color: var(--muted, #8a8a8a); cursor: pointer; transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out); }
.shelf-view-toggle button.active { background: var(--accent); color: #fff; font-weight: 700; }
.shelf-view-toggle button + button { border-left: 1px solid var(--line, #e6e6e6); }

.shelf-item { position: relative; transition: transform var(--t-base) var(--ease-out); }
.shelf-item::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); z-index: -1;
  box-shadow: 0 12px 28px rgba(0,0,0,.16); opacity: 0; transition: opacity var(--t-base) var(--ease-out); }
.shelf-item:hover { transform: translateY(-2px); }
.shelf-item:hover::after { opacity: 1; }
.shelf-item .cover { flex: none; width: 48px; height: 64px; border-radius: 6px; overflow: hidden; background: #ddd; }
.shelf-item .cover img { width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 400ms var(--ease-out); }
.shelf-item:hover .cover img { transform: scale(1.08); }
.shelf-item .title a { color: var(--text, #1a1a1a); text-decoration: none; }
.shelf-item .title a:hover { color: var(--accent); }
.shelf-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 10px; }
.chapter-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted, #8a8a8a);
  background: var(--surface-muted, #f4f4f4); border: 1px solid var(--line, #e6e6e6);
  padding: 3px 9px; border-radius: 999px; max-width: 100%; }
.chapter-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.continue-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border: 0;
  border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 700; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, var(--accent), #e67e22);
  box-shadow: 0 2px 8px rgba(192,57,43,.35);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), filter var(--t-fast) var(--ease-out); }
/* 按钮是 <a>，全站 a:hover / :active / :focus 都会加下划线；这里所有状态都明确去掉，
   否则点一下、按住、点完焦点还在时都会冒出下划线。 */
.continue-btn, .continue-btn:hover, .continue-btn:active, .continue-btn:focus, .continue-btn:visited { text-decoration: none; }
.continue-btn:hover { transform: translateY(-1px); filter: brightness(1.07); box-shadow: 0 6px 16px rgba(192,57,43,.4); color: #fff; }
.continue-btn:active { transform: scale(.97); }
.continue-btn.secondary { background: var(--surface-muted, #f4f4f4); color: var(--text, #1a1a1a);
  box-shadow: none; border: 1px solid var(--line, #e6e6e6); }
.continue-btn.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.remove-btn.ghost { border-color: transparent; background: none; color: var(--muted, #8a8a8a); }
.remove-btn.ghost:hover { border-color: var(--line, #ddd); color: var(--accent); }

/* 书架宫格展示：封面在上、信息在下的卡片网格 */
#shelf.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
#shelf.shelf-grid .shelf-item { flex-direction: column; align-items: stretch; padding: 12px; margin-bottom: 0; }
#shelf.shelf-grid .shelf-item .cover { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 8px; }
#shelf.shelf-grid .shelf-item .info { display: flex; flex-direction: column; }
#shelf.shelf-grid .shelf-item .title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#shelf.shelf-grid .shelf-item .sub { display: none; }
#shelf.shelf-grid .shelf-actions { flex-direction: column; align-items: stretch; gap: 8px; }
#shelf.shelf-grid .chapter-chip { justify-content: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#shelf.shelf-grid .continue-btn { justify-content: center; }
#shelf.shelf-grid .shelf-item .title .shelf-badge { display: none; }
/* 宫格里标题旁的标签移到封面左上角，跟右上角的“移出”平行 */
#shelf.shelf-grid .badge-corner { display: inline-block; position: absolute; top: 6px; left: 6px; z-index: 2;
  background: rgba(0,0,0,.45); color: #fff; border-color: transparent; margin-left: 0;
  font-size: 12px; padding: 2px 8px; }
#shelf.shelf-grid .remove-btn { position: absolute; top: 6px; right: 6px; padding: 2px 8px; font-size: 12px;
  background: rgba(0,0,0,.45); color: #fff; border-color: transparent; border-radius: 999px; }
#shelf.shelf-grid .remove-btn:hover { background: rgba(192,57,43,.9); color: #fff; }

/* ========== 目录（起点式）：头 tab 大字号、下面章节列表小字号，双排 + 行分隔线 ========== */
#catalogDrawer { font-size: 14px; }
/* 首栏下边不留空，让 tab 的红下划线贴着首栏底边（起点式） */
#catalogDrawer header { padding: 12px 20px 0; }
#catalogDrawer .drawer-body { padding: 4px 20px 20px; }
/* 目录里的卷名是分段标题行（不是可折叠的按钮），点它不折叠 */
#catalogDrawer .volume h3 { font-size: 15px; cursor: default; color: var(--text); font-weight: 700; margin: 16px 0 2px; }
#catalogDrawer .volume:first-child h3 { margin-top: 8px; }
/* 目录头：目录/书签大 tab（18px）+ 紧贴的小字状态（连载中·共912章）……右端倒序 + 灰色圆钮 ✕ */
#catalogDrawer header .catalog-tabs { display: flex; gap: 2px; }
#catalogDrawer header .cat-tab { padding: 8px 12px; border: none; background: none; font-size: 18px; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
#catalogDrawer header .cat-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
#catalogDrawer header .catalog-status { font-size: 13px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
#catalogDrawer header .catalog-order { border: 1px solid var(--line, #ddd); border-radius: 999px; padding: 4px 12px; font-size: 13px; background: none; color: var(--text); cursor: pointer; flex: none; margin-left: auto; }
#catalogDrawer header .catalog-order:hover { border-color: var(--accent); color: var(--accent); }
#catalogDrawer header #catalogClose { width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--bubble-bg, #f0f0f0); color: var(--muted); font-size: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
/* 书签 tab 的空状态 */
.marks-empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.marks-empty .marks-ico { font-size: 36px; margin-bottom: 12px; }
.marks-empty p { font-size: 15px; margin-bottom: 6px; }
.marks-empty .hint { font-size: 13px; }
/* 章节列表：双排，每行下面一条浅分隔线（列间距 0 + 链接内边距分开两列，线不断）；
   字号 14px，比上面 tab 的 18px 小一号，不再跟正文字号走 */
#catalogDrawer .chapter-list { display: grid; grid-template-columns: 1fr 1fr;
  gap: 0; padding: 0; list-style: none; }
#catalogDrawer .chapter-list li { min-width: 0; }
#catalogDrawer .chapter-list li a { display: flex; align-items: baseline; gap: .4em;
  padding: 10px 12px; border-bottom: 1px solid var(--line, #e9e9e9); font-size: 14px; line-height: 1.5;
  color: var(--text, #1a1a1a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out); }
#catalogDrawer .chapter-list li:nth-child(odd) a { padding-right: 20px; }
#catalogDrawer .chapter-list li:nth-child(even) a { padding-left: 20px; }
#catalogDrawer .chapter-list li a:hover { background: var(--surface-muted, #f4f4f4); }
#catalogDrawer .chapter-list li a.current {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent); }
#catalogDrawer .chapter-list li a.current::after { content: "正在读"; flex: none;
  font-size: 11px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: 1px 7px; }
@keyframes toc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
#catalogDrawer .chapter-list li { animation: toc-in 300ms var(--ease-pop) both;
  animation-delay: calc(var(--i, 0) * 30ms); }
@media (max-width: 560px) {
  #catalogDrawer .chapter-list { grid-template-columns: 1fr; }
  /* 单列时取消双排的内外边距，状态文案也藏掉，免得窄屏首栏放不下 */
  #catalogDrawer .chapter-list li:nth-child(odd) a,
  #catalogDrawer .chapter-list li:nth-child(even) a { padding-left: 12px; padding-right: 12px; }
  #catalogDrawer header .catalog-status { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shelf-item, .shelf-item .cover img, .continue-btn, #catalogDrawer .chapter-list li { transition: none !important; animation: none !important; }
  .shelf-item:hover { transform: none; }
  .shelf-item:hover .cover img { transform: none; }
}
