/* iLearning · 设计系统
   设计语言参考 shadcn/ui：中性底 + 1px 半透明描边（不用阴影）+ 4px 刻度 + 双主题。
   主题由 <html data-theme-mode> 切换，cookie 记忆，模板里内联 boot 脚本避免闪屏。

   原则：状态用文字 + 颜色双编码（不靠颜色单独表意）；对比度 >= 4.5:1；
   不发成就弹窗、不做连胜动画。 */

/* ---------------------------------------------------------------- token */

:root {
  /* 尺寸刻度：4px 基准 */
  --sidebar-w: 17rem;          /* 272px */
  --sidebar-w-collapsed: 3rem; /* 48px 图标条 */
  --topbar-h: 48px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --control-h: 32px;           /* 按钮 / 输入 / select */
  --control-h-sm: 28px;
  --control-h-xs: 24px;
  --ring-w: 3px;
}

/* 亮色（默认）：纯白底，主色近黑，蓝紫作强调 */
:root,
[data-theme-mode="light"] {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --card: #ffffff;
  --panel: #f7f8f9;
  --panel-2: #f0f2f4;
  --text: #101318;
  --muted: #626b7a;
  --faint: #8b94a3;
  --primary: #171b22;          /* 黑底白字按钮 */
  --primary-fg: #ffffff;
  --accent: #5b5bd6;           /* 蓝紫强调：链接、选中、进度 */
  --accent-soft: rgba(91, 91, 214, .10);
  --accent-border: rgba(91, 91, 214, .28);
  --border: rgba(16, 19, 24, .10);   /* ring-1 ring-foreground/10 */
  --border-soft: rgba(16, 19, 24, .07);
  --border-strong: rgba(16, 19, 24, .16);
  --input-bg: rgba(16, 19, 24, .02);
  --scrim: rgba(16, 19, 24, .32);

  /* 语义状态：15% 底 + 深色字 + 20% 描边 */
  --ok: #0f7b46;      --ok-bg: rgba(16, 185, 129, .15);   --ok-bd: rgba(16, 185, 129, .20);
  --warn: #96620a;    --warn-bg: rgba(245, 158, 11, .15); --warn-bd: rgba(245, 158, 11, .20);
  --err: #c0342c;     --err-bg: rgba(239, 68, 68, .15);   --err-bd: rgba(239, 68, 68, .20);
  --info: #1d4ed8;    --info-bg: rgba(59, 130, 246, .15); --info-bd: rgba(59, 130, 246, .20);
  --violet: #6d28d9;  --violet-bg: rgba(139, 92, 246, .15); --violet-bd: rgba(139, 92, 246, .20);
  --slate: #475569;   --slate-bg: rgba(100, 116, 139, .15); --slate-bd: rgba(100, 116, 139, .20);

  --shadow-sm: 0 1px 2px rgba(16, 19, 24, .06);
  --shadow-md: 0 4px 12px rgba(16, 19, 24, .08);
  --shadow-lg: 0 12px 32px rgba(16, 19, 24, .12);
  color-scheme: light;
}

/* 暗色：卡片比底亮一档（层次靠明度，不靠阴影） */
[data-theme-mode="dark"] {
  --bg: #0b0d11;
  --bg-soft: #101318;
  --card: #15191f;
  --panel: #1a1f27;
  --panel-2: #212734;
  --text: #e7eaee;
  --muted: #949cab;
  --faint: #6b7482;
  --primary: #eef1f5;          /* 暗色下主色反相为近白 */
  --primary-fg: #101318;
  --accent: #8b8bf0;
  --accent-soft: rgba(139, 139, 240, .14);
  --accent-border: rgba(139, 139, 240, .34);
  --border: rgba(255, 255, 255, .10);
  --border-soft: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .18);
  --input-bg: rgba(255, 255, 255, .04);
  --scrim: rgba(0, 0, 0, .55);

  --ok: #4ade80;       --ok-bg: rgba(74, 222, 128, .14);   --ok-bd: rgba(74, 222, 128, .22);
  --warn: #fbbf24;     --warn-bg: rgba(251, 191, 36, .14); --warn-bd: rgba(251, 191, 36, .22);
  --err: #f87171;      --err-bg: rgba(248, 113, 113, .14); --err-bd: rgba(248, 113, 113, .22);
  --info: #7aa2f7;     --info-bg: rgba(122, 162, 247, .14); --info-bd: rgba(122, 162, 247, .22);
  --violet: #c4b5fd;   --violet-bg: rgba(196, 181, 253, .14); --violet-bd: rgba(196, 181, 253, .22);
  --slate: #a3b0c2;    --slate-bg: rgba(163, 176, 194, .14); --slate-bd: rgba(163, 176, 194, .22);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}
code {
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
pre {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
}

h1 { font-size: 19px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 13.5px; margin: 0 0 8px; font-weight: 600; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 14px 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.mono-num { font-variant-numeric: tabular-nums; }

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

/* 细滚动条：不抢视觉 */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }

/* 统一焦点环 */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 var(--ring-w) var(--accent-soft);
}

