/* ============================================================
   页面层：各页组件样式
   · 跨页共享组件（封面 / 标签 / 价格）放最前
   · 主题专属覆盖不在此文件，统一在 themes.css
   ============================================================ */

/* ---------- 通用组件：封面 / 标签 / 价格 ---------- */
.cover {
  width: 120px; height: 168px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.75); font-size: 12px; font-weight: 700;
  text-align: center; padding: 8px; line-height: 1.3;
}
.tag {
  display: inline-block; font-size: 10px; padding: 2px 6px;
  background: var(--accent); color: #fff; border-radius: 4px; margin-bottom: 4px;
}
.price-box { text-align: right; flex-shrink: 0; }
.price-now { font-size: 18px; font-weight: 700; color: var(--accent); }
.price-old {
  font-size: 11px; color: var(--text-muted);
  text-decoration: line-through; margin-top: 2px; display: block;
}

/* ---------- 区块标题 ---------- */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title h2 {
  font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: 0.5px;
}
.section-title h2::after {
  content: "";
  display: inline-block; width: 20px; height: 3px;
  background: var(--accent);
  border-radius: 2px; margin-left: 8px; vertical-align: middle;
}
.section-title .more { font-size: 13px; color: var(--text-muted); }

/* ---------- 首页：搜索栏 ---------- */
.search-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: transparent;
  font-size: 15px; color: var(--text); outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.ai-btn {
  width: 30px; height: 30px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform .15s;
}
.ai-btn:hover { transform: scale(1.08); }
.search-btn {
  flex: none; border: none; cursor: pointer; border-radius: 999px; padding: 8px 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  font-size: 13px; font-weight: 700; font-family: inherit;
}

