/* 统一材质与极简骨架：顶栏两翼标识+动态中枢，悬浮双标识底栏，独立全屏页 */
:root {
  --bg: #f3f4f8; --glow-a: rgba(108, 123, 255, .16); --glow-b: rgba(34, 195, 166, .12);
  --fg: #141821; --muted: #667085; --faint: #a3aab8;
  --glass: rgba(255, 255, 255, .90); --glass-hi: rgba(255, 255, 255, .98); --edge: rgba(20, 24, 33, .08); --edge-hi: rgba(20, 24, 33, .16);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .14);
  --root: #5866e0; --root-hi: #a3adff; --root-lo: #2f3aa8;
  --leaf: #109f87; --leaf-hi: #6fe7cd; --leaf-lo: #0a6c5b;
  --bad: #e4553e; --bad-hi: #ffab86; --bad-lo: #b3302a;
  --dim: #b6bcc8; --dim-hi: #e2e5eb; --dim-lo: #8d94a3;
  --well-hi: #ffffff; --well-lo: #eceff6;
  --accent: linear-gradient(135deg, #6c7bff, #22c3a6);
  --ease: cubic-bezier(.2, .7, .2, 1);
  font: 14px/1.55 system-ui, -apple-system, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Noto Sans Mono CJK SC", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090b10; --glow-a: rgba(108, 123, 255, .20); --glow-b: rgba(34, 195, 166, .12);
    --fg: #e8ebf2; --muted: #8b94a7; --faint: #4c5466;
    --glass: rgba(20, 24, 33, .90); --glass-hi: rgba(30, 35, 47, .98); --edge: rgba(255, 255, 255, .07); --edge-hi: rgba(255, 255, 255, .14);
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -16px rgba(0, 0, 0, .6);
    --root: #7d8cff; --root-hi: #c3caff; --root-lo: #4050d4;
    --leaf: #34d3b0; --leaf-hi: #a6f7e3; --leaf-lo: #128d76;
    --bad: #ff7a59; --bad-hi: #ffc2a6; --bad-lo: #d9412f;
    --dim: #4a5264; --dim-hi: #6e778b; --dim-lo: #303645;
    --well-hi: #1a1f2b; --well-lo: #0d1017;
  }
}
:root[data-theme="dark"] {
  --bg: #090b10; --glow-a: rgba(108, 123, 255, .20); --glow-b: rgba(34, 195, 166, .12);
  --fg: #e8ebf2; --muted: #8b94a7; --faint: #4c5466;
  --glass: rgba(20, 24, 33, .90); --glass-hi: rgba(30, 35, 47, .98); --edge: rgba(255, 255, 255, .07); --edge-hi: rgba(255, 255, 255, .14);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -16px rgba(0, 0, 0, .6);
  --root: #7d8cff; --root-hi: #c3caff; --root-lo: #4050d4;
  --leaf: #34d3b0; --leaf-hi: #a6f7e3; --leaf-lo: #128d76;
  --bad: #ff7a59; --bad-hi: #ffc2a6; --bad-lo: #d9412f;
  --dim: #4a5264; --dim-hi: #6e778b; --dim-lo: #303645;
  --well-hi: #1a1f2b; --well-lo: #0d1017;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--edge-hi) transparent; }
[hidden] { display: none !important; }
body {
  margin: 0; color: var(--fg); height: 100vh; height: 100dvh; padding: 10px 10px 8px; gap: 8px;
  display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(60vmax 60vmax at 12% -10%, var(--glow-a), transparent 60%),
              radial-gradient(50vmax 50vmax at 110% 110%, var(--glow-b), transparent 60%), var(--bg);
  background-attachment: fixed;
}
@media (max-width: 768px) {
  body { padding: max(6px, env(safe-area-inset-top)) 6px 0; gap: 6px; }
  #params { display: none; }
}
.panel, #top, #bar { background: var(--glass); border: 1px solid var(--edge); border-radius: 16px; box-shadow: var(--shadow); }
.materials { position: absolute; width: 0; height: 0; overflow: hidden; }
.orb.root, .g.root, .root > .g { --hi: var(--root-hi); --c: var(--root); --lo: var(--root-lo); }
.orb.leaf, .g.leaf, .leaf > .g { --hi: var(--leaf-hi); --c: var(--leaf); --lo: var(--leaf-lo); }
.orb.bad, .g.bad, .bad > .g { --hi: var(--bad-hi); --c: var(--bad); --lo: var(--bad-lo); }
.orb.dim { --hi: var(--dim-hi); --c: var(--dim); --lo: var(--dim-lo); }
.orb .hi { stop-color: var(--hi); } .orb .mid { stop-color: var(--c); } .orb .lo { stop-color: var(--lo); }
.well .hi { stop-color: var(--well-hi); } .well .lo { stop-color: var(--well-lo); }

button, .btn { font: inherit; color: var(--fg); cursor: pointer; }
.btn { display: inline-flex; align-items: center; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--edge-hi); background: var(--glass-hi); transition: transform .15s var(--ease), box-shadow .2s, opacity .2s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px -8px var(--root); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.compact { padding: 4px 10px; font-size: 12.5px; white-space: nowrap; }
.btn:disabled { opacity: .4; cursor: default; }
.icon { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 10px; border: 1px solid transparent; background: none; }
.icon:hover { background: var(--glass-hi); border-color: var(--edge); }
.icon svg { width: 18px; height: 18px; fill: none; stroke: var(--fg); stroke-width: 1.8; stroke-linecap: round; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--edge); }
.seg:empty { display: none; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 999px; color: var(--muted); transition: background .2s, color .2s; }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--glass-hi); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.hint, .muted { color: var(--muted); }
.bad { color: var(--bad); }

