/* ============================================================
   连载阅读器（novel.html + js/novel.js）
   ----------------------------------------------------
   书架 → 阅读器两态。阅读排版按中文长文优化：窄版心（34em 上下）、
   字号/行高可调（写在 :root 的 --novel-size／--novel-lh 上）、段间距舒适。
   沉浸模式（html.novel-immersive）隐藏站点导航、页脚与阅读器头部，只留退出键。
   ============================================================ */

:root {
  --novel-size: 18px;
  --novel-lh: 1.9;
}

/* ---------- 书架 ---------- */
.novel-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.novel-shelf[hidden] {
  display: none;
}
.novel-book {
  display: flex;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: rgba(18, 20, 27, 0.5);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.25s var(--ease-swift);
}
.novel-book:hover {
  border-color: rgba(143, 184, 255, 0.38);
  transform: translateY(-2px);
}
.novel-cover {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 56px;
  height: 76px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(150deg, #23294d, #0e1428 70%);
  color: #b9c8ff;
  font-size: 1.4rem;
  font-weight: 700;
}
.novel-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.novel-meta {
  min-width: 0;
}
.novel-meta b {
  display: block;
  color: #f5f5f7;
  font-size: 14px;
  font-weight: 600;
}
.novel-badge {
  margin-left: 0.4rem;
  padding: 1px 6px;
  border: 1px solid rgba(143, 184, 255, 0.4);
  border-radius: 999px;
  color: #8fb8ff;
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
  vertical-align: 1px;
}
.novel-author {
  display: block;
  margin-top: 2px;
  color: #86868b;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 11px;
}
.novel-intro {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 0.35rem;
  color: #86868b;
  font-size: 12px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* ---------- 阅读器 ---------- */
.novel-reader {
  display: block;
}
.novel-reader[hidden] {
  display: none;
}
.novel-bar {
  position: sticky;
  top: 3rem;                    /* 让开站点吸顶导航（h-12 = 3rem） */
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin-bottom: 1.4rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: rgba(14, 16, 22, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
}
.novel-bar .novel-headline {
  min-width: 0;
  flex: 1 1 12rem;
}
.novel-bar .novel-headline b {
  display: block;
  overflow: hidden;
  color: #f5f5f7;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.novel-bar .novel-headline span {
  display: block;
  margin-top: 1px;
  color: #86868b;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 10.5px;
}
.novel-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}
.novel-btn {
  padding: 0.3rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  color: #f5f5f7;
  font-size: 11.5px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.novel-btn:hover:not(:disabled) {
  border-color: rgba(143, 184, 255, 0.5);
  background: rgba(143, 184, 255, 0.12);
}
.novel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.novel-ctl {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #86868b;
  font-size: 11.5px;
}
.novel-ctl input[type="range"] {
  width: 5.5rem;
  accent-color: #8fb8ff;
  cursor: pointer;
}
.novel-ctl output {
  min-width: 2.4rem;
  color: #b9c8ff;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 11px;
}

.novel-page {
  max-width: 34em;
  margin: 0 auto;
}
.novel-body {
  color: #d7d9e0;
  font-size: var(--novel-size);
  line-height: var(--novel-lh);
}
.novel-body p {
  margin: 0 0 1.25em;
}
.novel-body h3 {
  margin: 2em 0 0.8em;
  color: #f5f5f7;
  font-size: 1.05em;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.novel-body blockquote {
  margin: 1.4em 0;
  padding: 0.2em 0 0.2em 1em;
  border-left: 2px solid rgba(143, 184, 255, 0.45);
  color: #b9c8ff;
}
.novel-body code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.92em;
}
.novel-body pre {
  overflow-x: auto;
  margin: 1.4em 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: rgba(10, 12, 18, 0.8);
}
.novel-body pre code {
  background: none;
  padding: 0;
}

.novel-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 34em;
  margin: 2.4rem auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #86868b;
  font-size: 11.5px;
}

/* ---------- 章节抽屉 ---------- */
.novel-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 66;
  width: min(22rem, 88vw);
  overflow-y: auto;
  padding: 1.1rem 1.2rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 14, 20, 0.94);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  transform: translateX(100%);
  transition: transform 0.26s var(--ease-swift);
}
.novel-drawer[hidden] {
  display: none;
}
.novel-drawer.is-open {
  transform: none;
}
.novel-drawer h2 {
  margin-bottom: 0.8rem;
  color: #f5f5f7;
  font-size: 13px;
  font-weight: 600;
}
.novel-vol {
  margin: 0.9rem 0 0.35rem;
  color: rgba(158, 176, 202, 0.65);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.novel-toc-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #86868b;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.novel-toc-item:hover {
  color: #f5f5f7;
  background: rgba(255, 255, 255, 0.06);
}
.novel-toc-item.is-current {
  color: #8fb8ff;
  background: rgba(143, 184, 255, 0.12);
  box-shadow: inset 2px 0 0 #8fb8ff;
}
.novel-drawer-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
}

/* ---------- 示例提示 ---------- */
.novel-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(143, 184, 255, 0.3);
  border-radius: 10px;
  background: rgba(143, 184, 255, 0.08);
  color: #b9c8ff;
  font-size: 11.5px;
  line-height: 1.7;
}
.novel-tip[hidden] {
  display: none;
}
.novel-tip button {
  flex: 0 0 auto;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
}

/* ---------- 沉浸模式 ---------- */
html.novel-immersive header.site-header,
html.novel-immersive footer,
html.novel-immersive .novel-bar .novel-ctl,
html.novel-immersive .novel-bar .novel-headline span {
  display: none;
}
html.novel-immersive .novel-bar {
  top: 0;
  padding: 0.4rem 0.6rem;
  border-color: transparent;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html.novel-immersive .novel-page,
html.novel-immersive .novel-pager {
  max-width: 32em;
}
html.novel-immersive .novel-float-exit {
  display: inline-flex;
}
.novel-float-exit {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 34;
  display: none;
  align-items: center;
  align-self: center;
  padding: 0.34rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  background: rgba(18, 20, 27, 0.7);
  color: #f5f5f7;
  font-size: 11.5px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .novel-bar {
    top: 3rem;
  }
  .novel-ctl input[type="range"] {
    width: 4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .novel-book,
  .novel-drawer,
  .novel-btn {
    transition: none;
  }
  .novel-book:hover {
    transform: none;
  }
}
