:root {
  /* 柔和现代书房风（Alabaster & Slate Ink） */
  --bg-canvas: #f4f5f7;
  --bg-surface: #ffffff;
  --bg-subtle: #eef0f4;
  --bg-glass: rgba(244, 245, 247, 0.86);
  --ink-primary: #181a1f;
  --ink-secondary: #5a606d;
  --ink-muted: #8f96a3;
  --border: rgba(24, 26, 31, 0.08);
  --border-strong: rgba(24, 26, 31, 0.15);

  --accent: #2b59c3;
  --accent-hover: #21479e;
  --accent-soft: rgba(43, 89, 195, 0.09);

  --sage: #1e7a52;
  --sage-soft: rgba(30, 122, 82, 0.10);
  --amber: #a86414;
  --amber-soft: rgba(168, 100, 20, 0.10);
  --crimson: #c23b3b;
  --crimson-soft: rgba(194, 59, 59, 0.10);

  --shadow-card: 0 8px 28px -6px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-float: 0 14px 36px -8px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.05);

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --card-font-size: 1.36rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  /* 柔和多阶灰度暗色系统：背景 -> 上下文卡 -> 聚焦卡 -> 控件 阶梯分明且不刺眼 */
  --bg-canvas: #111317;
  --bg-surface: #1b1e25;
  --bg-surface-active: #242832;
  --bg-subtle: #2b303c;
  --bg-glass: rgba(17, 19, 23, 0.88);
  --ink-primary: #e7eaf0;
  --ink-secondary: #b2b9c6;
  --ink-muted: #868f9e;
  --border: rgba(231, 234, 240, 0.10);
  --border-strong: rgba(231, 234, 240, 0.20);

  --accent: #6694f6;
  --accent-hover: #7ea6f8;
  --accent-soft: rgba(102, 148, 246, 0.16);

  --sage: #52c48c;
  --sage-soft: rgba(82, 196, 140, 0.16);
  --amber: #ebb054;
  --amber-soft: rgba(235, 176, 84, 0.16);
  --crimson: #f27979;
  --crimson-soft: rgba(242, 121, 121, 0.16);

  --shadow-card: 0 18px 42px -12px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-float: 0 18px 42px -10px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .memo-card[data-dist="0"] {
  background: var(--bg-surface-active);
  border-color: rgba(102, 148, 246, 0.42);
}

html[data-theme="dark"] .memo-card[data-dist="1"] {
  opacity: 0.66;
}

html[data-theme="dark"] .memo-card[data-dist="2"] {
  opacity: 0.40;
}

html[data-theme="dark"] .rate-btn kbd {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: inherit;
}

::selection { background: var(--accent-soft); color: var(--accent); }
* { box-sizing: border-box; margin: 0; padding: 0; caret-color: var(--accent); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

body {
  font-family: var(--font-sans);
  background: var(--bg-canvas);
  color: var(--ink-primary);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.24s var(--ease), color 0.24s var(--ease);
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--ink-secondary);
  line-height: 1;
}

.kbd-on-accent {
  background: rgba(255, 255, 255, 0.2);
  border-color: transparent;
  color: #ffffff;
}

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-group { display: flex; align-items: center; gap: 12px; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.94rem;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 0.86rem;
  font-weight: 600;
}

.doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-secondary);
  background: var(--bg-surface);
  max-width: 220px;
}

.doc-btn span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-btn:hover { border-color: var(--border-strong); color: var(--ink-primary); }

.mode-tabs {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 12px;
  gap: 2px;
  overflow-x: auto;
  max-width: 100%;
}

.mode-tab {
  height: 28px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: background-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.mode-tab.active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toolbar-right { display: flex; align-items: center; gap: 6px; }

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-btn:hover { background: var(--bg-surface); border-color: var(--border); color: var(--ink-primary); }
.tool-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.api-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); }
.api-dot.online { background: var(--sage); }

