/* ==========================================================================
   拾页 Shiye — 样式
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
    Georgia, "Times New Roman", serif;

  --bg: #f3f0e8;
  --bg-deep: #ece8dd;
  --surface: #fdfbf6;
  --surface-2: #f8f4eb;
  --surface-3: #f1ece0;
  --ink: #1f241f;
  --ink-2: #485046;
  --muted: #878d81;
  --faint: #a7ab9f;
  --line: #e4dfd1;
  --line-strong: #d5cfbe;
  --accent: #2f6b5c;
  --accent-ink: #1e4c41;
  --accent-soft: #e2efe8;
  --accent-line: #bfd8cd;
  --warm: #bc6a45;
  --warm-soft: #f7e7dd;
  --gold: #a9812f;
  --gold-soft: #f6edd8;
  --danger: #b14338;
  --danger-soft: #f8e4e0;
  --blue: #42688f;
  --blue-soft: #e4edf5;

  --shadow-sm: 0 1px 2px rgba(38, 40, 30, 0.04);
  --shadow: 0 1px 2px rgba(38, 40, 30, 0.04), 0 12px 32px -18px rgba(38, 40, 30, 0.28);
  --shadow-lg: 0 2px 4px rgba(28, 30, 22, 0.05), 0 32px 64px -32px rgba(28, 30, 22, 0.35);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --sidebar-w: 236px;
  --topbar-h: 72px;
  --tabbar-h: 62px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101210;
    --bg-deep: #0c0e0c;
    --surface: #181b17;
    --surface-2: #1d211c;
    --surface-3: #242823;
    --ink: #eae8df;
    --ink-2: #bcc1b6;
    --muted: #8b9187;
    --faint: #72786e;
    --line: #2a2f29;
    --line-strong: #3a4038;
    --accent: #82bcab;
    --accent-ink: #bfe4d8;
    --accent-soft: #1d312b;
    --accent-line: #2f4d43;
    --warm: #db8d68;
    --warm-soft: #33231b;
    --gold: #cda552;
    --gold-soft: #2f2818;
    --danger: #e28074;
    --danger-soft: #34201d;
    --blue: #8cb1d4;
    --blue-soft: #1b2836;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -18px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 40px 80px -40px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1000px 520px at 88% -12%, rgba(188, 106, 69, 0.07), transparent 68%),
    radial-gradient(780px 480px at -8% 34%, rgba(47, 107, 92, 0.06), transparent 70%);
}

@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(1000px 520px at 88% -12%, rgba(219, 141, 104, 0.07), transparent 68%),
      radial-gradient(780px 480px at -8% 34%, rgba(130, 188, 171, 0.05), transparent 70%);
  }
}

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

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

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

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

button:disabled {
  cursor: default;
  opacity: 0.55;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(10px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: #f6f3e9;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 16px -8px var(--accent);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.brand-text small {
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.34em;
  color: var(--muted);
}

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

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--ink-2);
  font-size: 14.5px;
  transition: background 0.18s, color 0.18s;
}

.nav-item .icon {
  width: 19px;
  height: 19px;
  color: var(--muted);
  transition: color 0.18s;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.nav-item.active .icon {
  color: var(--accent);
}

.side-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}

.sync-chip .sync-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.sync-chip.online .dot {
  background: #4f9a7d;
  box-shadow: 0 0 0 3px rgba(79, 154, 125, 0.16);
}

.sync-chip.syncing .dot {
  background: var(--gold);
  animation: pulse 1.2s infinite;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-h);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 40px 12px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid transparent;
}

.topbar.scrolled {
  border-bottom-color: var(--line);
}

.topbar-title h1 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.topbar-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 22px 40px 96px;
  outline: none;
}

.tabbar {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .brand-mark {
    color: #10201a;
  }
}

/* 问问空状态：让开场卡片落在视线舒服的位置 */
.ask-wrap.is-empty .chat-scroll {
  display: none;
}

.ask-wrap.is-empty .ask-intro {
  margin-top: auto;
  margin-bottom: auto;
}

/* ==========================================================================
   基础组件
   ========================================================================== */

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon.sm {
  width: 15px;
  height: 15px;
}