/* 顶栏（极简标识）：左我的 · 中动态中枢 · 右设置 */
#top {
  flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 10px; position: relative; z-index: 32;
}
#top-center { display: flex; justify-content: center; align-items: center; min-width: 0; }
#top-rec-slot { display: flex; justify-content: center; }
#top-search-slot { width: min(540px, 100%); }

.wing-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 1px solid var(--edge-hi); background: var(--glass-hi); color: var(--fg);
  position: relative; transition: border-color .2s;
}
.wing-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wing-dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.wing-dot.admin { background: var(--root); box-shadow: 0 0 6px var(--root); }
.wing-dot.member { background: var(--leaf); box-shadow: 0 0 6px var(--leaf); }

.top-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--edge-hi); background: var(--glass-hi); color: var(--fg);
}
.top-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.top-pill.active { border-color: var(--root); color: var(--root); }
.pill-badge { font-size: 11.5px; font-weight: 650; }

.top-search-box {
  display: flex; align-items: center; gap: 4px; padding: 3px 6px 3px 4px;
  border-radius: 999px; border: 1px solid var(--edge-hi); background: var(--glass-hi); width: 100%;
}
.scope-chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px; border-radius: 999px;
  border: 0; background: var(--edge); color: var(--fg); font-size: 12px; font-weight: 600; white-space: nowrap; flex: none;
}
.top-search-box input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: 13.5px; outline: none; padding: 2px 4px; }
.mini-icon { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 14px; flex: none; }
.mini-icon:hover, .mini-icon.on { background: var(--edge); color: var(--root); }

@media (max-width: 768px) {
  #top.search-focused { grid-template-columns: minmax(0, 1fr); }
  #top.search-focused #me-btn, #top.search-focused #settings-btn { display: none; }
}

#popover-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .18); }
.top-popover {
  position: fixed; top: calc(max(6px, env(safe-area-inset-top)) + 54px); left: 50%; transform: translateX(-50%);
  width: min(400px, calc(100vw - 20px)); z-index: 35; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px; animation: drawer-in .18s var(--ease) both;
}
.pop-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pop-sec { display: flex; flex-direction: column; }
.pop-input { width: 100%; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--edge-hi); background: var(--glass-hi); color: var(--fg); font: inherit; font-size: 13px; }
.tuner-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tuner-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--edge-hi); background: var(--glass-hi); color: var(--fg); font-size: 12.5px; font-weight: 550; }
.tuner-chip.boost { border-color: var(--root); color: var(--root); background: var(--edge); font-weight: 650; }
.tuner-chip.mute { border-color: var(--bad); color: var(--bad); text-decoration: line-through; opacity: .75; }

