/* 书库管理子标签与批量操作 */
.library-status-tabs { grid-template-columns: repeat(3, 1fr); }
.library-status-tabs a { transition: border-color .15s, background .15s, box-shadow .15s; }
.library-status-tabs a.active { border-color: #77c5dc; background: #eefaff; box-shadow: 0 7px 18px rgba(18,127,177,.1); }
.library-status-tabs a.active span { color: #167fa4; }
.task-pane .manager-filters { grid-template-columns: minmax(260px,1fr) auto auto; }
.library-batch-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: #f8fbfd; }
.batch-select-all { display: flex; align-items: center; gap: 7px; color: #526b80; font-size: 12px; font-weight: 800; white-space: nowrap; }
.library-batch-bar form { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.library-batch-bar select { min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.library-batch-bar > [data-library-selection-count] { min-width: 65px; color: var(--muted); font-size: 11px; text-align: right; }
.library-manage-row { grid-template-columns: 24px 58px minmax(220px,1fr) auto; }
.library-select { display: grid; place-items: center; }
.library-select input, .batch-select-all input { width: 17px; height: 17px; accent-color: #168daf; }
.manager-notice[data-state="success"] { background: #eaf9f0; color: #26754b; font-weight: 800; }
.manager-notice[data-state="warning"] { background: #fff7e8; color: #8b6324; font-weight: 800; }
.manager-notice[data-state="error"] { background: #fff0ed; color: #a84435; font-weight: 800; }
.account .site-switch { border-color: #9fcde0; background: #edf9fd; color: #176f98; white-space: nowrap; }
.account .site-switch:hover { border-color: #58abc8; background: #e2f5fb; }

@media (max-width: 900px) {
  .library-manage-row { grid-template-columns: 24px 48px 1fr; }
  .library-manage-actions { grid-column: 2/-1; }
  .library-batch-bar { align-items: stretch; flex-wrap: wrap; }
  .library-batch-bar form { order: 3; width: 100%; margin-left: 0; }
  .library-batch-bar form select { flex: 1; }
}

@media (max-width: 560px) {
  .library-status-tabs { grid-template-columns: 1fr; }
  .task-pane .manager-filters { grid-template-columns: 1fr; }
  .library-manage-row { grid-template-columns: 22px 42px 1fr; }
  .library-batch-bar form { align-items: stretch; flex-direction: column; }
  .library-batch-bar form > * { width: 100%; }
  .library-batch-bar > [data-library-selection-count] { margin-left: auto; }
  .library-manage-actions { grid-column: 1/-1; }
}

/* BeeMan 同步的小说列表密度与分页 */
.book-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}
.book-cover { aspect-ratio: 2 / 3; }
.book-card-copy { padding: 12px; }
.home-main .book-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.home-main .shelf-heart { top: auto; bottom: 9px; }
.listing-bar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}
.listing-bar.bottom {
  justify-content: flex-end;
  margin: 18px 0 0;
}
.listing-bar:empty { display: none; }
.listing-bar .result-count { margin: 0; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.page-link, .page-total, .page-gap {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #52677f;
  white-space: nowrap;
}
.page-link:hover { border-color: #75bfd6; color: #116f98; }
.page-link.active {
  border-color: #168daf;
  background: linear-gradient(135deg, #0d5999, #19a9cb);
  box-shadow: 0 7px 16px rgba(18, 127, 177, .16);
  color: #fff;
  font-weight: 900;
}
.page-total, .page-gap {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.manager-pagination { margin-top: 12px; }

@media (max-width: 1280px) {
  .home-main .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .home-main .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .book-grid, .home-main .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listing-bar { align-items: flex-start; flex-direction: column; }
  .listing-bar.bottom { align-items: stretch; }
  .pagination {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
  }
  .page-link, .page-total, .page-gap { flex: 0 0 auto; }
}
@media (max-width: 620px) {
  .collection-shelf .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .collection-shelf .book-card { border-radius: 12px; }
  .collection-shelf .book-cover > span { display: none; }
  .collection-shelf .book-card-copy { padding: 7px 6px 8px; }
  .collection-shelf .book-card h3 {
    min-height: 34px;
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .collection-shelf .byline, .collection-shelf .tags { display: none; }
  .collection-recent .book-grid { grid-template-columns: 1fr; gap: 9px; }
  .collection-recent .book-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 114px; }
  .collection-recent .book-cover-wrap, .collection-recent .book-cover { height: 114px; }
  .collection-recent .book-cover { aspect-ratio: auto; }
  .collection-recent .book-cover > span, .collection-recent .tags { display: none; }
  .collection-recent .book-card-copy { min-width: 0; padding: 9px 10px; }
}
@media (max-width: 380px) {
  .collection-shelf .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
}

/* BeeMan 式手机导航 */
.mobile-nav { display: none; }
.mobile-recent-action { display: none; }
.mobile-nav summary { list-style: none; }
.mobile-nav summary::-webkit-details-marker { display: none; }
@media (max-width: 900px) {
  .home-dashboard > .home-side { display: none; }
  .topbar {
    min-height: 68px;
    height: 68px;
    padding: 8px 12px;
    flex-wrap: nowrap;
  }
  .topbar .brand { font-size: 20px; }
  .topbar .brand img { width: 38px; height: 38px; }
  .topbar > .navlinks, .topbar > .account { display: none !important; }
  .mobile-nav { position: relative; display: block; margin-left: auto; }
  .mobile-nav summary {
    width: 44px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid #a9cfe0;
    border-radius: 11px;
    background: #f4fbff;
    color: #176f98;
    cursor: pointer;
    font-size: 22px;
    font-weight: 900;
  }
  .mobile-nav-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 100;
    width: min(300px, calc(100vw - 24px));
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(9, 50, 96, .2);
  }
  .mobile-nav-panel > a {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 9px;
    color: #405a70;
    font-size: 14px;
    font-weight: 800;
  }
  .mobile-nav-panel > a.active { background: #eaf7fc; color: #117b9e; }
  .mobile-nav-panel > a.site-switch { border: 1px solid #b8d9e7; background: #f1faff; color: #176f98; }
  .mobile-nav-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 4px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
  }
  .mobile-nav-account a { color: #176f98; font-weight: 800; }
  .hero, .hero-inner { min-height: 235px; }
  .hero-inner { align-items: flex-end; padding: 22px 18px; }
  .hero-copy { max-width: 230px; }
  .hero-copy h1, .hero-copy > p { display: none; }
  .hero-copy .eyebrow { margin-bottom: 10px; font-size: 10px; }
  .hero-actions { display: grid; gap: 8px; }
  .hero-actions .primary, .hero-actions .secondary { min-height: 40px; padding: 0 15px; font-size: 13px; }
  .hero-actions .mobile-recent-action { display: inline-flex; }
  .hero-actions a[href="/admin"] { display: none; }
}

/* 完整的阅读背景与可关闭设置面板 */
.reader-settings { z-index: 91; }
.reader-settings[hidden], .reader-settings-backdrop[hidden] { display: none; }
.reader-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 18, 27, .28);
  backdrop-filter: blur(2px);
}
.reader-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -3px 0 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}
.reader-settings-head strong { display: block; font-size: 16px; }
.reader-settings-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.reader-settings-head button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbfe;
  color: #45647b;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}
.theme-buttons button.active { border-color: #168daf; background: #e8f8fc; color: #117b9e; font-weight: 900; }
.reader-font-field select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fbfd;
  color: #354f63;
  outline: none;
}
.reader-font-field select:focus { border-color: #66bcd5; box-shadow: 0 0 0 3px rgba(32, 185, 215, .1); }
.reader-paper[data-reader-font="serif"] .novel-body { font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif; }
.reader-paper[data-reader-font="sans"] .novel-body { font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif; }
.reader-paper[data-reader-font="kai"] .novel-body { font-family: KaiTi, STKaiti, "Kaiti SC", "DFKai-SB", serif; }
.reader-paper[data-reader-font="fangsong"] .novel-body { font-family: FangSong, STFangsong, FangSong_GB2312, serif; }
.reader-page.theme-sepia { background: #e8dfca; }
.reader-page.theme-night { background: #0e171e; }
.reader-page.theme-night .topbar, .reader-page.reader-lights-off .topbar { border-color: #293b47; background: rgba(15, 25, 33, .97); }
.reader-page.theme-night .brand, .reader-page.reader-lights-off .brand { color: #dce6ec; }
.reader-page.theme-night .navlinks a, .reader-page.theme-night .account,
.reader-page.reader-lights-off .navlinks a, .reader-page.reader-lights-off .account { color: #aabcc8; }
.reader-page.theme-night .account a, .reader-page.reader-lights-off .account a {
  border-color: #344b59;
  background: #192a35;
  color: #c7d6de;
}
.reader-page.theme-night .mobile-nav summary, .reader-page.reader-lights-off .mobile-nav summary {
  border-color: #3c5360;
  background: #192a35;
  color: #c7d6de;
}
.reader-page.theme-night .mobile-nav-panel, .reader-page.reader-lights-off .mobile-nav-panel {
  border-color: #344b59;
  background: #15242e;
}
.reader-page.theme-night .mobile-nav-panel > a, .reader-page.reader-lights-off .mobile-nav-panel > a { color: #c7d6de; }
.reader-page.theme-night .mobile-nav-panel > a.active, .reader-page.reader-lights-off .mobile-nav-panel > a.active { background: #213844; }
.reader-page.theme-night .reader-bar { border-color: #2c3c47; background: rgba(18, 29, 38, .96); }
.reader-page.theme-night .reader-bar a, .reader-page.theme-night .reader-bar strong, .reader-page.theme-night .reader-bar span { color: #c7d2da; }
.reader-page.reader-lights-off, .reader-lights-off .reader { background: #0b1218; }
.reader-lights-off .reader-paper {
  background: #18242d !important;
  color: #d7dfe5 !important;
  box-shadow: 0 0 48px rgba(0, 0, 0, .5) !important;
}
.reader-lights-off .novel-body { color: #d7dfe5; }
.reader-lights-off .reader-chapter-head h1 { color: #e5ebef; }
.reader-lights-off .reader-chapter-head p, .reader-lights-off .reader-paper .eyebrow { color: #91a6b5; }
.reader-lights-off .reader-nav { border-color: #344550; }
.reader-lights-off .reader-nav a { color: #72bdd5; }
.reader-lights-off .reader-settings-head { border-color: #334752; }
.reader-lights-off .reader-settings-head small { color: #9cafbb; }
.reader-lights-off .reader-settings-head button { border-color: #40525d; background: #21333e; color: #d6e0e6; }
.reader-lights-off .reader-font-field select { border-color: #40525d; background: #21333e; color: #d6e0e6; }
.reader-lights-off .theme-buttons button.active { border-color: #5faac1; background: #29414e; color: #d9edf3; }

@media (max-width: 760px) {
  .reader-page .topbar { position: relative; }
  .reader-settings-open { overflow: hidden; }
  .reader-settings {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(72vh, 520px);
    overflow-y: auto;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 50px rgba(6, 25, 39, .24);
  }
  .reader-settings label { grid-template-columns: 48px minmax(0, 1fr); margin-bottom: 18px; }
  .reader-settings input[type="range"] { width: 100%; min-width: 0; }
  .theme-buttons button { min-height: 46px; font-size: 14px; }
  .reader-bar { padding: 8px 10px; }
  .reader-controls button { padding: 0 9px; }
}