.icon.lg {
  width: 24px;
  height: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, transform 0.12s, box-shadow 0.16s;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f8f6ee;
  box-shadow: 0 8px 20px -12px var(--accent);
}

.btn.primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

@media (prefers-color-scheme: dark) {
  .btn.primary {
    color: #0f1714;
  }
  .btn.primary:hover {
    background: var(--accent-ink);
    color: #0f1714;
  }
}

.btn.warm {
  background: var(--warm);
  border-color: var(--warm);
  color: #fff8f2;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.btn.ghost:hover {
  background: var(--surface-2);
}

.btn.danger {
  color: var(--danger);
  border-color: var(--line);
}

.btn.danger:hover {
  background: var(--danger-soft);
  border-color: transparent;
}

.btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn.block {
  width: 100%;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-btn.soft {
  border-color: transparent;
  background: transparent;
}

.icon-btn.soft:hover {
  background: var(--surface-2);
}

.icon-btn.filled {
  background: var(--accent);
  border-color: var(--accent);
  color: #f8f6ee;
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.chip .icon {
  width: 12px;
  height: 12px;
}

.chip.accent {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.chip.warm {
  background: var(--warm-soft);
  color: var(--warm);
}

.chip.gold {
  background: var(--gold-soft);
  color: var(--gold);
}

.chip.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.chip.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.filter-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.16s;
}

.filter-chip:hover {
  background: var(--surface-2);
}

.filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

@media (prefers-color-scheme: dark) {
  .filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #101713;
  }
}

.filter-chip .count {
  margin-left: 5px;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}

.section {
  margin-top: 30px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.section-head .link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.section-head .link:hover {
  color: var(--accent);
}

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

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

/* ==========================================================================
   今天
   ========================================================================== */

.today-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 6px;
}

.greeting {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 2px;
}

.greeting-day {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--warm);
  letter-spacing: 0.16em;
  margin-bottom: 6px;
}

.greeting h2 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.greeting p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.greeting-note {
  display: none;
  font-family: var(--font-serif);
  color: var(--faint);
  font-size: 13px;
  writing-mode: vertical-rl;
  letter-spacing: 0.3em;
  padding-bottom: 6px;
}

@media (min-width: 760px) {
  .greeting-note {
    display: block;
  }
}

.capture {
  position: relative;
  padding: 6px;
  border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--surface) 0%, var(--surface) 55%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.capture:focus-within {
  border-color: var(--accent-line);
  box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.capture::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(420px 160px at 100% 0%, rgba(188, 106, 69, 0.07), transparent 70%);
}

.capture-inner {
  position: relative;
  z-index: 1;
  padding: 12px 12px 8px;
}

.capture textarea {
  width: 100%;
  min-height: 70px;
  max-height: 260px;
  padding: 2px 2px;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
}

.capture textarea::placeholder {
  color: var(--faint);
  font-family: var(--font-serif);
}

.capture-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed transparent;
}

.capture-types {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--surface-2);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.capture-types::-webkit-scrollbar {
  display: none;
}

.capture-send {
  flex: none;
}

.type-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  flex: none;
  white-space: nowrap;
  transition: all 0.16s;
}

.type-btn .icon {
  width: 13px;
  height: 13px;
}

.type-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.capture-send {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kbd {
  display: none;
  font-size: 10.5px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

@media (min-width: 760px) {
  .kbd {
    display: inline-block;
  }
}

.capture-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 6px;
  color: var(--faint);
  font-size: 11px;
}

/* 今日概览小条 */
.today-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.stat {
  padding: 13px 15px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.stat b {
  display: block;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.stat.warm b {
  color: var(--warm);
}
.stat.accent b {
  color: var(--accent);
}

/* ==========================================================================
   条目
   ========================================================================== */

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.entry {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;
  animation: fade-up 0.35s both;
}

.entry:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.entry-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  flex: none;
}

.entry-icon .icon {
  width: 17px;
  height: 17px;
}

.entry.todo .entry-icon {
  background: var(--warm-soft);
  color: var(--warm);
}
.entry.material .entry-icon {
  background: var(--blue-soft);
  color: var(--blue);
}
.entry.note .entry-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.entry-body {
  flex: 1;
  min-width: 0;
}

.entry-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.entry-title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: 0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.entry.done .entry-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

.entry-summary {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 12.8px;
  line-height: 1.65;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  color: var(--faint);
  font-size: 11px;
}

.entry-meta .sep {
  opacity: 0.5;
}

.entry-check {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-top: 4px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  color: transparent;
  flex: none;
  transition: all 0.18s;
}

.entry-check:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.entry-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.entry-check .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.entry-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.16s;
}

.entry:hover .entry-actions {
  opacity: 1;
}

@media (hover: none) {
  .entry-actions {
    opacity: 1;
  }
}

.mini-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--faint);
}