/* 中央纯净画布 & 悬浮双标识底栏 */
#view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; border-radius: 16px; }
.mode-pane { flex: 1; min-width: 0; min-height: 0; overflow: auto; padding: 12px 16px 84px; display: flex; flex-direction: column; gap: 14px; }

#mode-dock {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom)); z-index: 25;
  display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--edge-hi); box-shadow: var(--shadow);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
#mode-dock button {
  display: grid; place-items: center; border: 0; background: none; width: 54px; height: 36px; border-radius: 999px;
  color: var(--muted); transition: background .2s, color .2s;
}
#mode-dock button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#mode-dock button.on { background: var(--glass-hi); color: var(--fg); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .25); }

/* 卡片与搜索待命面板 */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.portal-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden;
  background: var(--glass); border: 1px solid var(--edge); border-radius: 16px; box-shadow: var(--shadow);
  transition: transform .2s var(--ease), border-color .2s;
}
.portal-card:hover { transform: translateY(-2px); border-color: var(--edge-hi); }
.portal-card:active { transform: scale(.985); }
.portal-cover {
  height: 136px; position: relative; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 28% 24%, var(--glow-a), transparent 65%),
              radial-gradient(circle at 80% 80%, var(--glow-b), transparent 60%), #10141e;
  border-bottom: 1px solid var(--edge);
}
.portal-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portal-cover svg { width: 84px; height: 84px; opacity: .92; }
.portal-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.portal-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.portal-tag { font-size: 11px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--edge); color: var(--leaf); }
.portal-tag.root { color: var(--root); }
.portal-tag.device { color: var(--leaf); }
.portal-tag.muted { color: var(--muted); }
.portal-title { font-size: 15px; font-weight: 650; color: var(--fg); }
.portal-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.portal-card.compact-card { flex-direction: row; align-items: center; padding: 12px 14px; gap: 12px; }
.compact-icon { position: relative; width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--edge); color: var(--leaf); }
.compact-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.status-dot { position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); border: 1.5px solid var(--glass); }
.status-dot.on { background: var(--leaf); }
.compact-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.text-excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }

.search-landing { display: flex; flex-direction: column; gap: 18px; width: min(820px, 100%); margin: 0 auto; }
.landing-sec { display: flex; flex-direction: column; gap: 8px; }
.landing-head { display: flex; justify-content: space-between; align-items: center; }
.landing-head h3 { margin: 0; font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.type-index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.type-index-tile { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--edge); }
.type-index-tile:hover { border-color: var(--edge-hi); }
.combo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.combo-card { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--edge); }
.combo-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; font-size: 13px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.cap-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--edge); border: 1px solid var(--edge-hi); font-size: 12px; }
.cap-owner { font-weight: 650; text-transform: uppercase; font-size: 10.5px; }
.cap-owner.cloud { color: var(--root); } .cap-owner.ai { color: var(--leaf); }

/* 独立全屏页：「我的」与「设置」 */
.sub-page { position: fixed; inset: 0; z-index: 45; padding: max(8px, env(safe-area-inset-top)) 10px 10px; gap: 10px; display: flex; flex-direction: column; background: var(--bg); animation: swap .22s var(--ease) both; }
.sub-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 10px; flex: none; }
.sub-top h2 { margin: 0; font-size: 15px; font-weight: 650; }
.sub-top button { justify-self: start; }
.sub-body { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 12px; width: min(720px, 100%); margin: 0 auto; padding-bottom: 24px; }
.sub-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.sub-card h4 { margin: 0; font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.about-card { flex-direction: row; align-items: center; gap: 10px; }
.compact-select { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--edge-hi); background: var(--glass-hi); color: var(--fg); font: inherit; font-size: 12.5px; }
.ops-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--edge); font-size: 12.5px; }
.ops-row:last-child { border-bottom: 0; }
.ops-addr-form { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
#ops-cloud-addr, #ops-token, #adm-job-topic { flex: 1; min-width: 0; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--edge-hi); background: var(--glass-hi); color: var(--fg); font: 12.5px var(--mono); }
.id-card { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--edge); }
.wing-actions { display: flex; gap: 8px; }
.wing-form { display: flex; flex-direction: column; gap: 8px; }
.wing-form input, .wing-form select { width: 100%; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--edge-hi); background: var(--glass-hi); color: var(--fg); font: inherit; font-size: 13px; }
.wing-details summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.wing-jobs { display: flex; flex-direction: column; gap: 6px; }
.wing-job-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--edge); }
.st { padding: 1px 8px; border-radius: 999px; background: var(--edge); font-weight: 650; text-transform: uppercase; font-size: 11px; }
.st.done { color: var(--leaf); } .st.running, .st.pending { color: var(--root); } .st.failed { color: var(--bad); }
.admin-entry { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--root); background: var(--glass-hi); box-shadow: var(--shadow); }

