/* ============================================================
   墨阅 · 小说阅读器 — 样式表
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg: #f4f1ea;
  --bg-panel: #ffffff;
  --bg-elevated: #ffffff;
  --text: #2f2a24;
  --text-secondary: #8a8177;
  --text-faint: #b3aaa0;
  --border: #e6e0d5;
  --accent: #8a6d3b;
  --accent-soft: rgba(138, 109, 59, 0.12);
  --shadow: 0 8px 30px rgba(60, 50, 30, 0.12);
  --header-bg: rgba(244, 241, 234, 0.9);
  --progress-bg: #e6e0d5;
  --highlight: #fdf3d7;
  --font-size: 19px;
  --font-family: "Georgia", "Songti SC", "SimSun", "Noto Serif SC", serif;
  color-scheme: light;
}

body[data-theme="dark"] {
  --bg: #161513;
  --bg-panel: #201e1b;
  --bg-elevated: #2a2723;
  --text: #c9c2b8;
  --text-secondary: #7f786e;
  --text-faint: #5c564e;
  --border: #332f2a;
  --accent: #c9a45e;
  --accent-soft: rgba(201, 164, 94, 0.16);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --header-bg: rgba(22, 21, 19, 0.9);
  --progress-bg: #332f2a;
  --highlight: #2c2a20;
  color-scheme: dark;
}

body[data-theme="sepia"] {
  --bg: #f3e8d2;
  --bg-panel: #faf0dd;
  --bg-elevated: #fff8ea;
  --text: #4a3f2f;
  --text-secondary: #9a8a6f;
  --text-faint: #bfae92;
  --border: #e2d3b5;
  --accent: #8a6d3b;
  --accent-soft: rgba(138, 109, 59, 0.14);
  --shadow: 0 8px 30px rgba(120, 90, 40, 0.15);
  --header-bg: rgba(243, 232, 210, 0.92);
  --progress-bg: #e2d3b5;
  --highlight: #f6e7c4;
  color-scheme: light;
}

/* ---------- 基础重置 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

svg {
  display: block;
}

/* ---------- 顶部工具栏 ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 14px;
  max-width: 1100px;
  margin: 0 auto;
}

.book-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
  flex: 1;
  text-align: center;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn:active {
  transform: scale(0.92);
}

#iconMoon {
  display: none;
}

body[data-theme="dark"] #iconSun {
  display: none;
}

body[data-theme="dark"] #iconMoon {
  display: block;
}

/* 章节进度条 */
.progress-track {
  height: 3px;
  background: var(--progress-bg);
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* ---------- 目录侧边栏 ---------- */
.toc-mask, .font-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toc-mask.show, .font-mask.show {
  opacity: 1;
  visibility: visible;
}

.toc {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-panel);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.toc.open {
  transform: translateX(0);
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px;
}

.toc-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
}

.toc-info {
  padding: 0 18px 12px;
  font-size: 12px;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}

.toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
  overscroll-behavior: contain;
}

.toc-list::-webkit-scrollbar {
  width: 4px;
}

.toc-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.toc-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 18px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-item:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.toc-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ---------- 字体设置面板 ---------- */
.font-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-panel);
  z-index: 300;
  border-radius: 18px 18px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: var(--shadow);
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
}

.font-panel.open {
  transform: translateY(0);
}

.font-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.font-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
}

.setting-group {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.setting-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

/* 字体大小滑块 */
.size-slider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.size-min {
  font-size: 13px;
  color: var(--text-secondary);
}

.size-max {
  font-size: 24px;
  color: var(--text-secondary);
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: var(--progress-bg);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-panel);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-panel);
  cursor: pointer;
}

.size-options {
  display: flex;
  gap: 8px;
}

.size-opt {
  flex: 1;
  padding: 8px 0;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--accent-soft);
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.size-opt.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  background: transparent;
}

/* 字体族 */
.font-family-options {
  display: flex;
  gap: 8px;
}

.font-opt {
  flex: 1;
  padding: 9px 0;
  border-radius: 10px;
  font-size: 15px;
  color: var(--text-secondary);
  background: var(--accent-soft);
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.font-opt[data-family="serif"] { font-family: "Songti SC", "SimSun", serif; }
.font-opt[data-family="kai"] { font-family: "Kaiti SC", "KaiTi", "STKaiti", serif; }
.font-opt[data-family="sans"] { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }

.font-opt.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  background: transparent;
}