.mini-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.mini-btn .icon {
  width: 15px;
  height: 15px;
}

.ai-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 10.5px;
}

.ai-dot .icon {
  width: 11px;
  height: 11px;
  animation: soft-spin 3s linear infinite;
}

.ai-done {
  color: var(--faint);
}

/* 相关条目 */
.related {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.related-label {
  font-size: 10.5px;
  color: var(--faint);
  margin-right: 2px;
}

.related-link {
  font-size: 10.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 2px 6px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-mark .icon {
  width: 26px;
  height: 26px;
}

.empty h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 5px;
}

.empty p {
  max-width: 340px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.empty .btn {
  margin-top: 18px;
}

.skeleton {
  height: 76px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}

/* ==========================================================================
   搜索
   ========================================================================== */

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.16s, box-shadow 0.16s;
}

.searchbar:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent);
}

.searchbar .icon {
  width: 17px;
  height: 17px;
  color: var(--faint);
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
}

.searchbar input::placeholder {
  color: var(--faint);
}

.searchbar .clear {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}

.searchbar .clear .icon {
  width: 12px;
  height: 12px;
}

.notes-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

/* ==========================================================================
   书库
   ========================================================================== */

.library-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.lib-stat {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.lib-stat b {
  display: block;
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.lib-stat span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.lib-stat::after {
  content: "";
  position: absolute;
  right: -12px;
  bottom: -18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface-2);
}

.book-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.book-toolbar .filter-row {
  flex: 1;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 22px 18px;
}

.book-card {
  cursor: pointer;
  animation: fade-up 0.4s both;
}

.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 8px 12px 12px 8px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
  box-shadow: 0 2px 5px rgba(30, 32, 24, 0.12), 0 14px 26px -18px rgba(30, 32, 24, 0.5);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.book-card:hover .book-cover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: 0 4px 8px rgba(30, 32, 24, 0.14), 0 22px 38px -18px rgba(30, 32, 24, 0.55);
}

.book-cover::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.22), rgba(255, 255, 255, 0.06));
  z-index: 2;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px 14px 18px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(155deg, var(--c1, #3f6b5e), var(--c2, #29473f));
  color: rgba(255, 255, 255, 0.94);
}

.cover-fallback .cf-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: 0.03em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.cover-fallback .cf-author {
  font-size: 9.5px;
  opacity: 0.78;
  letter-spacing: 0.08em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cover-fallback::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  pointer-events: none;
}

.book-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(20, 24, 20, 0.55);
  backdrop-filter: blur(6px);
}

.book-badge.proxy {
  background: color-mix(in srgb, var(--warm) 82%, transparent);
}

.book-cover.has-badge .cf-title {
  padding-right: 30px;
}

.book-info {
  padding: 10px 2px 0;
}

.book-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-author {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.book-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--ink-2);
}

.status-pill .sd {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill[data-s="wanted"] { background: var(--surface-3); color: var(--ink-2); }
.status-pill[data-s="ordered"] { background: var(--blue-soft); color: var(--blue); }
.status-pill[data-s="purchased"] { background: var(--gold-soft); color: var(--gold); }
.status-pill[data-s="shipped"] { background: var(--warm-soft); color: var(--warm); }
.status-pill[data-s="arrived"] { background: var(--accent-soft); color: var(--accent); }
.status-pill[data-s="to-read"] { background: var(--accent-soft); color: var(--accent-ink); }
.status-pill[data-s="reading"] { background: var(--warm-soft); color: var(--warm); }
.status-pill[data-s="read"] { background: var(--surface-2); color: var(--muted); }

.book-meta-line {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--faint);
  display: flex;
  gap: 6px;
  align-items: center;
}

