/* ==========================================================================
   TTSNover · 现代极简美学阅读器样式
   ========================================================================== */

/* ---------- 视觉主题变量 ---------- */
:root {
  /* 基础暗色 (星空黑 · 默认) */
  --bg: #090d16;
  --bg-gradient: radial-gradient(circle at 50% 0%, #151d30 0%, #090d16 75%);
  --panel: #111827;
  --panel-glass: rgba(17, 24, 39, 0.78);
  --panel-glass-thick: rgba(17, 24, 39, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --fg: #f1f5f9;
  --dim: #94a3b8;
  --dim-light: #64748b;
  
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.28);
  --accent-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
  
  --ok: #10b981;
  --ok-glow: rgba(16, 185, 129, 0.25);
  --warn: #f59e0b;
  --err: #ef4444;
  --err-glow: rgba(239, 68, 68, 0.25);

  --page-bg: #0f1420;
  --page-fg: #d6dce7;
  
  --fs: 19px;
  --lh: 1.85;
  --pd: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 极夜黑 (OLED 纯黑) */
body[data-theme="black"] {
  --bg: #000000;
  --bg-gradient: none;
  --panel: #0a0a0a;
  --panel-glass: rgba(10, 10, 10, 0.85);
  --panel-glass-thick: rgba(10, 10, 10, 0.96);
  --line: #1c1c1c;
  --line-strong: #2a2a2a;
  --fg: #e2e8f0;
  --dim: #71717a;
  --dim-light: #52525b;
  --page-bg: #000000;
  --page-fg: #a8b0bd;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.2);
}

/* 皓月白 (Light 纯净纸质) */
body[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-gradient: radial-gradient(circle at 50% 0%, #ffffff 0%, #f4f6fa 85%);
  --panel: #ffffff;
  --panel-glass: rgba(255, 255, 255, 0.85);
  --panel-glass-thick: rgba(255, 255, 255, 0.95);
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --fg: #1e293b;
  --dim: #64748b;
  --dim-light: #94a3b8;
  --page-bg: #fafafa;
  --page-fg: #1e293b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.16);
  --accent-gradient: linear-gradient(135deg, #2563eb, #1d4ed8);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.12);
}

/* 羊皮纸 (Warm Sepia 复古典雅) */
body[data-theme="sepia"] {
  --bg: #eee4d3;
  --bg-gradient: radial-gradient(circle at 50% 0%, #f7f1e5 0%, #eee4d3 85%);
  --panel: #faf3e6;
  --panel-glass: rgba(250, 243, 230, 0.88);
  --panel-glass-thick: rgba(250, 243, 230, 0.96);
  --line: rgba(94, 69, 44, 0.12);
  --line-strong: rgba(94, 69, 44, 0.2);
  --fg: #3d2f20;
  --dim: #857360;
  --dim-light: #a3927e;
  --page-bg: #f8f1e5;
  --page-fg: #3d2f20;
  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-glow: rgba(180, 83, 9, 0.18);
  --accent-gradient: linear-gradient(135deg, #b45309, #92400e);
  --shadow-sm: 0 2px 8px rgba(61, 47, 32, 0.08);
  --shadow-md: 0 8px 24px -4px rgba(61, 47, 32, 0.12);
  --shadow-lg: 0 16px 40px -8px rgba(61, 47, 32, 0.16);
}

/* 青水绿 (Sage 护眼柔和) */
body[data-theme="green"] {
  --bg: #d7e6d9;
  --bg-gradient: radial-gradient(circle at 50% 0%, #e8f3ea 0%, #d7e6d9 85%);
  --panel: #eaf4eb;
  --panel-glass: rgba(234, 244, 235, 0.88);
  --panel-glass-thick: rgba(234, 244, 235, 0.96);
  --line: rgba(33, 64, 40, 0.12);
  --line-strong: rgba(33, 64, 40, 0.2);
  --fg: #1d3322;
  --dim: #5c7562;
  --dim-light: #7b9481;
  --page-bg: #e5f0e6;
  --page-fg: #1d3322;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-glow: rgba(5, 150, 105, 0.18);
  --accent-gradient: linear-gradient(135deg, #059669, #047857);
  --shadow-sm: 0 2px 8px rgba(29, 51, 34, 0.08);
  --shadow-md: 0 8px 24px -4px rgba(29, 51, 34, 0.12);
  --shadow-lg: 0 16px 40px -8px rgba(29, 51, 34, 0.16);
}

/* 字体系统 */
body[data-font="serif"] {
  --font: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "STSong", serif;
}
body[data-font="sans"] {
  --font: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", -apple-system, sans-serif;
}
body[data-font="kai"] {
  --font: "Kaiti SC", "STKaiti", "KaiTi", "FZKai-Z03S", "Noto Serif CJK SC", serif;
}

/* ---------- 基础样式重置 ---------- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

.hide {
  display: none !important;
}

.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

/* ---------- SVG 图标通用类 ---------- */
.svg-icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

/* ---------- 顶部与底部导航栏 (Glassmorphism) ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  flex: 0 0 auto;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  transition: transform var(--transition-normal), background-color var(--transition-normal), opacity var(--transition-normal);
}

.bar.glass {
  background: var(--panel-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.brand-icon .svg-icon {
  width: 18px;
  height: 18px;
}
.brand-text {
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.brand-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
  letter-spacing: 0.05em;
}

.bar-search-wrap {
  flex: 1;
  max-width: 320px;
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 10px;
}
.bar-search-icon {
  position: absolute;
  left: 11px;
  color: var(--dim);
  pointer-events: none;
  font-size: 14px;
}
.shelf-filter {
  width: 100%;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 7px 12px 7px 34px;
  color: var(--fg);
  font-size: 13px;
  outline: none;
  transition: all var(--transition-fast);
}
.shelf-filter:focus {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
body[data-theme="light"] .shelf-filter,
body[data-theme="sepia"] .shelf-filter,
body[data-theme="green"] .shelf-filter {
  background: rgba(255, 255, 255, 0.6);
}

.bar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar .title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* ---------- 按钮规范 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all var(--transition-fast);
}
.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.btn:active {
  transform: scale(0.96);
}
.btn.primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 18px var(--accent-glow);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--dim);
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}
body[data-theme="light"] .btn.ghost:hover,
body[data-theme="sepia"] .btn.ghost:hover,
body[data-theme="green"] .btn.ghost:hover {
  background: rgba(0, 0, 0, 0.05);
}
.btn.secondary {
  background: var(--line);
  color: var(--fg);
}
.btn.danger {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
  box-shadow: 0 4px 12px var(--err-glow);
}
.btn.danger:hover {
  filter: brightness(1.1);
}
.btn.btn-icon {
  padding: 8px 12px;
}
.btn.round {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  padding: 0;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.round.big {
  width: 58px;
  height: 58px;
  font-size: 22px;
}
.btn.sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn.wide {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

/* ---------- 输入框与表单 ---------- */
input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--fg);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea,
body[data-theme="sepia"] input,
body[data-theme="sepia"] select,
body[data-theme="sepia"] textarea,
body[data-theme="green"] input,
body[data-theme="green"] select,
body[data-theme="green"] textarea {
  background: rgba(255, 255, 255, 0.8);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea {
  resize: vertical;
  line-height: 1.5;
}
.modern-code-editor {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, "Courier New", monospace;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.35);
}

/* 滑块 Range 样式 */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  padding: 0;
  background: rgba(148, 163, 184, 0.2);
  border: none;
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--accent);
  box-shadow: 0 2px 6px var(--accent-glow);
  border: 2px solid #fff;
  transition: transform var(--transition-fast);
  cursor: grab;
}
input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
input[type=range]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.25);
}

/* 提示文本与代码标签 */
code {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
  font-family: ui-monospace, monospace;
}
.hint {
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 4px 0;
}
.value-badge {
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  margin-left: 6px;
}

/* ---------- 书架页面与 3D 书籍卡片 ---------- */
.shelf-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.grid {
  display: grid;
  gap: 20px 18px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  align-content: start;
}
@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 24px 20px;
  }
}

.card {
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal);
}
.card:hover {
  transform: translateY(-5px);
}