/* 尊重系统减弱动效设置 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

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

.layout { display: flex; height: 100%; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  transition: width .16s ease, flex-basis .16s ease;
  overflow: hidden;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 8px 14px;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--primary); color: var(--primary-fg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px; flex: 0 0 26px; letter-spacing: -.02em;
}
.brand-name { font-weight: 600; letter-spacing: .01em; font-size: 14px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { margin-top: 10px; }
.nav-group-title {
  font-size: 11px; color: var(--faint);
  padding: 6px 10px 4px; letter-spacing: .04em;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px;
  transition: background .12s ease, color .12s ease;
  white-space: nowrap;
}
.nav-item:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-item.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--accent-border);
}
.nav-item .icon { flex: 0 0 16px; width: 16px; height: 16px; }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border-soft); }

/* 折叠成图标条：只留图标，hover 出 tooltip */
.sidebar.is-collapsed { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); padding-left: 6px; padding-right: 6px; }
.sidebar.is-collapsed .brand-name,
.sidebar.is-collapsed .nav-group-title,
.sidebar.is-collapsed .nav-item span:not(.icon),
.sidebar.is-collapsed .nav-collapse-label { display: none; }
.sidebar.is-collapsed .nav-item { justify-content: center; padding: 6px 0; }

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

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 12px;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-right .muted { white-space: nowrap; }

.content { flex: 1; overflow-y: auto; padding: 16px 20px 56px; }
@media (min-width: 900px) { .content { padding: 24px 24px 56px; } }
.narrow { max-width: 880px; margin: 0 auto; }
.wide { max-width: 1320px; margin: 0 auto; }

/* ---------------------------------------------------------------- 组件 */

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* 卡片：1px 半透明描边，不靠阴影 */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
}
.card.tight { padding: 12px; }
.card.flat { box-shadow: 0 0 0 1px var(--border); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.card-head h3 { margin: 0; }

/* 按钮：32px 高、8px 圆角、按下 1px 下沉 */
.btn-primary, .btn-ghost, .btn-outline, .btn-danger {
  height: var(--control-h);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); padding: 0 12px;
  font-size: 13px; font-family: inherit; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease, opacity .12s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 86%, var(--accent)); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel); text-decoration: none; }
.btn-outline { background: var(--card); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--panel); text-decoration: none; }
.btn-danger { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }
.btn-danger:hover { background: color-mix(in srgb, var(--err-bg) 70%, var(--err)); text-decoration: none; }

.btn-primary:active, .btn-ghost:active, .btn-outline:active, .btn-danger:active { transform: translateY(1px); }
.btn-primary:disabled, .btn-ghost:disabled, .btn-outline:disabled, .btn-danger:disabled {
  opacity: .45; cursor: not-allowed; transform: none;
}
.btn-primary .icon, .btn-ghost .icon, .btn-outline .icon, .btn-danger .icon { width: 14px; height: 14px; }

.btn-sm { height: var(--control-h-sm); padding: 0 10px; font-size: 12px; }
.btn-xs { height: var(--control-h-xs); padding: 0 8px; font-size: 11.5px; border-radius: 5px; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-icon.btn-sm { width: var(--control-h-sm); }
.btn-ghost.small { height: var(--control-h-xs); padding: 0 8px; font-size: 11.5px; }

/* 分段控件：胶囊底 + 激活项浮起 */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--panel); border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--border);
}
.seg-btn {
  background: transparent; border: 0; color: var(--muted);
  padding: 0 10px; height: 26px; font-size: 12px; cursor: pointer;
  font-family: inherit; border-radius: 5px;
  transition: background .12s ease, color .12s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on {
  background: var(--accent); color: var(--primary-fg); font-weight: 600;
  box-shadow: 0 0 0 1px var(--accent-border);
}

/* 表单 */
input[type="text"], input[type="password"], input[type="number"], input[type="file"],
textarea, select {
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 10px; height: var(--control-h);
  font-size: 13px; font-family: inherit; width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
input[type="file"] { padding: 4px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 var(--ring-w) var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%),
                    linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.field { display: block; margin-bottom: 10px; }
.field-inline { display: flex; align-items: center; gap: 8px; }
.label { color: var(--muted); font-size: 12px; margin-bottom: 4px; display: block; }
.field-inline .label { margin-bottom: 0; }
.field-inline select, .field-inline input { width: auto; min-width: 150px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input[type="text"] { flex: 1; min-width: 180px; }
.row select { width: auto; }
.hint { color: var(--faint); font-size: 11.5px; margin-top: 6px; }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 34px; height: 20px; border-radius: 999px;
  background: var(--border-strong); position: relative;
  transition: background .15s ease; flex: 0 0 34px;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 var(--ring-w) var(--accent-soft); }

.actions { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.actions-inline { display: flex; gap: 8px; flex-wrap: wrap; }

/* chip / 状态：软色底 + 深色字 + 淡描边 */
.tag, .chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 1px 8px; line-height: 18px;
  border-radius: 999px; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border-soft); white-space: nowrap;
}
.chip .icon { width: 12px; height: 12px; }
.tag.ok,    .chip.ok    { color: var(--ok);    background: var(--ok-bg);    border-color: var(--ok-bd); }
.tag.warn,  .chip.warn  { color: var(--warn);  background: var(--warn-bg);  border-color: var(--warn-bd); }
.tag.err,   .chip.err   { color: var(--err);   background: var(--err-bg);   border-color: var(--err-bd); }
.tag.info,  .chip.info  { color: var(--info);  background: var(--info-bg);  border-color: var(--info-bd); }
.tag.violet,.chip.violet{ color: var(--violet);background: var(--violet-bg);border-color: var(--violet-bd); }
.tag.slate, .chip.slate { color: var(--slate); background: var(--slate-bg); border-color: var(--slate-bd); }

/* 状态点：实时用 ping 扩散 */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 7px; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-err { background: var(--err); }
.dot-live { position: relative; }
.dot-live::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--ok); animation: ping 1.6s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

