/* ================= 我的兴趣宇宙 · 浅色主题 ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --panel: #ffffff;
  --panel2: #f7f9fd;
  --border: #e3e7f0;
  --border2: #cdd5e1;
  --text: #1d2638;
  --text2: #4a5468;
  --muted: #6b7588;
  --accent: #3877f5;
  --accent2: #00a8d4;
  --green: #1c9d5e;
  --red: #d63d3d;
  --yellow: #c4831a;
  --radius: 12px;
  --shadow: 0 2px 14px rgba(30, 50, 100, 0.08);
  --shadow-lg: 0 10px 36px rgba(30, 50, 100, 0.14);
}

html, body { height: 100%; }
body {
  background: linear-gradient(180deg, #f4f7fc 0%, #eef2f9 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(56, 119, 245, 0.18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c8d0dd; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #a8b3c4; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(30, 50, 100, 0.04);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
.brand h1 { font-size: 19px; letter-spacing: 1px; color: var(--text); }
.tagline { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 8px; }
.tab-btn {
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 999px;
  padding: 8px 18px; font-size: 14px; cursor: pointer;
  transition: all .18s; font-family: inherit;
}
.tab-btn:hover { color: var(--text); background: var(--bg-soft); }
.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 14px rgba(56, 119, 245, 0.28);
}

/* ---------- 布局 ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 22px 18px 60px; }

/* 页面底部隐私说明 */
.app-footer {
  max-width: 1180px; margin: 0 auto; padding: 0 18px 28px;
  font-size: 12px; color: var(--muted); line-height: 1.8;
  text-align: center;
}
.app-footer strong { color: var(--text2); }
.tab-pane { display: none; animation: fadeIn .25s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: var(--text2); margin: 12px 0 6px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 119, 245, 0.15);
}
.select { appearance: auto; cursor: pointer; }
.textarea { resize: vertical; min-height: 60px; }
.select.sm { width: auto; display: inline-block; padding: 7px 10px; font-size: 13px; }
.input.search { max-width: 230px; padding: 7px 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.7; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border2);
  background: var(--panel);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn:hover { border-color: var(--accent); background: var(--bg-soft); color: var(--accent); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; color: #fff;
  box-shadow: 0 4px 16px rgba(56, 119, 245, 0.28);
}
.btn-primary:hover { filter: brightness(1.08); border: none; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(214, 61, 61, 0.4); color: var(--red); background: rgba(214, 61, 61, 0.06); }
.btn-danger:hover { border-color: var(--red); background: rgba(214, 61, 61, 0.12); color: var(--red); }
.btn-lg { width: 100%; padding: 13px; font-size: 16px; font-weight: 600; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions .btn { margin-top: 0; }

/* ---------- 拖拽区 ---------- */
.dropzone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 34px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  color: var(--muted);
  background: var(--bg-soft);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(56, 119, 245, 0.04); color: var(--text2); }
.dz-hint { font-size: 15px; }
.dz-link { color: var(--accent); text-decoration: underline; }
.dropzone small { color: var(--muted); font-size: 12px; }

/* ---------- 缩略图（含旋转/删除工具） ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.thumb {
  position: relative; width: 92px; height: 92px;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border2); background: #f0f3f8;
  box-shadow: 0 1px 3px rgba(30,50,100,.08);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(20,30,50,0.75); color: #fff; font-size: 11px;
  cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.thumb-x:hover { background: var(--red); }
.thumb-tools {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; padding: 4px 3px;
  background: linear-gradient(to top, rgba(20,30,50,0.75), rgba(20,30,50,0));
}
.thumb-tool {
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.95); color: #1d2638;
  cursor: pointer; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.thumb-tool:hover { background: #fff; transform: scale(1.1); }
.thumb-tool:disabled { opacity: .5; cursor: wait; }

/* ---------- 学科标签 ---------- */
.cat-tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cat-tab {
  padding: 6px 16px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border2); color: var(--text2);
  font-size: 13px; transition: all .15s; font-family: inherit;
}
.cat-tab:hover { color: var(--accent); border-color: var(--accent); }
.cat-tab.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 2px 8px rgba(56, 119, 245, 0.25);
}