/* 精致 3D 书脊与封面质感 */
.cover {
  position: relative;
  aspect-ratio: 3/4.2;
  border-radius: 8px 12px 12px 8px;
  padding: 16px 14px 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  color: #fff;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.4), inset -2px 0 4px rgba(0,0,0,0.2);
  overflow: hidden;
  word-break: break-word;
  transition: box-shadow var(--transition-normal);
}
.card:hover .cover {
  box-shadow: 0 16px 32px -6px rgba(0, 0, 0, 0.5), inset -2px 0 5px rgba(0,0,0,0.3);
}

/* 书脊立体凹槽线 */
.cover::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 9px;
  background: linear-gradient(90deg, rgba(0,0,0,0.45) 0%, rgba(255,255,255,0.15) 40%, rgba(0,0,0,0.35) 100%);
  border-radius: 8px 0 0 8px;
  box-shadow: 1px 0 2px rgba(0,0,0,0.4);
  z-index: 3;
}
/* 封面纸张柔光层 */
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, transparent 45%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}
.cover-title {
  position: relative;
  z-index: 2;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.cover-bottom-tag {
  position: relative;
  z-index: 2;
  margin-top: auto;
  align-self: flex-start;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.card .name {
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 8px;
  line-height: 1.35;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card .meta {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card .meta .pct-tag {
  color: var(--accent);
  font-weight: 600;
}

/* 进度微进度条 */
.card-prog-line {
  height: 3px;
  width: 100%;
  background: var(--line);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}
.card-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--transition-fast);
}

/* 书籍卡片删除按钮 (悬浮微显) */
.card .del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.85);
  transition: all var(--transition-fast);
  z-index: 5;
}
.card:hover .del {
  opacity: 1;
  transform: scale(1);
}
.card .del:hover {
  background: var(--err);
  border-color: var(--err);
  transform: scale(1.08);
}

