/* 学而思 · 四学科 AI 自学工作台
   视觉基调：简约大气 + 科技感，浅色主题 */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F2F4F7;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text: #16181D;
  --text-2: #5A6270;
  --text-3: #8B93A1;
  --accent: #2F6BFF;
  --accent-soft: #EDF3FF;
  --success: #0F9D58;
  --success-soft: #E8F6EE;
  --warn: #C2740A;
  --warn-soft: #FDF3E2;
  --danger: #D93F3F;
  --danger-soft: #FDECEC;
  --purple: #6D4AFF;
  --purple-soft: #F1EEFF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.05);
  --shadow-lg: 0 8px 40px rgba(16,24,40,.12);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -.2px; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }

#app { display: flex; min-height: 100vh; }

/* ============ 侧边栏 ============ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2F6BFF, #6D4AFF);
  color: #fff;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 600;
  flex-shrink: 0;
}

.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--text-3); }

.subject-switch {
  padding: 4px 12px 14px;
  display: flex; flex-direction: column; gap: 3px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.subject-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: background .15s, color .15s;
  text-align: left;
  width: 100%;
}
.subject-btn:hover { background: var(--surface-2); color: var(--text); }
.subject-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.subject-emoji { font-size: 15px; }
.subject-label { flex: 1; font-size: 13px; }
.subject-count {
  font-size: 11px; color: var(--text-3);
  background: var(--surface-2); padding: 1px 6px; border-radius: 20px;
}
.subject-btn.active .subject-count { background: #fff; color: var(--accent); }

.main-nav { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 500; }

.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background .15s;
}
.nav-item.active .nav-dot { background: var(--accent); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.llm-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--text-3);
  background: var(--surface-2);
  padding: 7px 10px; border-radius: var(--radius-sm);
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.status-dot.live { background: var(--success); }
.status-dot.demo { background: var(--warn); }

/* ============ 主区 ============ */
.main { flex: 1; min-width: 0; padding: 26px 32px 60px; max-width: 1400px; }

.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.view-sub { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.view-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============ 按钮与表单 ============ */
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2558DC; }
.btn-ghost { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  max-width: 100%;
}
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; line-height: 1.6; width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--accent); }

/* ============ 统计卡片 ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
}
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.stat-value { font-size: 25px; font-weight: 600; letter-spacing: -.5px; line-height: 1.1; }
.stat-hint { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.warn .stat-value { color: var(--warn); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.purple .stat-value { color: var(--purple); }

/* ============ 面板 ============ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.panel-tight { padding: 15px; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-note { font-size: 11px; color: var(--text-3); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1080px) { .two-col { grid-template-columns: 1fr; } }

/* ============ 错因分布 ============ */
.category-chart { display: flex; flex-direction: column; gap: 9px; }
.cat-row { display: grid; grid-template-columns: 88px 1fr 34px; align-items: center; gap: 10px; }
.cat-label { font-size: 12px; color: var(--text-2); }
.cat-track { height: 7px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 20px; background: var(--accent); transition: width .4s ease; }
.cat-count { font-size: 12px; color: var(--text-3); text-align: right; }

.empty-inline { font-size: 13px; color: var(--text-3); padding: 14px 0; text-align: center; }

/* ============ 掌握度列表 ============ */
.mastery-list { display: flex; flex-direction: column; gap: 11px; }
.mastery-row { display: grid; grid-template-columns: 1fr 110px 46px; align-items: center; gap: 11px; }
.mastery-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mastery-track { height: 7px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.mastery-fill { height: 100%; border-radius: 20px; transition: width .4s ease; }
.mastery-pct { font-size: 12px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }

/* ============ 错题列表 ============ */
.mistake-list { display: flex; flex-direction: column; gap: 9px; }

.mistake-cards { display: flex; flex-direction: column; gap: 11px; }

.mistake-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.mistake-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

.mc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.mc-title { font-size: 14px; font-weight: 500; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-q { font-size: 13px; color: var(--text-2); line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; flex-wrap: wrap; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.success { background: var(--success-soft); color: var(--success); }
.tag.info { background: var(--accent-soft); color: var(--accent); }
.tag.purple { background: var(--purple-soft); color: var(--purple); }

.mastery-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-3);
}
.mastery-chip .track { width: 44px; height: 5px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.mastery-chip .fill { height: 100%; border-radius: 20px; }

/* ============ 空状态 ============ */
.empty-state {
  text-align: center; padding: 56px 20px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state.hidden { display: none; }
.empty-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface-2); color: var(--text-3);
  display: grid; place-items: center;
  font-size: 19px; font-weight: 600; margin: 0 auto 14px;
}
.empty-state h3 { margin-bottom: 5px; }
.empty-state p { font-size: 13px; color: var(--text-3); margin-bottom: 16px; }

/* ============ 对话 ============ */
.chat-layout { display: grid; grid-template-columns: 1fr 268px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .chat-layout { grid-template-columns: 1fr; } }

.chat-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: calc(100vh - 190px);
  min-height: 460px;
  display: flex; flex-direction: column;
}