/* ---------- 步骤 ---------- */
.steps { margin-top: 14px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.step { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; color: var(--muted); font-size: 13.5px; }
.step .step-ic { width: 22px; text-align: center; flex-shrink: 0; }
.step.done { color: var(--green); }
.step.run { color: var(--accent); font-weight: 500; }
.step.fail { color: var(--red); flex-wrap: wrap; }
.step-err {
  flex-basis: 100%; margin-top: 4px; margin-left: 32px;
  background: rgba(214, 61, 61, 0.06);
  border: 1px solid rgba(214, 61, 61, 0.2);
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px;
  white-space: pre-wrap; word-break: break-word; color: var(--red);
  line-height: 1.6;
}
.step-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- 结果 ---------- */
.result-head { border-color: rgba(28, 157, 94, 0.3); }
.result-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.result-title-row h2 { font-size: 17px; color: var(--text); }
.result-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; color: var(--text2); }
.badge {
  display: inline-block; padding: 4px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.result-sections { margin-top: 4px; }
.sec h3 { font-size: 15px; margin-bottom: 8px; color: var(--accent); }
.sec h4.sub { font-size: 14px; margin: 14px 0 6px; color: var(--yellow); }

/* ---------- 原题（OCR 还原）板块 ---------- */
.orig-section { display: flex; flex-direction: column; gap: 10px; }
.orig-text {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.orig-text:empty::before {
  content: "（未输入原题文字）";
  color: var(--muted);
  font-style: italic;
}
.orig-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.orig-imgs img {
  max-width: 200px; max-height: 240px;
  border-radius: 6px; border: 1px solid var(--border);
  object-fit: contain; background: #fafbfd;
}

.md-body { font-size: 14.5px; overflow-wrap: break-word; color: var(--text); line-height: 1.8; }
.md-body p { margin: 8px 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 14px 0 6px; color: var(--text); }
.md-body h1 { font-size: 18px; }
.md-body h2 { font-size: 16px; }
.md-body ul, .md-body ol { margin: 8px 0 8px 22px; }
.md-body code { background: #eef1f8; color: var(--red); padding: 2px 6px; border-radius: 5px; font-size: 13px; }
.md-body pre { background: #f7f9fd; border: 1px solid var(--border); border-radius: 9px; padding: 12px; overflow-x: auto; margin: 10px 0; }
.md-body pre code { background: transparent; padding: 0; color: var(--text); }
.md-body table { border-collapse: collapse; margin: 10px 0; }
.md-body th, .md-body td { border: 1px solid var(--border2); padding: 6px 12px; }
.md-body th { background: var(--bg-soft); }
.md-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); margin: 8px 0; }
.md-body a { color: var(--accent); }
.md-fallback { white-space: pre-wrap; font-family: inherit; }

/* ---------- 记录本 ---------- */
.book-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .book-layout { grid-template-columns: 1fr; } }
.sidebar { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sidebar-head h2 { font-size: 15px; color: var(--text); }

.tree-cat { margin-bottom: 6px; }
.tree-cat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border);
  transition: all .12s;
}
.tree-cat-head:hover { border-color: var(--border2); }
.tree-caret { color: var(--muted); width: 14px; }
.tree-cat-name { font-weight: 600; font-size: 14px; flex: 1; color: var(--text); }
.tree-count { font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.tree-add, .tree-edit, .tree-x {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 13px; padding: 2px 5px; border-radius: 6px; line-height: 1;
}
.tree-add:hover { color: var(--green); background: rgba(28, 157, 94, 0.1); }
.tree-edit:hover { color: var(--yellow); background: rgba(196, 131, 26, 0.1); }
.tree-x:hover { color: var(--red); background: rgba(214, 61, 61, 0.1); }
.tree-subs { padding-left: 12px; margin-top: 4px; }
.tree-sub {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
  color: var(--text2);
}
.tree-sub:hover { background: var(--bg-soft); color: var(--text); }
.tree-sub.sel { background: rgba(56, 119, 245, 0.12); color: var(--accent); font-weight: 500; }
.tree-sub-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.book-main { min-height: 300px; }
.book-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.book-head-row h2 { font-size: 18px; color: var(--text); }

/* ---------- 我的兴趣宇宙：顶部学科 + 下面左记录右宇宙（浅色主体，右侧星空独立成卡） ---------- */
.world-layout {
  display: flex; flex-direction: column; gap: 14px;
  height: calc(100vh - 138px); min-height: 540px;
  box-sizing: border-box;
}
.world-top { padding: 14px 16px; flex-shrink: 0; }
.world-top-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.world-top-head h2 { font-size: 15px; color: var(--text); }
/* 学科横向滚动条 */
.world-tree { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 6px; scrollbar-width: thin; }
.world-tree .tree-sub {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text2); font-size: 13.5px; cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.world-tree .tree-sub:hover { border-color: var(--border2); color: var(--text); }
.world-tree .tree-sub.sel { background: rgba(56, 119, 245, 0.14); color: var(--accent); border-color: var(--accent); font-weight: 500; }
.world-tree .tree-sub .tree-edit, .world-tree .tree-sub .tree-x { padding: 1px 4px; font-size: 12px; opacity: 0.6; color: var(--muted); }
.world-tree .tree-sub:hover .tree-edit, .world-tree .tree-sub:hover .tree-x { opacity: 1; }
.world-tree .tree-add-row {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  padding: 8px 14px; border-radius: 999px;
  border: 1px dashed var(--border2); background: transparent;
  color: var(--accent); cursor: pointer; font-size: 13px;
}
.world-tree .tree-add-row:hover { background: rgba(56, 119, 245, 0.08); }
.world-tree .tree-count { font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }

/* 下面：左记录列表，右宇宙（星空独立成卡、铺满不留白） */
.world-bottom { flex: 1; display: flex; gap: 14px; min-height: 0; }
.world-side { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; padding: 14px; overflow: hidden; }
.world-qlist { flex: 1; overflow-y: auto; min-height: 0; }
.world-qlist #bookHead { margin-bottom: 8px; }
.world-main { flex: 1; overflow: hidden; display: flex; flex-direction: column; padding: 0; }
#bookGraph { flex: 1; min-height: 0; position: relative; }
#bookGraph .graph-svg.graph-cosmic {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  display: block;
}