/* 主题选项 */
.theme-options {
  display: flex;
  gap: 8px;
}

.theme-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 0;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--accent-soft);
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.theme-opt.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  background: transparent;
}

.theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.swatch-light { background: #f4f1ea; }
.swatch-dark { background: #1c1a18; }
.swatch-sepia { background: #f3e8d2; }

/* 阅读进度 */
.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-clear {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--accent);
  border: 1px solid var(--accent);
  transition: all 0.2s ease;
}

.btn-clear:hover {
  background: var(--accent);
  color: var(--bg-panel);
}

/* ---------- 阅读区 ---------- */
.reader {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.page {
  width: 100%;
  max-width: 720px;
  height: 100%;
  padding: 28px 30px 90px;
  display: flex;
  justify-content: center;
}

.page-content {
  width: 100%;
  font-size: var(--font-size);
  font-family: var(--font-family);
  line-height: 1.9;
  letter-spacing: 0.05em;
  color: var(--text);
  overflow: hidden;
  text-align: justify;
  word-break: break-word;
  transition: font-size 0.15s ease, line-height 0.15s ease;
}

.page-content p {
  margin: 0 0 1.1em;
  text-indent: 2em;
}

.page-content .chapter-title {
  text-align: center;
  font-size: 1.45em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-indent: 0;
  margin: 0.4em 0 1.6em;
}

.page-content .page-break-zone {
  flex: 1;
  min-height: 2px;
}

/* 页码指示器 */
.page-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}

.page-indicator {
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: 1px;
  min-width: 70px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.nav-btn:active {
  transform: scale(0.92);
}

/* 点击翻页热区（桌面隐藏，移动端显示） */
.tap-zone {
  display: none;
  position: fixed;
  top: 56px;
  bottom: 0;
  width: 33.33%;
  z-index: 40;
}

.tap-prev { left: 0; }
.tap-next { right: 0; }

/* 翻页动画 */
@keyframes pageInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pageInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

.page-content.animate-right { animation: pageInRight 0.25s ease; }
.page-content.animate-left { animation: pageInLeft 0.25s ease; }

/* 键盘/触摸提示 */
.toc-tip {
  display: none;
}

/* ============================================================
   响应式适配
   ============================================================ */

/* 手机：单栏、全宽、点击翻页 */
@media (max-width: 640px) {
  .topbar-inner {
    height: 48px;
    padding: 0 8px;
  }

  .reader {
    top: 52px;
  }

  .tap-zone {
    display: block;
  }

  .page {
    max-width: 100%;
    padding: 20px 20px 80px;
  }

  .page-nav {
    gap: 14px;
  }

  .book-title {
    font-size: 14px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }
}

/* 平板：适度留白 */
@media (min-width: 641px) and (max-width: 1024px) {
  .page {
    padding: 32px 48px 90px;
    max-width: 680px;
  }
}

/* 桌面：更宽阅读区，鼠标悬停效果 */
@media (min-width: 1025px) {
  .page {
    padding: 36px 40px 90px;
  }
}

/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   平台 · 书城视图
   ============================================================ */

/* 通用隐藏 */
.hidden {
  display: none !important;
}

.shelf {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 48px;
}

.shelf-hero {
  text-align: center;
  padding: 12px 0 18px;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 4px;
}

.hero-slogan {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 6px;
  letter-spacing: 2px;
}

.hero-stats {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 8px;
  letter-spacing: 1px;
}

/* 分类标签栏 */
.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: none;
  position: sticky;
  top: -16px;
  z-index: 10;
  background: var(--bg);
}

.cat-bar::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  flex-shrink: 0;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--accent-soft);
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.cat-btn:hover {
  color: var(--accent);
}

.cat-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  background: transparent;
}

/* 书籍网格 */
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 12px;
  padding-bottom: 20px;
}

.book-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.book-card:active {
  transform: scale(0.98);
}

/* 封面（CSS 渐变 + 字） */
.book-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-glyph {
  font-size: 46px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 2px;
  font-family: "Songti SC", "SimSun", serif;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.cover-title {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 1px;
}

.cover-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  letter-spacing: 1px;
}