/* 书籍详情 */
.book-detail-top {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.book-detail-cover {
  width: 118px;
  flex: none;
  aspect-ratio: 2 / 3;
  border-radius: 6px 10px 10px 6px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 24px -12px rgba(20, 22, 16, 0.55);
}

.book-detail-cover .cover-fallback {
  padding: 12px 10px;
}

.book-detail-cover .cf-title {
  font-size: 11px;
  -webkit-line-clamp: 4;
}

.book-detail-info {
  flex: 1;
  min-width: 0;
}

.book-detail-info h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
}

.book-detail-author {
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 13px;
}

.book-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.book-detail-desc {
  margin-top: 18px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.75;
}

/* ==========================================================================
   问问
   ========================================================================== */

.ask-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--topbar-h) - 120px);
}

.ask-intro {
  padding: 20px 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(500px 200px at 100% 0%, var(--warm-soft), transparent 70%),
    var(--surface);
  margin-bottom: 18px;
}

.ask-intro h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
}

.ask-intro p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
}

.ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.suggestion {
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  transition: all 0.16s;
}

.suggestion:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.chat-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 2px 24px;
}

.msg {
  display: flex;
  gap: 11px;
  animation: fade-up 0.3s both;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 14px;
}

.msg.ai .msg-avatar {
  background: var(--accent);
  color: #f7f4ea;
}

@media (prefers-color-scheme: dark) {
  .msg.ai .msg-avatar {
    color: #0f1714;
  }
}

.msg-body {
  flex: 1;
  min-width: 0;
}

.msg-name {
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 5px;
  letter-spacing: 0.04em;
}

.msg.user {
  justify-content: flex-end;
}

.msg.user .msg-body {
  padding: 10px 14px;
  border-radius: 14px 4px 14px 14px;
  background: var(--surface-2);
  width: fit-content;
  max-width: 88%;
  flex: 0 1 auto;
}

.msg.user .msg-name {
  display: none;
}

.msg-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-text strong {
  font-weight: 600;
}

.msg-text code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 4px;
}

.msg-cites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.cite {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 10.5px;
  text-align: left;
}

.cite:hover {
  border-color: var(--accent-line);
  color: var(--accent-ink);
}

.cite b {
  color: var(--accent);
  font-weight: 600;
  flex: none;
}

.cite span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 6px 0;
}

.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  animation: bounce 1.2s infinite;
}

.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