/* 进度条：1px 高的细条（学习进度不是装饰） */
.progress { height: 3px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.progress.ok > i { background: var(--ok); }
.progress.warn > i { background: var(--warn); }
.progress.err > i { background: var(--err); }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
  height: 12px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态：虚线框，不做大面积色块 */
.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px 20px; text-align: center; color: var(--muted);
}
.empty .empty-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--panel); display: grid; place-items: center;
  margin: 0 auto 10px; color: var(--faint);
}
.empty .empty-icon .icon { width: 16px; height: 16px; }
.empty p { margin: 0 auto; max-width: 42ch; font-size: 13px; }

.callout {
  border-left: 2px solid var(--accent);
  background: var(--accent-soft); padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0; font-size: 13px;
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout.err { border-left-color: var(--err); background: var(--err-bg); }
.skip-badge {
  display: inline-flex; align-items: center; font-size: 12px; color: var(--muted);
  background: var(--card); border: 1px dashed var(--border-strong);
  padding: 4px 10px; border-radius: var(--radius-sm);
}

.kbd {
  display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: 11px;
  padding: 1px 5px; border-radius: 4px; background: var(--panel);
  border: 1px solid var(--border-strong); color: var(--muted);
}

/* ---------------------------------------------------------------- 今日计划 */

.plan { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.plan-item {
  background: var(--card);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
  border-radius: var(--radius-lg); padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.plan-item .step { font-weight: 600; font-size: 13.5px; }
.plan-item .eta { color: var(--muted); font-size: 12px; }
.plan-item.is-done { opacity: .62; }
.plan-item.is-done .step { text-decoration: line-through; }

/* ---------------------------------------------------------------- 地图 */

.routes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.route-card {
  background: var(--card);
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.route-card:hover { box-shadow: 0 0 0 1px var(--border), var(--shadow-md); }
.route-card .name { font-weight: 600; margin-bottom: 4px; font-size: 13.5px; }
.route-card .claim { font-size: 12px; color: var(--muted); }

.tree { margin-top: 12px; }
.tree-group { margin-bottom: 16px; }
.tree-group-title {
  color: var(--faint); font-size: 11.5px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px; letter-spacing: .02em;
}
.node {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .12s ease;
}
.node:hover { background: var(--panel); }
.node-name { width: 190px; flex: 0 0 190px; font-size: 13px; }
.mastery-bar {
  flex: 1; height: 3px; background: var(--panel-2);
  border-radius: 999px; overflow: hidden; max-width: 220px;
}
.mastery-fill { height: 100%; background: var(--accent); transition: width .3s ease; }
.mastery-fill.ok { background: var(--ok); }
.mastery-fill.warn { background: var(--warn); }
/* 测验小结里的进度条是单独出现的（不在 .node 的 flex 行里），要自己撑开 */
.mastery-bar.is-wide { display: block; width: 100%; max-width: 280px; height: 6px; }
.node-state { width: 120px; text-align: right; font-size: 12px; color: var(--muted); }

/* 四档自报：目的是决定"不教什么"，所以要能一键点掉 */
.self-report { display: flex; gap: 4px; margin-left: auto; }
.sr-btn {
  background: transparent; border: 1px solid var(--border-strong); color: var(--muted);
  border-radius: 5px; padding: 1px 7px; font-size: 11px; cursor: pointer;
  font-family: inherit; transition: all .12s ease;
}
.sr-btn:hover { border-color: var(--accent); color: var(--text); }
.sr-btn.is-on {
  background: var(--accent); border-color: var(--accent); color: var(--primary-fg);
  font-weight: 600; box-shadow: 0 0 0 1px var(--accent-border);
}

/* 概念图（力导向 SVG，无外部依赖） */
.graph-wrap {
  position: relative; background: var(--bg-soft);
  border-radius: var(--radius-lg); box-shadow: 0 0 0 1px var(--border);
  overflow: hidden;
}
.graph-wrap svg { display: block; width: 100%; height: 520px; touch-action: none; }
.graph-legend {
  position: absolute; left: 10px; bottom: 10px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm); box-shadow: 0 0 0 1px var(--border);
  padding: 8px 10px; font-size: 11.5px; color: var(--muted);
  display: flex; flex-direction: column; gap: 4px;
}
.graph-legend .k { display: flex; align-items: center; gap: 6px; }
.graph-node { cursor: pointer; }
.graph-node circle { transition: stroke-width .12s ease; }
.graph-node:hover circle { stroke-width: 2.5; }
.graph-node.is-sel circle { stroke: var(--accent); stroke-width: 2.5; }
.graph-node text { font-size: 11px; fill: var(--text); pointer-events: none; }
.graph-edge { stroke: var(--border-strong); stroke-width: 1; }

/* ---------------------------------------------------------------- 对话 */

.chat {
  background: var(--card);
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  min-height: 240px; max-height: 56vh; overflow-y: auto; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
/* 学习舱的对话区更高：长回答要能纵向读下去，不用在小框里滚 */
.study-log { max-height: 68vh; min-height: 320px; }
.msg { max-width: 92%; }
/* 回答正文：块级元素一律占满整行向下排列，绝不横向延伸 */
.msg-answer { align-self: flex-start; width: 100%; max-width: 100%; }
.answer-body {
  display: block; width: 100%; max-width: 100%;
  white-space: normal; overflow-wrap: anywhere; word-break: break-word;
  font-size: 13.5px; line-height: 1.75;
}
.msg-user { align-self: flex-end; overflow-wrap: anywhere; }
.msg-meta {
  font-size: 11px; color: var(--faint); margin-bottom: 3px;
  display: flex; gap: 6px; align-items: center;
}
.msg-user .msg-meta { justify-content: flex-end; }
.bubble {
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13.5px;
  line-height: 1.7; overflow-wrap: anywhere;
}
.msg-user .bubble {
  background: var(--primary); color: var(--primary-fg);
  border-top-right-radius: 2px;
}
.msg-answer .bubble { background: var(--panel); border-top-left-radius: 2px; }
.msg-pending { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }

.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer input, .composer textarea { flex: 1; }
.composer .btn-primary { height: var(--control-h); }

/* ---------------------------------------------------------------- 列表 */

.list { list-style: none; padding: 0; margin: 0; }
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--panel); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.table tbody tr:hover { background: var(--panel); }

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

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(6px);
  background: var(--card); color: var(--text);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-lg);
  border-radius: var(--radius-sm); padding: 8px 14px; z-index: 60; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  opacity: 0; transition: opacity .16s ease, transform .16s ease;
  max-width: 90vw;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .dot { flex: 0 0 7px; }
.toast.ok .dot { background: var(--ok); }
.toast.err .dot { background: var(--err); }
.toast.warn .dot { background: var(--warn); }

/* ---------------------------------------------------------------- 活动流 */

.event-row {
  display: flex; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 12px;
  align-items: baseline;
}
.event-actor { color: var(--violet); width: 92px; flex: 0 0 92px; font-size: 11.5px; }
.event-msg { color: var(--text); }
.event-time { color: var(--faint); margin-left: auto; font-size: 11px; white-space: nowrap; }
.event-row.level-error .event-msg { color: var(--err); }
.event-row.level-warn .event-msg { color: var(--warn); }

/* ---------------------------------------------------------------- 面试 */

/* 取消沉浸式：之前面试页隐藏侧栏/顶栏，导致进去后没有返回入口。所有页面统一保留导航。 */
.setup { display: grid; gap: 10px; }

/* ---------------------------------------------------------------- 报告 */

.report-section { margin-bottom: 18px; }
.markdown { color: var(--text); font-size: 13.5px; line-height: 1.75; }
.markdown h1, .markdown h2, .markdown h3 { margin-top: 18px; }
.markdown ul, .markdown ol { padding-left: 22px; }
.markdown blockquote {
  margin: 10px 0; padding: 2px 12px;
  border-left: 2px solid var(--accent); color: var(--muted);
}

/* ---------------------------------------------------------------- 网格工具 */

.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* 统计卡片：数字为主，标签为辅 */
.stat {
  background: var(--card); box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px;
}
.stat .v { font-size: 22px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- 对话来源提示 */
.conv-source-note {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; color: var(--muted); line-height: 1.5;
  background: var(--card); box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-lg); padding: 9px 12px; margin-bottom: 10px;
}
.conv-source-note .icon { width: 15px; height: 15px; margin-top: 1px; color: #b8860b; flex: none; }
.conv-source-note code { font-size: 11px; padding: 1px 5px; border-radius: 4px; background: var(--bg); box-shadow: 0 0 0 1px var(--border); }

/* 学习舱：自动开讲的章节标题（区别于用户发言） */
.msg-lesson {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--bg); box-shadow: 0 0 0 1px var(--border);
  border-radius: 999px; padding: 3px 12px; margin: 6px 0;
}
.msg-lesson .icon { width: 13px; height: 13px; }

/* 学习舱：今日术语队列（当前高亮、已完成打勾、可点跳讲） */
/* 展开全部术语时别把页面撑爆：超过一屏多就内部滚动 */
.lesson-queue {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  max-height: 168px; overflow-y: auto; align-content: flex-start;
}
.lesson-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px;
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
  background: var(--bg); box-shadow: 0 0 0 1px var(--border); color: var(--muted);
}
.lesson-chip:hover { box-shadow: 0 0 0 1px var(--accent); }
.lesson-chip.is-cur { color: var(--text); font-weight: 600; box-shadow: 0 0 0 1.5px var(--accent); }
.lesson-chip.is-done { color: var(--ok); }
/* 还没轮到的术语：按顺序学，不能跳着点 */
.lesson-chip.is-locked { opacity: .45; cursor: not-allowed; }
.lesson-chip.is-locked:hover { box-shadow: 0 0 0 1px var(--border); }
/* 展开 / 收起 */
.lesson-toggle { color: var(--accent); box-shadow: 0 0 0 1px var(--accent-border); }
.lesson-toggle:hover { background: var(--accent-soft); }

/* 学习舱：回答正文的 Markdown 版式 */
.answer-body .md-h { display: block; width: 100%; }
.msg-answer .md-h {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.msg-answer .md-h:first-child { margin-top: 4px; }
.msg-answer .md-p { margin: 6px 0; line-height: 1.75; font-size: 13.5px; }
.msg-answer .md-ul { margin: 6px 0; padding-left: 20px; list-style: disc; }
.msg-answer .md-ul li { margin: 4px 0; line-height: 1.7; font-size: 13.5px; }
.msg-answer code {
  font-size: 12px; padding: 1px 5px; border-radius: 4px;
  background: var(--bg); box-shadow: 0 0 0 1px var(--border);
}
.msg-answer b { color: var(--text); }

/* 学习舱：回答后的「接着问」—— 固定 4 个，装在下面一个框里 */
.followups {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--border);
}
.followups-title { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.followups-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fu-btn {
  width: 100%; text-align: left; font-family: inherit; font-size: 12.5px; line-height: 1.5;
  padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--text);
  background: var(--card); border: 1px solid var(--border);
}
.fu-btn:hover { border-color: var(--accent); color: var(--accent); }
/* 流式输出光标 */
.cursor {
  display: inline-block; width: 2px; height: 1em; margin-left: 2px;
  background: var(--accent); vertical-align: text-bottom; animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* ---------------------------------------------------------------- 页面导览
   每个功能页顶部一块：这页是干什么的 + 在学习主线里的位置。
   主线：对话 → 资料库 → 学习舱 → 地图 → 练习 → 面试 → 报告 */
.page-guide {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 12.5px; color: var(--muted); line-height: 1.65;
  background: var(--card); box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 14px;
}
.page-guide .icon { width: 15px; height: 15px; margin-top: 3px; color: #b8860b; flex: none; }
.page-guide b { color: var(--text); font-weight: 600; }
.page-guide code { font-size: 11px; padding: 1px 5px; border-radius: 4px; background: var(--bg); box-shadow: 0 0 0 1px var(--border); }
/* 流程条「对话 → 资料库 → …」：page-help（页内）与 help-body（问号浮卡）共用一套。
   注意别把选择器写成 .page-guide —— 那个类名早就改掉了，样式会整段失效。 */
.page-help .flow, .help-body .flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px; font-size: 11.5px;
}
.page-help .flow .step, .help-body .flow .step {
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--bg); box-shadow: 0 0 0 1px var(--border); color: var(--muted);
}
.page-help .flow .step.cur, .help-body .flow .step.cur {
  color: var(--accent); font-weight: 600;
  background: var(--accent-soft); box-shadow: 0 0 0 1.5px var(--accent-border);
}
.page-help .flow .arrow, .help-body .flow .arrow { margin: 0 1px; color: var(--faint); }

/* 资料库：资料行 + 段落展开 */
.src-item { display: flex; flex-direction: column; gap: 6px; }
.passages {
  display: flex; flex-direction: column; gap: 6px; margin-top: 4px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--border);
  max-height: 320px; overflow-y: auto;
}
.passage-item { font-size: 12px; line-height: 1.6; color: var(--muted); }
.passage-item .tag { margin-right: 6px; }


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

