/* ============================================================
   Chwt Manga - 移动端优先漫画阅读器样式
   手机 / Pad / PC 自适应
   ============================================================ */
:root {
  --bg: #12131a;
  --bg-soft: #1a1c26;
  --bg-card: #1f2230;
  --bg-hover: #282c3d;
  --border: #2c3042;
  --text: #e8eaf2;
  --text-dim: #9aa0b4;
  --text-faint: #6b7188;
  --accent: #6c8cff;
  --accent-soft: rgba(108, 140, 255, 0.15);
  --danger: #ff6b6b;
  --success: #4cd97b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --header-h: 40px;
  --tabbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --reader-font-scale: 1;
}

/* FEAT-05：浅色主题（设置页可切换，html[data-theme="light"]） */
html[data-theme="light"] {
  --bg: #f4f5f9;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #eceef5;
  --border: #dde1ec;
  --text: #1d2230;
  --text-dim: #5c6377;
  --text-faint: #9aa0b4;
  --accent: #4a6cf7;
  --accent-soft: rgba(74, 108, 247, 0.12);
  --danger: #e5484d;
  --success: #23964a;
  --shadow: 0 4px 16px rgba(30, 40, 90, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }

/* 关键修复：hidden 属性会被类选择器的 display:flex/grid 覆盖（实例：
   .img-overlay 设了 display:flex，导致带 hidden 的遮罩永远可见=「一直转圈」）。
   用 !important 保证 hidden 语义永远生效。 */
[hidden] { display: none !important; }

/* ---------------- 首屏加载遮罩 ---------------- */
.boot {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg); color: var(--text);
  transition: opacity .3s ease;
}
.boot--hidden { opacity: 0; pointer-events: none; }
.boot-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--accent);
  animation: boot-spin .9s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-text { font-size: 13px; color: var(--text-faint); }
.boot-error { text-align: center; padding: 0 24px; max-width: 320px; }
.boot-error-icon { font-size: 32px; }
.boot-error-title { font-size: 16px; font-weight: 600; margin-top: 8px; }
.boot-error-desc { font-size: 13px; color: var(--text-faint); margin-top: 6px; line-height: 1.5; }
.boot-retry {
  margin-top: 16px; padding: 9px 22px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 14px; cursor: pointer;
}
/* 8s 超时页里的启动事件流（截图即可定位问题） */
.boot-diag {
  margin: 12px auto 0; padding: 8px 10px; max-width: 320px; max-height: 38vh;
  overflow: auto; text-align: left; font-size: 11px; line-height: 1.6;
  color: var(--text-faint); background: rgba(255, 255, 255, 0.06);
  border-radius: 8px; white-space: pre-wrap; word-break: break-all;
}
/* 5 连点屏幕调出的诊断浮层 */
.diag-panel {
  position: fixed; top: 56px; left: 8px; right: 8px; z-index: 10000;
  max-height: 62vh; overflow: auto; margin: 0; padding: 10px 12px;
  background: var(--bg); color: var(--text-faint); border: 1px solid var(--border);
  border-radius: 10px; font-size: 11px; line-height: 1.6; text-align: left;
  white-space: pre-wrap; word-break: break-all; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
/* 调试面板增强：div 容器 + 标题栏按钮行 + 分区内容（移动端可滚动、按钮可点） */
.diag-panel { display: flex; flex-direction: column; gap: 6px; }
.diag-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.diag-title {
  flex: 1 1 auto; min-width: 120px; font-size: 11px; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.diag-btn {
  min-height: 32px; padding: 0 12px; font-size: 13px; line-height: 1;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-hover); color: var(--text); cursor: pointer;
  touch-action: manipulation; user-select: none;
}
.diag-btn:active { opacity: 0.7; }
.diag-section {
  margin: 0; padding: 6px 8px; max-height: 26vh; overflow: auto;
  background: rgba(255, 255, 255, 0.04); border-radius: 8px;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--text); }
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 布局 ---------------- */
/* 顶栏：单行恒定高度（见 --header-h）。左端 = 返回键（仅子页出现）+ 版本徽标（恒在左上，点按开诊断窗）。
   返回键与版本号共占同一行（tab 页用 display:none 彻底不占位 → 不浪费整行）。
   因 header 恒在且内容 padding 恒定，返回键显隐不会推动下方任何元素。 */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-h);            /* 统一高度：tab 与子页一致，返回键显隐不撑高 */
  padding-top: var(--safe-top);
  display: flex; flex-direction: row; align-items: center; gap: 2px;
  padding-left: 6px; padding-right: 8px;
  background: rgba(18, 19, 26, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 返回键（#header-back）：紧贴版本号右侧；子页无返回目标时 display:none（不占空间），而非占位 */
#header-back {
  width: 32px; height: 32px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--text); font-size: 20px; line-height: 1;
  background: transparent; transition: background 0.2s;
  margin-left: -2px;
}
#header-back:active { background: var(--bg-hover); }
#header-back.back-hidden { display: none; } /* tab 页/无历史：彻底移除，版本号左移顶满，不浪费行 */

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text); background: transparent;
  transition: background 0.2s;
  flex: none;
}
.icon-btn:active { background: var(--bg-hover); }
.icon-btn[hidden] { display: none; }