/* 声音开关按钮 */
.graph-sound-btn {
  position: absolute; top: 10px; right: 14px; z-index: 5;
  background: rgba(10, 18, 38, 0.75); border: 1px solid rgba(120, 160, 255, 0.35);
  color: #cfe0ff; border-radius: 999px; width: 34px; height: 34px;
  font-size: 15px; cursor: pointer; line-height: 1;
  transition: all .15s;
}
.graph-sound-btn:hover { background: rgba(120, 160, 255, 0.22); }

/* 图谱内星云：静态光斑（不再漂移，保持底图稳定；星星闪烁营造氛围即可） */
.graph-nebulae .nebula { transform-box: fill-box; }

@media (max-width: 900px) {
  .world-bottom { flex-direction: column; }
  .world-side { width: 100%; max-height: 38vh; }
}
.empty-state {
  text-align: center; color: var(--muted); padding: 70px 20px; font-size: 14px; line-height: 2;
}

.q-card {
  display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; margin-bottom: 6px;
  cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.q-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(56, 119, 245, 0.08); }
.q-thumb {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 6px; overflow: hidden; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--muted);
}
.q-thumb img { width: 100%; height: 100%; object-fit: cover; }
.q-info { flex: 1; min-width: 0; overflow: hidden; }
.q-top { display: flex; gap: 6px; align-items: center; margin-bottom: 1px; }
.q-date { font-size: 11px; color: var(--muted); }
.q-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-model { display: none; }
.q-text { display: none; }
.q-actions { display: flex; gap: 4px; flex-shrink: 0; }
.q-actions .btn-sm { font-size: 12px; padding: 2px 6px; min-width: 26px; }
.q-actions .danger { color: var(--red); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 30, 50, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .18s ease;
}
.modal {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; max-width: 760px; width: 100%;
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 14px 14px 0 0;
}
.modal-head h3 { font-size: 16px; color: var(--text); }
.modal-x { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.modal-x:hover { color: var(--text); background: var(--border); }
.modal-body { padding: 16px 18px; overflow-y: auto; background: var(--panel); }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--bg-soft); border-radius: 0 0 14px 14px; }
/* 详情弹窗：换模型重新分析行 */
.dt-regen-foot { justify-content: space-between; border-top: none; padding-top: 8px; border-radius: 0; }
.dt-regen-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-regen-row .select.sm { max-width: 240px; }