.due-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--crimson);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.granularity-switch {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 2px;
  border-radius: 9px;
  height: 32px;
  font-size: 0.76rem;
  flex-shrink: 0;
}

.granularity-switch button { padding: 0 10px; border-radius: 7px; color: var(--ink-secondary); white-space: nowrap; }
.granularity-switch button.active { background: var(--bg-surface); color: var(--ink-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.progress-rail { height: 2px; background: var(--border); width: 100%; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.35s var(--ease); }

/* 主工作区 */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  max-width: 1460px;
  margin: 0 auto;
  gap: 24px;
  padding: 24px 24px 128px;
  align-items: start;
}

.workspace.panel-closed { grid-template-columns: minmax(0, 1fr); }

.stream-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.stream-meta {
  width: 100%;
  max-width: 840px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  gap: 8px;
  flex-wrap: wrap;
}

.stream-meta-actions { display: flex; gap: 8px; }

.filter-chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-size: 0.78rem;
}

.filter-chip:hover { border-color: var(--border-strong); color: var(--ink-primary); }
.filter-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* 聚光灯卡片流 */
.card-stream {
  width: 100%;
  max-width: 840px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty-state {
  width: 100%;
  padding: 56px 24px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ink-secondary);
}

.memo-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  padding: 22px 26px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  transition:
    transform 0.36s var(--ease),
    opacity 0.36s var(--ease),
    filter 0.36s var(--ease),
    box-shadow 0.32s var(--ease),
    border-color 0.26s var(--ease),
    padding 0.3s var(--ease);
  will-change: transform, opacity;
}

.memo-card[data-dist="0"] {
  opacity: 1;
  filter: none;
  transform: translate3d(0, 0, 0) scale(1);
  border-color: rgba(43, 89, 195, 0.32);
  box-shadow: var(--shadow-card);
  padding: 34px 36px;
  cursor: default;
  z-index: 2;
}

.memo-card[data-dist="1"] {
  opacity: 0.56;
  filter: blur(0.45px);
  transform: translate3d(0, 0, 0) scale(0.985);
}

.memo-card[data-dist="2"] {
  opacity: 0.30;
  filter: blur(1.2px);
  transform: translate3d(0, 0, 0) scale(0.97);
}

.memo-card[data-dist="1"]:hover,
.memo-card[data-dist="2"]:hover {
  opacity: 0.86;
  filter: blur(0px);
}

.card-gutter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 5px;
}

.memo-card[data-dist="0"] .card-gutter { color: var(--accent); font-weight: 600; }

.status-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.st-mastered { background: var(--sage-soft); color: var(--sage); }
.st-fuzzy { background: var(--amber-soft); color: var(--amber); }
.st-forgot { background: var(--crimson-soft); color: var(--crimson); }

.card-main { min-width: 0; }

.card-text {
  font-family: var(--font-serif);
  font-size: var(--card-font-size);
  line-height: 1.9;
  color: var(--ink-primary);
  letter-spacing: 0.01em;
  white-space: pre-wrap;
}

/* 磨砂遮罩 */
.veil-box { position: relative; cursor: pointer; border-radius: 12px; }
.veil-text { transition: filter 0.28s var(--ease), opacity 0.28s var(--ease); }

.veil-box.masked .veil-text {
  filter: blur(10px);
  opacity: 0.36;
  user-select: none;
}

.veil-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.memo-card[data-dist="0"] .veil-box.masked .veil-prompt { opacity: 1; }

.veil-tag {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--ink-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  padding: 5px 14px;
  border-radius: 999px;
}

.card-extra { display: none; margin-top: 20px; }
.memo-card[data-dist="0"] .card-extra { display: block; }

.hint-line {
  font-size: 0.84rem;
  color: var(--ink-secondary);
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: 10px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.typing-area {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.75;
  min-height: 88px;
  resize: vertical;
  margin-bottom: 10px;
}

.typing-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.diff-result {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-subtle);
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.8;
  margin-bottom: 10px;
}