.chat-scroll { flex: 1; overflow-y: auto; padding: 22px; }

.chat-welcome { text-align: center; padding: 40px 20px 26px; }
.welcome-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #2F6BFF, #6D4AFF);
  color: #fff; display: grid; place-items: center;
  font-size: 20px; font-weight: 600; margin: 0 auto 14px;
}
.chat-welcome h2 { font-size: 17px; margin-bottom: 6px; }
.chat-welcome p { font-size: 13px; color: var(--text-3); margin-bottom: 20px; }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggestion {
  padding: 7px 13px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; color: var(--text-2);
  transition: border-color .15s, color .15s, background .15s;
}
.suggestion:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.message-list { display: flex; flex-direction: column; gap: 16px; }

.msg { display: flex; gap: 11px; }
.msg-avatar {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.msg.user .msg-avatar { background: var(--surface-2); color: var(--text-2); }
.msg.assistant .msg-avatar { background: linear-gradient(135deg, #2F6BFF, #6D4AFF); color: #fff; }
.msg-body { flex: 1; min-width: 0; }
.msg-role { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.msg-content { font-size: 14px; line-height: 1.75; word-break: break-word; }
.msg-content p { margin-bottom: 9px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul, .msg-content ol { margin: 0 0 9px 20px; }
.msg-content li { margin-bottom: 3px; }
.msg-content h2 { font-size: 15px; font-weight: 600; margin: 14px 0 6px; }
.msg-content h3 { font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
.msg-content h4 { font-size: 13px; font-weight: 600; margin: 10px 0 5px; }
.msg-content table { margin: 0 0 9px; }
.msg-content pre { margin: 0 0 9px; }
.msg-content blockquote { margin: 0 0 9px; }
.msg-content code {
  background: var(--surface-2); padding: 1px 5px;
  border-radius: 4px; font-size: 12.5px;
  font-family: "SF Mono", Consolas, monospace;
}
.msg-content pre {
  background: var(--surface-2); padding: 11px 13px; border-radius: var(--radius-sm);
  overflow-x: auto;
}
.msg-content pre code { background: none; padding: 0; }
.msg-content blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 12px; color: var(--text-2);
}
.msg-content table { border-collapse: collapse; font-size: 13px; }
.msg-content th, .msg-content td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.msg-content th { background: var(--surface-2); font-weight: 600; }

.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
  animation: blink 1.3s infinite;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-input-wrap {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; gap: 10px; align-items: flex-end;
}
.chat-input {
  flex: 1; resize: none; border: none; outline: none;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 14px; line-height: 1.6;
  max-height: 160px; min-height: 38px;
}
.chat-input:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent-soft); }
.send-btn { flex-shrink: 0; height: 38px; }

.chat-side { display: flex; flex-direction: column; gap: 12px; }
.context-box, .tips-box { display: flex; flex-direction: column; gap: 8px; }
.ctx-line { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.ctx-line b { color: var(--text); font-weight: 600; }
.tip-item {
  font-size: 12.5px; color: var(--text-2); line-height: 1.6;
  padding-left: 14px; position: relative;
}
.tip-item::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}

/* ============ 弹窗 ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.42);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
  backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface); border-radius: 14px;
  width: 100%; max-width: 640px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 20px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding-top: 6px;
}
.modal-actions { display: flex; gap: 8px; }

.btn-close {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  color: var(--text-3); font-size: 19px; line-height: 1;
  display: grid; place-items: center;
}
.btn-close:hover { background: var(--surface-2); color: var(--text); }

/* ============ 抽屉 ============ */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.32);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 520px; max-width: 94vw;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  z-index: 95; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 20px; border-bottom: 1px solid var(--border);
}
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }

/* ============ 详情内容 ============ */
.detail-block { margin-bottom: 20px; }
.detail-label {
  font-size: 11px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px; font-weight: 600;
}
.detail-content { font-size: 13.5px; line-height: 1.75; color: var(--text); white-space: pre-wrap; }
.detail-answer {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap;
}

.diag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.diag-item {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 12px;
}
.diag-item .k { font-size: 11px; color: var(--text-3); }
.diag-item .v { font-size: 15px; font-weight: 600; margin-top: 2px; }

.suggestion-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.suggestion-list li {
  font-size: 13px; color: var(--text-2); line-height: 1.65;
  padding-left: 20px; position: relative;
}
.suggestion-list li::before {
  content: ''; position: absolute; left: 5px; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

.variant-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 14px; margin-bottom: 9px; background: var(--surface);
}
.variant-q { font-size: 13.5px; line-height: 1.7; margin-bottom: 9px; white-space: pre-wrap; }
.variant-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--border); }

/* ============ 复习 ============ */
.review-list { display: flex; flex-direction: column; gap: 13px; }
.review-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.review-q {
  font-size: 14px; line-height: 1.75; margin-bottom: 13px;
  white-space: pre-wrap;
}
.review-answer-row { display: flex; gap: 9px; margin-top: 12px; align-items: flex-end; }
.review-answer-row .input { flex: 1; }
.review-result {
  margin-top: 13px; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.7;
}
.review-result.ok { background: var(--success-soft); color: #0A6E3F; }
.review-result.no { background: var(--danger-soft); color: #96201F; }

.due-badge {
  font-size: 12.5px; color: var(--warn);
  background: var(--warn-soft); padding: 6px 12px; border-radius: 20px;
}

/* ============ 出题 ============ */
.practice-form {
  display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px;
}
.practice-form .field { margin-bottom: 0; }
.practice-form .select { min-width: 150px; }

.practice-list { display: flex; flex-direction: column; gap: 13px; }
.practice-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px;
}
.practice-q { font-size: 14px; line-height: 1.75; margin-bottom: 12px; white-space: pre-wrap; }
.practice-solution {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; line-height: 1.7; margin-bottom: 12px;
  white-space: pre-wrap;
}
.practice-solution .sol-label {
  font-size: 11px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .4px; font-weight: 600; margin-bottom: 4px;
}

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translate(-50%, 16px);
  background: var(--text); color: #fff;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 200;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

@media (max-width: 900px) {
  .sidebar { width: 68px; }
  .brand-text, .subject-label, .subject-count, .nav-item span:last-child, .status-text { display: none; }
  .brand { justify-content: center; padding: 16px 8px; }
  .subject-btn, .nav-item { justify-content: center; }
  .main { padding: 18px 16px 40px; }
  .field-row { grid-template-columns: 1fr; }
  .diag-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   知识图谱视图
   ============================================================ */
.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  align-items: start;
  min-height: calc(100vh - 190px);
}

.graph-tree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 4px 14px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}

.graph-domain { border-bottom: 1px solid var(--border); padding: 10px 12px 12px; }
.graph-domain:last-child { border-bottom: none; }

.graph-domain-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.graph-domain-name { font-size: 13.5px; font-weight: 650; color: var(--text); }
.graph-domain-count {
  font-size: 11px; color: var(--text-3);
  background: var(--surface-2); border-radius: 20px; padding: 1px 8px;
}

.graph-chapter { margin: 8px 0 0; }
.graph-chapter-name {
  font-size: 11.5px; color: var(--text-3);
  margin-bottom: 4px; letter-spacing: .2px;
}
.graph-topics { display: flex; flex-wrap: wrap; gap: 6px; }

.graph-topic {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 11px;
  cursor: pointer;
  color: var(--text-2);
  transition: all .14s ease;
}
.graph-topic:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.gt-name { font-weight: 500; }
.gt-meta { font-size: 10.5px; color: var(--text-3); }
.graph-topic:hover .gt-meta { color: var(--accent); opacity: .75; }

