:root { --bg:#f6f7f9; --ink:#1f2937; --muted:#6b7280; --line:#e5e7eb; }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--ink);
  font-family:"Microsoft YaHei","PingFang SC",system-ui,sans-serif; }

.wrap { margin:0 auto; padding:0; position:relative; }

/* 画布：原生滚动容器，内容尺寸随缩放变化，因此文字始终按真实字号矢量重绘 */
.frame { position:relative; }
/* 画布左右边缘渐隐：被裁掉的内容淡出，不出现生硬的半截文字 */
.edge { position:absolute; top:0; bottom:0; width:54px; pointer-events:none; z-index:4; }
.el { left:0; background:linear-gradient(90deg,var(--bg) 20%,rgba(246,247,249,0)); }
.er { right:0; background:linear-gradient(270deg,var(--bg) 20%,rgba(246,247,249,0)); }

.map { position:relative; overflow:auto; height:100vh; min-height:260px;
  cursor:grab; touch-action:none;
  -webkit-user-select:none; user-select:none;
  scrollbar-width:none; -ms-overflow-style:none; }
.map::-webkit-scrollbar { width:0; height:0; display:none; }
.map.drag { cursor:grabbing; }
.map a { -webkit-user-drag:none; text-decoration:none; }

.inner { margin:0 auto; position:relative; }
svg { display:block; }
svg text { font-family:inherit; user-select:none; }

/* 画布分层：竖脊 → 两列章节 → 根节点 */
.trunk { position:absolute; left:0; top:0; pointer-events:none; }
.col { position:absolute; top:0; transition:top .18s ease; }
#colL { left:0; }
#colR { left:0; }
svg.root { position:absolute; left:0; top:0; z-index:3; }

.tgl { cursor:pointer; }
.chip { cursor:pointer; }
.chip:hover { stroke-width:1.8; }
.leaflink:hover text { fill:#1d4ed8; }

/* 右侧竖排缩放按钮 */
.zoombar { position:absolute; right:30px; bottom:30px; z-index:5;
  display:flex; flex-direction:column; gap:7px; }
.zoombar button { width:40px; height:40px; padding:0; border-radius:12px;
  border:1px solid #d8dfe8; background:#fff; color:#334155; font-size:20px; line-height:1;
  font-family:inherit; cursor:pointer; box-shadow:0 2px 10px rgba(15,23,42,.10);
  display:flex; align-items:center; justify-content:center;
  transition:background .12s, transform .12s; }
.zoombar button:hover { background:#f1f5f9; }
.zoombar button:active { transform:scale(.94); }
.zoombar button.txt { font-size:11.5px; color:#475569; letter-spacing:.5px; }
.zoombar button.prog { width:auto; min-width:40px; padding:0 10px; height:40px;
  font-weight:600; color:#0d9488; }

/* ---------- 顶部 HUD：左品牌+入口，右搜索 ---------- */
.hud { position:absolute; top:14px; z-index:6; display:flex; align-items:center; gap:8px; }
.hud.tl { left:20px; }
.hud.tr { right:20px; }
.brand { font-size:13.5px; font-weight:600; color:#334155;
  background:#fff; border:1px solid #e2e8f0; border-radius:12px;
  padding:9px 14px; box-shadow:0 2px 10px rgba(15,23,42,.08); white-space:nowrap; }
.hudbtn { font-size:12.5px; font-weight:600; text-decoration:none; color:#334155;
  background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:9px 13px;
  box-shadow:0 2px 10px rgba(15,23,42,.08); transition:background .12s; white-space:nowrap; }
.hudbtn:hover { background:#f1f5f9; }
.hudbtn.quiz { color:#fff; background:linear-gradient(135deg,#2563eb,#0d9488); border:0; }
.hudbtn.quiz:hover { filter:brightness(1.08); }

/* ---------- 搜索 ---------- */
.searchbox { position:relative; }
.searchbox input { width:260px; height:38px; padding:0 14px; font-size:13px;
  font-family:inherit; color:var(--ink); background:#fff; border:1px solid #e2e8f0;
  border-radius:12px; outline:none; box-shadow:0 2px 10px rgba(15,23,42,.08);
  transition:width .18s, border-color .12s; }
.searchbox input:focus { width:320px; border-color:#93c5fd; }
.qres { position:absolute; top:44px; right:0; width:360px; max-height:420px; overflow:auto;
  background:#fff; border:1px solid #e2e8f0; border-radius:14px;
  box-shadow:0 10px 34px rgba(15,23,42,.16); display:none; padding:6px; }
.qres.show { display:block; }
.qitem { padding:8px 10px; border-radius:9px; cursor:pointer; font-size:12.5px;
  color:#334155; display:flex; gap:8px; align-items:baseline; line-height:1.45; }
.qitem:hover, .qitem.act { background:#eff6ff; }
.qitem .qk { flex:none; font-size:10.5px; font-weight:600; color:#fff; background:#64748b;
  border-radius:5px; padding:1.5px 6px; }
.qitem.q-leaf .qk { background:#2563eb; }
.qitem.q-chip .qk { background:#0d9488; }
.qitem .qt b { color:#1d4ed8; }
.qempty { padding:14px; text-align:center; font-size:12px; color:#94a3b8; }

/* ---------- 学习进度：检查点 / 已读态 / 高亮闪烁 ---------- */
.leafchk { cursor:pointer; }
.leafchk circle { transition:fill .15s, stroke .15s; }
.leafchk:hover circle { stroke:#0d9488; }
.leafchk .tick { opacity:0; }
.leafchk.done circle { fill:#10b981; stroke:#10b981; }
.leafchk.done .tick { opacity:1; }
a.leaflink.done text { fill:#0f766e; }
a.chipread rect.chip { fill:#ecfdf5; stroke:#6ee7b7; }
a.flashmark rect, a.flashmark text { animation:topo-flash 1.5s ease-out 1; }
g.flashmark text { animation:topo-flash 1.5s ease-out 1; }
@keyframes topo-flash {
  0% { fill:#fbbf24; } 60% { fill:#fbbf24; } 100% { } }
g.flashmark circle { stroke:#f59e0b; stroke-width:3; }