.composer {
  position: sticky;
  bottom: 20px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.composer:focus-within {
  border-color: var(--accent-line);
}

.composer textarea {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  resize: none;
  min-height: 34px;
  max-height: 130px;
  padding: 7px 0;
  font-size: 14px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: var(--faint);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #f8f6ee;
  flex: none;
  transition: background 0.16s, transform 0.12s;
}

.send-btn:hover {
  background: var(--accent-ink);
}

.send-btn:active {
  transform: scale(0.94);
}

.send-btn .icon {
  width: 17px;
  height: 17px;
}

/* ==========================================================================
   回顾
   ========================================================================== */

.review-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(600px 260px at 100% 0%, var(--warm-soft), transparent 60%),
    radial-gradient(500px 260px at 0% 100%, var(--accent-soft), transparent 65%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.review-hero::after {
  content: "拾";
  position: absolute;
  right: 18px;
  bottom: -32px;
  font-family: var(--font-serif);
  font-size: 150px;
  line-height: 1;
  color: var(--ink);
  opacity: 0.035;
  pointer-events: none;
}

.review-hero h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.review-hero p {
  margin-top: 6px;
  max-width: 460px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.review-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.segmented button {
  height: 30px;
  padding: 0 13px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12.5px;
  transition: all 0.16s;
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

.review-sheet {
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: fade-up 0.4s both;
}

.review-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font-size: 11.5px;
  margin-bottom: 14px;
}

.review-overview {
  font-family: var(--font-serif);
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--ink);
  letter-spacing: 0.01em;
  padding-left: 15px;
  border-left: 2px solid var(--warm);
}

.review-block {
  margin-top: 24px;
}

.review-block h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  margin-bottom: 11px;
}

.review-block h3 .icon {
  width: 15px;
  height: 15px;
  color: var(--warm);
}

.theme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.theme-pill {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}

.highlight-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.highlight {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.highlight b {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--warm);
  font-size: 10px;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

.action-item .icon {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: var(--accent);
  flex: none;
}

.action-item .act-badge {
  margin-left: auto;
  flex: none;
  font-size: 10px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}

.review-empty {
  padding: 30px 0;
}

.review-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}

.review-history-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.review-history-item .icon {
  color: var(--gold);
}

.review-history-item b {
  font-size: 13px;
  font-weight: 500;
}

.review-history-item span {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
}

/* ==========================================================================
   Sheet / 弹层
   ========================================================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(24, 26, 20, 0.38);
  backdrop-filter: blur(3px);
  animation: fade 0.2s both;
}

.sheet {
  position: fixed;
  z-index: 81;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: slide-left 0.26s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.sheet.wide {
  width: min(680px, 100%);
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  overscroll-behavior: contain;
}

.sheet-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.sheet-foot .spacer {
  flex: 1;
}

.modal {
  position: fixed;
  z-index: 81;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 32px));
  max-height: min(84dvh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: pop 0.22s cubic-bezier(0.22, 0.8, 0.3, 1) both;
  overflow: hidden;
}

.modal-body {
  overflow-y: auto;
  padding: 6px 26px 30px;
}

@media (max-width: 720px) {
  .sheet {
    top: auto;
    width: 100%;
    height: min(92dvh, 900px);
    border-radius: 22px 22px 0 0;
    animation: slide-up 0.28s cubic-bezier(0.22, 0.8, 0.3, 1) both;
  }
  .sheet-head {
    padding-top: 14px;
  }
  .sheet-head::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: var(--line-strong);
    transform: translateX(-50%);
  }
  .sheet-foot {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .modal {
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-height: 90dvh;
    border-radius: 22px 22px 0 0;
    animation: slide-up 0.28s cubic-bezier(0.22, 0.8, 0.3, 1) both;
  }
}

/* ==========================================================================
   表单
   ========================================================================== */

.field {
  margin-bottom: 16px;
}

.field > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.field > label .hint {
  font-weight: 400;
  color: var(--faint);
  font-size: 10.5px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent);
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.7;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

@media (max-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-note {
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

/* 设置 */
.settings-section {
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}

.settings-section:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 4px;
}

.settings-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.settings-section h3 .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.settings-section > p {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
  margin-bottom: 12px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-row .input {
  flex: 1;
}

/* 详情 */
.detail-content {
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-title-input {
  width: 100%;
  border: 0;
  border-bottom: 1px dashed var(--line);
  background: transparent;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
  padding: 2px 0 8px;
  outline: none;
}

.detail-title-input:focus {
  border-bottom-color: var(--accent);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 18px;
}

.detail-section {
  margin-top: 22px;
}

.detail-section h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 9px;
}

.detail-section h4 .icon {
  width: 14px;
  height: 14px;
  color: var(--warm);
}

.ai-summary-box {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.ai-summary-box p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--accent-ink);
}

.keypoint {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
  padding: 3px 0;
}

.keypoint::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--warm);
  flex: none;
}

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 40px;
  align-items: center;
}

.tag-input-wrap input {
  flex: 1;
  min-width: 80px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  padding: 2px 4px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
}

.tag-chip button {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  color: var(--faint);
}

.tag-chip button:hover {
  background: var(--line);
  color: var(--ink);
}

.tag-chip .icon {
  width: 9px;
  height: 9px;
}

/* 搜索结果（书籍） */
.result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 330px;
  overflow-y: auto;
}

.result-item {
  display: flex;
  gap: 12px;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.16s, background 0.16s;
}

.result-item:hover {
  border-color: var(--accent-line);
  background: var(--surface-2);
}

