/* AI 知识地图 — 样式 */

:root {
  --bg:        #14161a;
  --bg-panel:  #1a1d23;
  --bg-raise:  #21252d;
  --line:      #2c313b;
  --line-soft: #23272f;
  --fg:        #dfe3ea;
  --fg-dim:    #9aa2b1;
  --fg-faint:  #7f8999;
  --accent:    #7aa2d8;
  --controls-width: 224px;
  --lyr-base:     #6b8cbe;
  --lyr-emerging: #d3a05a;
  --lyr-news:     #cf6f6f;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font: 14px/1.6 "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ───────── 顶栏 ───────── */
#topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 16px; height: 52px; flex: 0 0 52px;
  background: var(--bg-panel); border-bottom: 1px solid var(--line);
  z-index: 30;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark { color: var(--accent); font-size: 17px; }
.brand-name { font-weight: 600; letter-spacing: .04em; }
.brand-ver  { color: var(--fg-faint); font-size: 11px; }
.mode-nav { display: flex; gap: 3px; padding: 3px; background: #15181e; border: 1px solid var(--line);
            border-radius: 8px; }
.mode-nav-btn { border: 0; border-radius: 5px; padding: 4px 10px; color: var(--fg-faint);
                background: transparent; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.mode-nav-btn:hover { color: var(--fg); background: var(--bg-raise); }
.mode-nav-btn.active { color: #eaf2ff; background: #33435b; box-shadow: inset 0 0 0 1px #486180; }

/* ───────── 软件模式 ───────── */
#cy.hidden, #legend.hidden { display: none; }
#software-view { position: absolute; inset: 0; overflow-y: auto; padding: 24px 28px 60px;
                 background: var(--bg); z-index: 6; }
#software-view.hidden { display: none; }
.sw-head h2 { margin: 0 0 4px; font-size: 20px; }
.sw-head p { margin: 0 0 20px; color: var(--fg-faint); font-size: 13px; }
.sw-head .xref { cursor: default; }
.sw-cat { margin-bottom: 26px; }
.sw-cat h3 { font-size: 14px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px;
             border-bottom: 1px solid var(--line-soft); padding-bottom: 7px; }
.sw-cat h3 em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--fg-faint); }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.sw-card { background: var(--bg-raise); border: 1px solid var(--line); border-left-width: 3px;
           border-radius: 6px; padding: 11px 13px; cursor: pointer; transition: border-color .12s; }
.sw-card:hover { border-color: var(--accent); }
.sw-name { font-size: 14px; font-weight: 600; color: var(--fg); }
.sw-by { font-size: 11px; color: var(--fg-faint); margin: 1px 0 6px; }
.sw-sum { font-size: 12px; color: var(--fg-dim); line-height: 1.6; }

/* ───────── 专业资料库 ───────── */
#library-view { position: absolute; inset: 0; overflow-y: auto; padding: 24px 28px 60px;
                background: var(--bg); z-index: 7; }
#library-view.hidden { display: none; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
            margin: 0 auto 20px; max-width: 1180px; }
.lib-head h2 { margin: 0 0 4px; font-size: 20px; }
.lib-head p { margin: 0; color: var(--fg-faint); font-size: 13px; }
.lib-count { color: var(--accent); font-size: 12px; white-space: nowrap; }
.lib-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px;
              max-width: 1180px; margin: 0 auto; }
.lib-sources { align-self: start; position: sticky; top: 0; padding: 8px;
               border: 1px solid var(--line); border-radius: 9px; background: var(--bg-panel); }
.lib-source { width: 100%; display: grid; grid-template-columns: 25px 1fr auto; gap: 7px;
              align-items: center; border: 0; border-radius: 6px; padding: 7px 8px;
              color: var(--fg-dim); background: transparent; text-align: left; font: inherit; cursor: pointer; }
.lib-source:hover { color: var(--fg); background: var(--bg-raise); }
.lib-source.active { color: var(--fg); background: #252c36; box-shadow: inset 2px 0 var(--source-color, var(--accent)); }
.lib-source-order { font: 600 11px/1 ui-monospace, "SFMono-Regular", Consolas, monospace; color: var(--source-color); }
.lib-source-label { font-size: 12px; }
.lib-source-count { color: var(--fg-faint); font-size: 10px; }
.lib-subnav { margin-bottom: 13px; padding: 12px; border: 1px solid var(--line);
              border-radius: 8px; background: var(--bg-panel); }
.lib-subnav-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 9px; }
.lib-subnav-head b { display: block; color: var(--fg); font-size: 12px; }
.lib-subnav-head span { display: block; margin-top: 1px; color: var(--fg-faint); font-size: 10px; }
.lib-subnav-head em { color: var(--fg-faint); font-style: normal; font-size: 10px; white-space: nowrap; }
.lib-sub-overview { display: flex; align-items: center; gap: 12px; color: var(--fg-faint); font-size: 11px; }
.lib-sub-select { flex: 1; min-width: 220px; padding: 6px 9px; border: 1px solid var(--line);
                  border-radius: 5px; background: var(--bg-raise); color: var(--fg); font: inherit; font-size: 11px; }