/* 创作书卡片的编辑按钮 */
.card-edit {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  transition: background 0.2s ease, transform 0.15s ease;
}

.card-edit:hover {
  background: var(--accent);
}

.card-edit:active {
  transform: scale(0.92);
}

/* 卡片信息 */
.book-meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.book-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-author {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-intro {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   平台 · 响应式适配
   ============================================================ */

/* 手机：两列卡片 */
@media (max-width: 640px) {
  .shelf {
    top: 52px;
  }

  .cat-bar {
    top: -16px;
  }

  .hero-title {
    font-size: 22px;
  }
}

/* 平板：三列 */
@media (min-width: 641px) and (max-width: 1024px) {
  .shelf {
    padding: 20px 24px 48px;
  }

  .book-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 16px;
    max-width: 860px;
    margin: 0 auto;
  }
}

/* 桌面：五列，内容居中 */
@media (min-width: 1025px) {
  .shelf {
    padding: 24px 32px 56px;
  }

  .book-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 22px 18px;
    max-width: 1080px;
    margin: 0 auto;
  }

  .cat-bar {
    justify-content: center;
    max-width: 1080px;
    margin: 0 auto;
  }
}

/* ============================================================
   写小说 · 创作视图
   ============================================================ */
.hero-write {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 9px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(138, 109, 59, 0.35);
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.hero-write:hover {
  opacity: 0.9;
}

.hero-write:active {
  transform: scale(0.96);
}

.editor {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.editor-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 14px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.editor-head-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
}

.editor-save {
  padding: 7px 18px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: var(--accent);
  transition: opacity 0.2s ease;
}

.editor-save:hover {
  opacity: 0.9;
}

.editor-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ed-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.ed-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.ed-ch-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-faint);
}

.ed-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.ed-input:focus,
.ed-textarea:focus {
  border-color: var(--accent);
}

.ed-textarea {
  width: 100%;
  min-height: 74px;
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.ed-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 12px 0 8px;
  letter-spacing: 1px;
}

.ed-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ed-cat {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--accent-soft);
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.ed-cat:hover {
  color: var(--accent);
}

.ed-cat.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  background: transparent;
}

/* 章节列表 */
.ed-chapters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ed-chapter {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.ed-chapter.dragging {
  opacity: 0.5;
  border-style: dashed;
  border-color: var(--accent);
}

.ed-chapter.drag-over {
  border-color: var(--accent);
  transform: translateY(2px);
}

.ed-ch-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ed-drag {
  cursor: grab;
  color: var(--text-faint);
  font-size: 14px;
  letter-spacing: -2px;
  padding: 4px 2px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.ed-drag:active {
  cursor: grabbing;
}

.ed-ch-num {
  font-size: 12px;
  color: var(--text-faint);
  min-width: 16px;
  text-align: center;
}

.ed-ch-title {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ed-ch-title:focus {
  border-color: var(--accent);
  background: var(--bg-panel);
}

.ed-ch-del {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: background 0.2s ease, color 0.2s ease;
}

.ed-ch-del:hover {
  background: rgba(214, 69, 69, 0.12);
  color: #d64545;
}

.ed-ch-content {
  width: 100%;
  min-height: 90px;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-family);
  line-height: 1.8;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.ed-ch-content:focus {
  border-color: var(--accent);
}

.ed-add-chapter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 0;
  border-radius: 10px;
  border: 1.5px dashed var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.ed-add-chapter:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.ed-tip {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 10px;
  text-align: center;
}

.ed-tip b {
  letter-spacing: -2px;
  color: var(--text-secondary);
}

.ed-delete-book {
  padding: 12px 0;
  border-radius: 12px;
  border: 1.5px solid #d64545;
  color: #d64545;
  font-size: 14px;
  letter-spacing: 1px;
  background: transparent;
  transition: all 0.2s ease;
}

.ed-delete-book:hover {
  background: rgba(214, 69, 69, 0.1);
}

/* 移动端适配 */
@media (max-width: 640px) {
  .editor {
    top: 52px;
  }

  .editor-body {
    padding: 12px 12px 40px;
  }
}
