/* ==========================================================================
   AI 学习工作台 · 设计系统
   零依赖 / 深浅双主题 / 响应式。所有组件类都在这里定义。
   ========================================================================== */

/* ---------- 主题变量 ---------- */
:root[data-theme="dark"] {
  --bg: #080b18;
  --bg-2: #0d1226;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-solid: #121834;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e8ecf8;
  --text-2: #a7b0cc;
  --text-3: #737d9c;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --info: #60a5fa;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.30);
  --code-bg: rgba(4, 7, 18, 0.72);
  --glow-a: rgba(124, 92, 255, 0.30);
  --glow-b: rgba(34, 211, 238, 0.18);
  --grid-line: rgba(255, 255, 255, 0.05);
}
:root[data-theme="light"] {
  --bg: #f4f6fc;
  --bg-2: #eaeefb;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-2: #ffffff;
  --surface-solid: #ffffff;
  --border: rgba(17, 24, 60, 0.10);
  --border-strong: rgba(17, 24, 60, 0.20);
  --text: #131a33;
  --text-2: #4c5679;
  --text-3: #79839f;
  --accent: #6039ff;
  --accent-2: #0891b2;
  --accent-soft: rgba(96, 57, 255, 0.10);
  --ok: #059669;
  --warn: #b45309;
  --err: #e11d48;
  --info: #2563eb;
  --shadow: 0 16px 40px rgba(23, 32, 74, 0.12);
  --shadow-sm: 0 4px 14px rgba(23, 32, 74, 0.08);
  --code-bg: #0f1428;
  --glow-a: rgba(96, 57, 255, 0.16);
  --glow-b: rgba(8, 145, 178, 0.12);
  --grid-line: rgba(17, 24, 60, 0.05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -5%, var(--glow-a), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, var(--glow-b), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.35; font-weight: 650; letter-spacing: .2px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.04rem; }
p { margin: .5em 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; flex: 0 0 252px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 18px 12px; display: flex; gap: 11px; align-items: center; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 8px 22px var(--glow-a);
}
.brand-text b { display: block; font-size: 15px; letter-spacing: .3px; }
.brand-text span { font-size: 11.5px; color: var(--text-3); }
.nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 11px; color: var(--text-3); padding: 14px 10px 6px; letter-spacing: .12em; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 11px; cursor: pointer;
  color: var(--text-2); font-size: 14px; border: 1px solid transparent;
  transition: background .16s, color .16s, transform .16s;
  user-select: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft); color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item .ni { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; opacity: .95; }
.nav-item .ni svg { width: 17px; height: 17px; }
.nav-item .nt { flex: 1; }
.nav-item .nv { font-size: 11px; color: var(--text-3); }
.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px);
}
.topbar-title { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.topbar-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.view { padding: 24px 22px 60px; max-width: 1180px; width: 100%; margin: 0 auto; }
.menu-btn { display: none; }

/* ---------- 通用 ---------- */
.lead { color: var(--text-2); font-size: 15px; max-width: 74ch; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; }
.section-title .line { flex: 1; height: 1px; background: var(--border); }
.hero {
  border: 1px solid var(--border); border-radius: 20px; padding: 26px 26px 22px;
  background:
    radial-gradient(600px 260px at 88% -10%, var(--glow-a), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero h1 { font-size: 1.75rem; }
.hero .kicker { font-size: 12px; letter-spacing: .18em; color: var(--accent-2); text-transform: uppercase; }
.hero-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 16px; }
.hero-stat b { display: block; font-size: 1.3rem; }
.hero-stat span { font-size: 12px; color: var(--text-3); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 17px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card.hoverable { cursor: pointer; }
.card.hoverable:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.card-title { font-weight: 640; font-size: 15px; }
.card-sub { font-size: 12.5px; color: var(--text-3); }
.card-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
}
.card-icon svg { width: 18px; height: 18px; }
.card-foot { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.panel-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 10px 12px; }

/* ---------- 按钮 / 控件 ---------- */
.btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); padding: 8px 13px; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; font-family: inherit; display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, border-color .15s, transform .15s, opacity .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 8px 22px var(--glow-a);
}
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px;
  color: var(--text-2); cursor: pointer; user-select: none; transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip .cdot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: 11.5px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.tag.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.tag.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.kbd {
  font-family: "Cascadia Code", Consolas, monospace; font-size: 11.5px; padding: 2px 6px;
  border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2);
}
.input, .select, .textarea {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px;
  font-family: inherit; font-size: 13.5px;
}
.textarea { font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.65; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.field .help { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); position: relative; transition: all .18s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: all .18s; }
.switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .track::after { left: 20px; background: var(--accent); }

