:root{
  --bg:#0b1220; --surface:#101826; --ink:#e6ebf5; --muted:#9aa6b2; --line:#24324a;
  --primary:#22c55e; --accent:#60a5fa; --warn:#f59e0b; --danger:#ef4444;
  --noteY:#fff3b0; --noteB:#bde0fe; --noteG:#caffbf; --noteP:#ffc6ff; --noteO:#ffd6a5; --noteC:#a0e7e5; --noteM:#bdb2ff; --noteT:#c3f0ca; --noteR:#ffadad;
}
:root.light{
  --bg:#f8fafc; --surface:white; --ink:#0f172a; --muted:#475569; --line:#e2e8f0;
  --primary:#16a34a; --accent:#2563eb; --warn:#d97706; --danger:#dc2626;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,Arial}
.header{position:sticky;top:0;background:linear-gradient(90deg,#0b1220,#0f172a);border-bottom:1px solid var(--line);z-index:50}
.inner{max-width:1220px;margin:0 auto;padding:12px 16px;display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.brand h1{font-size:20px;margin:0}
.tag{font-size:12px;color:var(--muted)}
.controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
input[type=search], select, .btn{padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:var(--surface);color:var(--ink)}
.btn{cursor:pointer}
.main{max-width:1220px;margin:0 auto;display:grid;grid-template-columns:280px 1fr;gap:12px;padding:12px 16px}
@media (max-width:960px){.main{grid-template-columns:1fr}}
.side{position:sticky;top:68px;height:max-content;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px}
.nav a,.nav summary{display:block;padding:10px 12px;border-radius:10px;color:var(--ink);text-decoration:none;border:1px solid transparent;margin:4px 0;cursor:pointer}
.nav a:hover,.nav summary:hover{background:rgba(255,255,255,.05)}
.card{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:16px;margin-bottom:14px}
.hidden{display:none}
.k-card{background:rgba(255,255,255,.04);border:1px solid var(--line);border-radius:12px;padding:10px 12px}
.tip{border-left:4px solid var(--warn);background:rgba(255,255,255,.04);padding:8px 10px;border-radius:10px;margin-top:8px}
.item-card{border:1px dashed var(--line);border-radius:12px;margin:12px 0;background:rgba(255,255,255,.02)}
.item-head{display:flex;justify-content:space-between;gap:8px;align-items:center;padding:10px 12px;border-bottom:1px dashed var(--line)}
.item-body{display:grid;grid-template-columns:1fr;gap:14px;padding:10px 12px}
.pills{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.pill{padding:3px 8px;border-radius:999px;border:1px solid var(--line);font-size:12px;background:rgba(255,255,255,.04)}
.table3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px}
.table3>div{border:1px solid var(--line);border-radius:10px;padding:8px 10px;background:rgba(255,255,255,.03)}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media (max-width:900px){.grid-2{grid-template-columns:1fr}.table3{grid-template-columns:1fr}}
.note-row{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
.note{display:inline-block;padding:6px 8px;border-radius:8px;color:#111;font-weight:700}
.note.y{background:var(--noteY)} .note.b{background:var(--noteB)} .note.g{background:var(--noteG)} .note.p{background:var(--noteP)} .note.o{background:var(--noteO)}
.note.c{background:var(--noteC)} .note.m{background:var(--noteM)} .note.t{background:var(--noteT)} .note.r{background:var(--noteR)}
.footer{color:var(--muted);border-top:1px solid var(--line);padding-top:8px;margin-bottom:24px}
svg text{fill:currentColor}


/* --- Ultra-rich visual alignment & polish --- */
figure.viz {margin:6px auto 10px; max-width:900px; display:flex; flex-direction:column; align-items:center;
  background:rgba(255,255,255,.03); border:1px solid var(--line); border-radius:12px; padding:10px;}
figure.viz svg {width:100%; height:auto; display:block}
figure.viz figcaption {font-size:12px; color:var(--muted); margin-top:6px}
.item-body {gap:18px}
.table3>div ul{margin:6px 0 0 18px}
/* Highlight search matches */
mark.hl {background: #fde68a; color: #111; padding:0 2px; border-radius:3px}
/* Sticky section title for long pages */
.card > h2 {position:sticky; top:64px; background:var(--surface); z-index:5; padding:6px 0; margin-top:-6px}
/* Better button affordance */
.btn {transition:transform .05s ease-in-out}
.btn:active {transform:scale(.98)}
/* No results state */
.no-results {padding:14px; border:1px dashed var(--line); border-radius:10px; color:var(--muted); text-align:center}
