/* ============================================================
   墨阅 · MOYUE
   宣纸、墨色、朱砂。所有样式为原生 CSS，无构建步骤。
   ============================================================ */

/* ------------------------------- 设计变量 ------------------------------- */

:root {
  --paper: #f7f2e7;
  --paper-2: #f2eadc;
  --paper-3: #e9dfcd;
  --paper-4: #ded2bc;
  --ink: #24261f;
  --ink-2: #3a3d33;
  --ink-soft: #585b4e;
  --muted: #8b8475;
  --faint: #b0a795;
  --line: rgba(58, 54, 43, 0.13);
  --line-strong: rgba(58, 54, 43, 0.24);
  --cinnabar: #a83b2e;
  --cinnabar-2: #8d2d22;
  --cinnabar-soft: rgba(168, 59, 46, 0.1);
  --jade: #526d5b;
  --jade-soft: rgba(82, 109, 91, 0.12);
  --gold: #a9854e;
  --shadow-sm: 0 2px 8px rgba(43, 38, 28, 0.05);
  --shadow-md: 0 14px 40px -18px rgba(43, 38, 28, 0.35);
  --shadow-lg: 0 30px 80px -30px rgba(35, 31, 23, 0.42);
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", SimSun, serif;
  --font-kai: "Kaiti SC", "STKaiti", KaiTi, "KaiTi_GB2312", serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", sans-serif;
  --sidebar-w: 250px;
  --topbar-h: 72px;
  --radius: 3px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-ui-theme="dark"] {
  --paper: #171b18;
  --paper-2: #1e231f;
  --paper-3: #262d27;
  --paper-4: #313a32;
  --ink: #ebe4d4;
  --ink-2: #d8d0bf;
  --ink-soft: #aaa392;
  --muted: #8c8576;
  --faint: #686357;
  --line: rgba(236, 227, 208, 0.1);
  --line-strong: rgba(236, 227, 208, 0.2);
  --cinnabar: #bd5a49;
  --cinnabar-2: #cc6d5a;
  --cinnabar-soft: rgba(189, 90, 73, 0.15);
  --jade: #7d9b84;
  --jade-soft: rgba(125, 155, 132, 0.14);
  --gold: #c0a06a;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 18px 44px -18px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, 0.75);
}

/* -------------------------------- 基础 -------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 8% 0%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(168, 59, 46, 0.035), transparent 70%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-ui-theme="dark"] body {
  background:
    radial-gradient(ellipse 80% 60% at 8% 0%, rgba(255, 255, 255, 0.025), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(189, 90, 73, 0.05), transparent 70%),
    var(--paper);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.038;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

html[data-ui-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.025; }

body.reader-open { overflow: hidden; }

::selection { background: rgba(168, 59, 46, 0.2); color: var(--ink); }

:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 2px; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

button { background: none; border: 0; padding: 0; cursor: pointer; }

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4, p { margin: 0; }

ul, ol, dl, dd { margin: 0; padding: 0; }

li { list-style: none; }

code { font-family: Consolas, "SFMono-Regular", monospace; font-size: 0.9em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--paper-4); border: 3px solid var(--paper); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

.muted { color: var(--muted); font-size: 13px; }
.dot { color: var(--faint); margin: 0 4px; }
.icon { flex: 0 0 auto; }

.logo-mark {
  display: inline-flex;
  width: var(--mark-size, 34px);
  height: var(--mark-size, 34px);
  color: var(--cinnabar);
  flex: 0 0 auto;
}
.logo-mark svg { width: 100%; height: 100%; }

/* -------------------------------- 布局 -------------------------------- */

.app-shell { display: flex; min-height: 100vh; }

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.view {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 38px 46px 84px;
}

.page { animation: page-in 0.45s var(--ease) both; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 46px 30px;
  color: var(--faint);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  border-top: 1px solid var(--line);
}
.site-footer span { font-family: var(--font-kai); letter-spacing: 0.1em; }