/* ---------- 进度 ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.ring { width: 46px; height: 46px; flex: 0 0 46px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-txt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px 15px; }
.stat-num { font-size: 1.5rem; font-weight: 700; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--text-3); }

/* ---------- 代码 / 日志 ---------- */
.code {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px;
  overflow: auto; max-height: 460px; padding: 10px 0;
}
:root[data-theme="light"] .code { color: #dbe4ff; }
.code-line { display: flex; gap: 12px; padding: 0 14px; white-space: pre; font-family: "Cascadia Code", Consolas, monospace; font-size: 12.8px; line-height: 1.75; }
.code-line .ln { color: var(--text-3); min-width: 22px; text-align: right; user-select: none; flex: 0 0 auto; }
.code-line.hl { background: rgba(124, 92, 255, .14); }
.trace { background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
:root[data-theme="light"] .trace { color: #dbe4ff; }
.trace-row {
  display: flex; gap: 12px; padding: 5px 14px; font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.6px; line-height: 1.7; cursor: pointer; border-left: 3px solid transparent;
}
.trace-row:hover { background: rgba(255, 255, 255, .05); }
.trace-row .t { color: var(--text-3); flex: 0 0 62px; }
.trace-row .lv { flex: 0 0 52px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.trace-row .msg { flex: 1; white-space: pre-wrap; word-break: break-word; }
.trace-row.suspect { background: rgba(251, 113, 133, .10); border-left-color: var(--err); }
.trace-row.open { background: rgba(124, 92, 255, .14); border-left-color: var(--accent); }
.trace-note {
  padding: 8px 14px 10px 82px; font-size: 13px; color: var(--text-2);
  background: rgba(124, 92, 255, .08); border-left: 3px solid var(--accent);
  font-family: inherit;
}
.lv-info { color: var(--info); } .lv-warn { color: var(--warn); } .lv-error { color: var(--err); }
.lv-tool { color: var(--accent-2); } .lv-deny { color: #f472b6; } .lv-ok { color: var(--ok); }
.callout { border-left: 3px solid var(--info); background: var(--surface); padding: 11px 14px; border-radius: 0 12px 12px 0; margin: 12px 0; font-size: 13.5px; }
.callout.warn { border-color: var(--warn); }
.callout.danger { border-color: var(--err); }
.callout.ok { border-color: var(--ok); }
.callout b { color: var(--text); }
pre.raw { background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; overflow: auto; font-size: 12.5px; font-family: "Cascadia Code", Consolas, monospace; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; background: var(--surface-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; }

/* ---------- Tabs / 折叠 ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 16px; }
.tab {
  padding: 7px 13px; border-radius: 10px; cursor: pointer; font-size: 13.5px;
  color: var(--text-2); border: 1px solid transparent; user-select: none;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.acc { border: 1px solid var(--border); border-radius: 13px; margin-bottom: 10px; overflow: hidden; background: var(--surface); }
.acc-head { padding: 12px 15px; cursor: pointer; display: flex; align-items: center; gap: 11px; user-select: none; }
.acc-head:hover { background: var(--surface-2); }
.acc-head .idx {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; background: var(--accent-soft); color: var(--accent-2); font-weight: 700;
}
.acc-head .arrow { margin-left: auto; color: var(--text-3); transition: transform .2s; }
.acc.open .acc-head .arrow { transform: rotate(90deg); }
.acc-body { display: none; padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.acc.open .acc-body { display: block; }

/* ---------- 概念地图 ---------- */
.map-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 14px; align-items: start; }
.map-stage { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; height: 660px; }
.map-stage svg { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.map-stage svg.dragging { cursor: grabbing; }
.node-g { cursor: pointer; }
.node-g circle { transition: stroke-width .15s, r .15s; }
.node-g text { fill: var(--text); font-size: 13.5px; pointer-events: none; font-weight: 550; paint-order: stroke; stroke: var(--bg); stroke-width: 3.5px; stroke-linejoin: round; }
.node-g.dim { opacity: .18; }
.node-g.hit circle { stroke-width: 3.5px; }
.edge { stroke: var(--border-strong); stroke-width: 1.1; fill: none; }
.edge.hit { stroke: var(--accent); stroke-width: 2; }
.edge.dim { opacity: .12; }
.map-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 76px; }
.detail-box { max-height: 470px; overflow: auto; }
.detail-box h3 { display: flex; align-items: center; gap: 8px; }
.detail-box .lvl { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.rel-list { display: flex; flex-wrap: wrap; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ---------- Skill 工坊 ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.score-ring { display: flex; align-items: center; gap: 14px; }
.issue { display: flex; gap: 9px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.issue:last-child { border-bottom: 0; }
.issue .sev { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; }
.sev.err { background: var(--err); } .sev.warn { background: var(--warn); } .sev.ok { background: var(--ok); } .sev.info { background: var(--info); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.checkline { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; font-size: 13.5px; cursor: pointer; }
.checkline input { margin-top: 6px; accent-color: var(--accent); }

/* ---------- 编排台 ---------- */
.orch { display: grid; grid-template-columns: 172px minmax(0, 1fr) 282px; gap: 12px; align-items: start; }
.orch > div { min-width: 0; }
.orch-palette { display: flex; flex-direction: column; gap: 7px; }
.pal-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px;
  transition: all .15s;
}
.pal-item:hover { border-color: var(--accent); transform: translateX(3px); }
.pal-item .sq { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 10px; color: #fff; font-weight: 700; }
.canvas {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  height: 560px; overflow: auto;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 26px 26px;
}
.canvas-inner { position: relative; width: 1400px; height: 1000px; }
.edge-layer { position: absolute; inset: 0; width: 1400px; height: 1000px; pointer-events: none; }
.node-card {
  position: absolute; width: 152px; padding: 9px 11px; border-radius: 12px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); cursor: grab;
  box-shadow: var(--shadow-sm); font-size: 12.5px; user-select: none;
}
.node-card:active { cursor: grabbing; }
.node-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.node-card .nt { display: flex; align-items: center; gap: 7px; font-weight: 620; }
.node-card .nb { font-size: 11px; color: var(--text-3); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-card .bar { height: 3px; border-radius: 3px; margin-bottom: 7px; }
.node-card .port { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--accent-2); border: 2px solid var(--surface-solid); right: -6px; top: 50%; transform: translateY(-50%); cursor: crosshair; }
.node-card .port.in { left: -6px; right: auto; background: var(--ok); }
.node-card.running { border-color: var(--accent-2); animation: pulse 1s ease-in-out infinite; }
.node-card.done { border-color: var(--ok); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 8px transparent; } }
.inspector { display: flex; flex-direction: column; gap: 12px; }
.console-log { background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; height: 190px; overflow: auto; font-family: "Cascadia Code", Consolas, monospace; font-size: 12.4px; }
.console-log div { white-space: pre-wrap; }

/* ---------- 学习进度 ---------- */
.badge-card { text-align: center; padding: 14px 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); opacity: .45; filter: grayscale(1); }
.badge-card.on { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: 0 8px 22px var(--glow-a); }
.badge-card .bi { font-size: 24px; }
.badge-card .bn { font-size: 12.5px; font-weight: 620; margin-top: 5px; }
.badge-card .bd { font-size: 11px; color: var(--text-3); }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface-solid); border: 2px solid var(--accent); }
.tl-item.done::before { background: var(--ok); border-color: var(--ok); }
.tl-item h4 { margin: 0 0 4px; font-size: 14px; }

/* ---------- 测验 ---------- */
.quiz-opt {
  display: flex; gap: 10px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 8px; cursor: pointer; background: var(--surface); font-size: 13.8px; transition: all .15s;
}
.quiz-opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.quiz-opt .k { flex: 0 0 22px; height: 22px; border-radius: 7px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.quiz-opt.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.quiz-opt.wrong { border-color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.quiz-opt.locked { cursor: default; }

/* ---------- 浮层 ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 10px 15px; font-size: 13.5px; box-shadow: var(--shadow);
  animation: slideIn .22s ease; max-width: 340px;
}
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--err); } .toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay { position: fixed; inset: 0; z-index: 150; background: rgba(5, 8, 20, .62); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 9vh 18px 18px; }
.overlay[hidden] { display: none; }
.modal { background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow); width: min(760px, 100%); max-height: 80vh; overflow: auto; padding: 20px 22px; }
.palette { width: min(640px, 100%); background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.palette-input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); padding: 15px 18px; font-size: 15px; font-family: inherit; outline: none; }
.palette-list { max-height: 52vh; overflow: auto; padding: 6px; }
.palette-item { display: flex; gap: 11px; align-items: center; padding: 9px 12px; border-radius: 11px; cursor: pointer; font-size: 13.5px; }
.palette-item.active, .palette-item:hover { background: var(--accent-soft); }
.palette-item .pi-kind { margin-left: auto; font-size: 11px; color: var(--text-3); }
.palette-hint { padding: 8px 14px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); display: flex; gap: 14px; }
.empty { text-align: center; padding: 38px 18px; color: var(--text-3); }
.empty .big { font-size: 30px; margin-bottom: 8px; }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border-strong); border-top-color: var(--accent-2);
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: grid; place-items: center; gap: 12px; padding: 60px 0; color: var(--text-3); }
footer.site-foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .map-wrap { grid-template-columns: 1fr; }
  .map-side { position: static; }
  .orch { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 120; left: 0; top: 0; height: 100vh;
    transform: translateX(-102%); transition: transform .24s ease; box-shadow: var(--shadow);
    background: var(--surface-solid);
  }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .view { padding: 18px 14px 50px; }
  .topbar { padding: 10px 14px; }
  .map-stage { height: 480px; }
  .kv { grid-template-columns: 96px 1fr; }
}
@media print {
  .sidebar, .topbar-actions, .toasts { display: none; }
}