/* ---------- 首页：搜索结果 ---------- */
.search-results {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 26px;
}
.search-item {
  display: flex; gap: 14px; padding: 14px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); align-items: center;
}
.search-item img {
  width: 60px; height: 84px; object-fit: cover; border-radius: 8px;
  background: var(--surface-2); flex-shrink: 0;
}
.search-ph {
  width: 60px; height: 84px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.search-info { flex: 1; min-width: 0; }
.search-info .t {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-info .m {
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.search-none {
  text-align: center; color: var(--text-muted); font-size: 13px;
  padding: 26px 0; line-height: 2;
}
.search-none a { color: var(--primary); cursor: pointer; text-decoration: underline; }

/* 可点的书目行：点开看详情（三句名言 + 基本信息） */
.search-item.clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.search-item.clickable:active { transform: scale(.99); }
.search-go { color: var(--text-muted); font-size: 18px; flex-shrink: 0; align-self: center; }
.cat-tag {
  display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; vertical-align: middle;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.bs-cat { font-size: 12px; color: var(--accent); margin-top: 4px; }
.bs-fav.bs-del { color: #d9534f; border-color: color-mix(in srgb, #d9534f 40%, transparent); }
.cat-filter { display: flex; gap: 8px; padding: 0 20px 10px; flex-wrap: wrap; }
.cat-chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  font-size: 12px; font-weight: 600; font-family: inherit; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.cat-chip.active { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }

/* ---------- 首页：AI 荐书 banner ---------- */
.ai-banner {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #fff;
  margin-bottom: 26px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.ai-banner-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ai-badge { font-size: 12px; font-weight: 700; letter-spacing: 1px; opacity: .95; }
.ai-more { font-size: 12px; opacity: .85; cursor: pointer; }
/* 「书友在聊」文案高度固定为 3 行：短句撑满 3 行、长句截断，避免随机语句长短导致页面跳动 */
.ai-tip {
  font-size: 13px; line-height: 1.7; opacity: .96;
  min-height: calc(1.7em * 3);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ai-tip b { font-weight: 700; }

/* ---------- 首页：畅销轮播 ---------- */
.bestsellers { margin-bottom: 30px; }
.carousel {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.carousel::-webkit-scrollbar { display: none; }
.book-card { flex-shrink: 0; width: 120px; scroll-snap-align: start; cursor: pointer; }
.book-card .cover-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.fav-empty {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.8;
  padding: 18px 16px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.carousel .book-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carousel .book-author { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---------- 首页：特价列表 ---------- */
.specials-list { display: flex; flex-direction: column; gap: 14px; }
.special-item {
  display: flex; gap: 14px; padding: 14px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); align-items: center;
}
.special-item .cover {
  width: 72px; height: 100px; flex-shrink: 0; margin-bottom: 0; border-radius: 8px;
}
.special-info { flex: 1; min-width: 0; }
.special-info .book-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.special-info .meta {
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- 录入页 ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin: 10px 0 16px; }
.page-head h2 { font-size: 20px; font-weight: 800; color: var(--text); }
.page-head .more { font-size: 12px; color: var(--text-muted); }
.scan-card {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 18px 16px; border: none; cursor: pointer; text-align: left;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius); color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  transition: transform .15s;
}
.scan-card:hover { transform: translateY(-2px); }
.scan-icon { font-size: 26px; }
.sc-txt { display: block; flex: 1; }
.scan-card b { display: block; font-size: 15px; margin-bottom: 3px; }
.scan-card span:not(.scan-icon):not(.scan-go) { font-size: 12px; opacity: .85; line-height: 1.5; }
.scan-go { margin-left: auto; font-size: 20px; opacity: .85; }
.scan-loading {
  margin-top: 12px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); font-size: 13px; text-align: center;
}
/* 未登录时拦住录入整个流程，不让白拍一张照 */
.scan-gate {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 4px; padding: 28px 20px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.scan-gate .sg-icon { font-size: 30px; }
.scan-gate b { font-size: 15px; color: var(--text); }
.scan-gate span { font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }
.sg-btn {
  margin-top: 8px; border: none; cursor: pointer; font-family: inherit;
  padding: 11px 26px; border-radius: 999px; font-size: 14px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
}
.scan-result { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.sr-head { display: flex; justify-content: space-between; align-items: center; }
.sr-badge {
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--surface); border-radius: 999px; padding: 4px 12px;
  box-shadow: var(--shadow);
}
.sr-actions { display: flex; gap: 8px; }
.ghost-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 12px; border-radius: 999px;
  padding: 4px 12px; cursor: pointer;
}
.sr-book {
  display: flex; gap: 14px; padding: 14px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.sr-photo {
  width: 76px; height: 100px; object-fit: cover;
  border-radius: 8px; background: var(--surface-2); flex-shrink: 0;
}
.sr-book .cover { width: 72px; height: 100px; margin-bottom: 0; border-radius: 8px; font-size: 11px; }
.sr-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sr-fields div { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sr-fields b { color: var(--text-muted); font-weight: 500; width: 34px; flex-shrink: 0; }
.sr-fields input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 13px; color: var(--text); border-bottom: 1px dashed var(--border); padding: 2px 0;
}
.sr-ai {
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); font-size: 12px; color: var(--text); line-height: 1.7;
  border: 1px dashed var(--border);
}
.sr-ai b { color: var(--primary); }
.sr-error {
  padding: 10px 12px; border-radius: 10px; font-size: 12px; line-height: 1.6;
  color: var(--accent); background: var(--surface-2);
  border: 1px dashed var(--accent);
}
.save-btn {
  border: none; cursor: pointer; padding: 13px;
  border-radius: var(--radius); font-size: 15px; font-weight: 700;
  background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}
.manual {
  margin-top: 16px; padding: 14px 16px; text-align: center;
  font-size: 13px; color: var(--text-muted);
  background: var(--surface); border-radius: var(--radius);
  border: 1px dashed var(--border); cursor: pointer;
}
.manual:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 录入页：最近录入（默认展示最新入库的书） ---------- */
.recent { margin-top: 28px; }
.recent-list { display: flex; flex-direction: column; gap: 12px; }
.recent-more { text-align: center; font-size: 12px; color: var(--text-muted); padding: 14px 0 4px; letter-spacing: 1px; }
.toast {
  position: absolute; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 999px; z-index: 20;
  white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* ---------- 书目详情抽屉（点书打开：基本信息 + 三句名言） ---------- */
.book-sheet {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.bs-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.bs-panel {
  position: relative; z-index: 1; max-height: 84%;
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 34px rgba(0, 0, 0, .28);
  animation: bs-up .22s ease-out;
}
@keyframes bs-up { from { transform: translateY(16%); opacity: .5; } to { transform: none; opacity: 1; } }
.bs-close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 30px; height: 30px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); color: var(--text-muted); font-size: 14px;
}
.bs-scroll {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 22px 20px calc(26px + env(safe-area-inset-bottom));
}
.bs-scroll::-webkit-scrollbar { display: none; }

/* ---------- 店铺详情（实体书店号） ---------- */
.store-sheet {
  position: absolute; inset: 0; z-index: 31;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.ss-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.ss-panel {
  position: relative; z-index: 1; max-height: 84%;
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 34px rgba(0, 0, 0, .28);
  animation: bs-up .22s ease-out;
}
.ss-scroll { overflow-y: auto; padding: 20px 20px 28px; -webkit-overflow-scrolling: touch; }
.ss-scroll::-webkit-scrollbar { display: none; }
.ss-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ss-ic { font-size: 30px; }
.ss-title { display: flex; flex-direction: column; gap: 2px; }
.ss-title b { font-size: 18px; font-weight: 800; color: var(--text); }
.ss-sub { font-size: 12px; color: var(--text-muted); }
.ss-meta { font-size: 13px; color: var(--text); line-height: 1.8; margin-bottom: 18px; }
.ss-setcontact {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: transparent;
  color: var(--accent); font-size: 12px; font-weight: 600; font-family: inherit;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; margin: -6px 0 16px;
}
.ss-contact-form { display: flex; flex-direction: column; gap: 8px; margin: -6px 0 16px; }
.ss-contact-form input {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; color: var(--text); background: var(--surface); outline: none; font-family: inherit;
}
.ss-contact-form input:focus { border-color: var(--primary); }
.ss-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ss-form-actions button {
  font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.ss-form-actions button.ss-save { border-color: transparent; background: var(--primary); color: #fff; }
.ss-form-actions button:disabled { opacity: .6; cursor: default; }
.ss-photos-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ss-photos-head span { font-size: 14px; font-weight: 700; color: var(--text); }
.ss-add {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: transparent;
  color: var(--accent); font-size: 12px; font-weight: 600; font-family: inherit;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.ss-add:disabled { opacity: .6; cursor: default; }
.ss-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ss-photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.ss-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ss-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none;
  border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; cursor: pointer;
}
.ss-empty { font-size: 12px; color: var(--text-muted); padding: 10px 0; }
.ss-empty a { color: var(--primary); cursor: pointer; }
.talk-dir {
  margin-left: auto; flex: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 12px; font-weight: 600; font-family: inherit;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.dir-head { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.dir-list { display: flex; flex-direction: column; gap: 10px; }
.dir-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); }
.dir-av {
  width: 40px; height: 40px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 18px;
}
.dir-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dir-info b { font-size: 14px; color: var(--text); }
.dir-info span { font-size: 12px; color: var(--text-muted); }
.store-by { color: var(--accent); }
.bs-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; padding-right: 30px; }
.bs-cover {
  width: 76px; height: 104px; flex-shrink: 0; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: rgba(255, 255, 255, .88); font-size: 13px; font-weight: 700;
  text-align: center; line-height: 1.35;
}
.bs-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bs-meta { min-width: 0; flex: 1; }
.bs-meta h3 { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 6px; line-height: 1.35; }
.bs-meta .bs-author { font-size: 13px; color: var(--text); margin-bottom: 3px; }
.bs-meta .bs-sub { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.bs-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.bs-fav {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 999px;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.bs-fav:hover { border-color: var(--accent); color: var(--accent); }
.bs-fav.active {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.bs-fav:disabled { opacity: .6; cursor: default; }
.bs-summary {
  font-size: 13px; color: var(--text); line-height: 1.7; margin-bottom: 16px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 10px;
}
.bs-quotes-head, .bs-model-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.bs-quotes-head span, .bs-model-head span { font-size: 14px; font-weight: 700; color: var(--text); }
.bs-quotes-head small, .bs-model-head small { font-size: 11px; color: var(--text-muted); }
.bs-model-head { margin-top: 20px; }
.bs-quotes { display: flex; flex-direction: column; gap: 10px; }
.bs-quote {
  position: relative; padding: 12px 14px 12px 40px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
  font-size: 13.5px; line-height: 1.75; color: var(--text);
}
.bs-qmark {
  position: absolute; left: 12px; top: 12px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.bs-quotes-loading { font-size: 13px; color: var(--text-muted); padding: 20px 0; text-align: center; }
.bs-model-card {
  padding: 14px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.bs-model-name {
  font-size: 15px; font-weight: 800; color: var(--accent); margin-bottom: 6px;
}
.bs-model-gist {
  font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.6; margin-bottom: 8px;
  padding-bottom: 8px; border-bottom: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent);
}
.bs-model-detail { font-size: 13.5px; color: var(--text); line-height: 1.75; }

/* ---------- 谈书页（AI 对话） ---------- */
.talk-head { display: flex; align-items: center; gap: 10px; padding: 8px 20px 12px; }
.talk-head h2 { font-size: 20px; font-weight: 800; color: var(--text); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 8px #3ddc97; }
.talk-head small { color: var(--text-muted); font-size: 12px; }
.talk-persona {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 20px 8px; padding: 8px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 12.5px; color: var(--text);
}
.talk-persona button {
  flex: none; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: transparent; color: var(--accent); font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.chat { flex: 1; overflow-y: auto; padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.chat::-webkit-scrollbar { display: none; }
.bubble {
  max-width: 86%; padding: 11px 13px; font-size: 13.5px; line-height: 1.65;
  border-radius: 16px; white-space: pre-wrap;
}
.bubble.ai {
  align-self: flex-start; background: var(--surface);
  color: var(--text); border-radius: 4px 16px 16px 16px; box-shadow: var(--shadow);
}
.bubble.user {
  align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border-radius: 16px 4px 16px 16px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 12.5px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow); transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.composer {
  display: flex; gap: 10px;
  padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.composer input {
  flex: 1; border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 16px; font-size: 13.5px; outline: none; color: var(--text);
  background: var(--bg);
}
.composer input::placeholder { color: var(--text-muted); }
.send-btn {
  border: none; cursor: pointer; border-radius: 999px; width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 16px; flex-shrink: 0;
}
.bubble.ai.offline { color: var(--text-muted); font-size: 12.5px; background: var(--surface-2); }
.bubble.streaming::after {
  content: '▍'; margin-left: 1px; opacity: .55;
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 0%, 50% { opacity: .55; } 50.01%, 100% { opacity: 0; } }
.bubble.typing { color: var(--text-muted); font-style: italic; }

/* ---------- 我的页 ---------- */
.profile {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 16px; margin-top: 8px; margin-bottom: 24px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 22px; font-weight: 800;
}
.p-info { flex: 1; min-width: 0; }
.p-info b { display: block; font-size: 16px; color: var(--text); margin-bottom: 3px; }
.p-info span { font-size: 12px; color: var(--text-muted); }
.p-login {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--surface);
  color: var(--primary); font-size: 12.5px; font-weight: 600; font-family: inherit;
  padding: 8px 12px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.p-login:hover { border-color: var(--primary); }
.p-login.on { color: var(--text-muted); }
.p-stats { display: flex; gap: 14px; }
.p-stats div { text-align: center; }
.p-stats b { display: block; font-size: 15px; color: var(--primary); }
.p-stats span { font-size: 10px; color: var(--text-muted); }

/* ---------- 登录 / 注册（手机号 + 密码） ---------- */
.auth-sheet {
  position: absolute; inset: 0; z-index: 40;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.as-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.as-panel {
  position: relative; z-index: 1;
  background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 24px 22px calc(26px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 34px rgba(0, 0, 0, .28);
  animation: bs-up .22s ease-out;
}
.as-close {
  position: absolute; top: 12px; right: 14px;
  width: 30px; height: 30px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); color: var(--text-muted); font-size: 14px;
}
.as-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 14px; }
.as-tabs { display: flex; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.as-tab {
  flex: 1; border: none; background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 600; font-family: inherit; padding: 8px;
  border-radius: 999px; cursor: pointer;
}
.as-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.as-types { display: flex; gap: 8px; margin-bottom: 14px; }
.as-type {
  flex: 1; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  font-size: 13px; font-weight: 600; font-family: inherit; padding: 9px 8px;
  border-radius: 10px; cursor: pointer;
}
.as-type.active { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.as-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.as-field span { font-size: 12px; color: var(--text-muted); }
.as-field input {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  font-size: 14px; color: var(--text); background: var(--surface); outline: none;
  font-family: inherit;
}
.as-field input:focus { border-color: var(--primary); }
.as-error {
  font-size: 12px; color: var(--accent); background: var(--surface-2);
  border: 1px dashed var(--accent); border-radius: 10px; padding: 9px 11px;
  margin-bottom: 12px; line-height: 1.6;
}
.as-submit {
  width: 100%; border: none; cursor: pointer; padding: 13px;
  border-radius: var(--radius); font-size: 15px; font-weight: 700; font-family: inherit;
  background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
}
.as-submit:disabled { opacity: .6; cursor: default; }
.as-tip { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 12px; line-height: 1.6; }

.sec-title { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; letter-spacing: 1px; }
.theme-section { margin-bottom: 26px; }
.theme-picker { display: flex; flex-direction: column; gap: 10px; }
.theme-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 12px; border: 1.5px solid var(--border);
  background: var(--surface); border-radius: var(--radius);
  cursor: pointer; text-align: left; transition: border-color .2s, box-shadow .2s;
}
.theme-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.pp {
  position: relative; display: block; width: 52px; height: 64px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(0,0,0,0.12); box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}
.pp i {
  position: absolute; left: 7px; right: 7px; top: 11px; height: 24px;
  border-radius: 6px;
}
.pp b { position: absolute; left: 12px; bottom: 9px; width: 26px; height: 5px; border-radius: 3px; }
.t-meta { flex: 1; min-width: 0; }
.t-meta b { display: block; font-size: 14.5px; color: var(--text); margin-bottom: 2px; }
.t-meta span { font-size: 11px; color: var(--text-muted); }
.t-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 800;
  opacity: 0; transition: all .2s;
}
.theme-card.active .t-check { opacity: 1; background: var(--primary); border-color: var(--primary); }

.settings { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.s-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-size: 14px; color: var(--text);
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.s-item:last-child { border-bottom: none; }
.s-item i { color: var(--text-muted); font-style: normal; font-size: 16px; }
.me-footer { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 20px; letter-spacing: 1px; }

/* ---------- 位置 / 借阅 / 私信 ---------- */
.bs-loc { font-size: 12px; color: var(--primary); line-height: 1.5; margin-top: 4px; }
.bs-borrow { border-color: var(--primary); color: var(--primary); }

.loc-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 24px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.loc-ic { font-size: 20px; }
.loc-info { flex: 1; min-width: 0; }
.loc-info b { display: block; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.loc-info span { font-size: 11.5px; color: var(--text-muted); }
.loc-edit {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--surface);
  color: var(--primary); font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
}

.sec-badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  font-size: 11px; font-weight: 700; color: #fff; border-radius: 999px; background: var(--accent);
}

.thread-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.thread-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer;
}
.thread-item .ti-cover {
  width: 40px; height: 54px; border-radius: 7px; object-fit: cover; flex-shrink: 0;
  background: var(--surface-2);
}
.thread-item .ti-ph {
  width: 40px; height: 54px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.ti-main { flex: 1; min-width: 0; }
.ti-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ti-title { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-time { font-size: 10.5px; color: var(--text-muted); flex-shrink: 0; }
.ti-peer { font-size: 11.5px; color: var(--primary); margin-top: 2px; }
.ti-last { font-size: 12px; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-dot {
  flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: #fff; border-radius: 999px; background: var(--accent);
}

.borrow-who {
  font-size: 12.5px; color: var(--text); line-height: 1.7; margin-bottom: 12px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 10px;
}
.borrow-who b { color: var(--text); }
.borrow-who .who-loc { color: var(--primary); }
.as-field textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 13.5px; color: var(--text); background: var(--surface); outline: none;
  font-family: inherit; resize: none;
}
.as-field textarea:focus { border-color: var(--primary); }

/* ---------- 会话详情（借阅私信） ---------- */
.ts-sheet { position: absolute; inset: 0; z-index: 45; display: flex; flex-direction: column; justify-content: flex-end; }
.ts-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.ts-panel {
  position: relative; z-index: 1; max-height: 86%; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 34px rgba(0, 0, 0, .28); animation: bs-up .22s ease-out;
}
.ts-head { position: relative; padding: 18px 52px 12px 20px; border-bottom: 1px solid var(--border); }
.ts-head b { display: block; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-head span { font-size: 11.5px; color: var(--text-muted); }
.ts-close { top: 14px; }
.ts-body {
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 10px; min-height: 120px;
}
.ts-body::-webkit-scrollbar { display: none; }
.ts-msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.ts-msg.theirs { align-self: flex-start; background: var(--surface); color: var(--text); box-shadow: var(--shadow); border-radius: 4px 14px 14px 14px; }
.ts-msg.mine { align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-radius: 14px 4px 14px 14px; }
.ts-msg .ts-time { display: block; font-size: 10px; opacity: .7; margin-top: 4px; }
.ts-composer {
  display: flex; gap: 10px; padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--surface);
}
.ts-composer input {
  flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px;
  font-size: 13.5px; outline: none; color: var(--text); background: var(--bg); font-family: inherit;
}
.ts-send {
  border: none; cursor: pointer; border-radius: 999px; padding: 0 18px; font-family: inherit;
  font-size: 13.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

[data-theme="dark"] .ts-msg.mine,
[data-theme="dark"] .ti-dot,
[data-theme="dark"] .sec-badge { color: #111; }
[data-theme="dark"] .ts-send { color: #111; }
/* ---------- 分享的书籍：浏览模式切换（列表 / 翻页） ---------- */
.section-title-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.view-toggle {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border-radius: 999px;
}
.vt-btn {
  border: none; background: transparent; color: var(--text-muted); cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; padding: 5px 13px; border-radius: 999px;
  transition: background .16s ease, color .16s ease;
}
.vt-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }

/* ---------- 翻页模式：详情铺满 + 左右滑动翻书 ---------- */
.book-sheet.flip .bs-panel {
  max-height: none; height: 100%; border-radius: 0;
  animation: none; will-change: transform;
  transition: transform .18s ease, opacity .18s ease;
  touch-action: pan-y;   /* 纵向滚动交给浏览器，横向手势留给「翻书」 */
  box-shadow: none;
}
.book-sheet.flip .bs-scroll { flex: 1; padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.book-sheet.flip .bs-close { top: 11px; right: 10px; background: var(--surface); box-shadow: 0 1px 6px rgba(0, 0, 0, .12); }
.book-sheet.flip .flip-bar { padding-right: 52px; }   /* 给关闭按钮让位 */

.flip-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 8px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.flip-nav {
  flex: none; width: 34px; height: 34px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center; font-family: inherit;
}
.flip-nav:active { background: var(--primary-soft); }
.flip-nav:disabled { opacity: .3; cursor: default; }
.flip-mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.flip-pos { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.flip-tip { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 翻页动画：出 + 入 */
.bs-panel.out-left  { transform: translateX(-24%); opacity: 0; }
.bs-panel.out-right { transform: translateX(24%);  opacity: 0; }
.bs-panel.in-right  { animation: flip-in-right .24s ease-out; }
.bs-panel.in-left   { animation: flip-in-left  .24s ease-out; }
@keyframes flip-in-right { from { transform: translateX(24%);  opacity: .25; } to { transform: none; opacity: 1; } }
@keyframes flip-in-left  { from { transform: translateX(-24%); opacity: .25; } to { transform: none; opacity: 1; } }

@media (min-width: 560px) {
  /* 宽屏下别真铺满，留点边看起来像「一张卡片」 */
  .book-sheet.flip { justify-content: center; }
  .book-sheet.flip .bs-panel {
    height: auto; max-height: 90%; border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  }
}

/* 备案号（ICP + 公安）—— 未配置时容器带 hidden，不会占位 */
.beian-footer {
  text-align: center;
  font-size: 11px;
  line-height: 1.9;
  color: var(--text-muted);
  margin: 16px 0 6px;
  letter-spacing: .2px;
  word-break: break-all;
}
.beian-footer a { color: inherit; text-decoration: none; }
.beian-footer a:hover { text-decoration: underline; }
.beian-footer .sep { margin: 0 8px; opacity: .45; }
