/* Ivy知识花园 · shared site navigation (rendered by kg-nav.js) */
:root { --kgn-m: #88a8ee; --kgn-b: #72cc90; --kgn-c: #f2926c; --kgn-s: #efc252; --kgn-a: #b5bec9; --kgn-v: #f37791; }
#kgSidenav { display: flex; flex-direction: column; justify-content: flex-start; gap: 2px; padding: 12px; overflow-y: auto; flex: 1; font-family: inherit; }
.kgn-label { margin: 0; padding: 12px 12px 4px; font-size: 10px; font-weight: 600; letter-spacing: .08em; color: #64748b; text-transform: uppercase; }
.kgn-link { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 1.35; color: #cbd5e1; text-decoration: none; flex: none; min-width: 0; }
.kgn-item .kgn-link { flex: 1; }
.kgn-link i { width: 20px; text-align: center; flex: none; }
.kgn-link:hover { background: rgba(30, 41, 59, .7); color: #7dd3fc; }
.kgn-link[aria-current] { background: rgba(14, 165, 233, .1); border-color: rgba(14, 165, 233, .3); color: #e0f2fe; font-weight: 600; }
.kgn-dot { width: 20px; flex: none; display: flex; justify-content: center; }
.kgn-dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #475569; }
.kgn-item { display: flex; align-items: center; gap: 2px; }
.kgn-caret { flex: none; width: 30px; height: 30px; border: 0; border-radius: 6px; background: none; color: #64748b; cursor: pointer; }
.kgn-caret:hover { background: rgba(30, 41, 59, .7); color: #e2e8f0; }
.kgn-caret i, .kgn-head > i { font-size: 10px; transition: transform .2s; }
.kgn-caret[aria-expanded="false"] i, .kgn-head[aria-expanded="false"] > i { transform: rotate(-90deg); }
.kgn-sub { margin: 0 0 4px 22px; padding-left: 8px; border-left: 1px solid #1e293b; }
.kgn-sub .kgn-link { padding: 6px 10px; font-size: 13px; }
.kgn-group { margin-top: 2px; }
.kgn-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 0; border-radius: 8px; background: none;
  color: #e2e8f0; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.kgn-head:hover { background: rgba(30, 41, 59, .6); }
.kgn-head > i { color: #64748b; }
.kgn-title { flex: 1; }
.kgn-count { font-size: 11px; font-weight: 500; color: #64748b; }
.kgn-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--lc); flex: none; }
.kgn-body { padding: 2px 0 6px 10px; }
.kgn-link:focus-visible, .kgn-head:focus-visible, .kgn-caret:focus-visible, .kgn-top:focus-visible { outline: 2px solid #38bdf8; outline-offset: 1px; }

/* top bar */
#kgTopnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.kgn-top { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 0; background: none;
  color: #cbd5e1; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.kgn-top i { font-size: 12px; }
.kgn-top:hover { color: #7dd3fc; background: rgba(30, 41, 59, .7); }
.kgn-top.on { color: #7dd3fc; font-weight: 600; }
.kgn-drop[aria-expanded="true"] { background: rgba(30, 41, 59, .9); color: #fff; }
.kgn-chev { font-size: 9px !important; opacity: .7; }
.kgn-sep { color: #475569; }
.kgn-panel { position: fixed; z-index: 80; width: min(560px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto; padding: 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px;
  background: rgba(15, 23, 42, .97); border: 1px solid rgba(148, 163, 184, .2); border-radius: 12px; box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
  font-family: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; }
.kgn-panel[hidden] { display: none; }
.kgn-pgroup p { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; padding: 0 12px; font-size: 11px; font-weight: 600; color: #94a3b8; }
.kgn-pgroup .kgn-link { padding: 6px 12px; font-size: 13px; }
.kgn-panel-sm { width: min(280px, calc(100vw - 16px)); grid-template-columns: minmax(0, 1fr); }
.kgn-tree > .kgn-link { font-weight: 600; }
/* phones: the menu button already holds 首页 and 知识地图, so the bar keeps one line */
@media (max-width: 767px) {
  #kgTopnav.kgn-compact .kgn-wide { display: none; }
  #kgTopnav.kgn-compact { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #kgTopnav.kgn-compact::-webkit-scrollbar { display: none; }
}

/* homepage light theme */
body.light-theme .kgn-link, body.light-theme .kgn-head, body.light-theme .kgn-top { color: #0f172a; }
body.light-theme .kgn-link:hover, body.light-theme .kgn-head:hover, body.light-theme .kgn-top:hover { background: #e2e8f0; color: #0369a1; }
body.light-theme .kgn-link[aria-current] { background: #e0f2fe; color: #0c4a6e; }
body.light-theme .kgn-sub { border-left-color: #cbd5e1; }

/* a page's own sidebar items, moved under the current page by kg-nav.js */
.kgn-localwrap { margin: 2px 0 6px 22px; padding-left: 8px; border-left: 1px solid #1e293b; }
.kgn-localwrap .kgn-label { padding: 6px 10px 2px; }
.kgn-local { display: flex; flex-direction: column; gap: 2px; }
.kgn-local a, .kgn-local button { padding-top: 6px !important; padding-bottom: 6px !important; font-size: 13px !important; }
.kgn-local[hidden] { display: none; }

/* top bar inserted at the start of <main> on pages that had none */
.kgn-bar { grid-column: 1 / -1; align-self: stretch; box-sizing: border-box; width: 100%; max-width: 80rem; margin: 0 auto 20px;
  padding: 6px 12px; border-radius: 12px; background: rgba(30, 41, 59, .6); border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-family: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; }
.kgn-here { cursor: default; }
.kgn-here:hover { background: none !important; }
/* the page's own items (on-page anchors, mini game) sit on the right */
.kgn-toplocal { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-left: auto; padding-left: 12px; font-size: 13px; }
.kgn-toplocal[hidden] { display: none; }
/* bar placed at the top of a page's content column, above its own header */
.kgn-bar-col { width: calc(100% - 32px); margin: 12px auto; }
/* bar living inside an existing sticky top strip (NVIDIA, Spark pages) */
.kgn-inbar { flex: 1; min-width: 0; overflow-x: auto; flex-wrap: nowrap !important; }
/* atlas pages: same horizontal inset as the atlas section bar below it */
.kgn-bar-atlas { width: auto; max-width: none; margin: 16px max(5vw, 16px) 0; }