.diff-ok { color: var(--sage); }
.diff-miss { color: var(--crimson); text-decoration: underline wavy var(--crimson); font-weight: 600; }
.diff-extra { color: var(--amber); text-decoration: line-through; opacity: 0.8; }

.ai-grade-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--ink-primary);
  font-size: 0.84rem;
  line-height: 1.65;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.card-actions {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.action-left, .rating-group { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--bg-surface);
  transition: background-color 0.16s, border-color 0.16s;
}

.btn-sm { height: 28px; padding: 0 10px; font-size: 0.76rem; border-radius: 8px; }
.btn:hover { background: var(--bg-subtle); }
.btn-accent { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.link-btn { font-size: 0.76rem; color: var(--ink-secondary); }
.link-btn:hover { color: var(--ink-primary); }
.link-accent { color: var(--accent); font-weight: 500; }

.rate-btn {
  height: 34px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s;
}

.rate-btn:active { transform: scale(0.96); }
.rate-forgot { background: var(--crimson-soft); color: var(--crimson); }
.rate-fuzzy { background: var(--amber-soft); color: var(--amber); }
.rate-mastered { background: var(--sage-soft); color: var(--sage); }

/* 右侧面板 */
.side-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 76px;
  max-height: calc(100dvh - 104px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.side-panel.desktop-hidden { display: none; }

.side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 6px;
  gap: 4px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.side-tab {
  height: 32px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-secondary);
}

.side-tab.active {
  color: var(--ink-primary);
  background: var(--bg-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.side-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.side-pane { display: none; flex-direction: column; flex: 1; }
.side-pane.active { display: flex; }

.mobile-panel-bar { display: none; justify-content: flex-end; margin-bottom: 8px; }

/* 思维导图 */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: 10px;
  font-size: 0.78rem;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}

.mm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mm-caption { font-size: 0.76rem; color: var(--ink-muted); }

.mm-stage { position: relative; padding: 4px 0; }
.mm-svg-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.mm-path { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.mm-layout { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }

.mm-root-box {
  align-self: flex-start;
  padding: 7px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 600;
}

.mm-branches { display: flex; flex-direction: column; gap: 14px; padding-left: 16px; }
.mm-branch-row { display: flex; align-items: flex-start; gap: 14px; }
.mm-branch-node {
  flex-shrink: 0;
  width: 88px;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--bg-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.mm-leaves-col { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mm-leaf-node {
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 0.8rem;
  line-height: 1.5;
  cursor: pointer;
}

.mm-stage.mask-leaves .mm-leaf-node span { filter: blur(5px); user-select: none; transition: filter 0.2s; }
.mm-stage.mask-leaves .mm-leaf-node.peek span { filter: none; }

/* DeepSeek 对话 */
.chat-status-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--bg-subtle);
  font-size: 0.76rem;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 14px;
  min-height: 240px;
}

.chat-msg {
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 0.83rem;
  line-height: 1.65;
  word-break: break-word;
}

.chat-msg.user {
  align-self: flex-end;
  max-width: 88%;
  background: var(--accent);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.chat-msg.ai {
  align-self: flex-start;
  max-width: 96%;
  background: var(--bg-subtle);
  color: var(--ink-primary);
  border-bottom-left-radius: 4px;
}

/* 轻量 Markdown 渲染样式 */
.md-body p { margin: 0 0 6px; }
.md-body p:last-child { margin-bottom: 0; }
.md-body strong { font-weight: 600; color: var(--ink-primary); }
.md-body ul, .md-body ol { margin: 4px 0 8px 18px; padding: 0; }
.md-body li { margin-bottom: 3px; }
.md-body code {
  font-family: var(--font-mono);
  font-size: 0.78em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.md-body .md-h {
  font-weight: 600;
  font-size: 0.88rem;
  margin: 8px 0 4px;
  color: var(--accent);
}

/* 自测队列专属控制条与全篇默写卡 */
.selftest-bar {
  width: 100%;
  max-width: 840px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 0.8rem;
}

.seg-group {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 2px;
  border-radius: 9px;
  gap: 2px;
}

.seg-btn {
  height: 26px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.fulltext-exam-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid rgba(43, 89, 195, 0.28);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 28px 32px;
}

.exam-orig-box {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.12rem;
  line-height: 1.9;
  white-space: pre-wrap;
}

.chat-quick-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.quick-ask {
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--ink-secondary);
}

.quick-ask:hover { border-color: var(--accent); color: var(--accent); }

.chat-composer {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ds-input {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-size: 0.82rem;
}

/* 底部朗读条 */
.tts-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  border-radius: 999px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 16px);
  overflow-x: auto;
}

.play-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.tts-label { font-size: 0.78rem; color: var(--ink-secondary); white-space: nowrap; }

.tts-chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tts-chip.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--ink-muted);
  white-space: nowrap;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

/* 导入与设置弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-backdrop.open { display: flex; }

.modal-card {
  width: 100%;
  max-width: 740px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-float);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
}

.modal-nav-tabs {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 11px;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

.modal-nav-tabs::-webkit-scrollbar { display: none; }

.modal-nav-tab {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.close-label-mobile { display: none; }

/* 艾宾浩斯任务列表 */
.task-create-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card.due {
  border-color: var(--crimson);
}

.task-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.task-status-pill {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

.task-pill-due { background: var(--crimson-soft); color: var(--crimson); }
.task-pill-wait { background: var(--accent-soft); color: var(--accent); }
.task-pill-done { background: var(--sage-soft); color: var(--sage); }

.ebbinghaus-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.eb-dot {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.eb-dot.done { background: var(--sage-soft); color: var(--sage); }
.eb-dot.current { background: var(--accent); color: #ffffff; font-weight: 600; }

.task-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--ink-secondary);
}

.task-ops { display: flex; gap: 6px; flex-wrap: wrap; }

.modal-nav-tab.active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.modal-pane { display: none; }
.modal-pane.active { display: block; }

.preview-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
}

.field-group { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

.rule-panel-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.extra-prompt-wrap {
  padding-top: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* 纯图片与图文插图编辑区 */
.img-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  padding: 26px 16px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-secondary);
  background: var(--bg-canvas);
  cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s;
  margin-bottom: 14px;
}

.img-dropzone:hover, .img-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pure-img-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.pure-img-item {
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pure-img-thumb {
  width: 100%;
  height: 112px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-subtle);
}

.para-img-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-left: 22px;
}

.para-img-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.76rem;
}