/* 知识点详情面板 */
.graph-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 22px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}
.graph-empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.graph-empty .empty-mark {
  width: 46px; height: 46px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--accent-soft); color: var(--accent);
  font-size: 19px; font-weight: 700;
}
.graph-empty h3 { font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.graph-empty p { font-size: 12.5px; line-height: 1.7; }

.gd-head h2 { font-size: 17px; font-weight: 680; color: var(--text); margin-bottom: 8px; }
.gd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.gd-desc { font-size: 13px; line-height: 1.75; color: var(--text-2); margin-bottom: 12px; }
.gd-criteria {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 10px 13px; margin-bottom: 12px;
}
.gd-criteria h4 { font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 650; }
.gd-criteria ul { margin-left: 16px; }
.gd-criteria li { font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
.gd-mastery {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-2);
  padding: 9px 13px; background: var(--accent-soft);
  border-radius: var(--radius-sm); margin-bottom: 14px;
}

.gd-section { margin-top: 16px; }
.gd-section h4 {
  font-size: 12px; color: var(--text-2); font-weight: 650;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.sec-count {
  font-size: 10.5px; background: var(--surface-2); color: var(--text-3);
  border-radius: 10px; padding: 1px 7px; font-weight: 500;
}

.trace-list { display: flex; flex-direction: column; gap: 5px; }
.trace-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border-left: 3px solid var(--border-strong);
}
.trace-item.hard { border-left-color: var(--danger); }
.trace-item.soft { border-left-color: var(--border-strong); }
.trace-name { font-size: 12.5px; font-weight: 550; color: var(--text); }
.trace-meta { font-size: 11px; color: var(--text-3); }
.trace-reason { font-size: 11.5px; color: var(--text-2); line-height: 1.6; margin-top: 3px; }

.topic-questions { display: flex; flex-direction: column; gap: 8px; }
.topic-question {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.tq-prompt { font-size: 12.5px; line-height: 1.7; color: var(--text); }
.tq-meta { font-size: 10.5px; color: var(--text-3); margin-top: 3px; }
.tq-answer { margin-top: 7px; font-size: 12px; color: var(--text-2); }
.tq-answer summary { cursor: pointer; color: var(--accent); font-size: 11.5px; }
.tq-explain { margin-top: 6px; font-size: 11.5px; color: var(--text-3); line-height: 1.65; }

/* ============================================================
   根源薄弱点（看板）
   ============================================================ */
.root-weakness-list { display: flex; flex-direction: column; gap: 7px; }
.rw-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer;
  transition: background .14s ease;
}
.rw-item:hover { background: var(--danger-soft); }
.rw-name { font-size: 13px; font-weight: 570; color: var(--text); }
.rw-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.rw-hits {
  font-size: 11px; color: var(--danger); font-weight: 600;
  background: var(--danger-soft); border-radius: 20px; padding: 3px 10px;
  white-space: nowrap;
}

/* ============================================================
   错题详情里的知识溯源
   ============================================================ */
.trace-block {
  background: linear-gradient(180deg, var(--purple-soft), transparent 70%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
}
.trace-src {
  font-size: 10px; color: var(--text-3); font-weight: 400;
  margin-left: 6px; letter-spacing: .2px;
}
.tb-headline {
  font-size: 12.5px; line-height: 1.7; color: var(--purple);
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 9px 11px; margin-bottom: 10px; font-weight: 550;
}
.tb-topic { font-size: 12.5px; color: var(--text-2); margin-bottom: 9px; }
.tb-topic b { color: var(--text); }
.tb-meta { font-size: 11px; color: var(--text-3); margin-left: 6px; }

.tb-alert {
  font-size: 11.5px; color: var(--warn); line-height: 1.7;
  background: var(--warn-soft); border-radius: var(--radius-sm);
  padding: 8px 11px; margin-bottom: 10px;
}
.gap-chip {
  display: inline-block; background: var(--surface); border-radius: 20px;
  padding: 1px 9px; margin: 3px 4px 0 0; font-size: 11px; font-weight: 550;
}
.risk-chip {
  display: inline-block; background: var(--surface-2); border-radius: 20px;
  padding: 2px 9px; margin: 3px 4px 0 0; font-size: 11px; color: var(--text-2);
}

.tb-sub {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  margin: 11px 0 6px; letter-spacing: .2px;
}
.tb-list { display: flex; flex-direction: column; gap: 5px; }
.tb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--surface); border-left: 3px solid var(--border-strong);
}
.tb-item.hard { border-left-color: var(--danger); }
.tb-item.root { border-left-color: var(--purple); }
.tb-item.root.top { background: var(--purple-soft); }
.tb-rank {
  width: 17px; height: 17px; flex: 0 0 17px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--purple); color: #fff;
  font-size: 10px; font-weight: 700;
}
.tb-name { font-size: 12.5px; font-weight: 550; color: var(--text); flex: 1; }