/* 触摸设备没有 hover：删除按钮常显，否则手机上根本点不到 */
@media (hover: none) {
  .card .del {
    opacity: 0.92;
    transform: scale(1);
  }
}

/* ---------- 书架多选 / 批量删除 ---------- */
.card.multi {
  user-select: none;
}
.card.multi .del {
  display: none;
}
.card.multi:hover {
  transform: none;
}
.card.sel .cover {
  box-shadow: 0 0 0 2.5px var(--accent), 0 8px 20px -4px rgba(0, 0, 0, 0.45);
}
.card.sel .name {
  color: var(--accent);
}
.card-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  transition: all var(--transition-fast);
}
.card-check::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.card-check.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.card-check.on::after {
  opacity: 1;
}

/* 空书架拖拽区 */
.shelf-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.empty-dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 48px 36px;
  text-align: center;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-normal);
}
.empty-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: scale(1.02);
}
.empty-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.empty-icon {
  width: 32px;
  height: 32px;
}
.empty-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--fg);
}
.empty-desc {
  font-size: 13.5px;
  color: var(--dim);
  margin: 0 0 24px;
  line-height: 1.6;
}
.empty-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- 阅读器核心界面 ---------- */
#reader {
  background: var(--page-bg);
}
#reader .bar.glass {
  background: color-mix(in srgb, var(--page-bg) 88%, #000);
  border-color: rgba(255, 255, 255, 0.08);
}
body[data-theme="light"] #reader .bar.glass,
body[data-theme="sepia"] #reader .bar.glass,
body[data-theme="green"] #reader .bar.glass {
  background: color-mix(in srgb, var(--page-bg) 88%, #fff);
  border-color: rgba(0, 0, 0, 0.08);
}

.reader-titles {
  flex: 1;
  min-width: 0;
  text-align: center;
}
.reader-titles .title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--page-fg);
}
.reader-titles .sub-title {
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* 阅读器正文容器 */
.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--pd) var(--pd) 32vh;
  font-size: var(--fs);
  line-height: var(--lh);
  color: var(--page-fg);
  scroll-behavior: smooth;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}