@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .2s cubic-bezier(.32, .72, 0, 1);
    width: 18rem; flex-basis: 18rem;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-collapsed { width: 18rem; flex-basis: 18rem; }
  .sidebar.is-collapsed .brand-name,
  .sidebar.is-collapsed .nav-group-title,
  .sidebar.is-collapsed .nav-item span:not(.icon) { display: inline; }
  .sidebar.is-collapsed .nav-item { justify-content: flex-start; padding: 6px 10px; }
  .content { padding: 14px 14px 48px; }
  .node-name { width: auto; flex: 1 1 auto; }
  .node-state { width: auto; }
}

@media print {
  .sidebar, .topbar, .toast, .actions, .composer { display: none !important; }
  .content { padding: 0; overflow: visible; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---------------------------------------------------------------- 总览 / 仪表盘 */

.page { max-width: 1180px; margin: 0 auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi {
  background: var(--card); border-radius: var(--radius-lg); padding: 13px 14px;
  box-shadow: 0 0 0 1px var(--border);
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value {
  font-size: 25px; font-weight: 600; letter-spacing: -.02em;
  margin: 5px 0 3px; font-variant-numeric: tabular-nums; line-height: 1.15;
}
.kpi-note { font-size: 11px; color: var(--faint); }
.kpis-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; }
.kpis-3 .kpi-value { font-size: 21px; }

.chart { padding-top: 6px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.chart-sm .bars { height: 84px; }
.bar-wrap {
  flex: 1 1 0; min-width: 3px; height: 100%; display: flex; align-items: flex-end;
  background: var(--panel); border-radius: 3px; overflow: hidden;
}
.bar { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; transition: height .25s ease; }
.bar-wrap:hover .bar { opacity: .72; }
.bars-axis {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--faint); margin-top: 6px;
}

.feed { display: flex; flex-direction: column; gap: 2px; max-height: 330px; overflow-y: auto; }
.feed-item { display: flex; gap: 9px; padding: 7px 2px; border-bottom: 1px solid var(--border-soft); }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex: 0 0 6px; background: var(--faint); }
.feed-dot.lv-info { background: var(--info); }
.feed-dot.lv-warn { background: var(--warn); }
.feed-dot.lv-error { background: var(--err); }
.feed-body { min-width: 0; }
.feed-msg { font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.feed-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }

.topic-list { display: flex; flex-direction: column; }
.topic-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--border-soft);
  text-decoration: none; color: inherit;
}
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: var(--panel); border-radius: var(--radius-sm); }
.topic-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- 对话 */