/* 课标题库真题标记 */
.variant-src {
  font-size: 10.5px; color: var(--success); font-weight: 600;
  margin-top: 4px;
}
.practice-choices { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.pchoice {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; color: var(--text-2); line-height: 1.65;
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.pc-key {
  font-weight: 700; color: var(--accent); flex: 0 0 auto;
}

/* ============================================================
   自适应诊断（cn-math-taxonomy 诊断引擎）
   ============================================================ */
.diagnose-start { display: flex; flex-direction: column; gap: 16px; }

.diag-scope-group { margin-bottom: 16px; }
.diag-scope-group:last-child { margin-bottom: 0; }
.diag-scope-title {
  font-size: 12px; font-weight: 650; color: var(--text-3);
  margin-bottom: 8px; letter-spacing: .3px;
}
.diag-scope-list { display: flex; flex-wrap: wrap; gap: 8px; }
.diag-scope {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: 20px; padding: 6px 14px; cursor: pointer;
  transition: all .14s ease; font-size: 13px;
}
.diag-scope:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.diag-scope .ds-name { font-weight: 550; }
.diag-scope .ds-count { font-size: 11px; color: var(--text-3); }
.diag-scope:hover .ds-count { color: var(--accent); opacity: .8; }

.diagnose-target-search {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px; margin-bottom: 10px;
}
.diagnose-target-search .input { flex: 1 1 220px; min-width: 160px; }
.diagnose-target-search .select { flex: 0 1 230px; min-width: 150px; }
.diag-scope-group.univ .diag-scope { border-color: var(--accent-soft); }
.diag-scope-group.univ .diag-scope-title { color: var(--accent); }
.diag-scope.picked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.diagnose-target-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 7px; max-height: 320px; overflow-y: auto; padding-right: 4px;
}
.diag-target {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer;
  transition: all .14s ease;
}
.diag-target:hover { background: var(--accent-soft); border-color: var(--accent); }
.diag-target.picked { background: var(--accent-soft); border-color: var(--accent); }
.diag-target .dt-name { font-size: 13px; font-weight: 550; color: var(--text); }
.diag-target .dt-meta { font-size: 11px; color: var(--text-3); }
.diag-target.picked .dt-name { color: var(--accent); }

.diagnose-selected {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 12px; padding: 10px 12px;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.diag-chip {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 20px; padding: 2px 11px; font-size: 12px; font-weight: 550;
}
.diag-chip.mastered { background: var(--success-soft); color: var(--success); }
.diag-chip.shaky { background: var(--warn-soft); color: var(--warn); }
.diag-chip.weak { background: var(--danger-soft); color: var(--danger); }
.diag-chip.untested { background: var(--surface-2); color: var(--text-3); }

.diagnose-start-bar {
  display: flex; align-items: flex-end; gap: 12px; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--border);
}

/* ---------------- 出题页 ---------------- */
.diagnose-quiz { max-width: 780px; margin: 0 auto; }
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.quiz-progress-bar {
  flex: 1; height: 6px; background: var(--surface-2);
  border-radius: 4px; overflow: hidden;
}
.quiz-progress-bar > div {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 4px; transition: width .3s ease;
}
.quiz-progress > span { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.quiz-card { padding: 24px 26px 22px; }
.quiz-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.quiz-meta .tag.subtle { background: transparent; color: var(--text-3); padding-left: 0; }
.quiz-question {
  font-size: 16px; line-height: 1.85; color: var(--text);
  margin-bottom: 18px; white-space: pre-wrap;
}
.quiz-question .md-table { margin: 10px 0; }

.quiz-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.diag-choice {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  background: var(--surface-2); border: 1.5px solid transparent;
  border-radius: var(--radius-sm); padding: 11px 14px; cursor: pointer;
  transition: all .14s ease; font-size: 13.5px; line-height: 1.7;
}
.diag-choice:hover { background: var(--accent-soft); border-color: var(--accent); }
.diag-choice.picked { background: var(--accent-soft); border-color: var(--accent); }
.dc-key {
  font-weight: 700; color: var(--accent); flex: 0 0 auto;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border-radius: 50%; font-size: 11.5px;
}
.dc-text { flex: 1; color: var(--text); }

.quiz-input-wrap { margin-bottom: 16px; }
.quiz-input-wrap .input { width: 100%; font-size: 14px; padding: 10px 13px; }
.quiz-actions { display: flex; gap: 10px; }

.quiz-feedback {
  margin-top: 16px; padding: 12px 14px;
  border-radius: var(--radius-sm); font-size: 13px;
}
.quiz-feedback.ok { background: var(--success-soft); color: var(--text-2); }
.quiz-feedback.bad { background: var(--danger-soft); color: var(--text-2); }
.qf-head { font-weight: 650; margin-bottom: 7px; color: var(--text); }
.qf-row { display: flex; gap: 8px; margin-top: 5px; font-size: 12.5px; line-height: 1.7; }
.qf-row > span { color: var(--text-3); flex: 0 0 44px; }
.qf-row b { color: var(--text); font-weight: 600; }

/* ---------------- 结果页 ---------------- */
.diagnose-report { display: flex; flex-direction: column; gap: 16px; }
.diag-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.diag-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 10px; border-radius: var(--radius-sm); background: var(--surface-2);
}
.diag-stat b { font-size: 22px; font-weight: 700; line-height: 1.2; }
.diag-stat span { font-size: 11.5px; color: var(--text-3); }
.diag-stat.mastered { background: var(--success-soft); } .diag-stat.mastered b { color: var(--success); }
.diag-stat.shaky { background: var(--warn-soft); } .diag-stat.shaky b { color: var(--warn); }
.diag-stat.weak { background: var(--danger-soft); } .diag-stat.weak b { color: var(--danger); }
.diag-stat.untested { background: var(--surface-2); } .diag-stat.untested b { color: var(--text-2); }
.diag-stat.asked { background: var(--accent-soft); } .diag-stat.asked b { color: var(--accent); }

.diag-roots { margin-top: 4px; }
.diag-roots-head { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.diag-root {
  background: var(--danger-soft); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 8px;
}
.dr-name { font-size: 14px; font-weight: 650; color: var(--danger); }
.dr-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.dr-hint { font-size: 12px; color: var(--text-2); margin-top: 6px; line-height: 1.65; }
.dr-hint.subtle { color: var(--text-3); }

.diag-path { display: flex; flex-direction: column; gap: 6px; }
.diag-path-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); border-left: 3px solid var(--border-strong);
}
.diag-path-item.weak { border-left-color: var(--danger); }
.diag-path-item.shaky { border-left-color: var(--warn); }
.diag-path-item.mastered { border-left-color: var(--success); }
.dp-index {
  width: 19px; height: 19px; flex: 0 0 19px; display: flex;
  align-items: center; justify-content: center; border-radius: 50%;
  background: var(--text-3); color: #fff; font-size: 10.5px; font-weight: 700;
}
.diag-path-item.weak .dp-index { background: var(--danger); }
.diag-path-item.shaky .dp-index { background: var(--warn); }
.dp-name { flex: 1; font-size: 13px; font-weight: 550; color: var(--text); }
.dp-status { font-size: 11px; color: var(--text-3); }
.dp-flag {
  font-size: 10px; padding: 1px 7px; border-radius: 10px; font-weight: 600;
}
.dp-flag.root { background: var(--purple-soft); color: var(--purple); }
.dp-flag.target { background: var(--accent-soft); color: var(--accent); }
.dp-stage { font-size: 11px; color: var(--text-3); min-width: 68px; text-align: right; }

