/* ==========================================================================
   WeLib — 视觉样式
   无外部依赖：字体、图标全部走系统栈 / 内联 SVG。
   ========================================================================== */

:root {
  --bg: #f7f6f3;
  --bg-glow: #ffffff;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #191b20;
  --text-soft: #3b3f47;
  --muted: #6d7280;
  --line: #e3e0d8;
  --line-strong: #d2cec3;
  --accent: #2455c3;
  --accent-strong: #1a3f97;
  --accent-soft: #e8eefc;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --shadow-sm: 0 1px 2px rgba(24, 26, 31, .06);
  --shadow-md: 0 10px 28px -14px rgba(24, 26, 31, .28);
  --shadow-lg: 0 28px 60px -24px rgba(17, 20, 28, .35);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --header-h: 66px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1018;
  --bg-glow: #121a26;
  --surface: #121a26;
  --surface-2: #1a2432;
  --text: #e9edf4;
  --text-soft: #c6cfdd;
  --muted: #93a0b4;
  --line: #223044;
  --line-strong: #33445d;
  --accent: #79a6ff;
  --accent-strong: #a9c6ff;
  --accent-soft: #17263f;
  --accent-text: #0b1018;
  --danger: #ff8b82;
  --danger-soft: #2a1512;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 14px 32px -16px rgba(0, 0, 0, .75);
  --shadow-lg: 0 34px 70px -26px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1018;
    --bg-glow: #121a26;
    --surface: #121a26;
    --surface-2: #1a2432;
    --text: #e9edf4;
    --text-soft: #c6cfdd;
    --muted: #93a0b4;
    --line: #223044;
    --line-strong: #33445d;
    --accent: #79a6ff;
    --accent-strong: #a9c6ff;
    --accent-soft: #17263f;
    --accent-text: #0b1018;
    --danger: #ff8b82;
    --danger-soft: #2a1512;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 14px 32px -16px rgba(0, 0, 0, .75);
    --shadow-lg: 0 34px 70px -26px rgba(0, 0, 0, .85);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 480px at 12% -10%, var(--bg-glow) 0%, transparent 62%),
    radial-gradient(900px 420px at 96% 0%, var(--accent-soft) 0%, transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
button, input { font: inherit; color: inherit; }
code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .08em .38em;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-text);
  padding: 8px 14px;
  border-radius: 8px;
  transition: top .18s ease;
}
.skip-link:focus { top: 12px; color: var(--accent-text); }

/* --------------------------------------------------------------------------
   顶栏
   ------------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: var(--header-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(145deg, #3568d8 0%, #1f3f92 55%, #162a5e 100%);
  box-shadow: 0 8px 18px -8px rgba(36, 85, 195, .75), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark svg { width: 23px; height: 23px; }

.brand-text {
  font-size: 1.3rem;
  font-weight: 760;
  letter-spacing: -.02em;
  line-height: 1.05;
  display: flex;
  flex-direction: column;
}
.brand-text small {
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.filter {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(180px, 26vw, 320px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px 0 34px;
  height: 40px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.filter:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.filter-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.filter input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: .88rem;
  color: var(--text);
  padding: 0;
}
.filter input::placeholder { color: var(--muted); }
.filter input::-webkit-search-cancel-button { display: none; }

.filter-clear {
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .72rem;
  border-radius: 999px;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
}
.filter-clear:hover { color: var(--text); }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* --------------------------------------------------------------------------
   页头 / Hero
   ------------------------------------------------------------------------ */

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 40px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 26px 0 30px;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f9e6b;
  box-shadow: 0 0 0 0 rgba(47, 158, 107, .5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 158, 107, .45); }
  70% { box-shadow: 0 0 0 7px rgba(47, 158, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 158, 107, 0); }
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.85rem, 4.2vw, 2.9rem);
  font-weight: 780;
  letter-spacing: -.035em;
  line-height: 1.1;
  background: linear-gradient(120deg, var(--text) 30%, var(--accent) 115%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: .96rem;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.seg {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 620;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.seg:hover { color: var(--text); }
.seg.active {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 5px 14px -6px color-mix(in srgb, var(--accent) 75%, transparent);
}
.hero-hint {
  margin: 0;
  font-size: .78rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* --------------------------------------------------------------------------
   工具条
   ------------------------------------------------------------------------ */

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.count {
  font-size: .88rem;
  font-weight: 640;
  color: var(--text-soft);
}
.count .muted { color: var(--muted); font-weight: 500; }
.view-hint {
  font-size: .78rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   书卡网格
   ------------------------------------------------------------------------ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 22px 16px;
  min-height: 120px;
}

.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2, .7, .3, 1), box-shadow .22s ease, border-color .22s ease;
  outline: none;
}
.book-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.book-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent), var(--shadow-md);
}