.para-img-chip img {
  width: 36px;
  height: 28px;
  object-fit: cover;
  border-radius: 5px;
}

/* 图片卡片蒙蔽与按住全亮（PC + 移动端通用） */
.workspace.image-doc .stream-meta,
.workspace.image-doc .card-stream {
  max-width: 1120px;
}

.workspace.image-doc .img-veil-media {
  max-height: 70dvh;
}

/* 全屏可伸缩看图浮层 */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 13, 16, 0.92);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
}

.img-lightbox.open { display: flex; }

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 2;
}

.lightbox-scale {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #e7eaf0;
  min-width: 48px;
  text-align: center;
}

.lightbox-stage {
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.lightbox-stage:active { cursor: grabbing; }

.lightbox-img {
  max-width: 92vw;
  max-height: 84dvh;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  user-select: none;
  pointer-events: none;
}

.img-veil-box {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.img-veil-media {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  margin: 0 auto;
  transition: filter 0.14s ease, opacity 0.14s ease;
  pointer-events: none;
}

.img-veil-box.masked .img-veil-media {
  filter: blur(22px) brightness(0.65);
  opacity: 0.45;
}

.img-veil-box.peeking .img-veil-media {
  filter: none !important;
  opacity: 1 !important;
}

.img-veil-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.memo-card[data-dist="0"] .img-veil-box.masked:not(.peeking) .img-veil-overlay {
  opacity: 1;
}

.img-caption-line {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

.modal-section {
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

.section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.84rem;
  flex-wrap: wrap;
}

.status-note { font-size: 0.78rem; color: var(--ink-muted); }
.inline-form { display: flex; gap: 8px; }

.doc-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ds-select {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 0.8rem;
  font-family: inherit;
}

.doc-table-wrap {
  max-height: 270px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-surface);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.doc-table th {
  position: sticky;
  top: 0;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
}

.doc-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.doc-table tbody tr {
  cursor: pointer;
  transition: background-color 0.14s;
}

.doc-table tbody tr:last-child td { border-bottom: none; }
.doc-table tbody tr:hover { background: var(--bg-canvas); }
.doc-table tbody tr.active { background: var(--accent-soft); }

.doc-type-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  margin-left: 6px;
}

.doc-del { font-size: 0.74rem; color: var(--ink-muted); padding: 0 4px; }
.doc-del:hover { color: var(--crimson); }

.strategy-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.strategy-tab {
  flex: 1;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: 0.8rem;
  color: var(--ink-secondary);
}

.strategy-tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 500; }

.rule-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.n-input {
  width: 54px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  text-align: center;
  font-family: var(--font-mono);
}

.para-editor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.para-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.para-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.para-cards-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 22px;
}