/* 版本徽标（恒在左上；点它开/关诊断窗） */
.version-badge {
  font-size: 9px; line-height: 1; color: var(--text-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.2px; user-select: none;
  white-space: nowrap; padding: 4px 6px; cursor: pointer;
}
.version-badge[hidden] { display: none; }

.app-main {
  padding-top: calc(var(--header-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  min-height: 100vh;
}
.app-main.no-tabbar { padding-bottom: calc(16px + var(--safe-bottom)); }

.app-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; align-items: stretch;
  background: rgba(18, 19, 26, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.app-tabbar .tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-dim); font-size: 11px;
  transition: color 0.2s;
}
.app-tabbar .tab-item .tab-icon { font-size: 21px; line-height: 1; }
.app-tabbar .tab-item.active { color: var(--accent); font-weight: 600; }

/* ---------------- 通用组件 ---------------- */
.view { padding: 0 12px 12px; animation: fadeIn 0.2s ease; } /* 顶部 0：版本号/标题紧贴 header */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-title { font-size: 18px; font-weight: 700; margin: 2px 4px 12px; }
.section-title { font-size: 15px; font-weight: 700; margin: 20px 4px 10px; color: var(--text); display: flex; align-items: center; gap: 8px; }
/* 设置页可折叠分区：标题整行可点，状态持久化在 settings.sectionsCollapsed（默认折叠） */
.section-block + .section-block { margin-top: 2px; }
.section-head { justify-content: space-between; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.section-head:active { opacity: 0.65; }
.section-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.section-head-text { min-width: 0; }
.section-caret { flex: none; font-size: 12px; line-height: 1; color: var(--text-faint); transition: transform 0.18s ease; }
.section-block.collapsed .section-caret { transform: rotate(-90deg); }
.section-block.collapsed .section-head { margin-bottom: 0; }
/* MEDIA：发现页默认聚合视图——按类型分区块（漫画/图片/小说/书籍） */




/* 卡片 */
.card {
  background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 12px; margin-bottom: 10px;
}

/* 空状态 */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-faint);
}
.empty-state .empty-icon { font-size: 42px; margin-bottom: 10px; }
.empty-state .empty-title { font-size: 16px; color: var(--text-dim); margin-bottom: 6px; }

/* 加载中 */
.loading-state {
  text-align: center; padding: 60px 24px; color: var(--text-faint);
}
.spinner {
  width: 28px; height: 28px; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 漫画网格 */
.manga-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.manga-card { cursor: pointer; }
.manga-card .cover-wrap {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border);
}
.manga-card .cover {
  width: 100%; height: 100%; object-fit: cover; background: var(--bg-soft);
  transition: transform 0.25s ease;
}
.manga-card:active .cover { transform: scale(1.05); }
.manga-card .badge {
  position: absolute; right: 4px; bottom: 4px; font-size: 10px; line-height: 1;
  background: rgba(0, 0, 0, 0.72); color: #fff; padding: 3px 5px; border-radius: 4px;
}
/* 跨源重复标记：同一本书在 N 个源都有，点击可换源（定位左上角，避免与"最新话"角标重叠） */
.manga-card .badge-src {
  position: absolute; left: 4px; top: 4px; font-size: 10px; line-height: 1;
  background: var(--accent, #4a90d9); color: #fff; padding: 3px 5px; border-radius: 4px;
  z-index: 2;
}
.manga-card .title {
  margin-top: 6px; font-size: 13px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.manga-card .sub {
  margin-top: 2px; font-size: 11px; color: var(--text-faint);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

/* 横向滚动列表 */

/* 分段 tab（发现页：发现 | 资源） */
.seg-tabs {
  display: flex; gap: 4px; padding: 3px; margin: 10px 0 14px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
}
.seg-tab {
  flex: 1; height: 34px; border: none; border-radius: 8px; background: transparent;
  color: var(--text-dim); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg-tab.active { background: var(--bg-card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.seg-pane[hidden] { display: none !important; } /* 兜底：防 [hidden] 兜底规则被特例化 */
.src-panel-hint { padding: 2px 0 10px; }
/* 资源面板：源行点击跳转该源资源页（#/source/{id}） */
.src-row { cursor: pointer; align-items: flex-start; flex-wrap: wrap; }
/* 源名/meta 区占满剩余空间，ⓘ 与开关靠右（行中心落在信息区 → 点击即跳转） */
.src-info { flex: 1; min-width: 0; }
.src-row-open { background: var(--bg-soft); }
.src-detail {
  flex-basis: 100%; width: 100%;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.src-detail-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.src-detail-k { color: var(--text-faint); flex-shrink: 0; }
.src-detail-v { color: var(--text-dim); text-align: right; word-break: break-all; }
/* 源行详情展开按钮（行点击已用于跳转资源页，2026-10-14） */
.src-detail-btn {
  flex-shrink: 0; width: 30px; height: 30px; margin-right: 2px;
  border: none; border-radius: 8px; background: transparent;
  color: var(--text-faint); font-size: 15px; line-height: 1; cursor: pointer;
}
.src-detail-btn:hover { background: var(--bg-soft); color: var(--text-dim); }
/* 发现页标题行：左「发现」+ 右「一键测速」（与标题同行右对齐，2026-10-14） */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 4px 12px; }
.view-head .view-title { margin: 0; }
/* 源资源页：分类横向 tab（replace 切换，不污染返回栈） */
.source-cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.source-cats::-webkit-scrollbar { display: none; }
.source-cat-tab {
  flex-shrink: 0; height: 30px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 15px;
  background: var(--bg-soft); color: var(--text-dim); font-size: 13px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.source-cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.source-home-body { min-height: 40vh; }
/* 空书架引导卡 */
.shelf-guide {
  margin: 10px 0 4px; padding: 22px 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  text-align: center;
}
.shelf-guide-icon { font-size: 34px; margin-bottom: 8px; }
.shelf-guide-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.shelf-guide-desc { font-size: 13px; color: var(--text-faint); margin-bottom: 14px; }
.shelf-guide-btn { width: 100%; max-width: 220px; height: 38px; font-size: 14px; }

/* 发现页区块：单行横向轨（控制页面长度；轨内视口外的封面由原生 lazy 拦住，滑到才请求） */
.discover-row {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  padding: 2px 0 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.discover-row::-webkit-scrollbar { height: 0; display: none; }
.discover-row > .manga-card {
  flex: 0 0 auto; width: 30%; max-width: 118px; scroll-snap-align: start;
}
/* 区块末尾「更多 N」：按需展开剩余条目（不预先建 DOM、不预加载图片） */
.discover-more {
  flex: 0 0 auto; width: 58px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1.25; text-align: center; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: transparent; cursor: pointer;
}
.discover-more:active { border-color: var(--accent, #4a90d9); color: var(--accent, #4a90d9); }




/* 搜索框 */
.search-box {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.search-box input {
  flex: 1; height: 42px; padding: 0 14px; border-radius: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }
/* FEAT-09：键盘可访问性——仅键盘聚焦时显示清晰焦点环（鼠标点击不闪环） */
:focus-visible {
  outline: 2px solid var(--accent, #5b8cff);
  outline-offset: 2px;
  border-radius: 4px;
}
.search-box .search-btn {
  height: 42px; padding: 0 18px; border-radius: 10px; background: var(--accent);
  color: #fff; font-weight: 600; font-size: 15px;
}

/* 高级搜索过滤栏 */
.search-filters {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px;
  -webkit-overflow-scrolling: touch; align-items: center;
}
.search-filters::-webkit-scrollbar { display: none; }
.filter-group { flex: 0 0 auto; }
.filter-select {
  height: 36px; padding: 0 10px; border-radius: 8px; font-size: 13px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim);
  max-width: 44vw;
}
.filter-select:focus { border-color: var(--accent); }
.filter-clear { margin-left: auto; color: var(--accent); border-color: var(--accent); }

/* 书架整理工具栏 */
.shelf-toolbar { margin-bottom: 12px; }
.shelf-toolbar-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.shelf-toolbar-foot .filter-select { flex: 1; max-width: none; }
.shelf-cell { position: relative; }
.shelf-edit-btn {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; border: none;
  font-size: 14px; line-height: 28px; text-align: center;
  backdrop-filter: blur(2px);
}
.shelf-edit-btn:active { background: var(--accent); }

/* 逐本整理底部弹层 */
.sheet-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; justify-content: center;
}
.sheet-panel {
  width: 100%; max-width: 520px; background: var(--bg-card); color: var(--text);
  border-radius: 16px 16px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,0.3); display: flex; flex-direction: column; gap: 8px;
}
.sheet-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.sheet-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.sheet-input {
  height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text); outline: none;
}
.sheet-input:focus { border-color: var(--accent); }
.sheet-inline { display: flex; gap: 8px; }
.sheet-inline .sheet-input { flex: 1; }
.sheet-actions { display: flex; gap: 12px; margin-top: 10px; }

/* 源筛选 chips */
.source-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
}
.source-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 16px; font-size: 13px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim);
  transition: all 0.2s;
}
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* 分段器 */




/* 源主页（FEAT: 源主页 + 源内分类 tab） */






.load-more {
  display: block; margin: 16px auto 4px; padding: 10px 28px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; cursor: pointer;
}
.load-more:disabled { opacity: 0.55; cursor: default; }

/* MEDIA: 类型 Tab + 类型落地页（类型框架层） */


























/* 详情页 */
.detail-hero {
  display: flex; gap: 14px; padding: 14px 0 4px;
}
.detail-cover {
  flex: 0 0 118px; width: 118px; aspect-ratio: 2 / 3; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-meta { flex: 1; min-width: 0; }
.detail-meta h2 { font-size: 18px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.detail-meta .meta-line { font-size: 13px; color: var(--text-dim); margin-bottom: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.detail-meta .meta-line b { color: var(--text); font-weight: 600; }
.status-tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.status-tag.completed { background: rgba(76, 217, 123, 0.15); color: var(--success); }
.detail-actions { display: flex; gap: 10px; margin: 12px 0; }
.detail-actions .btn {
  flex: 1; height: 40px; border-radius: 10px; font-weight: 600; font-size: 15px;
  background: var(--accent); color: #fff;
}
.detail-actions .btn.secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
.detail-actions .btn.faved { background: var(--bg-card); border: 1px solid var(--danger); color: var(--danger); }
.detail-desc { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin-bottom: 16px; }
.detail-desc.expanded { color: var(--text); }
.detail-desc .desc-toggle { color: var(--accent); font-size: 13px; }

/* 章节列表 */
.chapter-list { display: flex; flex-direction: column; gap: 8px; }
.chapter-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 12px; cursor: pointer;
}
.chapter-item:active { background: var(--bg-hover); }
.chapter-item .ch-num {
  font-size: 14px; font-weight: 600; color: var(--text);
  flex: 0 0 auto; min-width: 64px;
}
.chapter-item .ch-title {
  flex: 1; font-size: 13px; color: var(--text-dim); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.chapter-item .ch-time { font-size: 11px; color: var(--text-faint); flex: 0 0 auto; }
.chapter-item.current { border-color: var(--accent); background: var(--accent-soft); }
.chapter-item.current .ch-num { color: var(--accent); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85); color: #fff; padding: 9px 18px; border-radius: 20px;
  font-size: 14px; z-index: 200; max-width: 82vw; text-align: center;
  animation: toastIn 0.25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 弹层 */
.sheet-backdrop {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 90; background: rgba(0, 0, 0, 0.55);
  animation: fadeIn 0.2s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--bg-soft); border-top-left-radius: 16px; border-top-right-radius: 16px;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  max-height: 75vh; overflow-y: auto;
  animation: sheetUp 0.25s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet h3 { font-size: 16px; margin-bottom: 12px; }





/* 开关 */
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: var(--border); border-radius: 13px;
  transition: background 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 阅读器 */
.reader-shell { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 80; background: #000; overflow: hidden; }
body.reader-open .app-header, body.reader-open .app-tabbar { display: none; }
.reader-topbar, .reader-bottombar {
  position: absolute; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: rgba(10, 10, 12, 0.88); backdrop-filter: blur(10px);
  transition: opacity 0.25s;
}
.reader-topbar { top: 0; padding-top: calc(8px + var(--safe-top)); }
.reader-bottombar { bottom: 0; padding-bottom: calc(8px + var(--safe-bottom)); }
.reader-shell.ui-hidden .reader-topbar,
.reader-shell.ui-hidden .reader-bottombar { opacity: 0; pointer-events: none; }
.reader-topbar .reader-title {
  flex: 1; font-size: calc(13px * var(--reader-font-scale)); color: var(--text-dim); text-align: center; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
/* 关闭按钮复用 icon-btn 样式（‹ 返回风格，与全站 header-back 一致） */
.reader-bottombar .reader-progress { flex: 1; text-align: center; font-size: calc(12px * var(--reader-font-scale)); color: var(--text-dim); }
.reader-nav-btn {
  height: 36px; padding: 0 14px; border-radius: 8px; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text); font-size: calc(13px * var(--reader-font-scale)); font-weight: 600;
  flex: 0 0 auto;
}
.reader-nav-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* 阅读内容区（两种模式共用容器） */
.reader-content { position: absolute; top: 0; right: 0; bottom: 0; left: 0; top: calc(52px + var(--safe-top)); bottom: calc(52px + var(--safe-bottom)); overflow: hidden; }

/* 章节加载中 */
.reader-loading {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}

/* 阅读模式：webtoon（竖滑） */
.reader-scroll { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.reader-scroll .reader-images { display: flex; flex-direction: column; align-items: center; }
/* PERF-03：webtoon 窗口化渲染的轻量占位槽位——定高保滚动高度，img 只挂载窗口内 */
.reader-scroll .page-slot {
  width: 100%; max-width: 820px; min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
  background: #16161a; margin-bottom: 2px;
}
.reader-scroll img.page-img {
  width: 100%; max-width: 820px; height: auto; background: #000;
}
.reader-scroll img.page-img.placeholder {
  /* webtoon 占位：固定 60vh 改为按图片比例 3/4 自适应（min-height 兜底首屏），
     避免加载完成后高度跳变导致的滚动漂移；
     底色/图标由统一 img-ph 三态样式提供（见文件末尾），此处只负责撑高 */
  aspect-ratio: 3 / 4; min-height: 40vh;
}

/* 阅读模式：翻页 */
.reader-content .page-viewport { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.reader-content .page-viewport img.page-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  user-select: none; -webkit-user-drag: none;
}
.reader-content .page-viewport img.page-img.placeholder { width: 100%; height: 100%; }

/* ---- 阅读器体验批次（对标 Mihon / WEBTOON，2026-10-10） ----
   层级约定：内容(0) < 亮度遮罩(4) < 顶/底栏(5) < 自动滚动钮(6)
             < 面板背板(10) < 面板/抽屉(11) < 缩放浮层(20) */
.reader-topbtns { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.reader-center { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.reader-dim { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 4; background: #000; opacity: 0; pointer-events: none; }

/* 画面滤镜（挂在 .reader-content[data-filter]，两种模式通用） */
.reader-content[data-filter="gray"] .page-img { filter: grayscale(1); }
.reader-content[data-filter="warm"] .page-img { filter: sepia(0.45) saturate(1.05) brightness(0.96); }
.reader-content[data-filter="invert"] .page-img { filter: invert(1) hue-rotate(180deg); }

/* paged 适配模式：适屏（默认 contain 居中）/ 适宽（纵向滚动）/ 原始（双向滚动） */
.page-viewport { touch-action: pan-y; }
.page-viewport.zoomed { cursor: grab; }
.page-viewport .page-frame { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; }








/* 横屏双页对开：两页并排（对开时翻页步进为 2） */
.page-viewport.spread .page-frame { gap: 2px; }
.page-viewport.spread img.page-img { max-width: calc(50% - 1px); }


/* 宽页旋转 90°（竖屏看横图；!important 覆盖缩放手势的行内 transform，旋转态不支持再缩放） */
img.page-img.rot90 { transform: rotate(90deg) !important; max-width: 100vh; max-height: 100vw; }

/* 翻页过渡动画（挂在 img 上，避免与白边裁切占用 frame transform 冲突） */
@keyframes page-in-next { from { opacity: 0.35; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes page-in-prev { from { opacity: 0.35; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.page-frame.anim-next img { animation: page-in-next 0.18s ease-out; }
.page-frame.anim-prev img { animation: page-in-prev 0.18s ease-out; }
/* 翻页动画：淡入（无方向位移，纯透明度） */
@keyframes page-fade { from { opacity: 0; } to { opacity: 1; } }
.page-frame.anim-fade-next img, .page-frame.anim-fade-prev img { animation: page-fade 0.22s ease-out; }

/* paged 页码滑条 */
.reader-slider { width: 100%; max-width: 420px; height: 20px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.reader-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--border); }
.reader-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); margin-top: -6px; }
.reader-slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border); }
.reader-slider::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: var(--accent); }

/* 自动滚动快捷钮（webtoon） */
.reader-auto-btn {
  position: absolute; right: 14px; bottom: 66px; z-index: 6;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(108, 140, 255, 0.92); color: #fff; font-size: 15px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); cursor: pointer;
}

/* 阅读设置面板（底部抽屉） */
.reader-sheet { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 11; display: flex; align-items: flex-end; pointer-events: none; }
.reader-sheet-backdrop { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 10; background: rgba(0, 0, 0, 0.45); }
.reader-sheet-panel {
  pointer-events: auto; width: 100%; max-height: 74%; overflow-y: auto;
  background: #16161a; border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(14px + var(--safe-bottom));
  display: flex; flex-direction: column;
}
.rs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.rs-row:last-of-type { border-bottom: none; }
.rs-label { font-size: 13px; color: var(--text); }
.rs-seg { display: flex; background: var(--bg); border-radius: 10px; padding: 2px; gap: 2px; }
.rs-seg-btn { border: none; background: transparent; color: var(--text-dim); font-size: 12px; padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.rs-seg-btn.on { background: var(--accent); color: #fff; font-weight: 600; }
.rs-sw { width: 44px; height: 24px; border-radius: 12px; background: var(--border); border: none; position: relative; cursor: pointer; transition: background 0.2s; flex: 0 0 auto; }
.rs-sw::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform 0.2s; }
.rs-sw.on { background: var(--accent); }
.rs-sw.on::after { transform: translateX(20px); }
.rs-bright { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 220px; }
.rs-range { flex: 1; -webkit-appearance: none; appearance: none; height: 20px; background: transparent; cursor: pointer; }
.rs-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--border); }
.rs-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); margin-top: -6px; }
.rs-bright-val { font-size: 12px; color: var(--text-dim); width: 34px; text-align: right; }
.reader-sheet-close { margin-top: 10px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; border: none; font-size: 14px; cursor: pointer; }

/* 章节抽屉（右侧滑出） */
.reader-drawer { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 11; display: flex; justify-content: flex-end; pointer-events: none; }
.reader-drawer-panel {
  pointer-events: auto; width: min(320px, 86%); height: 100%;
  background: #16161a; display: flex; flex-direction: column;
  padding: 12px 0 calc(8px + var(--safe-bottom));
}
.reader-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
.reader-drawer-list { flex: 1; overflow-y: auto; padding: 6px 8px; -webkit-overflow-scrolling: touch; }
.reader-drawer-item { display: block; width: 100%; text-align: left; padding: 11px 12px; border: none; background: transparent; color: var(--text-dim); font-size: 13px; border-radius: 8px; cursor: pointer; }
.reader-drawer-item.current { background: var(--accent); color: #fff; font-weight: 600; }
.reader-drawer-item.read { opacity: 0.55; }
/* 书签列表（阅读器内逐页书签查看/跳转） */
.reader-bm-rows { flex: 1; overflow-y: auto; padding: 6px 8px; -webkit-overflow-scrolling: touch; }
.reader-bm-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; border-bottom: 1px solid var(--border); }
.reader-bm-info { flex: 1; min-width: 0; text-align: left; padding: 8px 6px; border: none; background: transparent; color: var(--text); border-radius: 8px; cursor: pointer; }
.reader-bm-info:hover { background: var(--bg-card); }
.reader-bm-ch { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-bm-page { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.reader-bm-del { flex: 0 0 auto; padding: 0 12px; }

/* webtoon 双击缩放浮层 */
.zoom-overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 20; background: #000; display: flex; align-items: center; justify-content: center; touch-action: none; }
.zoom-img { max-width: 100%; max-height: 100%; object-fit: contain; will-change: transform; }
.zoom-close {
  position: absolute; top: calc(10px + var(--safe-top)); right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 15px; cursor: pointer;
}

/* 图片加载失败（统一三态：见文件末尾「统一图片状态」；此处 .broken 为旧类兼容） */
img.page-img.broken, .cover.broken { cursor: pointer; }

/* 页脚（章末） */
.chapter-end {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 40px 20px; color: var(--text-dim);
}
.chapter-end .end-title { font-size: 15px; font-weight: 600; color: var(--text); }
.chapter-end .end-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.chapter-end .end-actions .btn {
  height: 42px; padding: 0 22px; border-radius: 10px; background: var(--accent);
  color: #fff; font-weight: 600; font-size: 14px;
}
.chapter-end .end-actions .btn.ghost { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }

/* 图片加载遮罩（当前无 JS 引用，处于常隐状态；[hidden] 全局规则保证其不显示） */
.img-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 150;
  background: rgba(10, 10, 12, 0.8);
  display: flex; align-items: center; justify-content: center;
}
.img-overlay-spinner {
  width: 36px; height: 36px; border: 4px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* 设置页 */
.setting-group { margin-bottom: 16px; }
.setting-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 2px; border-bottom: 1px solid var(--border);
}
.setting-item:last-child { border-bottom: none; }
.setting-item .set-label { font-size: 15px; color: var(--text); }
.setting-item .set-desc { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.setting-item select {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; max-width: 150px;
}
.setting-item .proxy-input {
  flex: 1; min-width: 0; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none;
}
.setting-item .proxy-input:focus { border-color: var(--accent); }


/* WebDAV 云同步表单（FEAT-04）：带标签的字段行 + 统一圆角输入框 + 密码可见性切换 */










/* 源网速评分（设置页） */

.btn-mini {
  flex: none; background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.btn-mini:disabled { opacity: 0.55; }

/* ---- 离线管理（设置页列表 + 详情页下载面板） ---- */
.offline-manage { display: flex; flex-direction: column; gap: 6px; }
.offline-book { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.offline-book-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; cursor: pointer; background: var(--bg-card);
}
.offline-book-title { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offline-book-meta { flex: none; font-size: 11px; color: var(--text-faint); }
.offline-chlist { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.offline-chrow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; font-size: 12px; background: var(--bg);
}
.offline-chrow + .offline-chrow { border-top: 1px solid var(--border); }
.offline-ch-label { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offline-ch-meta { flex: none; color: var(--text-faint); font-size: 11px; }

.offline-backdrop {
  position: fixed; left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
}
.offline-panel {
  width: 100%; max-width: 560px; max-height: 78vh;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-soft); border-radius: 14px 14px 0 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.offline-head { display: flex; align-items: center; justify-content: space-between; }
.offline-title { font-size: 15px; font-weight: 600; color: var(--text); }
.offline-summary { font-size: 12px; color: var(--text-faint); }
.offline-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.offline-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; background: var(--bg-card); font-size: 13px;
}
.offline-row.done { opacity: 0.75; }
.offline-row-label { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offline-row-meta { flex: none; color: var(--text-faint); font-size: 11px; }
.offline-foot {
  display: flex; align-items: center; gap: 10px;
  padding-top: 6px; border-top: 1px solid var(--border);
}
.offline-prog { flex: 1; font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }



/* 发现页分阶段加载：源区块骨架占位 */



@keyframes skeleton-shimmer {
  from { background-position: 120% 0; }
  to { background-position: -80% 0; }
}

/* 列表封面 shimmer 骨架：加载完成前显示流动高光，复用 skeleton-shimmer 动画 */


/* 历史/收藏条目（横向） */
.manga-row {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; cursor: pointer;
}
.manga-row:active { background: var(--bg-hover); }
.manga-row .row-cover {
  flex: 0 0 48px; width: 48px; height: 64px; border-radius: 6px; overflow: hidden;
  background: var(--bg-soft);
}
.manga-row .row-cover img { width: 100%; height: 100%; object-fit: cover; }
.manga-row .row-info { flex: 1; min-width: 0; }
.manga-row .row-title {
  font-size: 14px; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.manga-row .row-sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }


/* ---------------- 响应式：Pad / PC ---------------- */
@media (min-width: 600px) {
  .manga-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .discover-row { gap: 14px; }
  .discover-row > .manga-card { width: 132px; max-width: none; }
  .view { padding: 0 24px 20px; } /* 顶部 0：版本号/标题紧贴 header */
  .app-main { max-width: 900px; margin: 0 auto; }
  
  .detail-hero { padding: 20px 0 8px; }
  .detail-cover { flex-basis: 150px; width: 150px; }
}

@media (min-width: 1024px) {
  .manga-grid { grid-template-columns: repeat(6, 1fr); gap: 18px; }
  .app-main { max-width: 1100px; }
  .reader-scroll img.page-img { max-width: 900px; }
}

/* 图片网格（photo-grid）：方形封面 photo-card */







/* 图片大图查看器（lightbox） */
.lightbox-overlay {
  /* 禁用 inset 简写：部分国产内核不解析 → 全屏层不铺满（回归守卫：tests/e2e + tests/css-guards） */
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1000; background: rgba(0, 0, 0, 0.94);
  display: flex; flex-direction: column;
  animation: fadeIn 0.18s ease;
}
.lightbox-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; color: #fff;
  transition: opacity 0.2s ease;
}
.lightbox-counter { font-size: 13px; opacity: 0.85; }
.lightbox-close {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 16px; line-height: 1;
}
.lightbox-close:active { background: rgba(255, 255, 255, 0.28); }
.lightbox-stage {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center;
  touch-action: pan-y; overflow: hidden;
}
.lightbox-img {
  max-width: 100%; max-height: 100%; object-fit: contain; user-select: none;
  transform-origin: center center; background: transparent;
}
.lightbox-spinner { position: absolute; top: 50%; left: 50%; margin: -14px 0 0 -14px; }
.lightbox-info {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px 16px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  font-size: 13px; transition: opacity 0.2s ease;
}
.lightbox-info-title { font-weight: 600; }
.lightbox-info-sub { opacity: 0.8; }
.lightbox-info-link { color: var(--accent, #8ab4ff); text-decoration: none; }
.lightbox-ui-hidden { opacity: 0; pointer-events: none; }
body.lightbox-open { overflow: hidden; }




/* ============================================================
 * 小说类型（第三批）：book-grid / 搜索 / 详情 / 文本阅读器
 * ============================================================ */

/* ---- 书籍网格（源主页 novel 分支 / 搜索分类共用） ---- */

/* 批次1-问题1/4：book-card 支持「N源」角标（position:relative 供 badge-src 定位）；
 * 标题/作者/语言放宽为最多 2 行，避免完整可读书名被截断成「P...」 */








/* ---- 小说搜索分类（media-source 内嵌搜索框） ---- */





/* ---- 书籍详情（novel-detail） ---- */


















/* ---- 小说文本阅读器（novel-reader，三主题独立于站点主题） ---- */












/* 正文内容区（夹在顶/底栏之间，主题色随 shell） */






/* 目录抽屉 */









/* 阅读提示浮层 */





/* ============================================================
 * 音乐类型（第六批）：music-grid / 详情 / 播放器
 * ============================================================ */

/* ---- 音乐网格（源主页 music 分支 / 搜索分类共用） ---- */

/* 批次1-问题1/3：music-card 支持「N源」角标；标题/作者/meta 放宽为最多 2 行，
 * 容纳完整作品名与「时长 28:31:41 · English · 26 章」类可读 meta */










/* ---- 音乐详情（music-detail，复用 novel-detail 布局骨架） ---- */






/* ---- 音乐播放器（覆盖层，独立于阅读路由） ---- */









@keyframes music-spin { to { transform: rotate(360deg); } }






















/* ================= 综合站点化：类型徽标 + 书架「更新」区块（追更并入书架） ================= */

.shelf-updates { margin-bottom: 4px; }

/* 更新卡片（原追更视图样式，并入书架后复用） */
.upd-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.upd-card {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm, 12px);
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; overflow: hidden;
}
.upd-card.is-new { border-color: var(--accent, #4a90d9); }
.upd-cover { flex: 0 0 auto; }
.upd-cover img {
  width: 46px; height: 62px; object-fit: cover; border-radius: 6px;
  background: var(--bg-soft); display: block;
}
.upd-info { flex: 1; min-width: 0; }
.upd-title {
  font-size: 13px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upd-sub { margin-top: 2px; font-size: 11px; }
.upd-badge {
  flex: 0 0 auto; font-size: 11px; line-height: 1;
  background: rgba(0, 0, 0, 0.72); color: #fff;
  padding: 4px 7px; border-radius: 999px; font-weight: 600;
}
.upd-badge.has-new { background: var(--accent, #4a90d9); }
.upd-mark {
  flex: 0 0 auto; font-size: 11px; padding: 5px 9px;
  border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.upd-mark:hover { border-color: var(--accent, #4a90d9); color: var(--accent, #4a90d9); }

/* 发现页区块：源标题行 + 单行横向轨（样式见 .discover-row） *//* ============================================================
 * 统一图片状态（占位 / 加载中 / 加载失败）
 *
 * 三态职责：
 *   .img-ph                    占位基底：柔和渐变 + 类型图标（封面/页图两版，
 *                              深/浅主题各一版，轻量内联 SVG data URI）
 *   .img-ph.img-state-loading  加载中：shimmer 流动骨架，与静态占位明显区分
 *   .img-ph.img-state-error    加载失败：断链图标 + 「图片加载失败」+ 可点击重试
 *
 * 所有图片入口（卡片封面/详情大图/lightbox/阅读器页图/图片类型源）统一走
 * views/img-ui.js 的 setImgState，视觉与行为在此收敛。
 * ============================================================ */

/* ---- 占位基底（封面：书本图标；默认） ---- */
img.img-ph {
  background-color: var(--bg-soft);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http://www.w3.org/2000/svg'%20width%3D'240'%20height%3D'360'%20viewBox%3D'0%200%20240%20360'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0.9'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%233a4152'/%3E%3Cstop%20offset%3D'0.55'%20stop-color%3D'%23262b36'/%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%231b1f28'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect%20width%3D'240'%20height%3D'360'%20fill%3D'url(%23g)'/%3E%3Cg%20fill%3D'none'%20stroke%3D'%239aa3b8'%20stroke-width%3D'4.5'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20opacity%3D'0.9'%3E%3Cpath%20d%3D'M120%20104c-13-10-32-12-48-8v124c16-4%2035-2%2048%208%2013-10%2032-12%2048-8V96c-16-4-35-2-48%208z'/%3E%3Cpath%20d%3D'M120%20104v124'/%3E%3C/g%3E%3Cg%20fill%3D'%239aa3b8'%20opacity%3D'0.5'%3E%3Ccircle%20cx%3D'66'%20cy%3D'92'%20r%3D'4'/%3E%3Ccircle%20cx%3D'174'%20cy%3D'92'%20r%3D'4'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: min(46%, 120px) auto;
}
/* ---- 占位基底（阅读器页图：图片图标） ---- */
img.img-ph.img-ph-page {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http://www.w3.org/2000/svg'%20width%3D'240'%20height%3D'360'%20viewBox%3D'0%200%20240%20360'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'1'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%232c3342'/%3E%3Cstop%20offset%3D'0.6'%20stop-color%3D'%2320242f'/%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%23171a22'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect%20width%3D'240'%20height%3D'360'%20fill%3D'url(%23g)'/%3E%3Cg%20fill%3D'none'%20stroke%3D'%238b93a7'%20stroke-width%3D'4'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20opacity%3D'0.85'%3E%3Ccircle%20cx%3D'128'%20cy%3D'104'%20r%3D'16'/%3E%3Cpath%20d%3D'M64%20252l46-58%2030%2034%2024-22%2048%2046'/%3E%3C/g%3E%3Cpath%20d%3D'M64%20252h112'%20stroke%3D'%238b93a7'%20stroke-width%3D'4'%20stroke-linecap%3D'round'%20opacity%3D'0.85'/%3E%3C/svg%3E");
}
/* ---- 浅色主题（html[data-theme=light]） ---- */
html[data-theme="light"] img.img-ph {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http://www.w3.org/2000/svg'%20width%3D'240'%20height%3D'360'%20viewBox%3D'0%200%20240%20360'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0.9'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23eef1f6'/%3E%3Cstop%20offset%3D'0.55'%20stop-color%3D'%23e2e6ee'/%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%23d6dbe6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect%20width%3D'240'%20height%3D'360'%20fill%3D'url(%23g)'/%3E%3Cg%20fill%3D'none'%20stroke%3D'%237a8296'%20stroke-width%3D'4.5'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20opacity%3D'0.85'%3E%3Cpath%20d%3D'M120%20104c-13-10-32-12-48-8v124c16-4%2035-2%2048%208%2013-10%2032-12%2048-8V96c-16-4-35-2-48%208z'/%3E%3Cpath%20d%3D'M120%20104v124'/%3E%3C/g%3E%3Cg%20fill%3D'%237a8296'%20opacity%3D'0.45'%3E%3Ccircle%20cx%3D'66'%20cy%3D'92'%20r%3D'4'/%3E%3Ccircle%20cx%3D'174'%20cy%3D'92'%20r%3D'4'/%3E%3C/g%3E%3C/svg%3E");
}
html[data-theme="light"] img.img-ph.img-ph-page {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http://www.w3.org/2000/svg'%20width%3D'240'%20height%3D'360'%20viewBox%3D'0%200%20240%20360'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'1'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23eef1f6'/%3E%3Cstop%20offset%3D'0.6'%20stop-color%3D'%23e2e6ee'/%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%23d6dbe6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect%20width%3D'240'%20height%3D'360'%20fill%3D'url(%23g)'/%3E%3Cg%20fill%3D'none'%20stroke%3D'%237a8296'%20stroke-width%3D'4'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20opacity%3D'0.8'%3E%3Ccircle%20cx%3D'128'%20cy%3D'104'%20r%3D'16'/%3E%3Cpath%20d%3D'M64%20252l46-58%2030%2034%2024-22%2048%2046'/%3E%3C/g%3E%3Cpath%20d%3D'M64%20252h112'%20stroke%3D'%238b93a7'%20stroke-width%3D'4'%20stroke-linecap%3D'round'%20opacity%3D'0.8'/%3E%3C/svg%3E");
}

/* ---- 加载中：shimmer 流动骨架（与静态占位明显区分） ---- */
img.img-ph.img-state-loading {
  background-color: var(--bg-soft);
  background-image: linear-gradient(100deg, var(--bg-soft) 40%, var(--bg-card) 50%, var(--bg-soft) 60%);
  background-size: 200% 100%;
  background-position: 0 0;
  animation: skeleton-shimmer 1.2s linear infinite;
}

/* ---- 加载失败：断链图标 + 「图片加载失败」+ 可点击重试 ---- */
img.img-ph.img-state-error,
img.img-ph.broken {
  cursor: pointer;
  background-color: var(--bg-soft);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http://www.w3.org/2000/svg'%20width%3D'240'%20height%3D'360'%20viewBox%3D'0%200%20240%20360'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0.9'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%233d3440'/%3E%3Cstop%20offset%3D'0.55'%20stop-color%3D'%232a222c'/%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%231e1820'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect%20width%3D'240'%20height%3D'360'%20fill%3D'url(%23g)'/%3E%3Cg%20fill%3D'none'%20stroke%3D'%23e4e8f0'%20stroke-width%3D'6'%20stroke-linecap%3D'round'%3E%3Cpath%20d%3D'M88%20132l64%2064M152%20132l-64%2064'/%3E%3C/g%3E%3Ccircle%20cx%3D'120'%20cy%3D'196'%20r%3D'5'%20fill%3D'%23e4e8f0'/%3E%3Cpath%20d%3D'M120%20162v22'%20stroke%3D'%23e4e8f0'%20stroke-width%3D'6'%20stroke-linecap%3D'round'/%3E%3Ctext%20x%3D'120'%20y%3D'242'%20font-size%3D'15'%20fill%3D'%23c3c9d6'%20text-anchor%3D'middle'%20font-family%3D'-apple-system,PingFang%20SC,Helvetica%20Neue,sans-serif'%3E%E5%9B%BE%E7%89%87%E5%8A%A0%E8%BD%BD%E5%A4%B1%E8%B4%A5%3C/text%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: min(52%, 150px) auto;
}
html[data-theme="light"] img.img-ph.img-state-error,
html[data-theme="light"] img.img-ph.broken {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http://www.w3.org/2000/svg'%20width%3D'240'%20height%3D'360'%20viewBox%3D'0%200%20240%20360'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0.9'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23f3ecea'/%3E%3Cstop%20offset%3D'0.55'%20stop-color%3D'%23ece1de'/%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%23e2d3d0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect%20width%3D'240'%20height%3D'360'%20fill%3D'url(%23g)'/%3E%3Cg%20fill%3D'none'%20stroke%3D'%23b3453c'%20stroke-width%3D'6'%20stroke-linecap%3D'round'%3E%3Cpath%20d%3D'M88%20132l64%2064M152%20132l-64%2064'/%3E%3C/g%3E%3Ccircle%20cx%3D'120'%20cy%3D'196'%20r%3D'5'%20fill%3D'%23b3453c'/%3E%3Cpath%20d%3D'M120%20162v22'%20stroke%3D'%23b3453c'%20stroke-width%3D'6'%20stroke-linecap%3D'round'/%3E%3Ctext%20x%3D'120'%20y%3D'242'%20font-size%3D'15'%20fill%3D'%238c4a44'%20text-anchor%3D'middle'%20font-family%3D'-apple-system,PingFang%20SC,Helvetica%20Neue,sans-serif'%3E%E5%9B%BE%E7%89%87%E5%8A%A0%E8%BD%BD%E5%A4%B1%E8%B4%A5%3C/text%3E%3C/svg%3E");
}

/* 弱动效偏好：关闭 shimmer 流动 */
@media (prefers-reduced-motion: reduce) {
  img.img-ph.img-state-loading { animation: none; }
}
