/* =========================================================
   读迹 ReadTrace — 视觉系统
   纸感底色 / 墨色文字 / 朱砂强调，克制的编辑式排版
   ========================================================= */

:root {
  --paper: #f6f1e7;
  --paper-2: #fbf8f1;
  --paper-3: #efe7d8;
  --ink: #1d1f1b;
  --ink-2: #4b4f46;
  --muted: #8b8577;
  --line: #ded4c2;
  --line-strong: #c8bda7;
  --accent: #a8452f;
  --accent-2: #c56b50;
  --accent-wash: #f0dcd2;
  --green: #4b6350;
  --gold: #9a7a3a;
  --radius: 8px;
  --radius-sm: 5px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  --rail-w: 212px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸纹：极轻的噪点，避免大面积纯色 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: radial-gradient(rgba(120, 100, 70, .16) .5px, transparent .5px);
  background-size: 3px 3px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

::selection { background: var(--accent-wash); color: var(--ink); }

/* ========================= 布局骨架 ========================= */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ========================= 左侧导航 ========================= */

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(251, 248, 241, .72), rgba(246, 241, 231, .4));
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px 26px;
}

.brand-seal {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fbf8f1;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.5px rgba(251, 248, 241, .5);
}

.brand-text strong {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.3;
}

.brand-text small {
  display: block;
  font-size: 9px;
  letter-spacing: .28em;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a {
  display: flex;
  align-items: baseline;
  gap: 11px;
  padding: 9px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
  font-size: 14px;
  transition: background .18s, color .18s, border-color .18s;
}

.nav a em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: color .18s;
}

.nav a:hover { background: rgba(168, 69, 47, .06); color: var(--ink); }

.nav a.active {
  color: var(--ink);
  font-weight: 500;
  border-left-color: var(--accent);
  background: rgba(168, 69, 47, .07);
}
.nav a.active em { color: var(--accent); }

.rail-foot { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); }

.conn { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.conn .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(139, 133, 119, .14);
}
.conn.ok .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(75, 99, 80, .16); }
.conn.bad .dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(168, 69, 47, .16); }
.conn strong { display: block; font-size: 11px; font-weight: 500; color: var(--ink-2); line-height: 1.4; }
.conn small { display: block; font-size: 10px; color: var(--muted); line-height: 1.4; }

.rail-meta { margin: 0; font-size: 10px; color: var(--muted); letter-spacing: .04em; }

/* ========================= 顶栏 ========================= */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 40px;
  background: rgba(246, 241, 231, .86);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.searchbar {
  flex: 1;
  max-width: 580px;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .18s, box-shadow .18s;
}
.searchbar:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(168, 69, 47, .07);
}
.searchbar svg { width: 17px; height: 17px; color: var(--muted); flex: 0 0 auto; }
.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
}
.searchbar input::placeholder { color: var(--muted); }
.searchbar kbd {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  background: var(--paper);
}

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

.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background .18s, color .18s;
}
.seg button.on { background: var(--ink); color: #fbf8f1; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-2);
  color: var(--ink-2);
  transition: border-color .18s, color .18s, transform .18s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--accent); }
.icon-btn:active { transform: rotate(90deg); }
.icon-btn svg { width: 16px; height: 16px; }

/* 退出应用、回到介绍首页：外观同 icon-btn，但不做旋转动效 */
.icon-link { text-decoration: none; }
.icon-link:hover { background: var(--paper); }
.icon-link:hover svg { transform: translateX(-2px); }
.icon-link:active { transform: none; }
.icon-link svg { transition: transform .18s; }

/* ========================= 内容区 ========================= */

.view {
  flex: 1;
  width: 100%;
  max-width: 1220px;
  padding: 34px 40px 64px;
}

.page-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 40px 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .04em;
}

/* ========================= 通用排版件 ========================= */

.eyebrow {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-head h1 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
  margin: 0;
}
.page-head .sub {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  max-width: 560px;
}
.page-head .head-side { text-align: right; flex: 0 0 auto; }

.section {
  margin-bottom: 34px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .02em;
}
.section-head .more {
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  cursor: pointer;
}
.section-head .more:hover { color: var(--accent); border-color: var(--accent); }

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card.flat { background: transparent; }