.result-cover {
  width: 42px;
  height: 62px;
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
  background: var(--surface-3);
  flex: none;
  position: relative;
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-info {
  min-width: 0;
  flex: 1;
}

.result-info b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.result-info span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 导入预览 */
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.preview-table th,
.preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-table th {
  color: var(--muted);
  font-weight: 500;
  background: var(--surface-2);
  position: sticky;
  top: 0;
}

.preview-scroll {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* Toast */
.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.toast .icon {
  width: 15px;
  height: 15px;
  flex: none;
}

@media (max-width: 899px) {
  .toast {
    bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  }
}

/* ==========================================================================
   移动端
   ========================================================================== */

@media (max-width: 899px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    min-height: 58px;
    padding: calc(12px + env(safe-area-inset-top)) 18px 10px;
    align-items: center;
  }

  .topbar-title h1 {
    font-size: 20px;
  }

  .topbar-title p {
    display: none;
  }

  .view {
    padding: 14px 16px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom));
  }

  .tabbar {
    position: fixed;
    z-index: 60;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 5px 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(18px) saturate(1.2);
    border-top: 1px solid var(--line);
  }

  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 9.5px;
    letter-spacing: 0.03em;
  }

  .tab .icon {
    width: 20px;
    height: 20px;
  }

  .tab.active {
    color: var(--accent);
  }

  .tab.active .icon {
    stroke-width: 2;
  }

  .greeting h2 {
    font-size: 25px;
  }

  .today-stats {
    margin-top: 14px;
  }

  .stat {
    padding: 11px 12px;
  }

  .stat b {
    font-size: 21px;
  }

  .library-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .lib-stat {
    padding: 10px 9px;
  }

  .lib-stat b {
    font-size: 20px;
  }

  .lib-stat span {
    margin-top: 4px;
    font-size: 9.5px;
    white-space: nowrap;
  }

  .lib-stat::after {
    display: none;
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
    gap: 17px 10px;
  }

  .book-cover {
    border-radius: 6px 9px 9px 6px;
  }

  .cover-fallback {
    padding: 13px 9px 9px 11px;
  }

  .cover-fallback .cf-title {
    font-size: 12.5px;
    -webkit-line-clamp: 4;
    line-height: 1.35;
  }

  .cover-fallback .cf-author {
    font-size: 8px;
  }

  .book-title {
    font-size: 12px;
  }

  .book-author {
    font-size: 10px;
  }

  .book-meta-line {
    font-size: 9.5px;
    gap: 3px;
  }

  .status-pill {
    font-size: 9px;
    padding: 2px 5px;
  }

  .book-badge {
    top: 6px;
    right: 6px;
    font-size: 8.5px;
    padding: 2px 6px;
  }

  .book-info {
    padding-top: 8px;
  }

  .book-cover.has-badge .cf-title {
    padding-right: 32px;
  }

  .filter-row {
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 6px;
  }

  .notes-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .category-select {
    width: 100%;
  }

  .entry {
    padding: 13px 13px;
    gap: 11px;
  }

  .entry-icon {
    width: 30px;
    height: 30px;
  }

  .sheet-body {
    padding: 16px 18px 28px;
  }

  .sheet-head {
    padding: 18px 18px 12px;
  }

  .sheet-foot {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  }

  .composer {
    bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  }

  .ask-wrap {
    min-height: calc(100dvh - 190px);
  }
}

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