.content h1, .content h2.ch-head {
  font-size: calc(var(--fs) * 1.25);
  margin: 1.2em 0 1em;
  line-height: 1.35;
  font-weight: 700;
  color: var(--page-fg);
  letter-spacing: -0.01em;
}
.content .ch-head {
  break-inside: avoid;
  break-after: avoid;
  page-break-after: avoid;
}
/* 连续阅读：平滑章节衔接点 */
.content .ch-block + .ch-block > .ch-head {
  margin-top: 3.2em;
  text-align: center;
}
.content .ch-block + .ch-block > .ch-head::before {
  content: "— · · · —";
  display: block;
  font-size: 0.6em;
  font-weight: 400;
  letter-spacing: 0.4em;
  opacity: 0.35;
  margin: 0 0 1.2em;
}
.content p {
  margin: 0 0 1.1em;
  text-indent: 2em;
  text-align: justify;
  letter-spacing: 0.02em;
}

/* 句子朗读高亮美学：优雅柔光光环 */
.content .s {
  border-radius: 4px;
  transition: background-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
  cursor: pointer;
}
.content .s:hover {
  background: rgba(59, 130, 246, 0.15);
}
.content .s.active {
  background: var(--accent-glow);
  color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-glow);
  font-weight: 600;
}
.content .s.done {
  opacity: 0.58;
}
.content::selection, .content ::selection {
  background: var(--accent-glow);
}

/* 翻页模式定制 */
.content.mode-page, .content.mode-slide {
  padding-bottom: var(--pd);
  scrollbar-width: none;
}
.content.mode-page::-webkit-scrollbar,
.content.mode-slide::-webkit-scrollbar {
  display: none;
}
.content.mode-slide {
  overflow: hidden;
  min-height: 0;
  column-fill: auto;
  -webkit-overflow-scrolling: auto;
  padding-bottom: var(--pd);
}
.content.mode-slide h1, .content.mode-slide .ch-head {
  column-span: none;
  margin-top: 0;
}
.content.mode-slide .ch-block + .ch-block > .ch-head {
  margin-top: 0;
}
.content.mode-slide p {
  margin-bottom: 0.9em;
}

/* 底部状态控制栏 */
.bar.bottom {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.btn-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  padding: 6px 12px;
}

/* 进度条精致设计 */
.prog-wrapper {
  flex: 1;
  margin: 0 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.prog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.prog-text {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--dim);
}
.prog-ch-info {
  font-size: 11px;
  color: var(--dim-light);
}
.prog-track {
  width: 100%;
  height: 4px;
  background: var(--line-strong);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.prog-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-fast);
}

.btn-listen-glow {
  background: var(--accent-gradient);
  box-shadow: 0 4px 16px var(--accent-glow);
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.btn-listen-glow:hover {
  transform: scale(1.06);
}

/* 沉浸式阅读：顶部与底部自动隐藏 */
body.hud-hidden #topBar {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
body.hud-hidden #bottomBar {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

/* 全书完结尾标识 */
.chend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 50px 0 70px;
}
.chend-line {
  font-size: 13.5px;
  letter-spacing: 0.35em;
  opacity: 0.55;
  color: var(--page-fg);
}