.chat-page {
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px;
  height: calc(100vh - var(--topbar-h) - 90px); min-height: 460px;
}
.conv-panel {
  display: flex; flex-direction: column; gap: 8px; min-height: 0;
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--border); padding: 10px;
}
.conv-new { width: 100%; justify-content: center; }
.conv-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.conv-item {
  display: flex; align-items: stretch; gap: 2px;
  width: 100%; padding: 0; border: 0; background: none;
  border-radius: var(--radius-sm); transition: background .12s ease;
}
.conv-item:hover { background: var(--panel); }
.conv-item.is-on { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-border); }
.conv-item-main {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  width: 100%; padding: 8px 9px; cursor: pointer; min-width: 0; border-radius: inherit;
}
/* 参照 ARTEX：ghost + 次要色的小icon按钮，不抢主标题的注意力 */
.conv-dots { align-self: center; flex: none; margin-right: 2px;
  width: 22px; height: 22px; padding: 0; background: none; border: 0;
  color: var(--text-soft); border-radius: var(--radius-sm); }
.conv-dots .icon { width: 14px; height: 14px; }
.conv-dots:hover { background: var(--panel); color: var(--text); }
.conv-menu { position: fixed; z-index: 100; min-width: 108px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(15,23,42,.18); padding: 4px; }
.conv-menu[hidden] { display: none; }
.conv-menu-item { display: flex; width: 100%; padding: 7px 10px; border: 0; background: none;
  border-radius: var(--radius-sm); font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.conv-menu-item:hover { background: var(--panel); }
.conv-menu-item[data-act="delete"]:hover { color: #dc4c4c; background: rgba(220,76,76,.10); }
.conv-title { font-size: 12.5px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-sub, .conv-time { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.conv-main {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--border); padding: 14px;
}
.conv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-soft);
}
.conv-head h1 { font-size: 15px; margin: 0; }
.conv-body { flex: 1; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 12px; }
.conv-empty { margin: auto; }
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-bubble {
  max-width: 78%; padding: 9px 12px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.6; overflow-wrap: anywhere;
}
.msg-user .msg-bubble { background: var(--primary); color: var(--primary-fg); border-bottom-right-radius: 4px; }
.msg-assistant .msg-bubble { background: var(--panel); box-shadow: 0 0 0 1px var(--border-soft); border-bottom-left-radius: 4px; }
.conv-composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding-top: 10px; border-top: 1px solid var(--border-soft);
}
.conv-composer textarea {
  flex: 1; min-height: var(--control-h); max-height: 160px; resize: none;
  padding: 7px 10px; border-radius: var(--radius-sm); font-family: inherit; font-size: 13px;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); outline: none; line-height: 1.5;
}
.conv-composer textarea:focus { box-shadow: 0 0 0 var(--ring-w) var(--accent-soft); border-color: var(--accent-border); }
.conv-foot { display: flex; gap: 6px; align-items: center; padding-top: 6px; }