/* -------------------------------- 侧栏 -------------------------------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  padding: 28px 20px 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 22%),
    linear-gradient(90deg, var(--paper-2), var(--paper));
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

html[data-ui-theme="dark"] .sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 22%),
    linear-gradient(90deg, var(--paper-2), var(--paper));
}

.sidebar-inner { display: flex; flex-direction: column; min-height: 100%; }

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 0; }
.brand .logo-mark { color: var(--cinnabar); filter: drop-shadow(0 2px 6px rgba(168, 59, 46, 0.14)); }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-text strong { font-size: 24px; font-weight: 600; letter-spacing: 0.18em; line-height: 1.2; }
.brand-text em { font-style: normal; font-family: var(--font-sans); font-size: 8px; letter-spacing: 0.42em; color: var(--muted); }

.sidebar-rule { display: flex; align-items: center; gap: 10px; margin: 24px 8px 22px; }
.sidebar-rule span { width: 24px; height: 1px; background: var(--cinnabar); opacity: 0.7; }
.sidebar-rule em { font-family: var(--font-kai); font-style: normal; font-size: 10.5px; letter-spacing: 0.1em; color: var(--muted); white-space: nowrap; }

.side-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 13px;
  border-radius: 2px;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0.06em;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), padding 0.2s var(--ease);
}
.nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  background: var(--cinnabar);
  transform: translateY(-50%);
  transition: height 0.2s var(--ease);
}
.nav-link:hover { background: rgba(58, 54, 43, 0.05); color: var(--ink); }
html[data-ui-theme="dark"] .nav-link:hover { background: rgba(255, 255, 255, 0.05); }
.nav-link.is-active { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.nav-link.is-active::before { height: 18px; }
.nav-icon { display: flex; opacity: 0.86; }
.nav-text { flex: 1; }
.nav-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--cinnabar);
  color: #fbf5e9;
  font-family: var(--font-sans);
  font-size: 10px;
  line-height: 19px;
  text-align: center;
}
.nav-link.is-active .nav-badge { background: var(--cinnabar); color: #fff; }

.sidebar-scroll-quote {
  margin-top: auto;
  padding: 30px 8px 20px;
  font-family: var(--font-kai);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.85;
  letter-spacing: 0.06em;
}
.sidebar-scroll-quote p { white-space: nowrap; }
.sidebar-scroll-quote span { display: block; margin-top: 6px; color: var(--faint); font-size: 10px; text-align: right; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 16px; }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.side-user-text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text span { font-family: var(--font-sans); font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .icon-btn { width: 30px; height: 30px; }
.side-guest p { font-size: 12px; color: var(--muted); line-height: 1.7; margin-bottom: 12px; }
.side-version { margin-top: 14px; font-family: var(--font-sans); font-size: 9.5px; letter-spacing: 0.06em; color: var(--faint); }

.drawer-scrim { display: none; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 46px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.1);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--paper); }
}

.topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.topbar-crumb { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
.topbar-crumb i { font-style: normal; color: var(--faint); }
.topbar-crumb strong { font-weight: 500; color: var(--ink); }
.mobile-menu { display: none !important; }
.mobile-brand { display: none; align-items: center; gap: 8px; font-size: 17px; letter-spacing: 0.14em; }

.top-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: clamp(220px, 28vw, 370px);
  height: 38px;
  padding: 0 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.top-search:focus-within { border-color: var(--cinnabar); color: var(--ink); }
.top-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  letter-spacing: 0.03em;
}
.top-search input::placeholder { color: var(--faint); }
.top-search kbd {
  font-family: var(--font-sans);
  font-size: 10px;
  line-height: 1;
  color: var(--faint);
  border: 1px solid var(--line-strong);
  padding: 3px 5px;
  border-radius: 2px;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; }
.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  padding: 5px 9px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 20px;
  transition: 0.2s var(--ease);
}
.topbar-status:hover { border-color: var(--line); background: var(--paper-2); }
.topbar-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.topbar-status.is-online i { background: var(--jade); box-shadow: 0 0 0 3px var(--jade-soft); }
.theme-toggle { width: 34px !important; height: 34px !important; }
.topbar-login {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  margin-left: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 0.05em;
  transition: 0.2s var(--ease);
}
.topbar-login:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 22px; transition: background 0.2s var(--ease); max-width: 150px; }
.topbar-user:hover { background: var(--paper-2); }
.topbar-user span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.05em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cinnabar); color: #fbf4e6; border-color: var(--cinnabar); box-shadow: 0 6px 18px -8px rgba(168, 59, 46, 0.55); }
.btn-primary:hover { background: var(--cinnabar-2); border-color: var(--cinnabar-2); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-soft); }
.btn-danger { background: var(--cinnabar); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; gap: 5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn.is-busy { pointer-events: none; }
.btn.is-shelved { border-color: var(--jade); color: var(--jade); background: var(--jade-soft); }
.btn.is-shelved:hover { background: rgba(82, 109, 91, 0.18); border-color: var(--jade); color: var(--jade); }
.btn-spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 2px;
  color: var(--ink-soft);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--cinnabar);
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: gap 0.2s var(--ease), color 0.2s var(--ease);
}
.text-link:hover { gap: 9px; color: var(--cinnabar-2); }
.text-button { color: var(--cinnabar); font-size: 12px; letter-spacing: 0.04em; border-bottom: 1px solid rgba(168, 59, 46, 0.35); padding-bottom: 1px; }
.text-button:hover { color: var(--cinnabar-2); }

/* -------------------------------- 通用组件 -------------------------------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 8px 0 26px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.page-kicker, .hero-kicker {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: var(--cinnabar);
  text-transform: uppercase;
  margin-bottom: 9px;
}
.page-heading h1 { font-size: clamp(28px, 3vw, 38px); font-weight: 600; letter-spacing: 0.04em; line-height: 1.25; }
.page-desc { margin-top: 7px; color: var(--muted); font-size: 13px; max-width: 560px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 4px; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-title-wrap { display: flex; align-items: flex-start; gap: 13px; }
.section-index {
  font-family: var(--font-kai);
  font-size: 12px;
  color: #fbf5e7;
  background: var(--cinnabar);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  flex: 0 0 auto;
  box-shadow: 0 3px 10px -4px rgba(168, 59, 46, 0.6);
}
.section-rule { width: 24px; height: 1px; background: var(--cinnabar); margin-top: 14px; }
.section-title-wrap h2 { font-size: 22px; font-weight: 600; letter-spacing: 0.06em; }
.section-title-wrap p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.section-action { flex: 0 0 auto; }

.paper-card {
  position: relative;
  background: linear-gradient(145deg, var(--paper-2), color-mix(in srgb, var(--paper) 70%, var(--paper-2)));
  border: 1px solid var(--line);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.paper-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--line);
  pointer-events: none;
  opacity: 0.45;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 18px; font-weight: 600; letter-spacing: 0.08em; }
.card-mark { font-family: var(--font-sans); font-size: 8px; letter-spacing: 0.3em; color: var(--faint); }

.stat-pill { display: flex; flex-direction: column; gap: 2px; padding-left: 18px; border-left: 1px solid var(--line); }
.stat-pill strong { font-size: 19px; font-weight: 500; letter-spacing: 0.03em; }
.stat-pill span { font-family: var(--font-sans); font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }

/* 头像 */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cinnabar), #7d2a21);
  color: #fbf5e7;
  font-family: var(--font-kai);
  box-shadow: 0 2px 8px -3px rgba(120, 40, 30, 0.5);
}
.avatar span { transform: translateY(-1px); }
.avatar-xs { width: 26px; height: 26px; font-size: 13px; }
.avatar-sm { width: 34px; height: 34px; font-size: 16px; }
.avatar-md { width: 42px; height: 42px; font-size: 19px; }
.avatar-lg { width: 58px; height: 58px; font-size: 26px; }

