/* ============================================================
   我的书房 · 在线小说阅读器  样式表
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --ui-font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --accent: #2f7cf6;
  --accent-soft: rgba(47, 124, 246, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .12);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .22);
  --reader-font: var(--ui-font);
  --reader-size: 19px;
  --reader-line: 1.9;
  --reader-para: .85em;
  --reader-width: 760px;
  --reader-indent: 2em;
  --topbar-h: 54px;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-soft: #ffffff;
  --bg-elev: #ffffff;
  --text: #1c1f23;
  --text-2: #5b636e;
  --text-muted: #8a919c;
  --border: #e3e7ee;
  --border-strong: #d3d9e3;
  --hover: #eef1f6;
  --reader-bg: #ffffff;
  --reader-text: #22262b;
  --reader-dim: #7b828c;
  --hl-yellow: #ffe98a; --hl-green: #b9ecc0; --hl-blue: #b6d9fb; --hl-pink: #ffc9dd; --hl-purple: #ddc9fb;
  --hl-yellow-ink: #6d5a00; --hl-green-ink: #1e5c2a; --hl-blue-ink: #12456f; --hl-pink-ink: #7d1f43; --hl-purple-ink: #4d2a7a;
}

[data-theme="sepia"] {
  --bg: #efe6d6;
  --bg-soft: #f8f1e3;
  --bg-elev: #fbf6ea;
  --text: #3a3226;
  --text-2: #6b6050;
  --text-muted: #8d8271;
  --border: #e2d6c0;
  --border-strong: #d2c3a6;
  --hover: #f0e7d5;
  --reader-bg: #f8f1e3;
  --reader-text: #3a3226;
  --reader-dim: #857a67;
  --hl-yellow: #f2dc9a; --hl-green: #c3e2b8; --hl-blue: #bcd4e6; --hl-pink: #f0c3cc; --hl-purple: #d9c9e8;
  --hl-yellow-ink: #6b5a13; --hl-green-ink: #2c5a2a; --hl-blue-ink: #17496b; --hl-pink-ink: #7d2a44; --hl-purple-ink: #4c2f72;
}

[data-theme="green"] {
  --bg: #dfeade;
  --bg-soft: #eaf3e8;
  --bg-elev: #f1f7ef;
  --text: #24301f;
  --text-2: #4c5b45;
  --text-muted: #77836f;
  --border: #cfdfcb;
  --border-strong: #b9cdb4;
  --hover: #e0ebdd;
  --reader-bg: #eaf3e8;
  --reader-text: #26311f;
  --reader-dim: #6f7d66;
  --hl-yellow: #efe0a0; --hl-green: #b9e3bd; --hl-blue: #b8d8e8; --hl-pink: #eec6d2; --hl-purple: #d5cbe9;
  --hl-yellow-ink: #665611; --hl-green-ink: #235c2b; --hl-blue-ink: #15486b; --hl-pink-ink: #7a2a45; --hl-purple-ink: #48306f;
}

[data-theme="night"] {
  --bg: #14161a;
  --bg-soft: #1b1e23;
  --bg-elev: #22262c;
  --text: #d8dce3;
  --text-2: #a4abb5;
  --text-muted: #7d848f;
  --border: #2b3037;
  --border-strong: #3a4048;
  --hover: #262b32;
  --reader-bg: #16181d;
  --reader-text: #c9ced7;
  --reader-dim: #7a838f;
  --hl-yellow: #6a5c1c; --hl-green: #2c5c34; --hl-blue: #24486b; --hl-pink: #6b2b45; --hl-purple: #46305f;
  --hl-yellow-ink: #f3e6a4; --hl-green-ink: #bfe8bf; --hl-blue-ink: #bcdcf7; --hl-pink-ink: #f6c3d6; --hl-purple-ink: #ddc9fb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
}

body {
  font-family: var(--ui-font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用按钮 ---------- */