.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.serif { font-family: var(--serif); }

.divider { height: 1px; background: var(--line); border: 0; margin: 22px 0; }

/* ========================= 今日 / 概览 ========================= */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, .85fr);
  gap: 26px;
  margin-bottom: 30px;
}

.hero-main {
  position: relative;
  padding: 30px 30px 26px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.hero-main::after {
  content: "";
  position: absolute;
  right: -46px; top: -46px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 69, 47, .10), transparent 68%);
  pointer-events: none;
}
.hero-main .greet {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-2);
  margin: 0 0 12px;
}
.hero-main h1 {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.18;
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: .01em;
}
.hero-main h1 .accent { color: var(--accent); }
.hero-main .sub { color: var(--ink-2); font-size: 13px; margin: 0; max-width: 460px; }

.hero-stats {
  display: flex;
  gap: 26px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.hero-stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.hero-stat { flex: 1; }
.hero-stat strong span { font-size: 12px; font-family: var(--sans); color: var(--muted); margin-left: 3px; font-weight: 400; }
.hero-stat small { display: block; font-size: 10px; color: var(--muted); letter-spacing: .1em; margin-top: 3px; }

.hero-side { display: flex; flex-direction: column; gap: 14px; }

.continue-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  background: var(--ink);
  color: #f6f1e7;
  border-radius: var(--radius);
  min-height: 176px;
}
.continue-card .eyebrow { color: rgba(246, 241, 231, .54); }
.continue-card .book-mini { display: flex; gap: 13px; align-items: center; }
.continue-card .book-mini img {
  width: 46px; height: 64px; object-fit: cover;
  border-radius: 3px;
  border: 1px solid rgba(246, 241, 231, .2);
}
.continue-card .book-mini h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 4px;
  line-height: 1.35;
}
.continue-card .book-mini p { margin: 0; font-size: 11px; color: rgba(246, 241, 231, .64); }
.continue-card .foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: rgba(246, 241, 231, .7);
}