/* 管理员工作台 & 拓扑图形 */
#admin-overlay { position: fixed; inset: 0; z-index: 50; padding: 10px; gap: 8px; display: flex; flex-direction: column; background: var(--bg); }
#admin-top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; overflow-x: auto; flex: none; }
.ctx-slot { display: flex; align-items: center; gap: 6px; flex: none; }
#admin-body { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
#admin-topo { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
#admin-ops { flex: 1; overflow: auto; padding: 8px 4px; }
.admin-ops-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.admin-card { padding: 14px 16px; }
.admin-card h3 { margin: 0 0 10px; font-size: 14px; }

#ring-view, #tree-view { flex: 1; min-width: 0; min-height: 0; }
#ring-view { display: flex; padding: 4px; }
#ring { width: 100%; height: 100%; overflow: visible; }
#tree-view { padding: 6px 14px 24px; overflow: auto; }
.swap { animation: swap .45s var(--ease) both; }
@keyframes swap { from { opacity: 0; transform: translateY(8px) scale(.99); } }
#summary { margin: 4px 0 10px; color: var(--muted); font-size: 13px; }
#tree svg { display: block; overflow: visible; }
#dirs { overflow: auto; padding: 8px 6px; font-size: 13px; }
#info { overflow: auto; padding: 14px 16px; }
#dirs.drawer.left, #info.drawer.right { position: absolute; top: 8px; bottom: 8px; width: min(320px, 84vw); z-index: 30; animation: drawer-in .22s var(--ease) both; }
#dirs.drawer.left { left: 8px; } #info.drawer.right { right: 8px; }
@keyframes drawer-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
#scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .34); z-index: 25; border-radius: 16px; }
#bar { flex: none; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; padding: 5px 12px; font-size: 12px; color: var(--muted); border-radius: 12px; margin-top: 6px; }
#toggle-left.on, #toggle-right.on { background: var(--glass-hi); border-color: var(--root); color: var(--root); }
#toggle-right { position: relative; }
#toggle-right.has-sel::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--leaf); }
#status { flex: 1 1 20em; display: flex; align-items: center; gap: 8px; }
#status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--leaf-hi), var(--leaf) 55%, var(--leaf-lo)); box-shadow: 0 0 10px var(--leaf); }
#status.bad { color: var(--bad); }
#status.bad::before { background: radial-gradient(circle at 35% 30%, var(--bad-hi), var(--bad) 55%, var(--bad-lo)); box-shadow: 0 0 10px var(--bad); }