.card-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
  overflow: hidden;
}
.card-cover img {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .3, 1), opacity .3s ease;
  opacity: 0;
}
.card-cover img.loaded { opacity: 1; }
.book-card:hover .card-cover img { transform: scale(1.045); }

.card-cover.is-fallback {
  background:
    linear-gradient(155deg, hsl(var(--h, 220) 46% 40%) 0%, hsl(calc(var(--h, 220) + 38) 52% 22%) 100%);
  display: flex;
  align-items: stretch;
}

.fallback-cover {
  position: relative;
  width: 100%;
  padding: 14px 13px 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
}
.fallback-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, .22), transparent 55%),
    linear-gradient(0deg, rgba(0, 0, 0, .18), transparent 55%);
  pointer-events: none;
}
.fallback-title {
  position: relative;
  z-index: 1;
  font-size: .92rem;
  font-weight: 720;
  line-height: 1.35;
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.fallback-author {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: .72rem;
  font-weight: 600;
  opacity: .82;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fallback-rule {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 2px;
  background: rgba(255, 255, 255, .55);
  border-radius: 2px;
  margin: 8px 0 2px;
}

.cover-badge {
  position: absolute;
  left: 9px;
  bottom: 9px;
  z-index: 2;
  max-width: calc(100% - 54px);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: .64rem;
  font-weight: 680;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(12, 17, 25, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-dl {
  position: absolute;
  right: 9px;
  top: 9px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(12, 17, 25, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}
.card-dl svg { width: 15px; height: 15px; }
.book-card:hover .card-dl,
.book-card:focus-within .card-dl { opacity: 1; transform: none; }
.card-dl:hover { background: var(--accent); color: var(--accent-text); opacity: 1; }
@media (pointer: coarse) {
  .card-dl { opacity: 1; transform: none; }
}

.card-body {
  padding: 11px 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.card-title {
  margin: 0;
  font-size: .91rem;
  font-weight: 660;
  line-height: 1.4;
  letter-spacing: -.006em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.card-author {
  margin: 0;
  font-size: .77rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.2em;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}
.chip {
  font-size: .66rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  line-height: 1.5;
  white-space: nowrap;
}
.card-desc {
  margin: 5px 0 0;
  font-size: .76rem;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   骨架屏 / 状态
   ------------------------------------------------------------------------ */

.skeleton {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.sk-cover {
  aspect-ratio: 2 / 3;
  background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 48%, var(--surface-2) 66%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
.sk-body { padding: 12px; display: grid; gap: 8px; }
.sk-line {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  animation: shimmer 1.5s linear infinite;
  background-image: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 48%, var(--surface-2) 66%);
  background-size: 220% 100%;
}
.sk-line.short { width: 58%; }
@keyframes shimmer { to { background-position: -220% 0; } }

.state-area {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.state-box {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.state-box .state-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.state-box.error { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface)); }
.state-box.error .state-icon { background: var(--danger-soft); color: var(--danger); }
.state-title { margin: 1px 0 3px; font-size: .92rem; font-weight: 680; }
.state-text { margin: 0; font-size: .82rem; color: var(--muted); word-break: break-word; }
.state-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.state-note { margin: 8px 0 0; font-size: .74rem; color: var(--muted); }

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 0 6px;
  color: var(--muted);
  font-size: .84rem;
}
.spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.end-note {
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  padding: 10px 0 4px;
}
.end-note::before,
.end-note::after {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  background: var(--line-strong);
  vertical-align: middle;
  margin: 0 12px;
}

/* --------------------------------------------------------------------------
   按钮
   ------------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 15px;
  font-size: .83rem;
  font-weight: 620;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-text);
}

.load-more-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 26px;
}
.load-more {
  min-width: 170px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 26px;
  font-size: .87rem;
  font-weight: 640;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.load-more:hover { background: var(--surface-2); border-color: var(--accent); }
.load-more:active { transform: translateY(1px); }
.load-more[disabled] { opacity: .6; cursor: progress; }

/* --------------------------------------------------------------------------
   页脚
   ------------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.footer-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 44px;
  font-size: .8rem;
  color: var(--muted);
}
.footer-brand {
  font-size: 1.02rem;
  font-weight: 760;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.footer-inner p { margin: 6px 0; max-width: 88ch; }
.footer-inner .muted { opacity: .8; }

/* --------------------------------------------------------------------------
   简介弹窗
   ------------------------------------------------------------------------ */

.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 19, .55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade .18s ease both;
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(780px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 22px;
  padding: 22px;
  animation: rise .24s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }

.modal-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
  align-self: start;
}
.modal-cover img {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal-cover.is-fallback {
  background: linear-gradient(155deg, hsl(var(--h, 220) 46% 40%) 0%, hsl(calc(var(--h, 220) + 38) 52% 22%) 100%);
}

.modal-body { min-width: 0; padding-right: 26px; }
.modal-body h2 {
  margin: 2px 0 6px;
  font-size: 1.32rem;
  font-weight: 760;
  letter-spacing: -.02em;
  line-height: 1.3;
  color: var(--text);
  overflow-wrap: anywhere;
}
.modal-author {
  margin: 0 0 10px;
  font-size: .88rem;
  color: var(--muted);
}
.modal-body .chips { margin-bottom: 14px; }
.modal-desc {
  margin: 0 0 18px;
  font-size: .9rem;
  line-height: 1.75;
  color: var(--text-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 34vh;
  overflow: auto;
  padding-right: 4px;
}
.modal-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.modal-note {
  margin: 14px 0 0;
  font-size: .73rem;
  color: var(--muted);
  line-height: 1.6;
}
.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--muted);
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close svg { width: 17px; height: 17px; }

body.modal-open { overflow: hidden; }

/* --------------------------------------------------------------------------
   响应式
   ------------------------------------------------------------------------ */

@media (max-width: 760px) {
  .header-inner { width: calc(100% - 28px); gap: 10px; }
  .brand-text small { display: none; }
  .filter { width: clamp(130px, 34vw, 210px); height: 38px; }
  main { width: calc(100% - 28px); padding-top: 20px; }
  .hero { padding: 18px 0 24px; gap: 20px; }
  .hero-panel { align-items: flex-start; width: 100%; }
  .seg { padding: 7px 13px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 16px 11px; }
  .card-body { padding: 10px 10px 12px; }
  .card-title { font-size: .86rem; }
  .card-desc { display: none; }
  .view-hint { display: none; }
  .modal-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px;
    max-height: 90vh;
  }
  .modal-cover { width: 132px; }
  .modal-body { padding-right: 0; }
  .modal-body h2 { padding-right: 34px; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented { width: 100%; justify-content: space-between; }
  .seg { flex: 1; text-align: center; padding-inline: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* 文字封面在卡片 / 弹窗里都要撑满容器 */
.card-cover > .fallback-cover,
.modal-cover > .fallback-cover { height: 100%; }

/* 文字封面底部留出格式角标的位置，避免作者名和角标叠在一起 */
.card-cover > .fallback-cover { padding-bottom: 42px; }