/* 书封 */
.book-cover {
  position: relative;
  width: 108px;
  aspect-ratio: 3 / 4;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--paper-3);
  box-shadow: 0 8px 20px -10px rgba(40, 34, 25, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.book-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.08));
}
.book-cover img { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; }
.cover-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  color: rgba(250, 244, 231, 0.94);
  text-align: center;
}
.cover-title {
  writing-mode: vertical-rl;
  max-height: 66%;
  overflow: hidden;
  font-family: var(--font-kai);
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.cover-author {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  font-family: var(--font-kai);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  opacity: 0.72;
}
.cover-seal {
  position: absolute;
  top: 9px;
  right: 8px;
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(168, 59, 46, 0.9);
  border: 1px solid rgba(255, 245, 230, 0.5);
  color: #fbf4e6;
  font-family: var(--font-kai);
  font-size: 9px;
  line-height: 1;
}
.tone-1 .cover-art { background: linear-gradient(150deg, #485b50, #2d3b33); }
.tone-2 .cover-art { background: linear-gradient(150deg, #8a4a3a, #5f2f26); }
.tone-3 .cover-art { background: linear-gradient(150deg, #536172, #333d49); }
.tone-4 .cover-art { background: linear-gradient(150deg, #8c7752, #5f5136); }
.tone-5 .cover-art { background: linear-gradient(150deg, #635a74, #403a4c); }
.tone-6 .cover-art { background: linear-gradient(150deg, #4f6b62, #33473f); }
.book-cover.is-broken img { display: none; }
.book-cover-shadow { position: absolute; left: 12%; right: 12%; bottom: -14px; height: 24px; background: rgba(30, 25, 18, 0.35); filter: blur(14px); z-index: -1; }

/* 来源徽章 */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.18);
}
.source-badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.source-badge.source-qimao { color: var(--cinnabar); border-color: rgba(168, 59, 46, 0.22); background: var(--cinnabar-soft); }
.source-badge.source-biquge { color: var(--jade); border-color: rgba(82, 109, 91, 0.24); background: var(--jade-soft); }

/* 进度条 */
.reading-progress { width: 100%; }
.progress-track { height: 2px; background: var(--line-strong); overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--cinnabar); transition: width 0.45s var(--ease); }
.progress-label { margin-top: 7px; font-family: var(--font-sans); font-size: 10px; color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 空状态 / 载入 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 62px 24px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.12);
}
.empty-symbol {
  width: 74px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--cinnabar);
  margin-bottom: 18px;
}
.empty-state h3 { font-size: 19px; font-weight: 600; letter-spacing: 0.06em; }
.empty-state p { margin-top: 7px; color: var(--muted); font-size: 13px; max-width: 420px; }
.empty-action { margin-top: 20px; display: flex; gap: 8px; }

.loading-view { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 280px; color: var(--muted); font-size: 13px; letter-spacing: 0.08em; }
.ink-loader { display: flex; align-items: center; gap: 7px; }
.ink-loader span { width: 7px; height: 7px; border-radius: 50%; background: var(--cinnabar); opacity: 0.25; animation: ink-pulse 1.2s var(--ease) infinite; }
.ink-loader span:nth-child(2) { animation-delay: 0.16s; }
.ink-loader span:nth-child(3) { animation-delay: 0.32s; }
@keyframes ink-pulse { 0%, 100% { opacity: 0.18; transform: scale(0.8); } 45% { opacity: 0.95; transform: scale(1); } }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.skeleton-card { border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--paper-2); }
.skeleton-cover { width: 100%; aspect-ratio: 3 / 1.25; background: var(--paper-3); }
.skeleton-line { height: 11px; background: var(--paper-3); }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w50 { width: 50%; }
.shimmer { position: relative; overflow: hidden; }
.shimmer::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent); animation: shimmer 1.5s infinite; }
html[data-ui-theme="dark"] .shimmer::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* 书卡 / 书行 */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 15px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.book-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.book-card-link { display: flex; gap: 14px; min-width: 0; }
.book-card-info { min-width: 0; padding-top: 2px; }
.book-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.book-card-top h3 { font-size: 16.5px; font-weight: 600; letter-spacing: 0.03em; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-author { margin-top: 5px; font-size: 11px; color: var(--muted); }
.book-author span { color: var(--faint); }
.book-intro { margin-top: 9px; font-size: 11.5px; line-height: 1.75; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .reading-progress { margin-top: 10px; }
.book-card-actions, .shelf-actions { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.book-card-actions > * { flex: 0 0 auto; }
.book-card.is-compact .book-cover { width: 88px; }
.book-card.is-compact .book-card-top h3 { font-size: 15.5px; }

.book-row { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--line); background: var(--paper-2); }
.book-row-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.book-row .book-cover { width: 60px; }
.book-row-info { min-width: 0; flex: 1; }
.book-row-title { display: flex; align-items: center; gap: 8px; }
.book-row-title h3 { font-size: 15px; font-weight: 600; }
.book-row-info > p { margin-top: 4px; font-size: 11px; color: var(--muted); }
.book-row-actions { display: flex; align-items: center; gap: 4px; }

/* Toast */
.toast-root { position: fixed; z-index: 1200; bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(520px, 88vw);
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  border-radius: 2px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast-success svg { color: #9fc3a8; }
.toast-error svg { color: #e6a096; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 22, 17, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}
.modal-overlay.is-visible { opacity: 1; }
.modal-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--paper);
  padding: 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-strong);
  transform: translateY(10px);
  transition: transform 0.22s var(--ease);
}
.modal-overlay.is-visible .modal-card { transform: none; }
.modal-card h2 { font-size: 20px; font-weight: 600; letter-spacing: 0.06em; }
.confirm-message { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.modal-corner { position: absolute; width: 12px; height: 12px; border-color: var(--cinnabar); opacity: 0.45; }
.modal-corner.tl { top: 7px; left: 7px; border-top: 1px solid; border-left: 1px solid; }
.modal-corner.tr { top: 7px; right: 7px; border-top: 1px solid; border-right: 1px solid; }
.modal-corner.bl { bottom: 7px; left: 7px; border-bottom: 1px solid; border-left: 1px solid; }
.modal-corner.br { bottom: 7px; right: 7px; border-bottom: 1px solid; border-right: 1px solid; }

/* 登录门槛 */
.gate-wrap { display: flex; justify-content: center; padding: 20px 0 40px; }
.gate-card { width: min(520px, 100%); text-align: center; padding: 46px 36px; border: 1px solid var(--line); background: var(--paper-2); position: relative; }
.gate-card::before { content: ""; position: absolute; inset: 7px; border: 1px solid var(--line); pointer-events: none; opacity: 0.6; }
.gate-seal { display: flex; justify-content: center; margin-bottom: 16px; }
.gate-card h2 { font-size: 23px; font-weight: 600; letter-spacing: 0.08em; }
.gate-card > p { margin-top: 9px; color: var(--muted); font-size: 13px; }
.gate-actions { display: flex; justify-content: center; gap: 8px; margin-top: 22px; }
.gate-note { font-size: 10px !important; color: var(--faint) !important; margin-top: 20px !important; }

.boot-screen { min-height: 64vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; color: var(--muted); font-size: 12px; letter-spacing: 0.12em; }
.boot-screen .logo-mark { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.7; transform: scale(0.98); } 50% { opacity: 1; transform: scale(1.02); } }

.fatal-card { max-width: 520px; margin: 12vh auto; text-align: center; padding: 42px; border: 1px solid var(--line); background: var(--paper-2); }
.fatal-card .logo-mark { margin: 0 auto 18px; }
.fatal-card h1 { font-size: 24px; letter-spacing: 0.08em; }
.fatal-card p { margin-top: 10px; color: var(--muted); }
.fatal-hint { font-size: 12px; color: var(--faint) !important; }
.fatal-card .btn { margin-top: 22px; }

/* --------------------------------- 首页 --------------------------------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: 30px;
  min-height: 470px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}
.hero-copy { position: relative; z-index: 2; padding: 20px 0 0; }
.hero-kicker { display: flex; align-items: center; gap: 10px; color: var(--muted); font-family: var(--font-kai); letter-spacing: 0.14em; font-size: 12px; margin-bottom: 18px; }
.kicker-rule { width: 30px; height: 1px; background: var(--cinnabar); }
.hero-copy h1 {
  font-size: clamp(46px, 5.3vw, 74px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.hero-copy h1 em { font-style: normal; color: var(--cinnabar); position: relative; }
.hero-copy h1 em::after { content: ""; position: absolute; left: 2px; right: -4px; bottom: 4px; height: 7px; background: var(--cinnabar-soft); z-index: -1; }
.hero-desc { margin-top: 20px; color: var(--ink-soft); font-size: 14px; line-height: 2; letter-spacing: 0.04em; }
.hero-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 600px;
  margin-top: 28px;
  padding: 6px 6px 6px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.hero-search:focus-within { border-color: var(--ink-soft); box-shadow: 0 10px 30px -18px rgba(40, 35, 25, 0.5); }
.hero-search-icon { color: var(--muted); display: flex; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; letter-spacing: 0.03em; height: 38px; }
.hero-search input::placeholder { color: var(--faint); }
.hero-search .btn { height: 38px; flex: 0 0 auto; }

.hot-words { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 16px; font-size: 11px; color: var(--faint); }
.hot-words > span { letter-spacing: 0.08em; }
.hot-words a { color: var(--ink-soft); font-family: var(--font-kai); border-bottom: 1px solid transparent; transition: 0.2s var(--ease); }
.hot-words a:hover { color: var(--cinnabar); border-color: rgba(168, 59, 46, 0.35); }
.recent-words { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 11px; color: var(--faint); }
.recent-words a { color: var(--muted); }
.recent-words a:hover { color: var(--cinnabar); }

.hero-art { position: relative; align-self: stretch; display: flex; align-items: center; justify-content: center; min-height: 380px; }
.hero-landscape { width: 100%; max-width: 540px; filter: drop-shadow(0 20px 40px rgba(40, 35, 25, 0.08)); animation: float-art 9s ease-in-out infinite; }
@keyframes float-art { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.hero-art-note { position: absolute; right: 4%; bottom: 14%; display: flex; align-items: center; gap: 9px; color: var(--muted); }
.hero-art-note span { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--cinnabar); color: var(--cinnabar); font-family: var(--font-kai); font-size: 14px; }
.hero-art-note p { font-family: var(--font-kai); font-size: 10.5px; line-height: 1.7; letter-spacing: 0.08em; }

.hero-stats { grid-column: 1 / -1; display: flex; gap: 0; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.hero-stats .stat-pill { min-width: 150px; padding-right: 30px; margin-right: 30px; }
.hero-stats .stat-pill:last-child { border: 0; }

.welcome-note {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
  padding: 20px 24px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.welcome-seal { flex: 0 0 auto; opacity: 0.9; }
.welcome-note h3 { font-size: 16px; font-weight: 600; letter-spacing: 0.06em; }
.welcome-note p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.welcome-actions { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }

.home-section { margin-top: 52px; }
.continue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.continue-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); background: var(--paper-2); transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease); }
.continue-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.continue-cover .book-cover { width: 66px; }
.continue-info { flex: 1; min-width: 0; }
.continue-title { font-size: 15.5px; font-weight: 600; letter-spacing: 0.03em; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-title:hover { color: var(--cinnabar); }
.continue-info > p { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.continue-chapter { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft) !important; }
.continue-info .reading-progress { margin-top: 9px; }
.continue-go { width: 34px; height: 34px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--cinnabar); transition: 0.2s var(--ease); }
.continue-go:hover { background: var(--cinnabar); color: #fff; border-color: var(--cinnabar); }

.source-ribbon { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.source-ribbon-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); background: var(--paper-2); transition: 0.2s var(--ease); }
.source-ribbon-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.source-ribbon-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--cinnabar); background: var(--paper); }
.source-ribbon-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.source-ribbon-text strong { font-size: 13.5px; font-weight: 600; }
.source-ribbon-text em { font-style: normal; font-family: var(--font-sans); font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.status-dot.is-ok { background: var(--jade); box-shadow: 0 0 0 3px var(--jade-soft); }
.status-dot.is-idle { background: var(--gold); }
.status-dot.is-off { background: var(--faint); opacity: 0.5; }

.home-quote { margin: 68px 0 10px; padding: 34px 20px; text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; }
.home-quote .quote-mark { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-family: Georgia, serif; font-size: 42px; line-height: 1; color: var(--cinnabar); opacity: 0.2; }
.home-quote p { font-family: var(--font-kai); font-size: 18px; letter-spacing: 0.16em; color: var(--ink-soft); }
.home-quote em { display: block; margin-top: 7px; font-style: normal; font-size: 10.5px; letter-spacing: 0.1em; color: var(--faint); }

/* --------------------------------- 搜索 --------------------------------- */

.search-stage { max-width: 820px; margin: 6px auto 0; }
.search-stage .hero-search { max-width: none; }
.search-stage .source-filter { margin-top: 18px; }
.source-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.filter-chip { display: inline-flex; align-items: center; height: 27px; padding: 0 11px; border: 1px solid var(--line); border-radius: 14px; font-size: 11px; color: var(--muted); transition: 0.2s var(--ease); }
.filter-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.search-suggest { margin-top: 44px; }
.search-suggest h3, .recent-head h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 14px; }
.word-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.word-cloud a { padding: 7px 15px; border: 1px solid var(--line); font-family: var(--font-kai); font-size: 14px; color: var(--ink-soft); background: var(--paper-2); transition: 0.2s var(--ease); }
.word-cloud a:hover { border-color: var(--cinnabar); color: var(--cinnabar); transform: translateY(-1px); }
.recent-searches { margin-top: 32px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; }
.recent-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.recent-list a { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.recent-list a:hover { color: var(--cinnabar); }
.search-source-note { margin-top: 42px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }
.search-source-note p { display: flex; align-items: center; gap: 6px; }

.search-toolbar .hero-search { max-width: 680px; margin-top: 0; }
.search-toolbar .source-filter { margin: 13px 0 0; }
.search-runbar { display: flex; align-items: center; gap: 16px; padding: 10px 0 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search-run-summary { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; flex: 0 0 auto; }
.run-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.run-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 12px; font-family: var(--font-sans); font-size: 9.5px; color: var(--muted); }
.run-chip i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.run-chip em { font-style: normal; color: var(--faint); }
.run-chip.is-ok i { background: var(--jade); }
.run-chip.is-fail { border-color: rgba(168, 59, 46, 0.25); color: var(--cinnabar); }
.run-chip.is-fail i { background: var(--cinnabar); }
.run-warning { display: flex; align-items: flex-start; gap: 6px; margin: -8px 0 18px; color: var(--cinnabar); font-size: 11px; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; }
.result-card { display: flex; gap: 17px; padding: 16px; border: 1px solid var(--line); background: var(--paper-2); transition: 0.25s var(--ease); }
.result-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.result-cover .book-cover { width: 118px; }
.result-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.result-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.result-title-row h3 { font-size: 18px; font-weight: 600; letter-spacing: 0.03em; line-height: 1.4; }
.result-title-row h3 a:hover { color: var(--cinnabar); }
.result-count { flex: 0 0 auto; font-family: var(--font-sans); font-size: 9px; color: var(--jade); background: var(--jade-soft); border: 1px solid rgba(82, 109, 91, 0.2); padding: 2px 6px; border-radius: 2px; margin-top: 4px; }
.result-author { margin-top: 4px; font-size: 11px; color: var(--muted); }
.result-author span { color: var(--faint); }
.result-intro { margin-top: 9px; font-size: 11.5px; line-height: 1.75; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-latest { margin-top: 7px; font-size: 10px; color: var(--faint); display: flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; }
.result-sources { display: flex; flex-wrap: wrap; gap: 4px; }

/* --------------------------------- 详情 --------------------------------- */

.book-page { max-width: 1240px; margin: 0 auto; }
.book-back-row { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; color: var(--muted); }
.book-back-rule { width: 28px; height: 1px; background: var(--line-strong); }
.book-back-row p { display: flex; align-items: center; }

.book-hero { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 42px; padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.book-hero-cover { position: relative; padding: 0 6px; }
.book-hero-cover .book-cover { width: 100%; box-shadow: 0 22px 44px -20px rgba(35, 29, 20, 0.7); }
.book-kicker { font-family: var(--font-sans); font-size: 9.5px; letter-spacing: 0.2em; color: var(--cinnabar); margin-bottom: 8px; }
.book-hero-body h1 { font-size: clamp(32px, 4vw, 48px); font-weight: 600; letter-spacing: 0.04em; line-height: 1.2; }
.book-author { margin-top: 8px; font-family: var(--font-kai); font-size: 15px; color: var(--ink-soft); }
.book-author span { color: var(--faint); font-size: 11px; }
.book-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.book-meta span { font-family: var(--font-sans); font-size: 10px; color: var(--muted); border: 1px solid var(--line); padding: 3px 8px; }
.book-latest { margin-top: 12px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.book-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.book-progress-card { display: flex; align-items: flex-end; gap: 18px; margin-top: 20px; max-width: 460px; }
.book-progress-card .reading-progress { flex: 1; }
.book-progress-time { flex: 0 0 auto; font-size: 9.5px; color: var(--faint); white-space: nowrap; }

.book-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 22px; margin-top: 28px; align-items: start; }
.book-main { display: flex; flex-direction: column; gap: 20px; }
.intro-card .book-intro { font-size: 13px; line-height: 2; color: var(--ink-soft); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.intro-card .book-intro.is-expanded { display: block; -webkit-line-clamp: unset; }
.intro-card .text-button { margin-top: 12px; }
.chapter-total { font-family: var(--font-sans); font-size: 10px; color: var(--faint); font-weight: 400; margin-left: 6px; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 14px; }
.chapter-chip { display: flex; align-items: center; gap: 4px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-soft); overflow: hidden; transition: 0.15s var(--ease); }
.chapter-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-chip:hover { color: var(--cinnabar); background: var(--cinnabar-soft); }
.chapter-chip.is-current { color: var(--cinnabar); }
.chapter-chip.is-current span::before { content: "· "; }
.chapter-chip.is-vip { color: var(--faint); }
.chapter-more { display: flex; justify-content: center; margin-top: 18px; }
.book-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 18px); }
.side-card { padding: 22px; }
.side-card-kicker { font-family: var(--font-sans); font-size: 8px; letter-spacing: 0.24em; color: var(--faint); }
.side-card h3 { font-size: 16px; font-weight: 600; margin: 6px 0 13px; letter-spacing: 0.04em; }
.side-card .reading-progress { margin-bottom: 14px; }
.side-read-btn { width: 100%; }
.side-dl { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.side-dl > div { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.side-dl dt { color: var(--muted); }
.side-dl dd { color: var(--ink-soft); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-quote { padding: 18px 10px; text-align: center; font-family: var(--font-kai); font-size: 11.5px; line-height: 1.9; color: var(--faint); letter-spacing: 0.06em; }
.book-loading { min-height: 55vh; display: flex; align-items: center; justify-content: center; }

/* --------------------------------- 书架 --------------------------------- */

.shelf-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.shelf-actions .shelf-remove { margin-left: auto; }
.shelf-foot-note { display: flex; align-items: center; gap: 5px; margin-top: 26px; color: var(--faint); font-size: 10.5px; }

/* --------------------------------- 足迹 --------------------------------- */

.history-group { margin-bottom: 30px; }
.history-day { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.history-day span { font-family: var(--font-kai); font-size: 12px; color: var(--muted); letter-spacing: 0.12em; flex: 0 0 auto; }
.history-day i { flex: 1; height: 1px; background: var(--line); }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--line); background: var(--paper-2); transition: border-color 0.2s var(--ease); }
.history-item:hover { border-color: var(--line-strong); }
.history-cover .book-cover { width: 58px; }
.history-body { flex: 1; min-width: 0; }
.history-title { display: flex; align-items: baseline; gap: 10px; }
.history-title a { font-size: 15px; font-weight: 600; letter-spacing: 0.03em; }
.history-title a:hover { color: var(--cinnabar); }
.history-time { font-size: 9.5px; color: var(--faint); }
.history-body > p { margin-top: 3px; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-body .reading-progress { margin-top: 8px; max-width: 420px; }
.history-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

/* --------------------------------- 书签 --------------------------------- */

.bookmark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.bookmark-card { position: relative; display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); background: var(--paper-2); transition: 0.25s var(--ease); }
.bookmark-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.bookmark-card::before { content: ""; position: absolute; top: 0; left: 24px; width: 1px; height: 18px; background: var(--cinnabar); }
.bookmark-quote { display: flex; gap: 10px; color: var(--ink-soft); }
.bookmark-quote svg { color: var(--cinnabar); opacity: 0.6; flex: 0 0 auto; margin-top: 2px; }
.bookmark-quote p { font-family: var(--font-kai); font-size: 14.5px; line-height: 1.95; letter-spacing: 0.03em; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bookmark-note { margin-top: 12px; padding: 8px 10px; background: var(--cinnabar-soft); font-size: 11px; color: var(--ink-soft); }
.bookmark-book { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 18px; }
.bookmark-thumb .book-cover { width: 40px; }
.bookmark-title { font-size: 12.5px; font-weight: 600; }
.bookmark-title:hover { color: var(--cinnabar); }
.bookmark-book p { font-size: 10px; color: var(--muted); margin-top: 2px; }
.bookmark-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.bookmark-foot > span { font-size: 9.5px; color: var(--faint); }
.bookmark-foot > div { display: flex; align-items: center; gap: 2px; }

/* -------------------------------- 源体检 -------------------------------- */

.clinic-summary {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 24px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.clinic-stat { min-width: 112px; padding-right: 30px; margin-right: 30px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.clinic-stat strong { font-family: var(--font-sans); font-size: 27px; font-weight: 500; line-height: 1.2; letter-spacing: -0.02em; }
.clinic-stat span { font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; }
.clinic-stat.is-good strong { color: var(--jade); }
.clinic-stat.is-bad strong { color: var(--cinnabar); }
.clinic-note { margin-left: auto; align-self: center; display: flex; align-items: center; gap: 6px; max-width: 300px; color: var(--faint); font-size: 10.5px; line-height: 1.7; }
.clinic-login-note { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding: 13px 16px; color: var(--muted); font-size: 11.5px; border: 1px dashed var(--line-strong); }
.clinic-login-note .text-link { margin-left: 2px; }

.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(390px, 1fr)); gap: 16px; }
.source-card {
  position: relative;
  padding: 20px 22px 18px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--faint);
  background: var(--paper-2);
  transition: opacity 0.25s var(--ease), border-color 0.25s var(--ease);
}
.source-card.status-ok { border-top-color: var(--jade); }
.source-card.status-down { border-top-color: var(--cinnabar); }
.source-card.status-idle { border-top-color: var(--gold); }
.source-card.is-disabled { opacity: 0.58; }
.source-card-head { display: flex; align-items: flex-start; gap: 12px; }
.source-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--cinnabar);
}
.source-avatar.source-biquge { color: var(--jade); }
.source-head-text { flex: 1; min-width: 0; }
.source-name-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.source-name-row h2 { font-size: 16.5px; font-weight: 600; letter-spacing: 0.03em; }
.source-url { margin-top: 3px; font-family: var(--font-sans); font-size: 9.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-pill { display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 7px; border-radius: 10px; font-size: 9.5px; letter-spacing: 0.04em; background: var(--paper-3); color: var(--muted); white-space: nowrap; }
.health-pill i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.health-pill.health-ok { background: var(--jade-soft); color: var(--jade); }
.health-pill.health-down { background: var(--cinnabar-soft); color: var(--cinnabar); }
.health-pill.health-idle { background: rgba(169, 133, 78, 0.12); color: var(--gold); }

.switch { width: 38px; height: 21px; flex: 0 0 auto; margin-top: 4px; padding: 2px; border-radius: 12px; background: var(--paper-4); transition: background 0.22s var(--ease); }
.switch span { display: block; width: 17px; height: 17px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.22s var(--ease); }
.switch.is-on { background: var(--jade); }
.switch.is-on span { transform: translateX(17px); }

.source-health-line { display: flex; margin: 15px 0 11px; color: var(--ink-soft); font-size: 11px; }
.source-health-line span { display: flex; align-items: flex-start; gap: 5px; line-height: 1.6; }
.source-health-line svg { margin-top: 2px; color: var(--faint); flex: 0 0 auto; }
.source-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.source-facts > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.source-facts dt { font-size: 9px; color: var(--faint); letter-spacing: 0.04em; }
.source-facts dd { font-family: var(--font-sans); font-size: 10.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-cooldown { display: flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 10px; color: var(--gold); }
.source-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; }
.source-card-foot > div { display: flex; align-items: center; gap: 3px; }
.source-note { font-size: 10px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------- 设置 --------------------------------- */

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-grid .paper-card { padding: 26px; }
.account-row { display: flex; align-items: center; gap: 14px; }
.account-row > div { flex: 1; min-width: 0; }
.account-row h3 { font-size: 17px; font-weight: 600; letter-spacing: 0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row p { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.settings-stats { display: flex; gap: 0; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.settings-stats > div { flex: 1; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-left: 16px; }
.settings-stats > div:first-child { padding-left: 0; }
.settings-stats > div:last-child { border: 0; }
.settings-stats strong { font-family: var(--font-sans); font-size: 21px; font-weight: 500; }
.settings-stats span { font-size: 10px; color: var(--muted); }

.settings-prefs .pref-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 48px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.settings-prefs .pref-row:last-of-type { border-bottom: 0; }
.pref-row > label { flex: 0 0 84px; font-size: 12px; color: var(--ink-soft); letter-spacing: 0.04em; }
.pref-row > label em { font-style: normal; font-family: var(--font-sans); font-size: 9.5px; color: var(--faint); margin-left: 2px; }
.pref-chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.pref-chip { display: inline-flex; align-items: center; gap: 5px; height: 27px; padding: 0 9px; border: 1px solid var(--line); border-radius: 2px; font-size: 10.5px; color: var(--muted); transition: 0.2s var(--ease); }
.pref-chip i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.12); }
.pref-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.pref-chip.is-active { border-color: var(--ink); color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink); }
.pref-range { flex: 1; max-width: 190px; height: 3px; accent-color: var(--cinnabar); cursor: pointer; }
.pref-hint { display: flex; align-items: center; gap: 5px; margin-top: 15px; color: var(--faint); font-size: 10px; }
.pref-hint svg { flex: 0 0 auto; }

.stack-form { display: flex; flex-direction: column; gap: 13px; }
.stack-form label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.stack-form input, .auth-form input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  outline: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.stack-form input:focus, .auth-form input:focus { border-color: var(--ink-soft); box-shadow: 0 0 0 2px var(--cinnabar-soft); }
.stack-form input::placeholder, .auth-form input::placeholder { color: var(--faint); }
.stack-form .btn { margin-top: 4px; align-self: flex-start; }
.settings-about > p { font-size: 12px; color: var(--ink-soft); line-height: 1.9; }
.settings-about code { padding: 1px 5px; background: var(--paper-3); border-radius: 2px; color: var(--cinnabar); }
.about-list { display: flex; flex-direction: column; gap: 7px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.about-list > div { display: flex; justify-content: space-between; gap: 14px; font-size: 11px; }
.about-list dt { color: var(--muted); }
.about-list dd { color: var(--ink-soft); font-family: var(--font-sans); font-size: 10.5px; }
.about-quote { margin-top: 18px !important; padding-top: 15px; border-top: 1px solid var(--line); font-family: var(--font-kai); color: var(--faint) !important; font-size: 11.5px !important; text-align: center; letter-spacing: 0.08em; }

/* --------------------------------- 登录 --------------------------------- */

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  min-height: min(680px, calc(100vh - 190px));
  border: 1px solid var(--line);
  background: var(--paper-2);
  overflow: hidden;
}
.auth-art {
  position: relative;
  display: flex;
  align-items: center;
  padding: 52px 56px;
  overflow: hidden;
  color: #ece4d3;
  background:
    radial-gradient(ellipse at 30% 15%, rgba(189, 90, 73, 0.22), transparent 55%),
    linear-gradient(160deg, #2d3a32, #1c241f 65%, #151b17);
}
.auth-art::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
.auth-art-inner { position: relative; z-index: 2; max-width: 390px; }
.auth-art .logo-mark { color: #d98b7b; margin-bottom: 24px; }
.auth-art-kicker { font-family: var(--font-sans); font-size: 9px; letter-spacing: 0.38em; color: rgba(236, 228, 211, 0.5); }
.auth-art h1 { margin-top: 12px; font-family: var(--font-kai); font-size: clamp(38px, 4.2vw, 56px); font-weight: 400; line-height: 1.35; letter-spacing: 0.1em; color: #f1ead9; }
.auth-art-desc { margin-top: 20px; font-size: 12.5px; line-height: 2; color: rgba(236, 228, 211, 0.68); letter-spacing: 0.04em; }
.auth-quote { margin-top: 48px; padding-top: 20px; border-top: 1px solid rgba(236, 228, 211, 0.15); font-family: var(--font-kai); font-size: 13px; line-height: 1.9; color: rgba(236, 228, 211, 0.66); letter-spacing: 0.05em; }
.auth-quote span { display: block; margin-top: 6px; font-size: 10px; color: rgba(236, 228, 211, 0.38); text-align: right; }
.auth-art-mountains { position: absolute; left: -8%; right: -8%; bottom: -6%; height: 48%; z-index: 1; opacity: 0.55; }
.auth-art-mountains::before, .auth-art-mountains::after { content: ""; position: absolute; inset: 0; }
.auth-art-mountains::before {
  background: linear-gradient(180deg, transparent, rgba(88, 112, 96, 0.55));
  clip-path: polygon(0 100%, 0 78%, 9% 62%, 19% 74%, 31% 42%, 42% 66%, 54% 30%, 66% 60%, 77% 45%, 88% 68%, 100% 56%, 100% 100%);
}
.auth-art-mountains::after {
  background: linear-gradient(180deg, transparent, rgba(20, 28, 23, 0.85));
  clip-path: polygon(0 100%, 0 88%, 12% 70%, 25% 84%, 38% 60%, 52% 82%, 65% 66%, 79% 86%, 91% 72%, 100% 84%, 100% 100%);
}
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(30px, 5vw, 76px); background: var(--paper); }
.auth-card-head .auth-kicker { font-family: var(--font-sans); font-size: 8.5px; letter-spacing: 0.32em; color: var(--cinnabar); }
.auth-card-head h2 { margin-top: 9px; font-size: clamp(25px, 2.6vw, 32px); font-weight: 600; letter-spacing: 0.06em; }
.auth-card-head > p:last-child { margin-top: 7px; color: var(--muted); font-size: 12px; }
.auth-tabs { display: flex; gap: 24px; margin-top: 30px; border-bottom: 1px solid var(--line); }
.auth-tab { position: relative; padding: 0 0 10px; font-size: 13px; letter-spacing: 0.08em; color: var(--muted); }
.auth-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: transparent; transition: background 0.2s var(--ease); }
.auth-tab.is-active { color: var(--ink); }
.auth-tab.is-active::after { background: var(--cinnabar); }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); letter-spacing: 0.05em; }
.auth-form label em { font-style: normal; color: var(--faint); font-size: 9px; margin-left: 3px; }
.auth-form input { height: 44px; background: var(--paper-2); font-size: 14px; }
.password-field { position: relative; }
.password-field input { padding-right: 42px; }
.password-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--faint); border-radius: 2px; }
.password-eye:hover { color: var(--ink); background: var(--paper-3); }
.auth-submit { height: 45px; margin-top: 6px; }
.auth-switch { margin-top: 18px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.auth-note { display: flex; align-items: center; gap: 5px; margin-top: 26px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 9.5px; color: var(--faint); }

/* --------------------------------- 阅读器 -------------------------------- */

.reader {
  --reader-bg: #f7f1e4;
  --reader-text: #2b2a23;
  --reader-soft: #8b8172;
  --reader-line: rgba(58, 54, 43, 0.13);
  --reader-bar: rgba(247, 241, 228, 0.9);
  --reader-panel: #f2ebdc;
  --reader-accent: #a83b2e;
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--reader-bg);
  color: var(--reader-text);
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.reader[data-reader-theme="sepia"] {
  --reader-bg: #efe0c3;
  --reader-text: #3c3223;
  --reader-soft: #85735a;
  --reader-line: rgba(82, 66, 45, 0.16);
  --reader-bar: rgba(239, 224, 195, 0.9);
  --reader-panel: #e9d8b8;
  --reader-accent: #96502f;
}
.reader[data-reader-theme="green"] {
  --reader-bg: #dfe6d3;
  --reader-text: #2c352b;
  --reader-soft: #75816d;
  --reader-line: rgba(55, 72, 52, 0.16);
  --reader-bar: rgba(223, 230, 211, 0.9);
  --reader-panel: #d3ddc5;
  --reader-accent: #8f4433;
}
.reader[data-reader-theme="night"] {
  --reader-bg: #1b211d;
  --reader-text: #c9c2b3;
  --reader-soft: #8b8475;
  --reader-line: rgba(235, 226, 207, 0.12);
  --reader-bar: rgba(23, 29, 25, 0.92);
  --reader-panel: #222a24;
  --reader-accent: #c0705e;
}
.reader[data-reader-width="narrow"] .reader-article { max-width: 600px; }
.reader[data-reader-width="normal"] .reader-article { max-width: 710px; }
.reader[data-reader-width="wide"] .reader-article { max-width: 840px; }
.reader[data-reader-font="kai"] .reader-content, .reader[data-reader-font="kai"] .reader-chapter-title { font-family: var(--font-kai); }
.reader[data-reader-font="sans"] .reader-content, .reader[data-reader-font="sans"] .reader-chapter-title { font-family: var(--font-sans); }

.reader-top-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 6; }
.reader-top-progress span { display: block; width: 0; height: 100%; background: var(--reader-accent); transition: width 0.2s linear; }

.reader-bar {
  position: relative;
  z-index: 5;
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--reader-line);
  background: var(--reader-bar);
  backdrop-filter: blur(12px);
}
.reader .icon-btn { color: var(--reader-soft); }
.reader .icon-btn:hover { color: var(--reader-text); background: var(--reader-line); }
.reader-back { margin-right: 2px; }
.reader-bar-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.reader-bar-title strong { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-bar-title span { font-size: 10px; color: var(--reader-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.reader-bar-actions { display: flex; align-items: center; gap: 1px; }

.reader-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; }
.reader-scroll::-webkit-scrollbar-thumb { background: var(--reader-line); border-color: var(--reader-bg); }
.reader-article { width: 100%; margin: 0 auto; padding: 46px 30px 90px; }
.reader-overline { font-family: var(--font-sans); font-size: 9px; letter-spacing: 0.26em; color: var(--reader-soft); text-transform: uppercase; margin-bottom: 12px; }
.reader-chapter-title { font-size: clamp(23px, 3vw, 31px); font-weight: 600; line-height: 1.45; letter-spacing: 0.04em; padding-bottom: 14px; border-bottom: 1px solid var(--reader-line); }
.reader-chapter-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-family: var(--font-sans); font-size: 9.5px; color: var(--reader-soft); }
.reader-chapter-meta span { display: inline-flex; align-items: center; gap: 3px; }
.reader-content { margin-top: 30px; font-size: var(--reader-font-size, 18px); line-height: var(--reader-line-height, 1.9); letter-spacing: 0.02em; text-align: justify; }
.reader-content p { margin: 0 0 0.82em; text-indent: 2em; word-break: break-word; }
.reader-content p:empty { display: none; }
.reader-empty { text-indent: 0 !important; color: var(--reader-soft); text-align: center; padding: 50px 0; }
.reader-inline-loading { min-height: 42vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--reader-soft); font-size: 11px; letter-spacing: 0.1em; }
.reader-inline-loading .ink-loader span { background: var(--reader-accent); }

.reader-end { margin-top: 46px; }
.end-mark { display: flex; align-items: center; gap: 14px; color: var(--reader-soft); font-family: var(--font-kai); font-size: 11px; letter-spacing: 0.2em; }
.end-mark span { flex: 0 0 auto; }
.end-mark::before, .end-mark::after { content: ""; flex: 1; height: 1px; background: var(--reader-line); }
.end-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.reader .btn-ghost { color: var(--reader-text); border-color: var(--reader-line); }
.reader .btn-ghost:hover { background: var(--reader-line); color: var(--reader-text); }
.end-last { font-size: 11px; color: var(--reader-soft); }

.reader-footer {
  flex: 0 0 62px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  border-top: 1px solid var(--reader-line);
  background: var(--reader-bar);
  backdrop-filter: blur(12px);
}
.reader-nav-btn { display: flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px; border: 1px solid var(--reader-line); border-radius: 2px; font-size: 11px; letter-spacing: 0.03em; color: var(--reader-text); transition: 0.2s var(--ease); }
.reader-nav-btn:hover:not(:disabled) { border-color: var(--reader-soft); }
.reader-nav-btn:disabled { opacity: 0.32; cursor: default; }
.reader-location { flex: 1; min-width: 0; }
.reader-location-track { height: 2px; background: var(--reader-line); }
.reader-location-track span { display: block; height: 100%; width: 0; background: var(--reader-accent); transition: width 0.2s linear; }
.reader-location p { display: flex; justify-content: space-between; gap: 14px; margin-top: 6px; font-family: var(--font-sans); font-size: 9px; color: var(--reader-soft); }
.reader-location p span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reader-scrim { position: absolute; inset: 0; z-index: 8; background: rgba(20, 18, 13, 0.32); opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease); }
.reader-scrim.is-open { opacity: 1; pointer-events: auto; }
.reader-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  width: min(400px, 94vw);
  display: flex;
  flex-direction: column;
  background: var(--reader-panel);
  border-left: 1px solid var(--reader-line);
  box-shadow: -20px 0 60px -30px rgba(0, 0, 0, 0.6);
  transform: translateX(102%);
  transition: transform 0.28s var(--ease);
}
.reader-panel.is-open { transform: none; }
.reader-panel-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px 17px; border-bottom: 1px solid var(--reader-line); }
.reader-panel-head p { font-family: var(--font-sans); font-size: 8px; letter-spacing: 0.3em; color: var(--reader-soft); }
.reader-panel-head h2 { margin-top: 3px; font-size: 19px; font-weight: 600; letter-spacing: 0.08em; }
.reader-panel-head .icon-btn { width: 32px; height: 32px; }

.reader-settings-panel { overflow-y: auto; }
.settings-section { padding: 18px 22px; border-bottom: 1px solid var(--reader-line); }
.settings-section h3 { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; color: var(--reader-soft); margin-bottom: 12px; }
.settings-section h3 em { font-style: normal; font-family: var(--font-sans); font-size: 10px; color: var(--reader-text); }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.theme-chip { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 1px solid var(--reader-line); border-radius: 2px; font-size: 11.5px; color: var(--reader-soft); text-align: left; transition: 0.2s var(--ease); }
.theme-chip:hover { border-color: var(--reader-soft); }
.theme-chip.is-active { border-color: var(--reader-accent); color: var(--reader-text); box-shadow: inset 0 0 0 1px var(--reader-accent); }
.theme-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.12); flex: 0 0 auto; }
.theme-chip-paper .theme-dot { background: #f6f0e3; }
.theme-chip-sepia .theme-dot { background: #efe0c3; }
.theme-chip-green .theme-dot { background: #dfe6d3; }
.theme-chip-night .theme-dot { background: #222925; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--reader-line); border-radius: 3px; background: rgba(0, 0, 0, 0.025); }
.segmented button { flex: 1; height: 30px; border-radius: 2px; font-size: 11px; color: var(--reader-soft); transition: 0.18s var(--ease); }
.segmented button:hover { color: var(--reader-text); }
.segmented button.is-active { background: var(--reader-bg); color: var(--reader-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 34px; height: 32px; flex: 0 0 auto; border: 1px solid var(--reader-line); border-radius: 2px; font-family: Georgia, serif; font-size: 12px; color: var(--reader-text); }
.stepper button:hover { border-color: var(--reader-soft); }
.stepper input { flex: 1; min-width: 0; accent-color: var(--reader-accent); height: 3px; }
.settings-tip { display: flex; align-items: flex-start; gap: 8px; margin: 18px 22px 0; padding: 12px; border: 1px dashed var(--reader-line); color: var(--reader-soft); font-size: 10px; line-height: 1.7; }
.settings-tip svg { margin-top: 1px; flex: 0 0 auto; }
.settings-reset { margin: 18px 22px 26px; width: calc(100% - 44px); }

.reader-chapter-panel .chapter-filter { flex: 0 0 auto; padding: 14px 22px 10px; }
.chapter-filter input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--reader-line);
  border-radius: 2px;
  outline: 0;
  background: var(--reader-bg);
  color: var(--reader-text);
  font-size: 12px;
}
.chapter-filter input:focus { border-color: var(--reader-soft); }
.chapter-filter input::placeholder { color: var(--reader-soft); }
.chapter-count { flex: 0 0 auto; padding: 0 22px 8px; font-family: var(--font-sans); font-size: 9px; color: var(--reader-soft); }
.chapter-list { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
.chapter-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px; border-bottom: 1px solid var(--reader-line); font-size: 12px; color: var(--reader-text); text-align: left; }
.chapter-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-item em { flex: 0 0 auto; font-style: normal; font-size: 9px; color: var(--reader-accent); }
.chapter-item:hover { background: var(--reader-line); }
.chapter-item.is-current { color: var(--reader-accent); }
.chapter-empty { padding: 40px 10px; text-align: center; font-size: 11px; color: var(--reader-soft); }
.chapter-list.is-ready { opacity: 1; }

.reader-error { min-height: 48vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.reader-error-mark { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--reader-line); border-radius: 50%; color: var(--reader-accent); margin-bottom: 8px; }
.reader-error h2 { font-size: 21px; font-weight: 600; letter-spacing: 0.05em; }
.reader-error p { max-width: 400px; color: var(--reader-soft); font-size: 12px; line-height: 1.9; }
.reader-error-actions { display: flex; gap: 8px; margin-top: 16px; }
.reader:fullscreen { width: 100vw; height: 100vh; }

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

@media (max-width: 1240px) {
  :root { --sidebar-w: 224px; }
  .view { padding: 34px 34px 76px; }
  .topbar { padding: 0 34px; }
  .site-footer { padding: 20px 34px 26px; }
  .result-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
  .source-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .book-detail-grid { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); min-height: 420px; }
  .hero-copy h1 { font-size: clamp(42px, 5vw, 58px); }
  .hero-art-note { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .clinic-note { display: none; }
  .source-facts { grid-template-columns: repeat(2, 1fr); gap: 10px 8px; }
}

@media (max-width: 980px) {
  :root { --sidebar-w: 250px; --topbar-h: 62px; }

  .app-main { margin-left: 0; }
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease);
    box-shadow: 22px 0 60px -30px rgba(0, 0, 0, 0.5);
    z-index: 60;
  }
  .sidebar.is-open { transform: none; }
  .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(24, 22, 17, 0.42); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease); }
  .drawer-scrim.is-open { opacity: 1; pointer-events: auto; }

  .topbar { padding: 0 22px; gap: 12px; }
  .mobile-menu { display: inline-flex !important; }
  .topbar-crumb { display: none; }
  .mobile-brand { display: flex; }
  .topbar-left { flex: 0 0 auto; }
  .top-search { margin-left: auto; }
  .view { padding: 26px 22px 108px; }
  .site-footer { display: none; }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    height: 62px;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }
  .mobile-nav-link { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 9.5px; letter-spacing: 0.06em; }
  .mobile-nav-link.is-active { color: var(--cinnabar); }
  .mobile-nav-link .nav-badge { position: absolute; margin-left: 22px; margin-top: -20px; min-width: 15px; height: 15px; line-height: 15px; font-size: 8.5px; }

  .page-header { align-items: flex-start; flex-direction: column; gap: 16px; padding-bottom: 20px; margin-bottom: 22px; }
  .page-actions { padding-bottom: 0; }
  .book-detail-grid { grid-template-columns: 1fr; }
  .book-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .book-side .side-card { flex: 1; min-width: 260px; }
  .book-side .side-quote { flex: 1 0 100%; }
  .history-item { gap: 12px; }
}