.diag-graph { display: flex; flex-direction: column; gap: 10px; overflow-x: auto; padding: 4px; }
.diag-graph-row { display: flex; gap: 8px; justify-content: center; min-width: min-content; }
.dg-node {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 108px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid transparent;
}
.dg-node.mastered { background: var(--success-soft); }
.dg-node.shaky { background: var(--warn-soft); }
.dg-node.weak { background: var(--danger-soft); }
.dg-node.root { border-color: var(--purple); }
.dg-node.target { border-color: var(--accent); }
.dg-name { font-size: 12px; font-weight: 550; color: var(--text); text-align: center; }
.dg-status { font-size: 10px; color: var(--text-3); }

.diag-chapters { display: flex; flex-direction: column; gap: 12px; }
.diag-chapter { background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 13px; }
.dc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.dc-label { font-size: 13px; font-weight: 600; color: var(--text); }
.dc-total { font-size: 11px; color: var(--text-3); }
.dc-bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.dc-bar .seg.mastered { background: var(--success); }
.dc-bar .seg.shaky { background: var(--warn); }
.dc-bar .seg.weak { background: var(--danger); }
.dc-bar .seg.untested { background: var(--border-strong); }
.dc-legend { display: flex; gap: 12px; font-size: 11px; color: var(--text-3); margin-top: 6px; }
.dc-weak { font-size: 11.5px; color: var(--danger); margin-top: 5px; }