#dirs a { display: flex; align-items: center; gap: 7px; padding: 3px 8px; border-radius: 8px; white-space: nowrap; cursor: pointer; color: var(--fg); transition: background .2s; }
#dirs a:hover { background: var(--edge); }
#dirs a.dir { color: var(--muted); font-weight: 600; margin-top: 6px; font-size: 12px; letter-spacing: .02em; }
#dirs .tw { display: inline-block; width: 1em; color: var(--faint); transition: transform .2s var(--ease); text-align: center; }
#dirs .tw.shut { transform: rotate(-90deg); }
#dirs a.cur { background: var(--edge); font-weight: 600; box-shadow: inset 2px 0 0 var(--root); }
#dirs a.sel { background: var(--glass-hi); box-shadow: inset 2px 0 0 var(--fg), 0 2px 10px -6px rgba(0, 0, 0, .3); }
#dirs a.unvisited { color: var(--faint); } #dirs a.bad { color: var(--bad); }
.g { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; --hi: var(--dim-hi); --c: var(--dim); --lo: var(--dim-lo); }
.g.is-root { background: radial-gradient(circle at 36% 30%, var(--hi), var(--c) 55%, var(--lo)); }
.g.is-leaf { border: 2.5px solid var(--c); background: radial-gradient(circle at 50% 38%, var(--well-hi), var(--well-lo)); }