/* ---------- 灵动音频悬浮播放胶囊 (TTS Capsule) ---------- */
.tts-capsule {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(92vw, 560px);
  background: var(--panel-glass-thick);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  padding: 6px 10px 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: capsuleUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes capsuleUp {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* 跳动音波可视化 */
.capsule-wave {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 20px;
  padding: 0 4px;
  flex-shrink: 0;
}
.wave-bar {
  width: 3px;
  height: 6px;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: height 0.15s ease;
}
.tts-capsule.playing .wave-bar:nth-child(1) { animation: wave 1s infinite 0.1s ease-in-out; }
.tts-capsule.playing .wave-bar:nth-child(2) { animation: wave 0.8s infinite 0.25s ease-in-out; }
.tts-capsule.playing .wave-bar:nth-child(3) { animation: wave 1.1s infinite 0.05s ease-in-out; }
.tts-capsule.playing .wave-bar:nth-child(4) { animation: wave 0.9s infinite 0.35s ease-in-out; }

@keyframes wave {
  0%, 100% { height: 4px; }
  50% { height: 18px; }
}

.capsule-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.capsule-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.capsule-meta {
  font-size: 11px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capsule-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-capsule-ctrl {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-capsule-ctrl:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}
.btn-capsule-ctrl.close:hover {
  background: var(--err-glow);
  color: var(--err);
}
.btn-capsule-play {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform var(--transition-fast);
}
.btn-capsule-play:active {
  transform: scale(0.92);
}
.capsule-speed-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

/* 朗读开启时正文底部增加间距 */
body.tts-open #content {
  padding-bottom: 240px;
}

/* ---------- 目录抽屉 (Drawer) ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 30;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(88vw, 400px);
  z-index: 35;
  background: var(--panel-glass-thick);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
  animation: slideInLeft 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: none; }
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  padding-top: calc(14px + env(safe-area-inset-top));
}
.toc-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.toc-search-wrap .svg-icon {
  position: absolute;
  left: 11px;
  color: var(--dim);
}
.toc-search-wrap input {
  padding: 8px 30px 8px 34px;
  border-radius: var(--radius-full);
  font-size: 13px;
}
.search-clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}
.drawer-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--line);
}
.toc-count-badge {
  font-size: 12px;
  color: var(--dim);
  font-weight: 500;
}

.toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.toc-item {
  padding: 12px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 10px;
  align-items: baseline;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.toc-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.toc-item.cur {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}
.toc-item .n {
  font-size: 11px;
  color: var(--dim);
  min-width: 2.8em;
  font-family: ui-monospace, monospace;
}
.toc-item .sn {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.5;
  margin-top: 4px;
}

/* ---------- 底部面板 (Sheet) ---------- */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--panel-glass-thick);
  backdrop-filter: blur(36px) saturate(190%);
  -webkit-backdrop-filter: blur(36px) saturate(190%);
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}

.sheet-grab {
  width: 42px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--line-strong);
  margin: 2px auto 14px;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}
.sheet-close-btn {
  font-size: 16px;
  padding: 6px;
}

/* 设置分组卡片 */
.setting-group {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
body[data-theme="light"] .setting-group,
body[data-theme="sepia"] .setting-group,
body[data-theme="green"] .setting-group {
  background: rgba(255, 255, 255, 0.5);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}
.row:first-child { margin-top: 0; }
.row:last-child { margin-bottom: 0; }
.row.col {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.row label {
  font-size: 13.5px;
  color: var(--dim);
  font-weight: 500;
  white-space: nowrap;
}
.row.switch-row {
  justify-content: space-between;
}
.slider-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}
.slider-subrow {
  margin: 6px 0 14px;
}

/* 字号步进器 Stepper */
.stepper-wrap {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.15);
  overflow: hidden;
}
.stepper-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
}
.stepper-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.stepper-val {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
}

/* 翻页模式分段控件 (Modern Seg) */
.modern-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: transparent;
  border: none;
}
.modern-seg button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  color: var(--dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.modern-seg button:hover {
  background: rgba(255, 255, 255, 0.08);
}
.modern-seg button.on {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.seg-icon {
  font-size: 20px;
  margin-bottom: 4px;
}
.seg-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.seg-desc {
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 2px;
}

/* iOS 风格平滑切换开关 (Switch Toggle) */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--line-strong);
  border-radius: var(--radius-full);
  transition: 0.25s;
}
.switch-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.switch-toggle input:checked + .switch-slider {
  background-color: var(--accent);
}
.switch-toggle input:checked + .switch-slider::before {
  transform: translateX(22px);
}

/* 主题颜色选择盘 (Theme Cards) */
.modern-themes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.theme-card:hover {
  background: rgba(255, 255, 255, 0.08);
}
.theme-card.on {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.theme-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-block;
}
.theme-name {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--dim);
}
.theme-card.on .theme-name {
  color: var(--accent);
  font-weight: 600;
}