.diag-detail-groups { display: flex; flex-direction: column; gap: 12px; }
.diag-group { }
.dg-title { font-size: 12.5px; font-weight: 650; color: var(--text-2); margin-bottom: 7px; }
.dg-title.mastered { color: var(--success); }
.dg-title.shaky { color: var(--warn); }
.dg-title.weak { color: var(--danger); }
.dg-title b { font-weight: 700; }
.dg-items { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------------------------------------------- 下一步该学什么 */
.diag-next { display: flex; }
.dn-card {
  flex: 1;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
}
.dn-card.ok { border-left-color: var(--success); }
.dn-card.warn { border-left-color: var(--warn); }
.dn-card.bad { border-left-color: var(--danger); }
.dn-action { font-size: 11px; font-weight: 650; color: var(--accent); letter-spacing: .04em; }
.dn-card.ok .dn-action { color: var(--success); }
.dn-card.warn .dn-action { color: var(--warn); }
.dn-card.bad .dn-action { color: var(--danger); }
.dn-target { font-size: 15px; font-weight: 650; color: var(--text); margin: 4px 0 5px; }
.dn-reason { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.dn-meta { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* ---------------------------------------------- 掌握度地图 */
.diag-mastery { display: flex; flex-direction: column; gap: 12px; }
.dm-chapter { background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 13px; }
.dm-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.dm-label { font-size: 13px; font-weight: 600; color: var(--text); }
.dm-total { font-size: 11px; color: var(--text-3); }
.dm-bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.dm-bar .seg.mastered { background: var(--success); }
.dm-bar .seg.learning { background: var(--warn); }
.dm-bar .seg.new { background: var(--border-strong); }
.dm-points { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.dm-point { background: var(--surface); border-radius: 6px; padding: 8px 10px; }
.dmp-top { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.dmp-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.dmp-stage {
  font-size: 10.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
}
.dmp-flag { font-size: 10px; color: var(--purple); background: var(--purple-soft); padding: 1px 6px; border-radius: 3px; }
.dmp-bar { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.dmp-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.dm-point.mastered .dmp-bar span { background: var(--success); }
.dm-point.learning .dmp-bar span { background: var(--warn); }
.dm-point.new .dmp-bar span { background: var(--border-strong); }
.dmp-meta { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }

/* ---------------------------------------------- 复习计划 */
.diag-reviews { display: flex; flex-direction: column; gap: 6px; }
.drv-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.6fr) 1fr 68px 96px 92px;
  gap: 10px;
  align-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12px;
}
.drv-name { font-weight: 600; color: var(--text); }
.drv-domain { color: var(--text-3); }
.drv-seq { color: var(--purple); }
.drv-days { color: var(--accent); font-weight: 600; }
.drv-due { color: var(--text-3); }

/* ---------------------------------------------- 课标依据 */
.diag-standards { display: flex; flex-direction: column; gap: 12px; }
.ds-row { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.ds-topic { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.ds-name { font-size: 13.5px; font-weight: 650; color: var(--text); }
.ds-domain { font-size: 11px; color: var(--text-3); }
.ds-desc { font-size: 12px; color: var(--text-2); line-height: 1.6; margin-bottom: 7px; }
.ds-label { font-size: 11px; font-weight: 650; color: var(--text-3); }
.ds-criteria ul { margin: 4px 0 0; padding-left: 18px; }
.ds-criteria li { font-size: 12px; color: var(--text-2); line-height: 1.7; }
.ds-clauses { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ds-clause { background: var(--surface); border-left: 2px solid var(--purple); border-radius: 0 6px 6px 0; padding: 8px 11px; }
.dsc-head { display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.dsc-head code { font-size: 10.5px; color: var(--purple); background: var(--purple-soft); padding: 1px 6px; border-radius: 3px; }
.dsc-head span { font-size: 10.5px; color: var(--text-3); }
.dsc-head .subtle { color: var(--text-3); opacity: .8; }
.dsc-text { font-size: 12px; color: var(--text-2); line-height: 1.65; }
.ds-root { font-size: 11.5px; color: var(--text-3); margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--border); }

/* ---------------------------------------------- 学科诊断口径 */
.diag-subject-profile {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px;
}
.dsp-block {
  background: var(--surface-2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--purple); padding: 11px 14px;
}
.dsp-block p { margin: 5px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.dsp-block ul { margin: 5px 0 0; padding-left: 18px; }
.dsp-block li { font-size: 12.5px; color: var(--text-2); line-height: 1.8; }

/* ---------------------------------------------- 分享图弹层 */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 24px;
}
.share-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
}
.share-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.share-head h3 { font-size: 15px; font-weight: 650; color: var(--text); }
.share-head-actions { display: flex; gap: 8px; }
.share-body { overflow: auto; padding: 16px; }
.share-body img { width: 100%; display: block; border-radius: var(--radius-sm); }

/* ---------------------------------------------- 大学课程 */
.univ-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 1.6fr;
  gap: 12px;
  margin-bottom: 16px;
}
.univ-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.univ-stat-num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.univ-stat-label { font-size: 11px; color: var(--text-3); letter-spacing: .03em; }
.univ-stat-text { font-size: 12px; color: var(--text-2); }

.univ-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.univ-toc {
  padding: 0;
  overflow: hidden;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
}
.univ-toc-head {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.univ-toc-head h3 { font-size: 13.5px; font-weight: 650; color: var(--text); }
.univ-toc-list { overflow-y: auto; padding: 6px 0 10px; }

.univ-toc-group { margin-bottom: 4px; }
.univ-toc-chapter {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 9px 15px 5px;
}
.univ-toc-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--purple);
  background: var(--purple-soft);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.univ-toc-chapter-name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.45;
}
.univ-toc-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 6px 15px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-2);
  border-left: 2px solid transparent;
}
.univ-toc-item.lvl2 { padding-left: 26px; }
.univ-toc-item.lvl3 { padding-left: 38px; font-size: 12px; }
.univ-toc-item:hover { background: var(--surface-2); color: var(--text); }
.univ-toc-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.univ-toc-item-name { flex: 1; min-width: 0; line-height: 1.45; }
.univ-toc-page { font-size: 10.5px; color: var(--text-3); flex-shrink: 0; }
.univ-empty-sm { padding: 22px 15px; font-size: 12.5px; color: var(--text-3); text-align: center; }

.univ-detail { padding: 0; overflow: hidden; }
.univ-empty { padding: 64px 24px; text-align: center; color: var(--text-3); }
.univ-empty-icon { font-size: 34px; margin-bottom: 10px; }
.univ-empty p { font-size: 13px; }

.univ-detail-body { padding: 0; }
.univ-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.univ-breadcrumb { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.univ-detail-head h2 { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.4; }
.univ-topic-meta { display: flex; align-items: center; gap: 7px; margin-top: 8px; flex-wrap: wrap; }
.univ-chip {
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 4px;
}
.univ-chip-accent { background: var(--accent-soft); color: var(--accent); }

.univ-prereq { padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.univ-prereq-block { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 5px; }
.univ-prereq-block:last-child { margin-bottom: 0; }
.univ-prereq-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-3);
  letter-spacing: .05em;
  flex-shrink: 0;
}
.univ-link {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  padding: 2px 9px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}
.univ-link:hover { background: var(--accent-soft); border-color: var(--accent); }
.univ-muted { font-size: 12px; color: var(--text-3); }

.univ-pages { padding: 18px 20px; background: var(--surface-2); }
.univ-pages img {
  width: 100%;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  background: #fff;
}
.univ-page-loading { padding: 40px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.univ-pager {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-top: 1px solid var(--border);
}
.univ-page-label { font-size: 12px; color: var(--text-3); flex: 1; }
.univ-pager a { text-decoration: none; }

.practice-note {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  margin-bottom: 12px;
}
