/* ============================================================
   书架首页 v2 · 封面主导的轻卡片，内容 App 质感
   ============================================================ */

/* —— 顶栏搜索 —— */
.search {
  flex: 1;
  max-width: 360px;
  margin-left: auto; margin-right: 8px;
  position: relative;
}
.search input {
  width: 100%;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  padding: 0 14px 0 38px;
  font-size: 13.5px;
  outline: none;
  transition: box-shadow .18s ease;
  color: var(--ink);
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus { box-shadow: inset 0 0 0 1.5px var(--brand); }
.search .search-ic {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none;
}

/* —— 主体 —— */
.shelf-main { padding: 22px 0 64px; }

/* —— 继续阅读 · 主路径 —— */
.resume {
  display: flex; align-items: center; gap: 18px;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  margin-bottom: 26px;
  animation: fadeUp .4s ease both;
}
.resume .cover {
  width: 64px; flex: none;
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 3px 10px rgba(15,16,20,.16);
}
.resume .cover img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.resume .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.resume .kind {
  font-size: 11.5px; font-weight: 600; letter-spacing: .12em; color: var(--brand);
}
.resume .bt {
  font-size: 16.5px; font-weight: 700;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.resume .bt .ch { font-size: 13px; color: var(--ink-soft); font-weight: 400; }
.resume .meta-row { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ink-faint); }
.resume .meta-row .progress { flex: 1; max-width: 220px; }
.resume .meta-row b { color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; }
.resume .act { flex: none; }

/* —— 工具行 —— */
.tools {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-chips {
  display: flex; gap: 6px; flex-wrap: wrap; flex: 1;
}
.fchip {
  font-size: 12.5px; font-weight: 500; padding: 6px 14px; border-radius: 999px;
  background: var(--card); color: var(--ink-soft);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: all .18s ease;
}
.fchip:hover { color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.fchip.on {
  background: var(--ink); color: var(--paper); border: none;
}
html[data-theme="dark"] .fchip.on { background: var(--brand); color: #fff; }

.tools-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* 自定义排序下拉 */
.sorter { position: relative; display: inline-block; }
.sorter-trigger {
  height: 32px; border-radius: 999px; border: none;
  background: var(--card); color: var(--ink-soft);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: 12.5px; padding: 0 12px 0 14px; outline: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; min-width: 92px;
  transition: box-shadow .18s ease, color .18s ease;
}
.sorter-trigger svg { color: var(--ink-faint); transition: transform .18s ease; }
.sorter-trigger:hover { color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.sorter-trigger:hover svg { color: var(--brand); }
.sorter-trigger:focus-visible { box-shadow: inset 0 0 0 1.5px var(--brand); }
.sorter.open .sorter-trigger svg { transform: rotate(180deg); }
.sorter.open .sorter-trigger { color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

.sorter-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  min-width: 120px; margin: 0; padding: 5px;
  list-style: none;
  background: var(--card);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line-strong);
  opacity: 0; transform: translateY(-6px) scale(.98);
  pointer-events: none; visibility: hidden;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.sorter.open .sorter-menu {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto; visibility: visible;
}
.sorter-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-s);
  font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.sorter-item::before {
  content: ""; display: inline-block; width: 14px; height: 14px;
  border-radius: 3px; box-shadow: inset 0 0 0 1px var(--ink-faint);
  background: transparent; flex: none;
  transition: box-shadow .15s ease, background .15s ease;
}
.sorter-item:hover { background: var(--brand-wash); color: var(--brand); }
.sorter-item:hover::before { box-shadow: inset 0 0 0 1px var(--brand); }
.sorter-item.on { color: var(--brand); font-weight: 600; }
.sorter-item.on::before {
  box-shadow: inset 0 0 0 0 transparent;
  background: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 10px 10px;
}

.demo-toggle {
  font-size: 11.5px; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: all .18s ease;
}
.demo-toggle:hover { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.demo-toggle.on { color: var(--accent); background: var(--accent-wash); }

/* 书架标题 */
.shelf-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 4px 0 16px;
}
.shelf-head h2 { font-size: 19px; font-weight: 700; }
.shelf-head .count { font-size: 12.5px; color: var(--ink-faint); }
.shelf-head .hint { margin-left: auto; font-size: 11.5px; color: var(--ink-faint); }

/* ============================================================
   书卡 · 封面主导
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 18px 14px;
}
.bcard {
  display: flex; flex-direction: column; gap: 8px;
  border-radius: var(--radius-l);
  cursor: pointer;
  position: relative;
  transition: transform .18s ease;
}
.bcard:hover { transform: translateY(-3px); }
.bcard .cover {
  border-radius: var(--radius-m);
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--card-deep);
  position: relative;
  box-shadow: 0 2px 8px rgba(15,16,20,.1);
  transition: box-shadow .18s ease;
}
.bcard:hover .cover { box-shadow: 0 8px 24px rgba(15,16,20,.18); }
.bcard .cover img { width: 100%; height: 100%; object-fit: cover; }
/* 进度 · 叠在封面底部 */
.bcard .cover-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(15,16,20,.24);
}
.bcard .cover-progress > i {
  display: block; height: 100%; background: var(--brand);
}
/* 徽标 · 右上角小胶囊 */
.bcard .status-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(15,16,20,.66);
  backdrop-filter: blur(4px);
  color: #F2F3F8;
  font-size: 10px; font-weight: 500; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 6px;
}
.bcard .status-badge.ongoing { color: #FFB899; }
.bcard .status-badge.done { color: #C6CBD8; }
/* 阅读中的书 · 封面左上角主色小条 */
.bcard.reading-flag .cover::before {
  content: ""; position: absolute; top: 8px; left: 8px;
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--brand);
}

.bcard .b-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bcard .b-sub {
  font-size: 11.5px; color: var(--ink-faint);
  display: flex; align-items: center; gap: 5px;
  overflow: hidden; white-space: nowrap;
}
.bcard .b-sub .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); flex: none; }
.bcard .b-sub .st-ongoing { color: var(--accent); }
.bcard .b-foot {
  font-size: 11px; color: var(--ink-faint);
  display: flex; justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.bcard .b-foot .pct { color: var(--brand); font-weight: 600; }

/* —— 空状态 —— */
.empty {
  display: none;
  flex-direction: column; align-items: center; text-align: center;
  padding: 66px 20px 56px;
  gap: 6px;
  animation: fadeUp .4s ease both;
}
.empty.show { display: flex; }
.empty .art { margin-bottom: 12px; }
.empty h3 { font-size: 19px; font-weight: 700; }
.empty p { font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }
.empty .acts { display: flex; gap: 12px; margin-top: 20px; }
.empty .restore {
  margin-top: 16px; font-size: 12.5px; color: var(--brand); font-weight: 500;
}
.empty .restore:hover { text-decoration: underline; text-underline-offset: 3px; }

.noresult { display: none; text-align: center; padding: 46px 0; color: var(--ink-faint); font-size: 13.5px; }
.noresult.show { display: block; }

/* —— 页脚 —— */
.footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 32px;
  text-align: center;
  font-size: 12px; color: var(--ink-faint);
}
.footer .line { margin-top: 5px; color: var(--ink-faint); opacity: .75; }

/* ============================================================
   ≤ 720px · 手机（书架）
   ============================================================ */
@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 0 16px; height: 52px; }
  .brand small { display: none; }
  .brand { font-size: 16.5px; }
  .search { max-width: none; margin-right: 0; }
  .search input { height: 34px; font-size: 13px; }

  .shelf-main { padding: 16px 0 56px; }
  .resume {
    gap: 14px; border-radius: var(--radius-l);
    flex-wrap: wrap; padding: 14px;
  }
  .resume .cover { width: 56px; }
  .resume .bt { font-size: 15.5px; gap: 6px; }
  .resume .bt .ch { font-size: 12px; }
  .resume .meta-row { flex-wrap: wrap; gap: 6px 10px; font-size: 11.5px; }
  .resume .meta-row .progress { min-width: 130px; }
  .resume .act { width: 100%; }
  .resume .act .btn { width: 100%; padding: 12px; }

  .tools { gap: 8px; }
  .tools-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .sorter-menu { left: 0; right: auto; }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 10px;
  }
  .bcard .b-sub, .bcard .b-foot { font-size: 10.5px; }
  .bcard .b-title { font-size: 13.5px; }
}