.detail-img-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.detail-img { width: 150px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border2); }
.detail-img img { width: 100%; display: block; }
.edit-body textarea { margin-bottom: 4px; }
.edit-imgs { display: flex; flex-wrap: wrap; gap: 10px; }
.edit-img { position: relative; width: 110px; height: 110px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border2); }
.edit-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-img-x, .edit-img-rot {
  position: absolute; border: none; border-radius: 50%;
  cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.edit-img-x { top: 4px; right: 4px; width: 22px; height: 22px; background: rgba(20,30,50,0.75); color: #fff; font-size: 11px; }
.edit-img-x:hover { background: var(--red); }
.edit-img-rot { bottom: 4px; width: 24px; height: 24px; background: rgba(255,255,255,0.95); color: var(--text); font-size: 13px; }
.edit-img-rot.left { left: 4px; }
.edit-img-rot.right { right: 4px; }
.edit-img-rot:hover { background: #fff; transform: scale(1.1); }

/* ---------- 设置 ---------- */
.provider-row { display: flex; gap: 10px; margin-bottom: 14px; }
.provider-card {
  flex: 1; cursor: pointer; border: 1px solid var(--border2);
  border-radius: 10px; padding: 12px 14px; background: var(--panel);
  transition: all .15s; position: relative;
}
.provider-card input { position: absolute; opacity: 0; }
.provider-card.active { border-color: var(--accent); background: rgba(56, 119, 245, 0.06); box-shadow: 0 0 0 3px rgba(56, 119, 245, 0.12); }
.pc-name { display: block; font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--text); }
.pc-desc { display: block; font-size: 12px; color: var(--muted); line-height: 1.6; }
.key-row { display: flex; gap: 8px; }
.key-row .input { flex: 1; }

.sm-cat { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--border); }
.sm-cat:last-child { border-bottom: none; }
.sm-cat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sm-cat-name { font-weight: 700; font-size: 14px; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-soft); border: 1px solid var(--border2);
  border-radius: 999px; padding: 4px 6px 4px 13px; font-size: 13px; color: var(--text);
}
.chip-name { cursor: pointer; }
.chip-name:hover { color: var(--accent); }
.chip-tpl {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%; font-size: 12px; line-height: 1;
}
.chip-tpl:hover { color: var(--accent); background: rgba(93, 141, 255, 0.14); }
.chip-x {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  width: 20px; height: 20px; border-radius: 50%; font-size: 11px; line-height: 1;
}
.chip-x:hover { color: var(--red); background: rgba(214, 61, 61, 0.12); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: var(--panel); border: 1px solid var(--border2); color: var(--text);
  padding: 11px 22px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 200; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: rgba(214, 61, 61, 0.5); color: var(--red); background: rgba(214, 61, 61, 0.04); }
#toast.ok { border-color: rgba(28, 157, 94, 0.4); }

#connResult { margin-top: 12px; font-size: 13px; white-space: pre-wrap; color: var(--text2); }

/* ---------- 额度徽章 ---------- */
.quota-badge {
  display: inline-block;
  background: rgba(56, 119, 245, 0.1);
  border: 1px solid rgba(56, 119, 245, 0.35);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 600;
  margin: 4px 0 8px;
}