.lib-sub-select:focus { outline: none; border-color: var(--accent); }
.lib-subchips { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-subchip { border: 1px solid var(--line); border-radius: 14px; padding: 3px 8px;
               background: var(--bg-raise); color: var(--fg-dim); font: inherit; font-size: 10px; cursor: pointer; }
.lib-subchip:hover { color: var(--fg); border-color: var(--source-color, var(--accent)); }
.lib-subchip.active { color: #eaf2ff; border-color: var(--accent); background: #2a3b51; }
.lib-subchip span { margin-left: 3px; color: var(--fg-faint); font-size: 9px; }
.lib-platform-profile { position: relative; margin-top: 13px; padding: 15px 16px 12px;
                        border: 1px solid #354052; border-radius: 8px;
                        background: linear-gradient(145deg, #202630, #1b1f26); overflow: hidden; }
.lib-platform-profile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
                                background: var(--accent); opacity: .8; }
.lib-profile-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.lib-profile-title span { color: var(--accent); font-size: 9px; letter-spacing: .12em; }
.lib-profile-title h3 { margin: 0; color: var(--fg); font-size: 17px; line-height: 1.35; }
.lib-profile-link, .lib-profile-no-link { flex: 0 0 auto; margin-top: 3px; padding: 4px 8px;
                                         border-radius: 5px; font-size: 10px; }
.lib-profile-link { border: 1px solid #496486; color: #b9d5fb; text-decoration: none; }
.lib-profile-link:hover { background: #29394d; }
.lib-profile-no-link { color: var(--fg-faint); background: #171a20; }
.lib-profile-intro { max-width: 1040px; margin: 11px 0 13px; padding: 12px 14px;
                     border-left: 2px solid #55779f; background: rgba(28,35,45,.62); }
.lib-profile-intro span { color: #8eabd0; font-size: 9px; letter-spacing: .1em; }
.lib-profile-intro p { margin: 4px 0 0; color: #d1d7e0; font-size: 12px; line-height: 1.85; }
.lib-profile-strengths { margin-bottom: 10px; }
.lib-profile-strengths h4 { margin: 0 0 6px; color: var(--fg); font-size: 11px; }
.lib-profile-strengths > div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.lib-profile-strengths p { position: relative; margin: 0; padding: 8px 9px 8px 25px;
                           border: 1px solid #303946; border-radius: 5px; background: #191d23;
                           color: var(--fg-dim); font-size: 10px; line-height: 1.55; }
.lib-profile-strengths p::before { content: "◆"; position: absolute; left: 9px; top: 9px;
                                   color: #6e90b8; font-size: 7px; }
.lib-profile-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 0 10px; }
.lib-profile-facts > div { padding: 8px 9px; border-radius: 5px; background: rgba(15,17,21,.48); }
.lib-profile-facts dt { margin-bottom: 2px; color: var(--fg-faint); font-size: 9px; }
.lib-profile-facts dd { margin: 0; color: var(--fg-dim); font-size: 10px; line-height: 1.55; }
.lib-profile-sections { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lib-profile-sections section { padding: 11px 12px; border-radius: 6px; background: rgba(15,17,21,.55); }
.lib-profile-sections h4 { margin: 0 0 6px; color: var(--fg); font-size: 11px; }
.lib-profile-sections ul { margin: 0; padding-left: 17px; color: var(--fg-dim); font-size: 11px; line-height: 1.65; }
.lib-profile-sections li + li { margin-top: 3px; }
.lib-profile-caution { margin-top: 10px; padding: 9px 11px; border-left: 2px solid #b99355;
                       border-radius: 3px; background: rgba(128,91,40,.12); }
.lib-profile-caution b { color: #d1aa6c; font-size: 10px; }
.lib-profile-caution p { margin: 2px 0 0; color: #b9b0a1; font-size: 11px; line-height: 1.65; }
.lib-platform-profile footer { margin-top: 9px; color: #667182; font-size: 9px; text-align: right; }
.lib-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.lib-search { flex: 1; min-width: 160px; padding: 7px 10px; border: 1px solid var(--line);
              border-radius: 6px; background: var(--bg-raise); color: var(--fg); font: inherit; }
.lib-search:focus { outline: none; border-color: var(--accent); }
.lib-filter-note { color: var(--fg-faint); font-size: 11px; white-space: nowrap; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 12px; }
.lib-card { min-height: 210px; display: flex; flex-direction: column; padding: 14px;
            border: 1px solid var(--line); border-top: 3px solid var(--source-color);
            border-radius: 8px; background: var(--bg-raise); cursor: pointer;
            transition: transform .12s, border-color .12s, background .12s; }
.lib-card:hover { transform: translateY(-2px); border-color: var(--source-color); background: #242932; }
.lib-card-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.lib-badge { padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--source-color) 55%, transparent);
             border-radius: 10px; color: var(--source-color); font-size: 10px; }
.lib-subbadge { padding: 1px 6px; border-radius: 10px; background: #171a20; color: var(--fg-dim); font-size: 10px; }
.lib-tier { margin-left: auto; color: var(--fg-faint); font: 600 10px ui-monospace, Consolas, monospace; }
.lib-discovery { color: #d0b15c; font-size: 10px; }
.lib-title { margin: 0 0 4px; font-size: 15px; line-height: 1.45; color: var(--fg); }
.lib-publisher { color: var(--fg-faint); font-size: 11px; margin-bottom: 9px; }
.lib-summary { color: var(--fg-dim); font-size: 12px; line-height: 1.65; margin: 0 0 12px; }
.lib-card-foot { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.lib-tag { padding: 1px 6px; border-radius: 4px; background: #191c22; color: var(--fg-faint); font-size: 10px; }
.lib-empty { padding: 45px 20px; border: 1px dashed var(--line); border-radius: 8px;
             color: var(--fg-faint); text-align: center; }
.lib-detail-meta { display: grid; grid-template-columns: 76px 1fr; gap: 5px 10px; font-size: 12px; }
.lib-detail-meta dt { color: var(--fg-faint); }
.lib-detail-meta dd { margin: 0; color: var(--fg); overflow-wrap: anywhere; }
.lib-source-link { display: inline-block; margin-top: 14px; padding: 6px 10px; border: 1px solid var(--accent);
                   border-radius: 5px; color: #b9d5fb; text-decoration: none; font-size: 12px; }
.lib-source-link:hover { background: #24354a; }

@media (max-width: 820px) {
  #topbar { gap: 8px; padding: 0 10px; }
  .brand-ver { display: none; }
  .mode-nav-btn { padding: 4px 7px; }
  .search-wrap { max-width: none; }
  #library-view { padding: 16px 14px 50px; }
  .lib-layout { grid-template-columns: 1fr; }
  .lib-sources { position: static; display: flex; overflow-x: auto; gap: 3px; }
  .lib-source { width: auto; min-width: max-content; grid-template-columns: 20px auto auto; }
  .lib-sub-overview { align-items: stretch; flex-direction: column; gap: 7px; }
  .lib-sub-select { width: 100%; min-width: 0; }
  .lib-profile-sections { grid-template-columns: 1fr; }
  .lib-profile-strengths > div, .lib-profile-facts { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .brand-name, .topbar-actions { display: none; }
  .mode-nav { flex: 0 0 auto; }
  .mode-nav-btn { font-size: 11px; }
  .lib-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .lib-grid { grid-template-columns: 1fr; }
  .lib-profile-title { flex-direction: column; }
}

.search-wrap { position: relative; flex: 1; max-width: 380px; }
#search {
  width: 100%; padding: 7px 12px;
  background: var(--bg-raise); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; outline: none;
  font-family: inherit; font-size: 13px;
}
#search:focus { border-color: var(--accent); }
#search-results {
  position: absolute; top: 38px; left: 0; right: 0;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: 6px; max-height: 300px; overflow-y: auto;
  display: none; z-index: 40;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
#search-results.open { display: block; }
.sr-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.sel { background: #2a303a; }
.sr-title { font-size: 13px; }
.sr-sum { font-size: 11px; color: var(--fg-faint); margin-top: 2px;
          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-none { padding: 10px 12px; color: var(--fg-faint); font-size: 12px; }

.topbar-actions { display: flex; gap: 8px; margin-left: auto; }
.btn {
  padding: 6px 12px; background: var(--bg-raise); color: var(--fg-dim);
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: 12px;
}
.btn:hover { color: var(--fg); border-color: var(--accent); }
.btn:focus-visible, .controls-toggle:focus-visible, .settings-close:focus-visible, .settings-select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
}
.icon-btn svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.65; stroke-linejoin: round;
}

.locale-fallback-banner {
  flex: 0 0 auto; padding: 7px 18px; border-bottom: 1px solid rgba(228,184,93,.28);
  background: rgba(228,184,93,.08); color: #d9bd7a; font-size: 11px; line-height: 1.45;
  text-align: center;
}
.locale-fallback-banner.hidden { display: none; }

/* ───────── 布局 ───────── */
#main { position: relative; display: flex; flex: 1; min-height: 0; }

/* ───────── 左侧控制栏 ───────── */
#controls {
  width: var(--controls-width); flex: 0 0 var(--controls-width); padding: 4px 0 24px;
  background: var(--bg-panel); border-right: 1px solid var(--line);
  overflow-y: auto;
  transition: width .18s ease, flex-basis .18s ease, border-color .18s ease;
}
#controls.hidden { display: none; }
#app.controls-collapsed #controls:not(.hidden) {
  width: 0; flex-basis: 0; padding-left: 0; padding-right: 0;
  border-right-color: transparent; overflow: hidden;
}
.controls-toggle {
  position: absolute; left: var(--controls-width); top: 24px; z-index: 35;
  width: 26px; height: 54px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0;
  background: rgba(26,29,35,.96); color: var(--fg-faint); cursor: pointer;
  box-shadow: 5px 0 16px rgba(0,0,0,.18);
  transition: left .18s ease, color .12s ease, border-color .12s ease, background .12s ease;
}
.controls-toggle:hover { color: var(--fg); border-color: #465163; background: #222731; }
.controls-toggle.hidden { display: none; }
.controls-toggle svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease;
}
#app.controls-collapsed .controls-toggle { left: 0; }
#app.controls-collapsed .controls-toggle svg { transform: rotate(180deg); }
.ctl-group { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.ctl-group h3 {
  margin: 0 0 8px; font-size: 11px; font-weight: 600;
  color: var(--fg-faint); letter-spacing: .12em; text-transform: uppercase;
}
.ctl-toggle-heading button {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 0; border: 0; background: transparent; color: inherit;
  font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; text-align: left;
}
.ctl-toggle-heading button:hover { color: var(--fg); }
.ctl-chevron { font-size: 15px; line-height: 1; transition: transform .16s ease; }
.ctl-toggle-heading button[aria-expanded="false"] .ctl-chevron { transform: rotate(-90deg); }
.ctl-hint { margin: -4px 0 8px; font-size: 11px; color: var(--fg-faint); line-height: 1.5; }

.chk {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 0; cursor: pointer; font-size: 13px; color: var(--fg-dim);
}
.chk:hover { color: var(--fg); }
.chk input { accent-color: var(--accent); cursor: pointer; margin: 0; }
.chk em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--fg-faint); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 9px; }
.dash { width: 14px; height: 0; border-top: 2px solid; display: inline-block; flex: 0 0 14px; }
.domain-group + .domain-group { border-top: 1px solid var(--line-soft); }
.domain-row { display: flex; align-items: center; gap: 4px; }
.domain-filter { flex: 1; min-width: 0; }
.domain-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-expand {
  width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 4px; background: transparent;
  color: var(--fg-faint); font: inherit; cursor: pointer;
}
.domain-expand:hover { color: var(--fg); background: var(--bg-raise); }
.domain-expand span { transition: transform .16s ease; }
.domain-expand[aria-expanded="true"] span { transform: rotate(180deg); }
.domain-node-list {
  max-height: 220px; overflow-y: auto; margin: 0 0 6px 20px;
  padding: 2px 2px 4px 6px; border-left: 1px solid var(--line);
}
.domain-node {
  width: 100%; display: flex; align-items: center; gap: 7px;
  padding: 5px 6px; border: 0; border-radius: 4px; background: transparent;
  color: var(--fg-dim); font: inherit; font-size: 11.5px; text-align: left; cursor: pointer;
}
.domain-node:hover { color: var(--fg); background: var(--bg-raise); }
.domain-node span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-expand:focus-visible, .domain-node:focus-visible, .ctl-toggle-heading button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* 视图范围切换 */
.seg { display: flex; gap: 0; margin-bottom: 8px; }
.seg button {
  flex: 1; padding: 5px 0; font-size: 12px; font-family: inherit; cursor: pointer;
  background: var(--bg-raise); color: var(--fg-faint);
  border: 1px solid var(--line); border-right-width: 0;
}
.seg button:first-child { border-radius: 5px 0 0 5px; }
.seg button:last-child  { border-radius: 0 5px 5px 0; border-right-width: 1px; }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--accent); color: #12141a; border-color: var(--accent); font-weight: 600; }

.scope-status { font-size: 11px; color: var(--fg-faint); margin-bottom: 8px; line-height: 1.5; }
.mini.wide { width: 100%; }
.mini:disabled { opacity: .4; cursor: default; }
.mini:disabled:hover { color: var(--fg-faint); border-color: var(--line); }

.edge-actions { display: flex; gap: 5px; margin-bottom: 8px; }
.mini {
  flex: 1; padding: 3px 0; font-size: 11px; font-family: inherit;
  background: var(--bg-raise); color: var(--fg-faint);
  border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
}
.mini:hover { color: var(--fg); border-color: var(--accent); }

.range { display: flex; align-items: center; gap: 8px; padding: 6px 0;
         font-size: 12px; color: var(--fg-dim); }
.range input { flex: 1; accent-color: var(--accent); }

/* 学习进度 */
.learning-overview {
  display: flex; align-items: baseline; justify-content: space-between;
  color: var(--fg-dim); margin-bottom: 7px;
}
.learning-overview strong { color: var(--fg); font-size: 20px; line-height: 1; }
.learning-overview span { font-size: 11px; color: var(--fg-faint); }
.learning-progress {
  height: 5px; overflow: hidden; margin-bottom: 10px;
  border-radius: 999px; background: var(--bg-raise);
}
.learning-progress span {
  display: block; width: 0; height: 100%; border-radius: inherit;
  background: var(--accent); transition: width .2s ease;
}
.learning-group { border-top: 1px solid var(--line-soft); }
.learning-group summary {
  display: flex; align-items: center; gap: 6px; padding: 8px 0;
  color: var(--fg-dim); font-size: 12px; cursor: pointer; list-style-position: inside;
}
.learning-group summary:hover { color: var(--fg); }
.learning-group summary em {
  margin-left: auto; font-style: normal; font-size: 10.5px; color: var(--fg-faint);
  background: var(--bg-raise); border-radius: 10px; padding: 0 7px;
}
.learning-node-list { max-height: 168px; overflow-y: auto; padding: 0 2px 7px 0; }
.learning-node {
  display: flex; align-items: center; gap: 7px; width: 100%; padding: 5px 4px;
  border: 0; border-radius: 4px; background: transparent; color: var(--fg-dim);
  font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
.learning-node:hover { color: var(--fg); background: var(--bg-raise); }
.learning-node span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learning-empty { padding: 4px 2px 10px; color: var(--fg-faint); font-size: 11px; }
.learning-storage-note { margin: 7px 0 0; }
.official-path-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; margin: 2px 0 10px; padding: 8px 9px;
  border: 1px solid #6a552f; border-radius: 6px; background: rgba(228,184,93,.06);
  color: #e4b85d; font: inherit; cursor: pointer;
}
.official-path-toggle:hover, .official-path-toggle.on {
  border-color: #e4b85d; background: rgba(228,184,93,.13);
}
.official-path-toggle span { font-size: 12px; font-weight: 650; }
.official-path-toggle em { color: var(--fg-faint); font-size: 9.5px; font-style: normal; }
.official-path-note {
  margin: -2px 0 10px; padding: 8px 9px; border-left: 2px solid #e4b85d;
  background: rgba(228,184,93,.045); color: var(--fg-faint); font-size: 10.5px; line-height: 1.55;
}
.official-path-note.hidden { display: none; }

/* ───────── 图 ───────── */
#stage { flex: 1; position: relative; min-width: 0; }
#cy { position: absolute; inset: 0; }

/* ───────── 设置 ───────── */
.settings-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
}
.settings-overlay.hidden { display: none; }
.settings-backdrop {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
  background: rgba(6,8,12,.68); backdrop-filter: blur(3px); cursor: default;
}
.settings-dialog {
  position: relative; width: min(440px, 100%); overflow: hidden;
  border: 1px solid #363d49; border-radius: 12px; background: var(--bg-panel);
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.settings-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 20px 16px; border-bottom: 1px solid var(--line);
}
.settings-eyebrow { display: block; color: var(--accent); font-size: 9px; letter-spacing: .16em; }
.settings-head h2 { margin: 1px 0 0; color: var(--fg); font-size: 19px; font-weight: 650; }
.settings-close {
  width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg-raise); color: var(--fg-dim); font: inherit; font-size: 22px; line-height: 1; cursor: pointer;
}
.settings-close:hover { color: var(--fg); border-color: var(--accent); }
.settings-body { padding: 18px 20px 22px; }
.settings-group h3 {
  margin: 0 0 8px; color: var(--fg-faint); font-size: 11px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raise);
}
.settings-row strong { display: block; color: var(--fg); font-size: 13px; font-weight: 600; }
.settings-row div > span { display: block; margin-top: 1px; color: var(--fg-faint); font-size: 11px; }
.settings-select {
  flex: 0 0 auto; min-width: 178px; min-height: 34px; padding: 6px 32px 6px 10px;
  border: 1px solid #44546b; border-radius: 6px; background: #283447; color: #dceaff;
  font: inherit; font-size: 12px; cursor: pointer; color-scheme: dark;
}
.settings-select:hover:not(:disabled) { border-color: var(--accent); }
.settings-select:disabled { cursor: wait; opacity: .72; }
.settings-note { margin: 8px 2px 0; color: var(--fg-faint); font-size: 10.5px; }
.settings-status { min-height: 16px; margin: 5px 2px 0; color: #e4b85d; font-size: 10.5px; }

.map-zoom {
  position: absolute; top: 14px; right: 14px; z-index: 8;
  display: grid; grid-template-columns: 38px 58px 38px; align-items: stretch;
  overflow: hidden; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(26,29,35,.94); box-shadow: 0 6px 20px rgba(0,0,0,.28);
}
.map-zoom.hidden { display: none; }
.map-zoom button {
  min-height: 38px; padding: 0; border: 0; background: transparent;
  color: var(--fg-dim); font: 600 21px/1 "Segoe UI", sans-serif; cursor: pointer;
}
.map-zoom button:hover:not(:disabled) { color: var(--fg); background: var(--bg-raise); }
.map-zoom button:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--accent); outline-offset: -2px; }
.map-zoom button:disabled { color: #4f5662; cursor: default; }
.map-zoom output {
  display: flex; align-items: center; justify-content: center;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  color: var(--fg-faint); font-size: 11px; font-variant-numeric: tabular-nums;
}

#legend {
  position: absolute; left: 14px; bottom: 14px;
  background: rgba(26,29,35,.92); border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 12px; font-size: 11px; color: var(--fg-faint);
  pointer-events: none; line-height: 1.9;
}
#legend b { color: var(--fg-dim); font-weight: 500; }

#empty-hint {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--fg-faint); font-size: 13px;
}
#empty-hint.hidden { display: none; }

/* ───────── 右侧详情 ───────── */
#detail {
  width: 400px; flex: 0 0 400px; position: relative;
  background: var(--bg-panel); border-left: 1px solid var(--line);
  overflow-y: auto;
}
#detail.closed { display: none; }
#detail-close {
  position: absolute; top: 12px; right: 14px; z-index: 5;
  background: none; border: none; color: var(--fg-faint);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
#detail-close:hover { color: var(--fg); }
#detail-body { padding: 20px 22px 40px; }

.d-domain { font-size: 11px; letter-spacing: .1em; margin-bottom: 8px; }
.mat-tag {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  font-size: 10px; letter-spacing: .05em; border-radius: 8px;
  color: #d3a05a; border: 1px dashed #d3a05a; background: rgba(211,160,90,.08);
}
.d-title { margin: 0 0 6px; font-size: 21px; font-weight: 600; line-height: 1.3; padding-right: 24px; }
.d-alias { color: var(--fg-faint); font-size: 11px; margin-bottom: 14px; }
.d-summary {
  color: var(--fg); font-size: 14px; line-height: 1.75;
  padding: 12px 14px; background: var(--bg-raise);
  border-left: 2px solid var(--accent); border-radius: 0 5px 5px 0;
  margin-bottom: 20px;
}
.d-sec { margin-bottom: 22px; }
.d-sec h4 {
  margin: 0 0 9px; font-size: 11px; font-weight: 600; color: var(--fg-faint);
  letter-spacing: .12em; text-transform: uppercase;
}
.d-body p { margin: 0 0 11px; color: var(--fg-dim); line-height: 1.8; }
.d-body p:last-child { margin-bottom: 0; }
.d-body strong { color: var(--fg); font-weight: 600; }
.d-body code {
  background: var(--bg-raise); padding: 1px 5px; border-radius: 3px;
  font-size: 12px; color: #b8cfe8;
}
.d-body .quote {
  border-left: 2px solid var(--line); padding-left: 12px;
  color: var(--fg-faint); font-size: 13px;
}

/* 正文表格 */
.d-table {
  width: 100%; border-collapse: collapse; margin: 4px 0 14px;
  font-size: 12.5px; display: block; overflow-x: auto;
}
.d-table th, .d-table td {
  border: 1px solid var(--line); padding: 6px 9px;
  text-align: left; vertical-align: top;
}
.d-table th { background: var(--bg-raise); color: var(--fg); font-weight: 600; font-size: 11.5px; }
.d-table td { color: var(--fg-dim); }

/* 正文里的内联概念跳转 */
.xref {
  color: var(--accent); cursor: pointer;
  border-bottom: 1px dashed rgba(122,162,216,.45);
}
.xref:hover { border-bottom-style: solid; background: rgba(122,162,216,.1); }
.xref-bad { color: #c86f6f; border-bottom: 1px dotted #c86f6f; cursor: help; }

.case { background: var(--bg-raise); border-radius: 6px; padding: 11px 13px; margin-bottom: 9px; }
.case-t { font-size: 12px; font-weight: 600; color: var(--fg); margin-bottom: 5px; }
.case-x { font-size: 12.5px; color: var(--fg-dim); line-height: 1.75; }
.case-x strong { color: var(--fg); }
.case-x code { background: #191c22; padding: 1px 4px; border-radius: 3px; font-size: 11.5px; }

.rel { display: flex; align-items: baseline; gap: 8px; padding: 6px 0;
       border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.rel:last-child { border-bottom: none; }
.rel-type { flex: 0 0 62px; font-size: 10.5px; padding: 1px 0; text-align: center;
            border-radius: 3px; color: #12141a; font-weight: 600; }
.rel-to { color: var(--accent); cursor: pointer; }
.rel-to:hover { text-decoration: underline; }
.rel-lbl { color: var(--fg-faint); font-size: 11px; margin-left: auto; }

.d-asof { font-weight: 400; color: var(--fg-faint); font-size: 10px; }
.d-model { display: flex; align-items: baseline; gap: 8px; padding: 6px 0;
           border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.d-model:last-child { border-bottom: none; }
.d-model b { color: var(--fg); font-weight: 600; }
.d-model span { color: var(--fg-faint); font-size: 11px; margin-left: auto; text-align: right; }

.act { border-left: 2px solid var(--lyr-news); padding: 2px 0 2px 11px; margin-bottom: 11px; }
.act-d { font-size: 10.5px; color: var(--lyr-news); letter-spacing: .06em; }
.act-t { font-size: 12.5px; font-weight: 600; margin: 2px 0 3px; }
.act-x { font-size: 12px; color: var(--fg-dim); line-height: 1.7; }

.src a { color: var(--accent); font-size: 12px; text-decoration: none; }
.src a:hover { text-decoration: underline; }

.d-empty { color: var(--fg-faint); font-size: 12px; }

/* ───────── 理解原理 · 深读页按钮（详情面板内） ───────── */
.dd-open {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-raise); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 5px;
  font-size: 11.5px; padding: 3px 10px; cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s;
}
.dd-open:hover { background: var(--accent); color: #12141a; }
.d-domain { display: flex; align-items: center; gap: 8px; }

/* ───────── 理解原理 · 全屏阅读视图 ───────── */
#deepdive { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
            background: var(--bg); }
#deepdive.hidden { display: none; }
.dd-top { display: flex; align-items: center; gap: 14px; height: 50px; flex: 0 0 50px;
          padding: 0 16px; background: var(--bg-panel); border-bottom: 1px solid var(--line); }
.dd-back { background: var(--bg-raise); color: var(--fg-dim); border: 1px solid var(--line);
           border-radius: 6px; font-size: 12.5px; padding: 5px 12px; cursor: pointer; font-family: inherit; }
.dd-back:hover { color: var(--fg); border-color: var(--accent); }
.dd-top-name { font-size: 13px; color: var(--fg-faint); }
.dd-provisional .dd-top-name { color: #ff6b6b; font-weight: 700; }
.dd-x { margin-left: auto; background: none; border: none; color: var(--fg-faint);
        font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.dd-x:hover { color: var(--fg); }
.dd-scroll { flex: 1; overflow-y: auto; }
#dd-article { max-width: 780px; margin: 0 auto; padding: 40px 28px 120px; }
.dd-loading { margin: 72px auto; padding: 24px; color: var(--fg-faint); text-align: center; }
.dd-loading-error { color: #e7a09a; }
.view-loading { margin: 80px auto; padding: 24px; color: var(--fg-faint); text-align: center; font-size: 14px; }

/* hero */
.dd-hero { border-bottom: 1px solid var(--line); padding-bottom: 26px; margin-bottom: 8px; }
.dd-eyebrow { font-size: 11px; letter-spacing: .18em; color: var(--accent); text-transform: uppercase; }
.dd-h1 { font-size: 32px; font-weight: 700; margin: 10px 0 6px; color: var(--fg); letter-spacing: .01em; }
.dd-h1.dd-h1-provisional { color: #ff5f5f; }
.dd-h1.dd-h1-editorial-draft { color: #ff5f5f; }
.dd-provisional-notice { display: flex; flex-direction: column; gap: 3px; margin: 12px 0 14px;
                         padding: 10px 13px; border: 1px solid #9f3a3a; border-radius: 7px;
                         background: rgba(143, 39, 39, .16); color: #f3b4b4; font-size: 12.5px; line-height: 1.6; }
.dd-provisional-notice strong { color: #ff6b6b; font-size: 13px; }
.dd-sub { font-size: 15px; color: var(--fg-dim); }
.dd-ali { font-size: 12px; color: var(--fg-faint); margin-top: 8px; }
.dd-metabar { font-size: 12px; color: var(--fg-faint); margin-top: 6px; }
.dd-thesis { margin-top: 18px; background: var(--bg-raise); border-left: 3px solid var(--accent);
             border-radius: 0 6px 6px 0; padding: 12px 16px; font-size: 14px; line-height: 1.8; color: var(--fg-dim); }
.dd-thesis-l { color: var(--accent); font-weight: 700; margin-right: 6px; }

/* 学习目标 */
.dd-goals { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 8px;
            padding: 16px 20px; margin: 24px 0; }
.dd-goals-h { font-weight: 600; color: var(--fg); margin-bottom: 8px; }
.dd-goals ul { margin: 0; padding-left: 20px; }
.dd-goals li { font-size: 13.5px; line-height: 1.9; color: var(--fg-dim); }

/* 章节 */
#dd-article article, .dd-sec { margin-top: 40px; }
.dd-sec h2 { font-size: 21px; font-weight: 700; color: var(--fg); margin: 0 0 4px;
             padding-bottom: 10px; border-bottom: 1px solid var(--line-soft);
             display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dd-n { display: inline-flex; align-items: center; justify-content: center;
        width: 27px; height: 27px; border-radius: 6px; background: var(--lyr-base); color: #12141a;
        font-size: 14px; font-weight: 700; flex: 0 0 auto; }
.dd-sec h3 { font-size: 15.5px; font-weight: 600; color: var(--fg); margin: 26px 0 8px; }
.dd-sec p { font-size: 14.5px; line-height: 1.9; color: var(--fg-dim); margin: 0 0 14px; }

/* 层级徽标 */
.dd-badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px;
            border: 1px solid var(--line); color: var(--fg-faint); background: var(--bg-raise); }
.dd-badge.intuition { color: #8fb0d8; border-color: #3d5170; }
.dd-badge.math { color: #74b79a; border-color: #35604c; }
.dd-badge.eng { color: #d3a05a; border-color: #6a552f; }

/* 认知链引导句 */
.dd-lead { font-size: 13.5px !important; color: var(--fg-faint) !important; font-style: italic;
           border-left: 2px solid var(--line); padding-left: 12px; margin: 4px 0 18px !important; }

/* 教材式数学公式：代码表达式使用 .dd-code，不与展示公式混排。 */
.dd-formula { font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", "Times New Roman", serif; text-align: center;
              background: var(--bg-panel); border: 1px solid var(--line); border-radius: 6px;
              padding: 14px 12px; margin: 6px 0 8px; font-size: 17px; color: var(--fg);
              line-height: 1.9; overflow-x: auto; }
.dd-formula math[display="block"] { display: block; width: max-content; min-width: min-content;
                                    max-width: 100%; margin: 0 auto; font-size: 1.08em; }
.dd-radical {
  display: inline-flex;
  align-items: flex-start;
  vertical-align: -0.16em;
  white-space: nowrap;
  font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", "Times New Roman", serif;
}
.dd-radical::before {
  content: "√";
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  font-size: 1.18em;
  line-height: 1;
  transform: scaleY(1.08);
  transform-origin: right center;
}
.dd-radicand {
  display: inline-block;
  box-sizing: border-box;
  min-width: 0.55em;
  border-top: 1px solid currentColor;
  padding: 0.03em 0.08em 0;
  line-height: 1.18;
}
.dd-formula-note { font-size: 12.5px !important; color: var(--fg-faint) !important; text-align: center;
                   margin: 0 0 16px !important; }
.dd-inline-root { font-family: inherit; font-size: 1em; vertical-align: -0.18em; margin: 0 .04em; }
.dd-inline-root mtext { font-family: inherit; }

/* 正文内联代码 */
#dd-article code { font-family: "SFMono-Regular", "Consolas", "Menlo", monospace;
                   background: var(--bg-raise); border: 1px solid var(--line-soft);
                   border-radius: 4px; padding: 1px 5px; font-size: 13px; color: #cdd6e4; }
.dd-formula code { font-family: inherit; background: none; border: none; padding: 0;
                   color: inherit; font-size: inherit; }
.dd-code {
  box-sizing: border-box; max-width: 100%; overflow-x: auto;
  margin: 8px 0 18px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--bg-panel);
}
.dd-code code {
  display: block; width: max-content; min-width: 100%;
  box-sizing: border-box; padding: 0 !important; border: 0 !important; background: none !important;
  white-space: pre; line-height: 1.75;
}

/* 提示框 */
.dd-note { border-radius: 0 7px 7px 0; padding: 12px 16px; margin: 8px 0 18px;
           font-size: 13.5px; line-height: 1.85; color: var(--fg-dim);
           border-left: 3px solid var(--fg-faint); background: var(--bg-panel); }
.dd-note b { color: var(--fg); }
.dd-note.intuition { border-left-color: #6b8cbe; } .dd-note.intuition b { color: #9cc0e8; }
.dd-note.math { border-left-color: #4f9d78; } .dd-note.math b { color: #7ecaa4; }
.dd-note.eng { border-left-color: #d3a05a; } .dd-note.eng b { color: #e0b877; }
.dd-note.warn { border-left-color: #cf6f6f; background: rgba(207,111,111,.06); } .dd-note.warn b { color: #e39494; }
.dd-note.key { border-left-color: var(--accent); background: rgba(122,162,216,.07); } .dd-note.key b { color: var(--accent); }

/* 图 */
.dd-fig { margin: 20px 0 22px; text-align: center; }
.dd-fig svg { max-width: 100%; height: auto; background: var(--bg-panel);
              border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.dd-fig figcaption { font-size: 12.5px; color: var(--fg-faint); line-height: 1.7; margin-top: 10px; text-align: left; }
.svg-t { fill: var(--fg-faint); font-size: 13px; font-family: inherit; }
.svg-tn { fill: var(--fg); font-size: 15px; font-weight: 600; font-family: inherit; }

/* 表格 */
.dd-table-wrap { overflow-x: auto; }
.dd-table { width: 100%; border-collapse: collapse; margin: 8px 0 20px; font-size: 13px; }
.dd-table th, .dd-table td { border: 1px solid var(--line); padding: 8px 11px; text-align: left;
                             vertical-align: top; line-height: 1.7; }
.dd-table th { background: var(--bg-raise); color: var(--fg); font-weight: 600; }
.dd-table td { color: var(--fg-dim); }
.dd-table code { font-size: 12px; }
.dd-table .dd-align-center { text-align: center; }
.dd-table .dd-align-right { text-align: right; }

/* 步骤 / 因果链 / 自测 列表 */
.dd-steps, .dd-chain, .dd-quiz { margin: 4px 0 18px; padding-left: 22px; }
.dd-steps li, .dd-chain li, .dd-quiz li { font-size: 14px; line-height: 1.9; color: var(--fg-dim); margin-bottom: 7px; }
.dd-chain li span { color: var(--fg-faint); font-size: 12px; }
.dd-answers { margin: 6px 0 8px; }
.dd-answers summary { cursor: pointer; color: var(--accent); font-size: 13.5px; font-weight: 600; }
.dd-answers ol { margin-top: 12px; padding-left: 22px; }
.dd-answers li { font-size: 13px; line-height: 1.85; color: var(--fg-dim); margin-bottom: 7px; }

/* 来源 */
.dd-src { margin-top: 44px; border-top: 1px solid var(--line); padding-top: 18px;
          font-size: 12.5px; line-height: 1.8; color: var(--fg-faint); }
.dd-src ul { margin: 10px 0 0; padding-left: 20px; }
.dd-sec a { color: var(--accent); }
.dd-sec a:hover { text-decoration: underline; }
.dd-src a { color: var(--accent); text-decoration: none; }
.dd-src a:hover { text-decoration: underline; }
.dd-src-date { margin-top: 8px; }

/* 深读页学习完成按钮 */
.dd-learning-complete {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 44px; padding: 20px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--bg-panel);
}
.dd-learning-kicker { color: var(--fg); font-size: 15px; font-weight: 650; }
.dd-learning-copy { margin-top: 3px; color: var(--fg-faint); font-size: 12.5px; line-height: 1.7; }
.dd-learning-actions { flex: 0 0 auto; display: flex; align-items: stretch; gap: 10px; }
.dd-learn-btn {
  flex: 0 0 auto; min-width: 126px; padding: 9px 16px;
  border: 1px solid var(--accent); border-radius: 7px;
  background: var(--accent); color: #12141a; font: inherit; font-weight: 650; cursor: pointer;
}
.dd-learn-btn:hover { filter: brightness(1.08); }
.dd-learn-btn.is-learned { background: rgba(122,162,216,.1); color: var(--accent); }
.dd-path-btn {
  flex: 0 1 auto; min-width: 180px; max-width: 290px; display: grid;
  align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg-raise); color: var(--fg); font: inherit; cursor: pointer; text-align: left;
}
.dd-prev-btn { grid-template-columns: auto minmax(0, 1fr); }
.dd-next-btn { grid-template-columns: minmax(0, 1fr) auto; }
.dd-path-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dd-path-copy small { color: var(--fg-faint); font-size: 10.5px; white-space: nowrap; }
.dd-path-copy strong { overflow: hidden; color: var(--accent); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.dd-path-btn > span[aria-hidden="true"] { color: var(--accent); font-size: 16px; }
.dd-path-btn:hover { border-color: var(--accent); background: rgba(122,162,216,.08); }
.dd-learn-btn:focus-visible, .dd-path-btn:focus-visible, .learning-node:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ───────── 软件使用教程页 ───────── */
.tutorial-learning { margin-bottom: 28px; }
.tutorial-layout { display: grid; grid-template-columns: 178px minmax(0, 1fr); gap: 26px;
  align-items: start; margin-top: 24px; }
.tutorial-sidebar { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 7px;
  padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-panel); }
.tutorial-sidebar-title { padding: 3px 7px 8px; color: var(--fg-faint); font-size: 10.5px;
  font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.tutorial-platform-btn { width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 9px; border: 1px solid transparent; border-radius: 7px;
  color: var(--fg-dim); background: transparent; font: inherit; cursor: pointer; text-align: left; }
.tutorial-platform-btn:hover { color: var(--fg); background: var(--bg-raise); }
.tutorial-platform-btn.active { color: var(--fg); border-color: var(--line);
  background: var(--bg-raise); box-shadow: inset 3px 0 0 var(--platform-color); }
.tutorial-platform-label { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; }
.tutorial-count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 5px; align-items: center;
  justify-content: center; border: 1px solid var(--line); border-radius: 10px;
  color: var(--fg-faint); font-size: 10.5px; }
.tutorial-platform-content { min-width: 0; }
.tutorial-platform-head { display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin: 0 0 12px; padding: 0 2px 12px; border-bottom: 1px solid var(--line); }
.tutorial-platform-head h2 { margin: 2px 0 0; color: var(--fg); font-size: 19px; }
.tutorial-platform-head > span { color: var(--fg-faint); font-size: 11.5px; }
.tutorial-platform-kicker { color: var(--fg-faint); font-size: 10px; letter-spacing: .1em; }
.tutorial-card { border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; background: var(--bg-panel); margin: 14px 0; overflow: hidden; }
.tutorial-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 17px 18px; cursor: pointer; list-style: none; }
.tutorial-card-head::-webkit-details-marker { display: none; }
.tutorial-card-head:hover { background: rgba(255,255,255,.018); }
.tutorial-card[open] .tutorial-card-head { border-bottom: 1px solid var(--line-soft); }
.tutorial-expand { flex: 0 0 auto; color: var(--fg-faint); font-size: 18px; line-height: 1;
  transform: rotate(-90deg); transition: transform .16s ease; }
.tutorial-card[open] .tutorial-expand { transform: rotate(0); }
.tutorial-card-body { padding: 2px 20px 20px; }
.tutorial-card h3 { margin: 0 0 5px; color: var(--fg); font-size: 16px; line-height: 1.45; }
.tutorial-card h4 { margin: 22px 0 9px; color: var(--fg); font-size: 13.5px; }
.tutorial-card h4 span { color: var(--fg-faint); font-size: 11px; font-weight: 400; }
.tutorial-card h5 { margin: 0 0 9px; color: var(--fg); font-size: 13px; }
.tutorial-card p { margin: 10px 0; }
.tutorial-meta { color: var(--fg-faint); font-size: 11.5px; }
.tutorial-audience { margin-top: 13px; color: var(--fg-dim); font-size: 12.5px; }
.tutorial-audience b { color: var(--fg); }
.tutorial-summary { color: var(--fg-dim); font-size: 13.5px; line-height: 1.85; }
.tutorial-actions, .tutorial-uniques { display: grid; gap: 10px; }
.tutorial-action, .tutorial-unique { padding: 14px 15px; border: 1px solid var(--line-soft);
  border-radius: 7px; background: rgba(255,255,255,.012); }
.tutorial-action ol, .tutorial-unique ol { margin: 0; padding-left: 20px; }
.tutorial-action li, .tutorial-unique li { margin: 0 0 7px; color: var(--fg-dim);
  font-size: 13px; line-height: 1.75; }
.tutorial-action li:last-child, .tutorial-unique li:last-child { margin-bottom: 0; }
.tutorial-unique { border-color: rgba(122,162,216,.28); background: rgba(122,162,216,.045); }
.tutorial-unique > p { color: var(--fg-dim); font-size: 12.5px; line-height: 1.75; }
.tutorial-unique > p b { color: var(--fg); }
.tutorial-done { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line);
  color: var(--fg-dim); font-size: 12.5px; line-height: 1.7; }
.tutorial-done b { display: inline-block; margin-right: 8px; color: var(--accent); font-size: 11.5px; }
.tutorial-link { display: inline-block; color: var(--accent); font-size: 12.5px; text-decoration: none; }
.tutorial-link:hover { text-decoration: underline; }
.tutorial-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 7px;
  color: var(--fg-faint); font-size: 12.5px; }

/* 窄屏 */
@media (max-width: 1100px) {
  #controls { position: absolute; left: 0; top: 0; bottom: 0; z-index: 20; }
  #detail { position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; width: 340px; flex-basis: 340px; }
}
@media (max-width: 720px) {
  #dd-article { padding: 28px 18px 100px; }
  .dd-h1 { font-size: 26px; }
  .dd-table { font-size: 12px; }
  .dd-table th, .dd-table td { padding: 7px 6px; overflow-wrap: anywhere; }
  .dd-table code { font-size: 11px; }
  .tutorial-layout { grid-template-columns: 1fr; gap: 18px; }
  .tutorial-sidebar { position: static; flex-direction: row; overflow-x: auto; padding: 8px; }
  .tutorial-sidebar-title { display: none; }
  .tutorial-platform-btn { flex: 0 0 auto; width: auto; }
  .tutorial-platform-btn.active { box-shadow: inset 0 -3px 0 var(--platform-color); }
  .tutorial-platform-head { align-items: flex-start; }
  .tutorial-card-body { padding: 2px 14px 16px; }
  .dd-learning-complete { align-items: stretch; flex-direction: column; gap: 14px; padding: 16px; }
  .dd-learning-actions { width: 100%; }
  .dd-learning-actions > button { flex: 1 1 0; min-width: 0; }
  .dd-path-btn { max-width: none; }
  .settings-overlay { align-items: end; padding: 10px; }
  .settings-dialog { width: 100%; border-radius: 12px 12px 8px 8px; }
  .settings-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .settings-select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #controls, .controls-toggle, .controls-toggle svg { transition: none; }
}
.dd-language-notice {
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px solid #607ca5;
  border-radius: 8px;
  color: #c6d7ef;
  background: #202c3a;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
/* English reading resources: scope by actual content language, including fallback. */
#dd-article[lang="en"] .dd-diagram-scroll { overflow-x: auto; max-width: 100%; }
#dd-article[lang="en"] .dd-diagram-scroll svg { display: block; width: 100%; min-width: 560px; max-width: none; }
#dd-article .dd-split-with-legend text:nth-of-type(n+4) { display: none; }
#dd-article .dd-split-legend { margin: .75rem 0; font-size: 16px; line-height: 1.6; text-align: left; }
#dd-article .dd-split-legend > div { display: grid; grid-template-columns: 10rem 1fr; gap: .5rem 1rem; padding: .5rem 0; }
#dd-article .dd-split-legend dt { font-weight: 600; }
#dd-article .dd-split-legend dd { margin: 0; color: var(--fg-dim); }
#dd-article .dd-diagram-hint { display: none; }
#dd-article[lang="en"] .dd-table-wrap { max-width: 100%; }
#dd-article[lang="en"] .dd-table { min-width: 620px; }
#dd-article[lang="en"] .dd-table th, #dd-article[lang="en"] .dd-table td { overflow-wrap: normal; word-break: normal; }
#dd-article[lang="en"] .dd-sec > .dd-table { display: block; min-width: 0; overflow-x: auto; }
#dd-article[lang="en"] .dd-sec > .dd-table th, #dd-article[lang="en"] .dd-sec > .dd-table td { min-width: 9rem; }
@media (max-width: 600px) {
  #dd-article .dd-split-legend > div { grid-template-columns: 1fr; }
  #dd-article .dd-diagram-hint { display: block; font-size: 14px; line-height: 1.6; color: var(--fg-faint); }
  #dd-article[lang="en"] .dd-table-wrap::before { content: "Scroll horizontally to read all columns."; display: block; font-size: 14px; color: var(--fg-faint); }
}
/* Reader feedback belongs to the reading interface, outside controlled article content. */
.dd-feedback { margin: 28px 0; padding: 16px; border: 1px solid currentColor; border-radius: 8px; }
.dd-feedback p { margin: 8px 0 0; font-size: .9em; }