@media (max-width: 760px) {
  .top-search { display: none; }
  .topbar-actions { flex: 1; }
  .topbar-status { display: none; }
  .view { padding: 20px 16px 104px; }

  .hero { grid-template-columns: 1fr; min-height: 0; padding-bottom: 22px; }
  .hero-copy { padding-top: 6px; }
  .hero-copy h1 { font-size: clamp(38px, 11vw, 52px); }
  .hero-desc { font-size: 12.5px; margin-top: 14px; }
  .hero-search { margin-top: 20px; }
  .hero-art { display: none; }
  .hero-stats { flex-wrap: wrap; gap: 12px 0; margin-top: 22px; }
  .hero-stats .stat-pill { min-width: 50%; padding: 0 16px 0 0; margin: 0; border: 0; }
  .hero-stats .stat-pill:nth-child(even) { border-left: 1px solid var(--line); padding-left: 16px; }
  .hero-stats .stat-pill strong { font-size: 17px; }

  .home-section { margin-top: 36px; }
  .continue-list { grid-template-columns: 1fr; }
  .book-grid, .shelf-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .result-card { gap: 13px; padding: 13px; }
  .result-cover .book-cover { width: 88px; }
  .result-title-row h3 { font-size: 16px; }
  .result-intro { -webkit-line-clamp: 2; }

  .source-list { grid-template-columns: 1fr; }
  .source-card { padding: 17px; }
  .clinic-summary { flex-wrap: wrap; padding: 16px 18px; gap: 14px 0; }
  .clinic-stat { min-width: 45%; padding-right: 14px; margin-right: 14px; }
  .clinic-stat:nth-child(even) { border-right: 0; margin-right: 0; }

  .book-hero { grid-template-columns: 118px minmax(0, 1fr); gap: 18px; padding-bottom: 24px; }
  .book-hero-body h1 { font-size: clamp(23px, 6vw, 30px); }
  .book-kicker { font-size: 8.5px; }
  .book-author { font-size: 12px; margin-top: 4px; }
  .book-meta { margin-top: 10px; gap: 4px; }
  .book-meta span { font-size: 9px; padding: 2px 6px; }
  .book-latest { display: none; }
  .book-actions { gap: 6px; margin-top: 16px; }
  .book-actions .btn { height: 36px; padding: 0 12px; font-size: 12px; }
  .book-progress-card { margin-top: 15px; }
  .book-main { gap: 14px; }
  .paper-card { padding: 20px; }
  .book-side .side-card { min-width: 100%; }
  .chapter-grid { grid-template-columns: 1fr 1fr; gap: 0 10px; }
  .chapter-chip { font-size: 11px; }

  .bookmark-grid { grid-template-columns: 1fr; }
  .bookmark-card { padding: 20px; }
  .history-cover { display: none; }
  .history-item { flex-wrap: wrap; }
  .history-body { flex: 1 1 calc(100% - 110px); }
  .history-actions { margin-left: auto; }

  .settings-grid { gap: 12px; }
  .settings-grid .paper-card { padding: 20px; }
  .account-row { flex-wrap: wrap; }
  .account-row .btn { margin-left: auto; }
  .pref-row { flex-direction: column; align-items: flex-start !important; gap: 8px !important; }
  .pref-chips { justify-content: flex-start; }
  .pref-range { max-width: none; width: 100%; }

  .auth-page { grid-template-columns: 1fr; min-height: 0; }
  .auth-art { padding: 30px 26px; min-height: 0; }
  .auth-art .logo-mark { --mark-size: 42px; margin-bottom: 14px; }
  .auth-art h1 { font-size: 30px; line-height: 1.4; }
  .auth-art-desc, .auth-quote, .auth-art-mountains { display: none; }
  .auth-card { padding: 28px 24px 34px; }

  .toast-root { bottom: 78px; }
  .modal-card { padding: 24px; }

  .reader-bar { padding: 0 12px; gap: 6px; height: 54px; flex-basis: 54px; }
  .reader-bar-title span { display: none; }
  .reader-bar-title strong { font-size: 12px; }
  .reader-fullscreen { display: none; }
  .reader-article { padding: 30px 20px 72px; }
  .reader-chapter-title { font-size: 23px; }
  .reader-content { margin-top: 22px; line-height: calc(var(--reader-line-height, 1.9) - 0.05); }
  .reader-footer { flex-basis: 54px; height: 54px; gap: 8px; padding: 0 10px; }
  .reader-nav-btn span { display: none; }
  .reader-nav-btn { width: 38px; padding: 0; justify-content: center; }
  .reader-location p { font-size: 8px; }
  .reader-panel { width: 100%; }
  .end-actions .btn { font-size: 11px; padding: 0 10px; }
}

@media (max-width: 420px) {
  .book-hero { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .book-actions .btn-primary { flex: 1 0 100%; }
  .hero-copy h1 { font-size: 34px; }
  .mobile-brand { font-size: 15px; }
  .topbar { padding: 0 14px; }
  .view { padding: 16px 12px 100px; }
  .auth-card { padding: 24px 18px 28px; }
}

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