/* 标签页导航 (Tabs) */
.tabs {
  display: flex;
  gap: 8px;
  flex: 1;
}
.tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tab:hover {
  background: rgba(255, 255, 255, 0.08);
}
.tab.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* 朗读控制卡片 */
.tts-playback-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.tts-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tts-info {
  flex: 1;
  min-width: 0;
  margin-left: 6px;
}
#ttsNow {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--fg);
  max-height: 2.9em;
  overflow: hidden;
}
.speed-presets-row {
  display: flex;
  gap: 6px;
  margin: 6px 0 12px;
  flex-wrap: wrap;
}
.speed-pill {
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.speed-pill:hover, .speed-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.preset-note-box {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  margin: 8px 0 14px;
}
.template-tags-hint {
  font-size: 12px;
  color: var(--dim);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tts-test-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.test-result-box {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.5;
  min-height: 36px;
  display: none;
}
.test-result-box.show {
  display: block;
}

/* 小米音色克隆：文件选择 + 上传/删除按钮 */
.clone-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.clone-upload-row input[type="file"] {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--dim);
  padding: 6px 8px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line);
  background: rgba(0, 0, 0, 0.15);
}
.clone-upload-row input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: var(--line);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.clone-upload-row .btn {
  flex: 0 0 auto;
}
#mimoVoiceDesc {
  resize: vertical;
  min-height: 68px;
  line-height: 1.6;
  font-family: inherit;
}

/* ---------- 搜书与详情页面 ---------- */
.search-box-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-icon {
  position: absolute;
  left: 12px;
  color: var(--dim);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 9px 34px 9px 38px;
  color: var(--fg);
  font-size: 14px;
  outline: none;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-box-wrap .search-clear-btn {
  right: 12px;
}

.status-pill {
  padding: 8px 18px;
  font-size: 12.5px;
  color: var(--dim);
  font-weight: 500;
}

.res-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 18px 24px;
}
.res-group {
  margin: 18px 0 8px;
  font-size: 12.5px;
  color: var(--dim);
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
}
.res-group b {
  color: var(--accent);
  font-size: 13.5px;
}

.res-item {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--panel-glass);
  border: 1px solid var(--line);
  margin-bottom: 10px;
  cursor: pointer;
  align-items: flex-start;
  transition: all var(--transition-fast);
}
.res-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.res-item:active {
  transform: scale(0.99);
}
.res-item .thumb {
  width: 58px;
  height: 78px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
  background: linear-gradient(150deg, #2b3a55, #1a2230);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  color: #8fa0bb;
  text-align: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.res-item .info {
  flex: 1;
  min-width: 0;
}
.res-item .t {
  font-size: 15px;
  color: var(--fg);
  font-weight: 700;
  margin-bottom: 4px;
}
.res-item .m {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 书籍详情页 */
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.d-head {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.d-head .cover {
  width: 110px;
  height: 150px;
  border-radius: 8px 12px 12px 8px;
  object-fit: cover;
  flex: none;
  background: linear-gradient(150deg, #2b3a55, #1a2230);
  box-shadow: var(--shadow-md);
}
.d-head .meta {
  flex: 1;
  min-width: 0;
}
.d-head h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.3;
}
.d-head .line {
  font-size: 13px;
  color: var(--dim);
  margin: 4px 0;
  line-height: 1.5;
}
.d-intro {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--fg);
  opacity: 0.92;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
  white-space: pre-wrap;
  border-left: 3px solid var(--accent);
}
.d-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.d-actions .btn {
  flex: 1;
  padding: 11px;
  font-size: 14.5px;
}
.ch-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.ch-list a {
  font-size: 12.5px;
  color: var(--fg);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-glass);
  border: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.ch-list a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 书源管理页面 ---------- */
.src-toolbar {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.src-filter-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}
.src-filter-wrap .svg-icon {
  position: absolute;
  left: 10px;
  color: var(--dim);
  font-size: 13px;
}
.src-filter-input {
  padding: 6px 12px 6px 30px;
  font-size: 12.5px;
  border-radius: var(--radius-full);
}
.src-stat-group {
  font-size: 12px;
  color: var(--dim);
}
.src-actions-group {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.src-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 30px;
}
.src-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--panel-glass);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}
.src-row:hover {
  background: rgba(255, 255, 255, 0.06);
}
.src-row .n {
  flex: 1;
  min-width: 0;
}
.src-row .n b {
  font-size: 14px;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.src-row .n span {
  font-size: 11.5px;
  color: var(--dim);
}
.sw {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.25);
  position: relative;
  flex: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.sw::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: all 0.2s;
}
.sw.on {
  background: var(--accent);
}
.sw.on::after {
  left: 22px;
}
.src-row .mini {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.src-row .mini:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.src-row .mini.danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}
.src-row .mini.danger:hover {
  border-color: #f87171;
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}

/* ---------- 书源多选 / 批量删除 ---------- */
.src-bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-glass-thick);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  animation: slideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.bulkbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bulk-pill-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
}
.src-bulkbar .hint {
  flex: 1;
  min-width: 120px;
  font-size: 12.5px;
}
.src-bulk-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.src-bulk-actions .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.src-row.multi {
  cursor: pointer;
  user-select: none;
}
.src-row.multi .sw {
  display: none;
}
.src-row.picked {
  background: var(--accent-glow);
  border-color: var(--accent);
}
.src-check {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid rgba(148, 163, 184, 0.55);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}
.src-check.on {
  background: var(--accent);
  border-color: var(--accent);
}
.src-check.on::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- 自定义确认弹窗 (Confirm Modal) ---------- */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.16s ease-out;
}
.confirm-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel-glass-thick);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalScale 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalScale {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.confirm-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--err-glow);
  color: var(--err);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.confirm-icon-wrap .svg-icon {
  width: 26px;
  height: 26px;
}
.confirm-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--fg);
}
.confirm-msg {
  font-size: 13.5px;
  color: var(--dim);
  line-height: 1.5;
  margin: 0 0 20px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
}
.confirm-actions .btn {
  flex: 1;
}