.para-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-canvas);
}

.para-card-ops { display: flex; gap: 4px; flex-shrink: 0; }

/* Toast */
.toast {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 120;
  background: var(--ink-primary);
  color: var(--bg-surface);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

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

/* 手机端适配：背诵区域填满屏幕，导图/对话默认隐藏点击弹出 */
@media (max-width: 960px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .brand-group { width: 100%; justify-content: space-between; }
  .doc-btn { max-width: 56vw; height: 30px; font-size: 0.78rem; }
  .mode-tabs { width: 100%; justify-content: space-between; }
  .mode-tab { flex: 1; text-align: center; padding: 0 6px; font-size: 0.76rem; }
  .toolbar-right {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 6px;
    justify-content: space-between;
  }
  .toolbar-right::-webkit-scrollbar { display: none; }
  .granularity-switch { height: 28px; }
  .granularity-switch button { padding: 0 8px; font-size: 0.74rem; }
  .tool-btn { height: 28px; padding: 0 9px; font-size: 0.74rem; }
  .workspace { grid-template-columns: 1fr; padding: 12px 8px 96px; gap: 0; }
  .stream-meta { max-width: 100%; margin-bottom: 10px; padding: 0 4px; }
  .card-stream { max-width: 100%; gap: 10px; }
  .memo-card { grid-template-columns: 38px 1fr; gap: 10px; padding: 18px 14px; border-radius: 16px; }
  .memo-card[data-dist="0"] { padding: 24px 16px; min-height: 48dvh; }
  .side-panel {
    display: none;
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 70px;
    top: auto;
    max-height: 70dvh;
    z-index: 65;
  }
  .side-panel.mobile-open { display: flex; }
  .mobile-panel-bar { display: flex; }
  .kbd-hint { display: none; }

  /* 手机端弹窗排版优化：单行标签不换行、紧凑关闭按钮、留白舒适 */
  .modal-backdrop { padding: 8px; }
  .modal-card { padding: 16px 14px; border-radius: 16px; max-height: 92dvh; }
  .modal-nav-tab { padding: 0 10px; font-size: 0.78rem; height: 28px; }
  .close-label-desktop { display: none; }
  .close-label-mobile { display: inline; }
  .modal-close-btn { width: 30px; padding: 0; justify-content: center; flex-shrink: 0; }
  .doc-table-wrap { overflow-x: auto; }
  .doc-table { min-width: 420px; }
}