svg text { fill: var(--fg); font-size: 15px; }
svg .label { font-size: 13px; fill: var(--muted); pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
svg .label.on { fill: var(--fg); font-weight: 600; }
svg .clabel { font-size: 12px; fill: var(--fg); pointer-events: none; font-weight: 600; }
svg .count { font-size: 11px; fill: var(--leaf); pointer-events: none; font-weight: 600; }
svg .ring { fill: none; stroke: var(--edge-hi); stroke-width: 1.5; }
svg .ring.top { stroke-dasharray: 2 9; stroke-linecap: round; animation: drift 90s linear infinite; }
svg .band { fill: none; stroke: var(--root); stroke-width: 26; opacity: .05; }
@keyframes drift { to { stroke-dashoffset: -1100; } }
svg .spoke { stroke: var(--root); stroke-width: 1.5; opacity: .45; stroke-linecap: round; }
svg .node { cursor: pointer; transform-box: fill-box; transform-origin: center; transition: transform .25s var(--ease); }
svg .node:hover { transform: scale(1.18); }
svg .node.is-root { stroke: var(--bg); stroke-width: 2; }
svg .node.is-root.root { fill: url(#orb-root); } svg .node.is-root.leaf { fill: url(#orb-leaf); }
svg .node.is-root.bad { fill: url(#orb-bad); } svg .node.is-root.unvisited, svg .node.is-root.unreached { fill: url(#orb-dim); }
svg .node.is-leaf { fill: url(#well); stroke-width: 3.5; }
svg .node.is-leaf.leaf { stroke: url(#rim-leaf); } svg .node.is-leaf.root { stroke: url(#rim-root); }
svg .node.is-leaf.bad { stroke: url(#rim-bad); } svg .node.is-leaf.unvisited, svg .node.is-leaf.unreached { stroke: url(#rim-dim); }
svg .node.is-root.sel { stroke: var(--fg); stroke-width: 3; } svg .node.is-leaf.sel { stroke-width: 5.5; }
svg .halo { fill: none; stroke: var(--fg); stroke-width: 1.2; opacity: .5; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: halo 2.4s var(--ease) infinite; }
@keyframes halo { 0% { transform: scale(.8); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
svg .child { cursor: pointer; fill: url(#well); stroke: var(--root); stroke-width: 1.2; stroke-opacity: .6; transition: stroke-width .2s, stroke-opacity .2s; }
svg .child:hover { stroke-width: 2.5; stroke-opacity: 1; }
.arrive .node, .arrive .label, .arrive .child, .arrive .spoke { animation: pop .55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 16ms + 80ms); }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
.arrive .label, .arrive .spoke { animation-name: fade; }
@keyframes fade { from { opacity: 0; } }
.idle circle { fill: none; stroke: var(--edge-hi); stroke-width: 1.5; stroke-dasharray: 3 12; stroke-linecap: round; transform-origin: 0 0; animation: spin 80s linear infinite; }
.idle circle:nth-child(2) { stroke: var(--root); opacity: .35; animation-direction: reverse; animation-duration: 60s; }
.idle circle:nth-child(3) { stroke: var(--leaf); opacity: .35; animation-duration: 40s; }
.idle .core { fill: url(#orb-root); stroke: none; animation: breathe 3.2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.35); opacity: .7; } }

#tree .ground { stroke: var(--edge-hi); stroke-width: 1.5; stroke-dasharray: 2 6; stroke-linecap: round; }
#tree .branch { fill: none; stroke: var(--root); stroke-width: 2; opacity: .5; stroke-linecap: round; transition: opacity .2s, stroke-width .2s; }
#tree .branch.trunk { stroke-width: 3; }
#tree .branch:hover { opacity: 1; stroke-width: 4; cursor: pointer; }
#tree.grow .branch { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .9s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 18ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }
#tree.grow .layer, #tree.grow .tnode, #tree.grow .label, #tree.grow .count { animation: pop .5s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 18ms + 250ms); }
#tree .layer { fill: url(#well); stroke: var(--edge-hi); stroke-width: 1.5; cursor: pointer; transform-box: fill-box; transform-origin: center; }
#tree .layer.bad { stroke: var(--bad); stroke-width: 2.5; filter: url(#glow); }
#tree .scope { fill: url(#orb-root); stroke: var(--bg); stroke-width: 3; cursor: pointer; }
.unreached { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 2; }
.unreached a { color: var(--fg); cursor: pointer; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: var(--edge); }

#info.fresh > * { animation: rise .35s var(--ease) both; }
#info h3 { font-size: 11px; margin: 0; color: var(--muted); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
#info h2 { font: 600 14px/1.45 var(--mono); margin: 6px 0 12px; word-break: break-all; }
#info .chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 6px; border-radius: 999px; background: var(--edge); font-weight: 600; }
#info .chip.bad { color: var(--bad); } #info .meta { color: var(--muted); margin-left: 8px; }
#info .k { margin: 14px 0 6px; font-size: 11px; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
#info ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
#info li { word-break: break-all; padding: 5px 9px; border-radius: 9px; background: var(--edge); font-size: 13px; }
#info ul.bad li { color: var(--bad); box-shadow: inset 2px 0 0 var(--bad); }
#info li .kind { display: inline-block; min-width: 3.2em; margin-right: 6px; color: var(--muted); font-size: 12px; }
#info .stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin: 10px 0; }
#info .stats div { padding: 8px 10px; border-radius: 12px; background: var(--edge); display: flex; flex-direction: column; }
#info .stats b { font-size: 20px; line-height: 1.2; font-weight: 650; }
#info .stats span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
#info details.src summary { color: var(--muted); cursor: pointer; margin-top: 12px; font-size: 12px; }
#info details.src pre { white-space: pre-wrap; word-break: break-word; font: 12.5px/1.65 var(--mono); max-height: 60vh; overflow: auto; background: var(--glass-hi); border: 1px solid var(--edge); border-radius: 12px; padding: 10px 12px; margin: 8px 0 0; }
#info .advice { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--glass-hi); border: 1px solid var(--edge-hi); font-size: 13px; }
#info .advice .prio { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; margin-right: 6px; background: var(--edge); text-transform: uppercase; }
#info .advice .prio.high { color: var(--bad); } #info .advice .prio.medium { color: var(--root); } #info .advice .prio.low { color: var(--leaf); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
#first-bad:not(:disabled) { color: var(--bad); border-color: var(--bad); }
svg [tabindex]:focus { outline: none; }
svg [tabindex]:focus-visible { stroke: var(--fg); stroke-width: 3; }
#dirs a:focus-visible, .unreached a:focus-visible, button:focus-visible, .btn:focus-within { outline: 2px solid var(--root); outline-offset: 1px; }

/* 单层全屏舞台 */
#stage-overlay { position: fixed; inset: 0; z-index: 60; background: #090b10; display: flex; flex-direction: column; }
#stage-bar { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 65; display: flex; align-items: center; gap: 10px; pointer-events: none; }
#stage-bar > * { pointer-events: auto; }
#stage-title { color: #e8ebf2; font-weight: 600; font-size: 14px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
#stage-mount { flex: 1; min-height: 0; position: relative; display: flex; }
.stage-artifact { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 64px 16px 24px; overflow: auto; }
.stage-artifact img { max-width: min(760px, 100%); max-height: 70vh; border-radius: 14px; border: 1px solid rgba(255,255,255,.12); }
.stage-artifact-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