/* ==========================================================================
   动画
   ========================================================================== */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-left {
  from { transform: translateX(40px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

@keyframes pop {
  from { transform: translate(-50%, -48%) scale(0.98); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: 130% 0; }
  100% { background-position: -30% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes soft-spin {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(12deg) scale(1.12); }
  100% { transform: rotate(0) scale(1); }
}

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 720px) {
  @keyframes pop {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
}

@media (prefers-color-scheme: dark) {
  .brand-mark {
    color: #10201a;
  }
}

/* ==========================================================================
   补充组件
   ========================================================================== */

body.locked {
  overflow: hidden;
}

.boot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 60px 4px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.boot .spinner {
  width: 15px;
  height: 15px;
  margin: 0;
}

mark {
  background: color-mix(in srgb, var(--gold) 26%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
}

.btn-label {
  display: none;
}

@media (min-width: 900px) {
  .btn-label {
    display: inline;
  }
}

.topbar-actions .btn.sm {
  height: 36px;
  padding: 0 13px;
}

.ai-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 13px 16px;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  background:
    radial-gradient(360px 120px at 0% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
}

.ai-banner-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}

.ai-banner-text {
  flex: 1;
  min-width: 0;
}

.ai-banner-text b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.ai-banner-text p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.gentle-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 17px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  color: var(--muted);
  font-size: 12.5px;
}

.gentle-empty .icon {
  color: var(--accent);
}

.today-footer {
  margin-top: 42px;
  display: flex;
  justify-content: center;
  color: var(--faint);
  font-size: 11px;
}

.today-footer span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.today-footer .icon {
  width: 13px;
  height: 13px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.empty-actions .btn {
  margin-top: 0;
}

.meta-tag {
  color: var(--faint);
  font-size: 10.5px;
}

.entry-meta .chip {
  height: 21px;
  padding: 0 7px;
  font-size: 10px;
}

.entry-meta .chip .icon {
  width: 10px;
  height: 10px;
}

.notes-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notes-filter-row .filter-row {
  flex: 1;
}

.category-select {
  width: 148px;
  flex: none;
  height: 34px;
  padding: 0 30px 0 11px;
  font-size: 12px;
}

.notes-count {
  margin: 2px 2px 10px;
  color: var(--faint);
  font-size: 11.5px;
  letter-spacing: 0.03em;
}

.book-searchbar {
  width: 230px;
  flex: none;
}

.book-toolbar {
  flex-wrap: wrap;
}

.book-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.book-tools .searchbar {
  flex: 1;
}

.book-cover > img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-cover > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-detail-cover {
  width: 124px;
}

.book-detail-cover .cf-title {
  font-size: 12.5px;
}

.detail-textarea {
  min-height: 190px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 16px;
  color: var(--accent);
  font-size: 12px;
  word-break: break-all;
}

.source-link .icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.select.compact {
  width: auto;
  height: 31px;
  padding: 0 28px 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.detail-meta .select {
  background-color: var(--surface-2);
  border-color: transparent;
}

.keypoints {
  margin-top: 10px;
}

.settings-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 14px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.settings-status .icon {
  width: 15px;
  height: 15px;
  flex: none;
}

.settings-status.ok {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  border-radius: 50%;
  border: 1.6px solid currentColor;
  border-right-color: transparent;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.act-add {
  flex: none;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10.5px;
  white-space: nowrap;
}

.act-add:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.action-item em {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-style: normal;
  font-size: 10.5px;
}

.import-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
}

.import-summary b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-summary span {
  flex: none;
  color: var(--muted);
}

.import-empty {
  border: 0;
  background: transparent;
  padding-top: 18px;
}

.review-history-item {
  width: 100%;
  text-align: left;
}

.review-history-item b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
}

.send-btn.stop {
  background: var(--warm);
}

.ask-context {
  margin-top: 14px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.chat-scroll {
  min-height: 60px;
}

.msg-text {
  overflow-wrap: anywhere;
}

/* 扫码 */
.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 14, 11, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s both;
}

.scanner-panel {
  width: min(440px, 100%);
  padding: 18px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.scanner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.scanner-head b {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
}

.scanner-video-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 13px;
  background: #141713;
}

.scanner-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 34%;
  height: 32%;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(10, 12, 9, 0.42);
}

.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.scan-frame::before {
  left: -1px;
  top: -1px;
  border-right: 0;
  border-bottom: 0;
  border-radius: 6px 0 0 0;
}

.scan-frame::after {
  right: -1px;
  bottom: -1px;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 6px 0;
}

.scanner-status {
  margin: 12px 2px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.scanner-manual {
  display: flex;
  gap: 8px;
}

.scanner-manual .input {
  flex: 1;
}

.scanner-note {
  margin-top: 12px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
}

@media (max-width: 899px) {
  .book-searchbar {
    width: 100%;
  }

  /* iOS 在字号小于 16px 的输入框聚焦时会自动放大页面 */
  .input,
  .textarea,
  .select,
  .searchbar input,
  .composer textarea {
    font-size: 16px;
  }

  .book-tools {
    width: 100%;
  }

  .notes-filter-row {
    align-items: stretch;
  }

  .category-select {
    width: 126px;
  }

  .ai-banner {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .ai-banner .btn {
    margin-left: 48px;
  }

  .modal-body {
    padding: 4px 18px 26px;
  }

  .book-detail-cover {
    width: 92px;
  }
}