.side-note {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.side-note h4 { margin: 0 0 6px; font-family: var(--serif); font-size: 14px; font-weight: 600; }
.side-note p { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.6; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 30px;
}
.metric {
  background: var(--paper-2);
  padding: 18px 20px;
}
.metric small { display: block; font-size: 10px; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }
.metric strong {
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.metric strong i { font-style: normal; font-size: 12px; font-family: var(--sans); color: var(--muted); margin-left: 3px; font-weight: 400; }
.metric p { margin: 6px 0 0; font-size: 11px; color: var(--muted); }

/* 目标 / 进度条 */
.bar {
  height: 3px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
}
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* ========================= 图表 ========================= */

.chart-card { padding: 22px 22px 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.chart-head h3 { font-family: var(--serif); font-size: 15px; font-weight: 600; margin: 0; }
.chart-head span { font-size: 11px; color: var(--muted); }

.chart { width: 100%; display: block; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; margin-top: 14px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .col .track {
  width: 100%;
  display: flex;
  align-items: flex-end;
  height: 100%;
  border-radius: 3px 3px 0 0;
}
.bars .col .fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height .4s ease;
  opacity: .92;
}
.bars .col .fill.zero { background: var(--line); opacity: 1; }
.bars .col label { font-size: 9px; color: var(--muted); white-space: nowrap; }
.bars .col .val {
  font-size: 9px; color: var(--ink-2); opacity: 0;
  transition: opacity .18s;
  font-variant-numeric: tabular-nums;
}
.bars .col:hover .val { opacity: 1; }

.pref-list { display: flex; flex-direction: column; gap: 12px; }
.pref-row { display: grid; grid-template-columns: 92px 1fr 74px; gap: 12px; align-items: center; }
.pref-row .name { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pref-row .track { height: 7px; background: var(--paper-3); border-radius: 4px; overflow: hidden; }
.pref-row .track > i { display: block; height: 100%; background: var(--ink); opacity: .78; border-radius: 4px; }
.pref-row .num { font-size: 10px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.hour-chart { display: flex; align-items: flex-end; gap: 3px; height: 86px; margin-top: 12px; }
.hour-chart .h {
  flex: 1; background: var(--line);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  position: relative;
}
.hour-chart .h.on { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.hour-chart .h:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper-2);
  font-size: 10px; padding: 3px 6px; border-radius: 3px; white-space: nowrap; z-index: 2;
}
.hour-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 9px; color: var(--muted); }

.rank-list { display: flex; flex-direction: column; }
.rank-item {
  display: grid;
  grid-template-columns: 26px 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.rank-item:last-child { border-bottom: 0; }
.rank-item .idx { font-family: var(--serif); font-size: 14px; color: var(--muted); }
.rank-item img { width: 36px; height: 50px; object-fit: cover; border-radius: 2px; border: 1px solid var(--line); }
.rank-item .t { font-family: var(--serif); font-size: 14px; line-height: 1.4; margin: 0; }
.rank-item .a { font-size: 10px; color: var(--muted); margin: 2px 0 0; }
.rank-item .time { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ========================= 书籍卡片 ========================= */

.book-list { display: flex; flex-direction: column; }
.book-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.book-row:last-child { border-bottom: 0; }
.book-row .cover {
  width: 58px; height: 82px; object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--paper-3);
}
.book-row .info h3 {
  margin: 0 0 3px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}
.book-row .info .byline { font-size: 11px; color: var(--muted); margin: 0 0 8px; }
.book-row .info .desc {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.65;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-row .facts { display: flex; gap: 14px; font-size: 10px; color: var(--muted); margin-top: 8px; }
.book-row .facts b { color: var(--ink-2); font-weight: 500; }
.book-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 84px; }

.rating {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rating small { font-family: var(--sans); font-size: 9px; color: var(--muted); }
.rating.none { color: var(--muted); font-size: 11px; font-family: var(--sans); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
  color: var(--ink-2);
  background: var(--paper);
  white-space: nowrap;
}
.chip.accent { color: var(--accent); border-color: rgba(168, 69, 47, .28); background: rgba(168, 69, 47, .05); }
.chip.green { color: var(--green); border-color: rgba(75, 99, 80, .3); background: rgba(75, 99, 80, .06); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  transition: background .18s, color .18s, border-color .18s;
}
.btn:hover { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }
.btn.solid { background: var(--accent); border-color: var(--accent); color: #fbf8f1; }
.btn.solid:hover { background: #933a26; border-color: #933a26; }
.btn.ghost { border-color: transparent; color: var(--muted); padding: 0 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ========================= 书架 ========================= */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.filters .group { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--paper-2); }
.filters .group button {
  border: 0; background: transparent; padding: 7px 12px;
  font-size: 11px; color: var(--muted);
}
.filters .group button.on { background: var(--ink); color: var(--paper-2); }
.filters .spacer { flex: 1; }

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: 22px 18px;
}
.shelf-item { cursor: pointer; }
.shelf-item .cover-wrap {
  position: relative;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-3);
  box-shadow: 0 1px 0 rgba(120, 100, 70, .06), 0 10px 22px -18px rgba(29, 31, 27, .5);
}
.shelf-item .cover-wrap img {
  width: 100%;
  aspect-ratio: 3 / 4.3;
  object-fit: cover;
  transition: transform .3s ease;
}
.shelf-item:hover .cover-wrap img { transform: scale(1.025); }
.shelf-item .tagline {
  position: absolute; left: 0; bottom: 0; right: 0;
  padding: 20px 10px 9px;
  background: linear-gradient(180deg, transparent, rgba(20, 22, 18, .72));
  color: #f6f1e7;
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.shelf-item .tagline .progress { letter-spacing: .04em; }
.shelf-item h3 {
  margin: 10px 0 2px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shelf-item p { margin: 0; font-size: 10px; color: var(--muted); }
.shelf-item .mini-bar { margin-top: 7px; }

.album-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  align-items: center;
  cursor: pointer;
}
.album-card img { width: 54px; height: 54px; border-radius: 4px; object-fit: cover; border: 1px solid var(--line); }
.album-card h4 { margin: 0 0 3px; font-family: var(--serif); font-size: 14px; font-weight: 600; }
.album-card p { margin: 0; font-size: 10px; color: var(--muted); }

/* ========================= 笔记 ========================= */

.note-summary {
  display: flex;
  gap: 40px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin-bottom: 26px;
}
.note-summary div strong { font-family: var(--serif); font-size: 26px; font-weight: 600; display: block; line-height: 1.2; }
.note-summary div small { font-size: 10px; color: var(--muted); letter-spacing: .08em; }

.note-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.note-row:last-child { border-bottom: 0; }
.note-row:hover { background: rgba(168, 69, 47, .03); }
.note-row img { width: 46px; height: 64px; object-fit: cover; border-radius: 2px; border: 1px solid var(--line); }
.note-row h3 { margin: 0 0 3px; font-family: var(--serif); font-size: 15px; font-weight: 600; }
.note-row p { margin: 0; font-size: 10px; color: var(--muted); }
.note-row .counts { display: flex; gap: 12px; font-size: 10px; color: var(--muted); }
.note-row .counts b { color: var(--ink-2); font-weight: 500; }
.note-row .when { font-size: 10px; color: var(--muted); min-width: 66px; text-align: right; }

/* ========================= 发现 ========================= */

.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.rec-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.rec-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -20px rgba(29, 31, 27, .6); }
.rec-card .cover { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: center top; border-bottom: 1px solid var(--line); }
.rec-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.rec-card h3 { font-family: var(--serif); font-size: 15px; font-weight: 600; margin: 0 0 3px; line-height: 1.4; }
.rec-card .by { font-size: 10px; color: var(--muted); margin: 0 0 10px; }
.rec-card .why {
  font-size: 11px; color: var(--ink-2); line-height: 1.6; margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rec-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rec-card .foot .btn { height: 27px; padding: 0 10px; font-size: 10px; }

.quote-card {
  padding: 22px 24px;
  border-left: 2px solid var(--accent);
  background: var(--paper-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 16px;
}
.quote-card blockquote {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
}
.quote-card .meta { display: flex; gap: 12px; font-size: 10px; color: var(--muted); }

.review-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.review-item:last-child { border-bottom: 0; }
.review-item .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.review-item .avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.review-item .name { font-size: 11px; color: var(--ink-2); }
.review-item .stars { color: var(--gold); font-size: 10px; letter-spacing: 1px; }
.review-item .content { font-size: 12px; color: var(--ink-2); line-height: 1.7; margin: 0; }

/* ========================= 空状态 / 骨架 ========================= */

.empty {
  padding: 52px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(251, 248, 241, .55);
}
.empty .seal {
  width: 46px; height: 46px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--serif);
  color: var(--muted);
  font-size: 18px;
}
.empty h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.empty p { margin: 0 auto; max-width: 380px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.empty .actions { margin-top: 16px; display: flex; gap: 10px; justify-content: center; }

.skeleton { background: linear-gradient(90deg, var(--paper-3) 25%, #f3ecdf 37%, var(--paper-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 12px; margin-bottom: 10px; }
.sk-card { height: 96px; border-radius: 6px; }

/* ========================= 抽屉 ========================= */

.scrim {
  position: fixed; inset: 0;
  background: rgba(29, 31, 27, .3);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  transition: opacity .24s;
}
.scrim.show { opacity: 1; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(540px, 94vw);
  height: 100vh;
  overflow-y: auto;
  background: var(--paper-2);
  border-left: 1px solid var(--line-strong);
  box-shadow: -30px 0 60px -40px rgba(20, 22, 18, .5);
  z-index: 41;
  transform: translateX(102%);
  transition: transform .3s cubic-bezier(.22, .61, .36, 1);
  padding: 0 0 40px;
  overscroll-behavior: contain;
}
.drawer.show { transform: translateX(0); }

.drawer-head {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: rgba(251, 248, 241, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.drawer-head .eyebrow { margin: 0; }
.drawer-close {
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--ink-2); font-size: 16px; line-height: 1;
}
.drawer-close:hover { border-color: var(--accent); color: var(--accent); }

.drawer-body { padding: 22px 24px 0; }

.book-hero { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; margin-bottom: 20px; }
.book-hero img {
  width: 96px; height: 138px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line);
  box-shadow: 0 8px 20px -16px rgba(20, 22, 18, .7);
}
.book-hero h2 { font-family: var(--serif); font-size: 22px; line-height: 1.35; margin: 0 0 5px; font-weight: 600; }
.book-hero .by { font-size: 11px; color: var(--muted); margin: 0 0 10px; }
.book-hero .facts { display: flex; flex-wrap: wrap; gap: 8px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 20px 0 18px;
  overflow-x: auto;
}
.tabs button {
  border: 0; background: transparent;
  padding: 8px 10px 9px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }

.chapter-list { font-size: 12px; }
.chapter-list .ch {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dotted var(--line);
  color: var(--ink-2);
}
.chapter-list .ch .w { color: var(--muted); font-size: 10px; white-space: nowrap; }

.hl-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.hl-item blockquote {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.8;
  border-left: 2px solid var(--accent-2);
  padding-left: 12px;
  color: var(--ink);
}
.hl-item .meta { font-size: 10px; color: var(--muted); display: flex; gap: 10px; }

/* ========================= 提示条 / Toast ========================= */

.toast {
  position: fixed;
  left: 50%; bottom: 34px;
  transform: translate(-50%, 18px);
  background: var(--ink);
  color: var(--paper-2);
  font-size: 12px;
  padding: 9px 16px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 60;
  max-width: 82vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  margin-bottom: 22px;
  border: 1px solid rgba(154, 122, 58, .35);
  background: rgba(154, 122, 58, .08);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #6f5624;
}
.banner.demo { border-color: rgba(168, 69, 47, .3); background: rgba(168, 69, 47, .06); color: #8a3a28; }
.banner .b-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ========================= 启动遮罩 ========================= */

.boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--paper);
  transition: opacity .4s;
}
.boot.hide { opacity: 0; pointer-events: none; }
.boot-seal {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fbf8f1;
  font-family: var(--serif);
  font-size: 30px;
  border-radius: 6px;
  animation: breathe 1.8s ease-in-out infinite;
}
.boot p { font-size: 11px; letter-spacing: .16em; color: var(--muted); }
@keyframes breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(168, 69, 47, .25); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 12px rgba(168, 69, 47, 0); }
}

/* ========================= 响应式 ========================= */

@media (max-width: 1120px) {
  .hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: sticky; top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    z-index: 30;
    background: rgba(246, 241, 231, .94);
    backdrop-filter: blur(10px);
  }
  .brand { padding: 0; flex: 0 0 auto; }
  .brand-seal { width: 30px; height: 30px; flex-basis: 30px; font-size: 18px; }
  .brand-text { display: none; }
  .nav { flex-direction: row; gap: 2px; overflow-x: auto; flex: 1; }
  .nav a {
    padding: 6px 7px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-size: 12px;
    border-radius: 4px 4px 0 0;
  }
  .nav a em { display: none; }
  .nav a.active { border-left-color: transparent; border-bottom-color: var(--accent); background: transparent; }
  .rail-foot { display: none; }
  .topbar { position: static; padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .searchbar { max-width: none; order: 2; width: 100%; }
  .top-actions { order: 1; margin-left: auto; }
  .view { padding: 22px 16px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 20px; }
  .page-head h1 { font-size: 27px; }
  .page-head .head-side { text-align: left; }
  .hero { grid-template-columns: 1fr; }
  .hero-main h1 { font-size: 31px; }
  .hero-stats { gap: 18px; flex-wrap: wrap; }
  .book-row { grid-template-columns: 46px minmax(0, 1fr); }
  .book-row .cover { width: 46px; height: 66px; }
  .book-row .side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; min-width: 0; }
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; }
  .note-summary { gap: 24px; padding: 16px 18px; }
  .note-row { grid-template-columns: 40px minmax(0, 1fr); }
  .note-row img { width: 40px; height: 56px; }
  .note-row .counts, .note-row .when { grid-column: 2; }
  .note-row .when { text-align: left; }
  .page-foot { padding: 16px; flex-direction: column; gap: 4px; }
  .drawer { width: 100vw; }
  .book-hero { grid-template-columns: 74px minmax(0, 1fr); }
  .book-hero img { width: 74px; height: 106px; }
  .banner { flex-direction: column; align-items: flex-start; }
}