/* ---------- 极光轻量气泡 Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 500;
  max-width: 88vw;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  animation: toastPop 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
@keyframes toastPop {
  from { transform: translate(-50%, 20px) scale(0.95); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}
.toast.ok {
  border-color: var(--ok);
  background: rgba(16, 185, 129, 0.9);
}
.toast.err {
  border-color: var(--err);
  background: rgba(239, 68, 68, 0.9);
}

/* ---------- 响应式细节调整 ---------- */
@media (max-width: 640px) {
  .brand-title {
    font-size: 15px;
  }
  .bar-search-wrap {
    display: none;
  }
  .btn-text {
    display: none;
  }
  .btn.btn-icon {
    padding: 8px;
  }
  .card .cover {
    padding: 12px 10px 10px 14px;
  }
  .cover-title {
    font-size: 13px;
  }
}

/* 顶栏账号头像与浮层菜单（多用户） */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn:hover .avatar {
  transform: scale(1.08);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.user-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 16px;
  z-index: 50;
  width: 250px;
  background: var(--panel-glass-thick);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  animation: popoverIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes popoverIn {
  from { transform: translateY(-8px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.user-popover-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.user-popover-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--accent-glow);
  flex-shrink: 0;
}
.user-popover-meta {
  flex: 1;
  min-width: 0;
}
.user-popover-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-popover-status {
  font-size: 11px;
  color: var(--dim);
  display: inline-block;
  margin-top: 2px;
}
.user-popover-menu {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.user-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.user-popover-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}
.user-popover-item .svg-icon {
  width: 16px;
  height: 16px;
  color: var(--dim);
}
.user-popover-item:hover .svg-icon {
  color: var(--accent);
}
.user-popover-item.danger {
  color: var(--err);
}
.user-popover-item.danger:hover {
  background: var(--err-glow);
  color: var(--err);
}
.user-popover-item.danger .svg-icon {
  color: var(--err);
}
.user-popover-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

/* ============ 搜索过滤 chips + 作者命中标记 ============ */
.chip-row {
  display: flex;
  gap: 8px;
  padding: 0 18px 8px;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  border: 1px solid var(--line-strong);
  background: var(--panel-glass);
  color: var(--dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s, box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.chip.on {
  color: #fff;
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.hit-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  border-radius: 999px;
  color: var(--ok);
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  vertical-align: middle;
  white-space: nowrap;
}