@media (max-width: 900px) {
  .chat-page { grid-template-columns: 1fr; height: auto; }
  .conv-panel { max-height: 180px; }
  .conv-main { height: 66vh; }
  .kpis-3 { grid-template-columns: repeat(2, 1fr); }
  .msg-bubble { max-width: 92%; }
}

/* ---------------------------------------------------------------- 视觉精修 */

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* 细滚动条，hover 时略深 */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

/* 页面头层级 */
.page-head h1 { letter-spacing: -.02em; }

/* 导航选中态：左侧色条 + 浅底（比四周描边更轻） */
.nav-item.is-on {
  position: relative;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: inset 2px 0 0 var(--accent);
}

/* KPI 卡：图标分组 + hover 微抬 */
.kpi { transition: transform .14s ease, box-shadow .14s ease; }
.kpi:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--border-strong); }
.kpi-top { display: flex; align-items: center; gap: 7px; }
.kpi-icon {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 22px;
  display: grid; place-items: center;
  background: var(--panel); color: var(--muted);
}
.kpi-icon .icon { width: 12px; height: 12px; }
.kpi-icon.tone-warn { background: var(--warn-bg); color: var(--warn); }
.kpi-icon.tone-ok { background: var(--ok-bg); color: var(--ok); }
.kpi-icon.tone-accent { background: var(--accent-soft); color: var(--accent); }
.kpi-icon.tone-err { background: var(--err-bg); color: var(--err); }
.kpi-icon.tone-violet { background: var(--violet-bg); color: var(--violet); }
.kpi-icon.tone-slate { background: var(--slate-bg); color: var(--slate); }
.kpi-value { font-size: 26px; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* 趋势图：柱子渐变 + 今天高亮 */
.bar {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 62%, transparent));
}
.bar-wrap { transition: background .12s ease; }
.bar-wrap:hover { background: var(--panel-2); }
.bar-wrap.is-today { background: var(--accent-soft); }
.bar-wrap.is-today .bar { background: var(--accent); box-shadow: 0 0 0 1px var(--accent-border); }

/* 卡片 hover 边框加深（不用阴影，沿用设计规范） */
.card { transition: box-shadow .14s ease; }
.card:hover { box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-sm); }

/* 活动流：hover 底色 */
.feed-item { transition: background .1s ease; border-radius: var(--radius-sm); padding: 7px 6px; }
.feed-item:hover { background: var(--panel); }

/* 主题行：hover 出箭头 */
.topic-row::after {
  content: "→"; color: var(--faint); flex: 0 0 auto;
  opacity: 0; transform: translateX(-4px); transition: opacity .12s ease, transform .12s ease;
}
.topic-row:hover::after { opacity: 1; transform: translateX(0); }

/* 按钮 hover 微抬 */
.btn-primary:hover { transform: translateY(-1px); }

/* 助手气泡：左侧细色条提示来源 */
.msg-assistant .msg-bubble { border-left: 2px solid var(--accent-border); }

/* 空状态：icon 圆形浅底 */
.empty-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel); display: grid; place-items: center; margin-bottom: 6px;
}

/* ---------------------------------------------------------------- 首次引导 */

.start-page { max-width: 740px; margin: 36px auto 0; }
.start-hero h1 { font-size: 26px; letter-spacing: -.02em; margin: 6px 0 8px; }
.start-tag {
  display: inline-block; font-size: 11px; color: var(--accent);
  background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-border);
  border-radius: 20px; padding: 3px 10px; letter-spacing: .04em;
}
.start-ask { display: flex; gap: 8px; margin-top: 20px; }
.start-ask input {
  flex: 1; height: 44px; padding: 0 14px; font-size: 14.5px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); color: var(--text); outline: none; font-family: inherit;
}
.start-ask input:focus { box-shadow: 0 0 0 var(--ring-w) var(--accent-soft); border-color: var(--accent-border); }
.start-ask .btn-primary { height: 44px; padding: 0 22px; }

.start-card { padding: 22px; max-width: 640px; }
.start-card h2 { font-size: 17px; margin: 0 0 4px; letter-spacing: -.01em; }

.progress { height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; margin: 14px 0 8px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .5s ease; }