/* ---------- 题目名称 ---------- */
.q-title {
  font-size: 13.5px; font-weight: 600; color: var(--accent);
  margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn.active {
  background: rgba(56, 119, 245, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 知识图谱（旧版单学科，留着兼容） ---------- */
#bookGraph { padding-top: 4px; }
.graph-toolbar { margin-bottom: 10px; }
.graph-svg {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: grab;
  touch-action: none;
}
.graph-svg:active { cursor: grabbing; }
.graph-edge {
  stroke: #b9c4d6;
  stroke-width: 1.3;
  opacity: 0.7;
  transition: stroke .15s, stroke-width .15s, opacity .15s;
}
.graph-edge.hl {
  stroke: var(--accent);
  stroke-width: 2.2;
  opacity: 1;
}
.graph-node { cursor: pointer; }
/* 旧版单学科图谱节点样式（不再使用，保留以防回滚；通过 .graph-cosmic 排除宇宙视图避免 fill 覆盖内联色） */
.graph-svg:not(.graph-cosmic) .graph-node circle {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2;
  transition: fill .15s, stroke-width .15s;
}
.graph-svg:not(.graph-cosmic) .graph-node:hover circle { fill: rgba(56, 119, 245, 0.12); stroke-width: 2.6; }
.graph-num {
  text-anchor: middle; font-size: 13px; font-weight: 700;
  fill: var(--accent); pointer-events: none;
}
.graph-label {
  text-anchor: middle; font-size: 12px;
  fill: var(--text2); pointer-events: none;
}

/* ---------- 知识图谱（宇宙视图：恒星—行星—卫星） ---------- */
.graph-svg.graph-cosmic {
  background: transparent; border: none;
  border-radius: 12px; overflow: hidden;
}
.graph-svg.graph-cosmic .graph-sub circle { stroke: none; }
.graph-svg.graph-cosmic .graph-q circle { stroke: none; }
.graph-cosmic-toolbar { padding: 6px 4px 8px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 4px; }
.graph-legend { font-size: 13px; color: var(--text2); }
.graph-legend b { color: var(--accent); }
.bg-star { fill: #ffffff; animation: bg-twinkle 4.5s ease-in-out infinite; }
@keyframes bg-twinkle { 0%, 100% { opacity: 0.55 } 50% { opacity: 1 } }
.graph-pulse { animation: graph-pulse 1.8s ease-in-out infinite; }
@keyframes graph-pulse {
  0%, 100% { r: 15; stroke-opacity: 0.9; }
  50% { r: 22; stroke-opacity: 0.15; }
}
/* 行星 / 卫星 hover：提亮 + 放大，增强把玩反馈 */
.graph-svg.graph-cosmic .graph-sub:hover { opacity: 1 !important; }
.graph-svg.graph-cosmic .graph-sub:hover circle { stroke: #fff; stroke-width: 2; }
.graph-svg.graph-cosmic .graph-q:hover circle { r: 4.2; stroke: #fff; stroke-opacity: 0.9; stroke-width: 1.2; }
.graph-svg.graph-cosmic .graph-cat:hover circle:first-of-type { r: 27; }
.graph-cat-label {
  text-anchor: middle; font-size: 14px; font-weight: 700;
  fill: #f5f7ff; pointer-events: none;
  text-shadow: 0 0 8px rgba(0,0,0,0.85), 0 0 3px rgba(0,0,0,0.9);
}
/* 恒星自转（虚线光环 + 指针绕中心缓慢旋转） */
.graph-star-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: star-spin 26s linear infinite;
}
@keyframes star-spin { to { transform: rotate(360deg); } }
/* 恒星呼吸光晕 */
.graph-star-glow {
  transform-box: fill-box;
  transform-origin: center;
  animation: star-breathe 3.4s ease-in-out infinite;
}
@keyframes star-breathe {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
.graph-sub-label {
  text-anchor: middle; font-size: 11.5px;
  fill: #cfd8e6; pointer-events: none;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

/* ---------- 图片灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
}
.lb-mask { position: absolute; inset: 0; background: rgba(10, 16, 28, 0.86); }
.lb-img {
  position: relative; max-width: 92vw; max-height: 88vh;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
.lb-close {
  position: absolute; top: 18px; right: 22px;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; font-size: 18px;
  cursor: pointer; transition: background .15s;
}
.lb-close:hover { background: rgba(255,255,255,.28); }
.lb-hint {
  position: absolute; bottom: 18px; left: 0; right: 0; text-align: center;
  color: rgba(255,255,255,.65); font-size: 12px;
}