.btn {
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: .16s;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-mini { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-danger { color: #e5484d; border-color: rgba(229, 72, 77, .35); }
.btn-danger:hover { background: rgba(229, 72, 77, .1); }
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: inherit; border-radius: 9px; font-size: 16px; position: relative;
}
.icon-btn:hover { background: var(--hover); }
.badge {
  font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 20px;
  background: var(--accent); color: #fff; min-width: 16px; text-align: center;
}
.icon-btn .badge { position: absolute; top: 0; right: -2px; }

/* ============================================================
   书架
   ============================================================ */
#shelf-view {
  height: 100%; overflow-y: auto; padding: 26px clamp(16px, 4vw, 52px) 80px;
  background:
    radial-gradient(1200px 500px at 12% -8%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.shelf-header {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { font-size: 34px; }
.brand h1 { margin: 0; font-size: 23px; letter-spacing: .5px; }
.brand p { margin: 3px 0 0; font-size: 13px; }
.shelf-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; min-width: 210px;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { border: none; background: none; outline: none; width: 100%; }
.search-icon { opacity: .55; font-size: 13px; }

.shelf-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; font-size: 13px; color: var(--text-2); }
.shelf-stats b { color: var(--text); }

.book-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.book-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; cursor: pointer; transition: .2s; position: relative; overflow: hidden;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

/* 刚导入的书：高亮提示，但不自动打开 */
.book-card.just-imported {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
  animation: cardIn .5s ease-out;
}
.book-card.just-imported::after {
  content: "刚导入";
  position: absolute; left: 12px; bottom: 12px; z-index: 4;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #fff;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.book-card .cover {
  aspect-ratio: 3 / 4.2; border-radius: 8px; overflow: hidden; position: relative;
  display: flex; align-items: flex-end; padding: 14px; color: #fff;
  background: linear-gradient(160deg, #4a6fa5, #2f3f5c);
  box-shadow: inset -6px 0 12px -8px rgba(0, 0, 0, .6), var(--shadow-sm);
}
.book-card .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-card .cover .cover-title {
  position: relative; font-size: 15px; font-weight: 600; line-height: 1.45;
  max-height: 4.4em; overflow: hidden; text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.book-card .bc-title { margin: 11px 2px 3px; font-weight: 600; font-size: 14.5px; line-height: 1.4; max-height: 2.8em; overflow: hidden; }
.book-card .bc-meta { margin: 0 2px; font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.book-card .bc-progress { margin-top: 9px; height: 4px; border-radius: 3px; background: var(--border); overflow: hidden; }
.book-card .bc-progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
/* 书卡右上角的「⋯」更多操作 */
.book-card .bc-more {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  width: 28px; height: 28px; padding: 0; border-radius: 8px; border: none;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: .15s; backdrop-filter: blur(4px); cursor: pointer;
}
.book-card:hover .bc-more, .book-card:focus-within .bc-more { opacity: 1; }
/* 触屏设备没有 hover：常显，否则永远点不到 */
@media (hover: none) {
  .book-card .bc-more { opacity: 1; background: rgba(0, 0, 0, .35); }
}
.book-card .bc-more:hover, .book-card .bc-more[aria-expanded="true"] { background: rgba(0, 0, 0, .78); opacity: 1; }

/* 卡片操作浮层菜单 */
.card-menu {
  position: fixed; z-index: 80; min-width: 158px; padding: 6px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 14px 36px rgba(0, 0, 0, .22);
}
.card-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: none; background: none; color: var(--text);
  font-size: 14px; text-align: left; border-radius: 7px; cursor: pointer;
}
.card-menu button:hover { background: var(--bg-soft); }
.card-menu button.danger { color: #e5484d; }
.card-menu .sep { height: 1px; margin: 5px 4px; background: var(--border); }
.book-card .bc-note-count { color: var(--accent); }

.empty-state { text-align: center; padding: 60px 20px; max-width: 560px; margin: 0 auto; }
.empty-state .empty-icon { font-size: 62px; margin-bottom: 12px; }
.empty-state h2 { margin: 0 0 8px; font-size: 19px; }
.empty-state p { margin: 6px 0; color: var(--text-2); font-size: 14px; line-height: 1.7; }
.empty-state .btn { margin-top: 16px; }

/* 回收箱 */
#btn-trash .trash-count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 9px; background: var(--bg-soft); border: 1px solid var(--border-strong);
  font-size: 12px; line-height: 16px; text-align: center;
}
.trash-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: var(--bg-soft);
}
.trash-title { font-weight: 600; word-break: break-all; }
.trash-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.trash-acts { display: flex; gap: 8px; flex: none; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: #e5484d; }

/* 云同步按钮与状态点 */
#btn-sync { display: inline-flex; align-items: center; gap: 6px; }
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: var(--border-strong); transition: background .2s;
}
.sync-dot-ok { background: #1f7a45; box-shadow: 0 0 0 3px rgba(31, 122, 69, .15); }
.sync-dot-busy { background: #d99a06; animation: syncPulse 1s ease-in-out infinite; }
.sync-dot-err { background: #e5484d; box-shadow: 0 0 0 3px rgba(229, 72, 77, .15); }
.sync-dot-off { background: var(--border-strong); }
@keyframes syncPulse { 50% { opacity: .25; transform: scale(.85); } }

/* 书架页脚：备案号（备案通过后显示） */
.shelf-footer {
  margin-top: 46px; padding-top: 18px; border-top: 1px solid var(--border);
  text-align: center; font-size: 12.5px; color: var(--text-muted);
}
.shelf-footer a { color: var(--text-muted); text-decoration: none; }
.shelf-footer a:hover { color: var(--accent); text-decoration: underline; }

/* ============================================================
   阅读器
   ============================================================ */
#reader-view { height: 100%; display: flex; flex-direction: column; background: var(--reader-bg); color: var(--reader-text); }

.reader-topbar {
  height: var(--topbar-h); flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 0 10px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text); z-index: 30;
}
.rb-title { flex: 1; min-width: 0; }
.rb-book { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-chapter { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-tools { display: flex; align-items: center; gap: 2px; }
.reader-progress { height: 3px; background: var(--border); flex: 0 0 auto; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }

.reader-body { flex: 1; display: flex; min-height: 0; position: relative; }

/* 侧栏 */
.side-panel {
  width: 320px; flex: 0 0 320px; background: var(--bg-soft); border: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; z-index: 25;
}
.side-left { border-left: none; border-top: none; border-bottom: none; }
.side-right { border-right: none; border-top: none; border-bottom: none; }
.side-panel[hidden] { display: none !important; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
.panel-head input, .pane-tools input {
  flex: 1; min-width: 0; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-elev); outline: none;
}
.panel-head input:focus, .pane-tools input:focus { border-color: var(--accent); }
.panel-close { border: none; background: none; font-size: 20px; line-height: 1; color: var(--text-muted); padding: 2px 6px; border-radius: 6px; }
.panel-close:hover { background: var(--hover); color: var(--text); }
.panel-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); }
.ptab {
  border: none; background: none; padding: 8px 10px; font-size: 13px; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ptab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.panel-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.pane-tools { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-list { flex: 1; overflow-y: auto; padding: 8px; }

.toc-item {
  padding: 8px 10px; border-radius: 8px; font-size: 13.5px; line-height: 1.5; cursor: pointer;
  color: var(--text-2); display: flex; gap: 8px; align-items: baseline;
}
.toc-item:hover { background: var(--hover); color: var(--text); }
.toc-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc-item .toc-idx { font-size: 11px; color: var(--text-muted); min-width: 26px; }
.toc-item.active .toc-idx { color: var(--accent); }

/* 正文区 */
.reader-main { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; position: relative; }
.page-area { max-width: var(--reader-width); margin: 0 auto; padding: 34px clamp(18px, 5vw, 44px) 120px; }

.chapter-title {
  font-size: 1.32em; font-weight: 700; line-height: 1.5; margin: 0 0 1.4em;
  padding-bottom: .5em; border-bottom: 1px solid var(--border); font-family: var(--reader-font);
}
.content {
  font-family: var(--reader-font); font-size: var(--reader-size); line-height: var(--reader-line);
  letter-spacing: .015em; word-break: break-word;
}
.content .para {
  margin: 0 0 var(--reader-para); text-indent: var(--reader-indent); position: relative;
  padding: 2px 0; border-radius: 4px; transition: background .35s;
}
.content .para.no-indent { text-indent: 0; }
.content .para.flash { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); }
.content .block-img { text-indent: 0; text-align: center; }
.content .block-img img { max-width: 100%; height: auto; border-radius: 6px; }
.content .block-h {
  text-indent: 0; font-weight: 700; font-size: 1.08em; margin: 1.5em 0 .8em; line-height: 1.5;
}
.content .block-quote {
  text-indent: 0; margin: .6em 0 var(--reader-para); padding: .2em 0 .2em 1em;
  border-left: 3px solid var(--border-strong); color: var(--text-2);
}
.content .block-li { text-indent: 0; margin: 0 0 .4em; padding-left: 1.6em; position: relative; }
.content .block-li::before { content: "·"; position: absolute; left: .7em; color: var(--text-muted); }

mark.hl {
  background: var(--hl-yellow); color: inherit; border-radius: 3px; padding: 1px 0;
  cursor: pointer; transition: .15s; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
mark.hl:hover { filter: brightness(.94); }
mark.hl-yellow { background: var(--hl-yellow); }
mark.hl-green { background: var(--hl-green); }
mark.hl-blue { background: var(--hl-blue); }
mark.hl-pink { background: var(--hl-pink); }
mark.hl-purple { background: var(--hl-purple); }
mark.hl.has-note { box-shadow: inset 0 -2px 0 var(--accent); }
mark.hl.active { outline: 2px solid var(--accent); outline-offset: 1px; }

.chapter-end { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 46px; padding-top: 20px; border-top: 1px solid var(--border); }

.page-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
  width: 46px; height: 92px; border: none; background: transparent; color: var(--text-muted);
  font-size: 34px; line-height: 1; border-radius: 10px; opacity: 0; transition: .18s;
}
.page-arrow:hover { opacity: 1; background: var(--hover); color: var(--text); }
.page-prev { left: 6px; }
.page-next { right: 6px; }
.reader-main.paged ~ .page-arrow, #reader-view.paged .page-arrow { opacity: .35; }

/* 分页模式：一页正好一屏，左右留白，邻页被裁掉，不能自由拖拽 */
.reader-main.paged {
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: stretch;
}
.reader-main.paged .page-area {
  /* 这个元素就是"一页"：宽度 = 页宽设置（不超过视口），自己负责横向分列 */
  flex: 0 0 auto;
  width: var(--page-col, 760px);
  max-width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  padding: 24px 0 36px;
  column-width: var(--page-col, 760px);
  column-gap: 0;
  column-fill: auto;
}
.reader-main.paged .chapter-title { margin-top: 0; }
.reader-main.paged .chapter-end { break-before: column; }

/* ============================================================
   浮动层
   ============================================================ */
.sel-toolbar {
  position: fixed; z-index: 90; display: flex; align-items: center; gap: 6px;
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 7px 9px; box-shadow: var(--shadow-lg);
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } }
.sel-toolbar .st-colors { display: flex; gap: 5px; }
.st-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--bg-elev); box-shadow: 0 0 0 1px var(--border-strong); }
.st-color[data-color="yellow"] { background: var(--hl-yellow); }
.st-color[data-color="green"] { background: var(--hl-green); }
.st-color[data-color="blue"] { background: var(--hl-blue); }
.st-color[data-color="pink"] { background: var(--hl-pink); }
.st-color[data-color="purple"] { background: var(--hl-purple); }
.st-color:hover { transform: scale(1.14); }
.st-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.st-btn { border: none; background: none; padding: 5px 9px; border-radius: 7px; font-size: 13px; color: var(--text); }
.st-btn:hover { background: var(--hover); }

.popover {
  position: fixed; z-index: 95; width: 330px; max-width: calc(100vw - 24px);
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: pop .14s ease-out; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
}
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.pop-close { border: none; background: none; font-size: 19px; color: var(--text-muted); line-height: 1; }
.pop-body { padding: 14px; overflow-y: auto; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 7px; }
.field.row { display: flex; align-items: center; justify-content: space-between; }
.field.row label { margin: 0; }
.field .val { color: var(--accent); font-weight: 600; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border-strong); background: var(--bg-soft); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; color: var(--text-2); transition: .15s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-color { padding: 5px 10px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.switch { width: 40px; height: 22px; appearance: none; background: var(--border-strong); border-radius: 999px; position: relative; transition: .2s; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

.anno-pop .ap-quote {
  margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--bg-soft);
  border-radius: 0 8px 8px 0; font-size: 13.5px; line-height: 1.7; max-height: 130px; overflow-y: auto; color: var(--text-2);
}
.anno-pop textarea {
  width: 100%; margin: 12px 0; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--bg-soft); resize: vertical; outline: none; line-height: 1.6; font-size: 13.5px;
}
.anno-pop textarea:focus { border-color: var(--accent); }
.ap-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.ap-meta { margin-top: 11px; font-size: 11.5px; line-height: 1.6; }

/* 批注卡片 */
.anno-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 9px;
  cursor: pointer; background: var(--bg-elev); transition: .15s; position: relative; overflow: hidden;
}
.anno-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.anno-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--hl-yellow); }
.anno-card.c-green::before { background: var(--hl-green); }
.anno-card.c-blue::before { background: var(--hl-blue); }
.anno-card.c-pink::before { background: var(--hl-pink); }
.anno-card.c-purple::before { background: var(--hl-purple); }
.anno-card .ac-quote { font-size: 13px; line-height: 1.65; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.anno-card .ac-note { margin-top: 7px; font-size: 13px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.anno-card .ac-note::before { content: "💭 "; }
.anno-card .ac-meta { margin-top: 7px; font-size: 11px; color: var(--text-muted); display: flex; justify-content: space-between; gap: 8px; }
.anno-card .ac-del { position: absolute; right: 6px; top: 6px; border: none; background: none; color: var(--text-muted); opacity: 0; font-size: 14px; }
.anno-card:hover .ac-del { opacity: 1; }
.anno-card .ac-del:hover { color: #e5484d; }
.anno-empty, .search-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 26px 14px; line-height: 1.8; }

.search-hit { padding: 9px 11px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.search-hit:hover { background: var(--hover); border-color: var(--border); }
.search-hit .sh-ch { font-size: 12px; color: var(--accent); margin-bottom: 3px; }
.search-hit .sh-text { font-size: 13px; line-height: 1.6; color: var(--text-2); }
.search-hit mark { background: var(--hl-yellow); color: inherit; border-radius: 2px; }

/* 拖拽层 */
.drop-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 20, 40, .55);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
}
.drop-card {
  background: var(--bg-elev); border: 2px dashed var(--accent); border-radius: 18px;
  padding: 40px 56px; text-align: center; box-shadow: var(--shadow-lg); color: var(--text);
}
.drop-card .drop-icon { font-size: 40px; margin-bottom: 10px; }
.drop-card small { display: block; margin-top: 8px; color: var(--text-muted); }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1f242c; color: #f2f4f7; padding: 9px 16px; border-radius: 999px; font-size: 13.5px;
  box-shadow: var(--shadow-md); animation: toastIn .2s ease-out; max-width: 84vw;
}
.toast.err { background: #b3261e; }
.toast.ok { background: #1f7a45; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* Modal */
.modal-mask { position: fixed; inset: 0; z-index: 250; background: rgba(10, 15, 25, .5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal {
  background: var(--bg-elev); border-radius: 14px; box-shadow: var(--shadow-lg); width: 520px; max-width: 100%;
  max-height: 86vh; display: flex; flex-direction: column; animation: pop .16s ease-out;
}
.modal h3 { margin: 0; padding: 16px 18px; font-size: 16px; border-bottom: 1px solid var(--border); }
.modal .modal-body { padding: 18px; overflow-y: auto; font-size: 14px; line-height: 1.75; color: var(--text-2); }
.modal .modal-body h4 { color: var(--text); margin: 16px 0 6px; font-size: 14px; }
.modal .modal-body kbd {
  background: var(--bg-soft); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 12px; font-family: ui-monospace, monospace; color: var(--text);
}
.modal .modal-body ul { margin: 6px 0; padding-left: 20px; }
.modal .modal-body li { margin: 3px 0; }
.modal .modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* 导入进度 */
.import-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.import-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.import-row .ir-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-row .ir-state { color: var(--text-muted); font-size: 12px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1000px) {
  .side-panel { position: absolute; top: 0; bottom: 0; box-shadow: var(--shadow-lg); }
  .side-left { left: 0; }
  .side-right { right: 0; }
  .page-area { padding: 22px 16px 100px; }
}
@media (max-width: 640px) {
  .side-panel { width: 88vw; flex-basis: 88vw; }
  .rb-tools .icon-btn { width: 32px; height: 32px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 16px; }
  :root { --reader-size: 18px; }
}
@media print { .reader-topbar, .side-panel, .page-arrow, .sel-toolbar { display: none !important; } }