.diag-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.diag-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); box-shadow: 0 0 0 1px var(--border-soft);
  transition: box-shadow .12s ease;
}
.diag-row:hover { box-shadow: 0 0 0 1px var(--border); }
.diag-name { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.diag-title { font-size: 13px; font-weight: 500; }
.diag-seg { flex: 0 0 auto; }
.diag-seg .seg-btn { padding: 0 9px; }

.chip { font-size: 11px; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.chip-0 { background: var(--err-bg); color: var(--err); }
.chip-1 { background: var(--warn-bg); color: var(--warn); }
.chip-2 { background: var(--info-bg); color: var(--info); }
.chip-3 { background: var(--ok-bg); color: var(--ok); }
.checkup-row { display: flex; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--border-soft); }
.checkup-row:last-child { border-bottom: 0; }

.start-done { text-align: center; padding: 34px 22px; }
.done-icon { margin: 0 auto 10px; background: var(--ok-bg); color: var(--ok); }

.start-steps { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.dot-step { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); transition: background .15s ease; }
.dot-step.on { background: var(--accent); }
.dot-step.done { background: var(--ok); }

.nav-start { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav-start:hover { background: var(--accent-soft); color: var(--accent); }
.nav-start.is-on { box-shadow: inset 2px 0 0 var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------------------------------------------------------------- 图谱（力导向） */

.graph-wrap { position: relative; min-height: 480px; }
#graphSvg { display: block; width: 100%; height: 480px; }
.graph-node { cursor: grab; }
.graph-node:active { cursor: grabbing; }
.graph-node text { fill: var(--text); font-size: 11px; pointer-events: none; user-select: none; }
.graph-node.dimmed { opacity: 0.14 !important; }
.graph-edge { stroke: var(--border-strong); stroke-width: 1; stroke-opacity: 0.5; }
.graph-edge.hi { stroke: var(--accent); stroke-width: 1.6; stroke-opacity: 1; }
.graph-edge.dimmed { stroke-opacity: 0.08; }
.graph-node.is-sel circle { stroke: var(--accent); stroke-width: 2.5; }

/* ---------------------------------------------------------------- 术语图谱 */
.term-controls { display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; margin-top:14px; }
.term-controls .ctrl { background:var(--panel); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; }
.term-controls .ctrl-val { font-variant-numeric:tabular-nums; color:var(--accent); font-weight:600; }
.term-controls input[type=range] { width:100%; margin-top:8px; accent-color:var(--accent); }

.quota-badge { display:inline-block; margin-left:8px; padding:1px 9px; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-size:12px; font-weight:600; }

.term-graph { position:relative; margin-top:12px; overflow:visible; }
.term-edges { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:visible; }
.term-cols { display:flex; gap:56px; align-items:flex-start; padding:8px 4px 4px; min-width:min-content; }
.term-col { display:flex; flex-direction:column; gap:10px; min-width:200px; }
.term-col-title { font-size:12px; font-weight:600; color:var(--muted); letter-spacing:.04em; text-transform:uppercase; margin-bottom:2px; text-align:center; }
.term-col[data-col="center"] .term-col-title { color:var(--accent); }
.node-card { position:relative; background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:9px 11px; cursor:pointer; transition:border-color .15s, transform .15s, box-shadow .15s; }
.node-card:hover { border-color:var(--accent-border); transform:translateY(-1px); }
.node-card.is-center { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent-border); }
.node-card.is-backward { border-left:3px solid var(--faint); }
.node-card.is-forward { border-left:3px solid var(--accent); }
.node-name { font-weight:600; font-size:14px; color:var(--text); }
.node-line { font-size:12px; color:var(--muted); margin-top:3px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.node-card.dim { opacity:.18; }
.term-edge { fill:none; stroke-width:1.6; }
.term-edge.prereq { stroke:var(--faint); }
.term-edge.leads_to { stroke:var(--accent); }
.term-edge.dim { stroke-opacity:.08; }
.term-edge.hi { stroke-width:2.4; }

.legend { display:flex; gap:14px; flex-wrap:wrap; }
.legend-item { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); }
.lg { width:16px; height:0; border-top:2px solid var(--faint); display:inline-block; }
.lg-leads { border-color:var(--accent); }
.lg-center { width:10px; height:10px; border:2px solid var(--accent); border-radius:50%; }

.term-history { display:flex; flex-direction:column; gap:8px; }
.hist-item { display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; transition:border-color .15s; }
.hist-item:hover { border-color:var(--accent-border); }
.hist-name { font-weight:600; }
.hist-meta { font-size:12px; color:var(--muted); margin-left:auto; }
.hist-status { font-size:11px; padding:1px 7px; border-radius:999px; background:var(--panel-2); color:var(--muted); }
.hist-status.done { color:var(--ok); background:rgba(22,163,74,.12); }
.hist-status.failed { color:var(--danger,#dc2626); background:rgba(220,38,38,.1); }

.term-drawer-mask { position:fixed; inset:0; background:rgba(15,23,42,.18); z-index:95; }
.term-drawer { position:fixed; top:0; right:0; height:100%; width:min(360px,92vw); background:var(--card); border-left:1px solid var(--border); box-shadow:-12px 0 32px rgba(15,23,42,.16); z-index:96; padding:22px 20px; overflow:auto; }
.term-drawer-close { position:absolute; top:12px; right:14px; border:0; background:none; font-size:16px; color:var(--muted); cursor:pointer; }
.term-drawer-name { font-size:18px; font-weight:600; color:var(--text); }
.term-drawer-side { font-size:12px; color:var(--accent); margin-top:4px; }
.term-drawer-desc { font-size:14px; line-height:1.7; color:var(--muted); margin-top:12px; }

/* 流式输出的打字光标 */
.cursor {
  display: inline-block; width: 8px; height: 14px; margin-left: 2px;
  background: var(--accent); vertical-align: -2px; border-radius: 1px;
  animation: blink .8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------------- 入场动效（克制，面向商业用户）
   短时长 + ease-out + 只动 opacity/transform（GPU 友好、不触发重排）；
   逐条错落靠行内 --i 索引；系统开"减弱动效"时被顶部媒体查询整体关掉 */
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes growBar { from { height: 0; } }

/* 列表/卡片逐条浮入 */
.kpi, .feed-item, .topic-row, .conv-item, .event-row, .diag-row, .plan-item {
  animation: fadeUp .3s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
/* 消息气泡单条入场 */
.msg { animation: fadeUp .22s cubic-bezier(.22, 1, .36, 1) both; }
/* 趋势柱从底部长出（--i 继承自 .bar-wrap） */
.bar { animation: growBar .6s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--i, 0) * 16ms); }
/* 页面区块整体淡入 */
.content > section, .content > .page, .content > .narrow, .content > .wide { animation: fadeUp .32s ease both; }
/* 按钮按压更跟手 */
.btn-primary:active, .btn-ghost:active, .btn-outline:active, .btn-danger:active { transform: translateY(1px) scale(.98); }
/* 平滑滚动 */
html { scroll-behavior: smooth; }

/* ------------------------------------------------- 本页说明（问号浮卡） */
.page-help[hidden] { display: none; }

/* 贴在问号按钮下方的小卡片：不用全屏遮罩，点开/点别处/Esc 收起 */
.help-pop { position: fixed; z-index: 90;
  width: min(420px, calc(100vw - 24px)); max-height: 62vh; overflow: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 12px 32px rgba(15,23,42,.16);
  padding: 14px 16px; animation: helpIn .16s ease both; }
.help-pop[hidden] { display: none; }
@keyframes helpIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.help-body { font-size: 13px; line-height: 1.8; }
.help-body > *:first-child { margin-top: 0; }
/* 块与块之间留呼吸：说明文字和下面的流程条、多个段落都不再糊成一坨 */
.help-body > * + * { margin-top: 9px; }
.help-body p { margin: 0; }
.help-body b, .help-body strong { color: var(--text); font-weight: 600; }
.help-body .muted { color: var(--text-soft); }

#btnHelp { border-radius: 50%; }
#btnHelp:hover { background: var(--accent-soft); color: var(--accent); }

/* 面试页语音输入：录音中高亮 + 轻微呼吸，让用户知道麦克风是开着的 */
#btnMic.is-on { background: var(--accent-soft); color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border); animation: pulse 1.2s ease-in-out infinite; }
#btnMic:disabled { opacity: .4; cursor: not-allowed; }

/* ------------------------------------------------- 回答里的 Markdown 排版 */
.md-h { margin: 14px 0 6px; font-weight: 600; line-height: 1.45; color: var(--text); }
.md-h:first-child { margin-top: 0; }
.md-p { margin: 0 0 8px; }
.md-p:last-child { margin-bottom: 0; }
.md-ul, .md-ol { margin: 6px 0 8px; padding-left: 20px; }
.md-ul { list-style: disc; }
.md-ol { list-style: decimal; }
.md-ul li, .md-ol li { margin: 3px 0; }
.md-pre { margin: 8px 0; padding: 9px 11px; overflow-x: auto;
  background: var(--panel); border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.msg-bubble code { padding: 1px 5px; border-radius: 4px;
  background: var(--panel); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.msg-bubble .md-pre code { padding: 0; background: none; }

/* ------------------------------------------------- 资料库：上传区与六阶段进度 */
.drop-zone { display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 16px; margin-top: 10px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
  background: var(--panel); color: var(--text-soft);
  transition: border-color .15s ease, background .15s ease, color .15s ease; }
.drop-zone:hover { border-color: var(--accent-border); color: var(--text); }
.drop-zone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop-zone .icon { width: 20px; height: 20px; }

.steps { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.step-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-soft); }
.step-dot { display: grid; place-items: center; width: 18px; height: 18px; flex: none;
  border-radius: 50%; background: var(--panel); box-shadow: 0 0 0 1px var(--border);
  font-size: 10px; line-height: 1; }
.step-item.is-run { color: var(--accent); }
.step-item.is-run .step-dot { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-border); animation: pulse 1.2s ease-in-out infinite; }
.step-item.is-done { color: var(--text); }
.step-item.is-done .step-dot { background: var(--ok, #16a34a); color: #fff; box-shadow: none; }
.step-item.is-fail { color: #dc4c4c; }
.step-item.is-fail .step-dot { background: rgba(220,76,76,.12); box-shadow: 0 0 0 1px rgba(220,76,76,.35); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------------------------------------------------------------- 登录遮罩 */
.auth-pop { position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); }
.auth-pop[hidden] { display: none; }
.auth-body { width: min(92vw, 380px); padding: 18px 18px 16px;
  border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  background: var(--panel, #fff); color: var(--text, #111);
  box-shadow: 0 12px 40px rgba(0,0,0,.22); }
.auth-body h3 { margin: 0 0 6px; font-size: 16px; }
.auth-body .field { display: block; }
.auth-body input[type=text], .auth-body input[type=password] {
  width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--border, #d1d5db); background: transparent; color: inherit; }
.auth-body input[type=text]:focus, .auth-body input[type=password]:focus {
  outline: none; border-color: var(--accent, #6366f1); }
/* 未登录时让顶栏按钮显眼，但不阻塞浏览页面 */
#btnAuth[data-logged="0"] { color: var(--warn, #d97706); border-color: var(--warn, #d97706); }
