header .bar { position: relative; }
header a.brand { display: inline-flex; align-items: center; flex: none; color: var(--fg, #e8ddd9); border: none; text-decoration: none; line-height: 0; }
header a.brand .kb-mark { height: 18px; width: auto; display: block; fill: currentColor; }
header a.brand .kb-dot { fill: var(--hl, #d8992f); }
header .crumb { color: var(--fg-muted, #9b8f91); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header .crumb a { color: var(--fg-dim, #b5a8a5); border: none; }
header .crumb a:hover { color: var(--hl, #d8992f); }
header .crumb .sep { margin: 0 6px; opacity: 0.5; }
header .crumb [aria-current] { color: var(--fg-muted, #9b8f91); }
.knav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.knav-menu > summary, .knav-find {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--fg-dim, #b5a8a5); background: var(--bg-2, #221a20);
  border: 1px solid var(--rule, #352e39); border-radius: 4px; padding: 3px 9px; line-height: 1.5; user-select: none;
}
.knav-menu > summary::-webkit-details-marker { display: none; }
.knav-menu > summary svg, .knav-find svg { width: 14px; height: 14px; display: block; }
.knav-menu > summary:hover, .knav-find:hover, .knav-menu[open] > summary, .knav-menu > summary:focus-visible, .knav-find:focus-visible { color: var(--hl, #d8992f); border-color: var(--hl, #d8992f); outline: none; }
.knav-find[hidden] { display: none; }
.knav-kbd { font: inherit; font-size: 10px; color: var(--fg-muted, #9b8f91); }
.knav-kbd:empty { display: none; }
.knav-panel {
  position: absolute; left: 12px; right: 12px; top: calc(100% + 6px); z-index: 50;
  background: var(--bg-2, #221a20); border: 1px solid var(--rule, #352e39); border-radius: 8px;
  box-shadow: 0 24px 60px #0009; padding: 18px 20px; max-height: calc(100vh - 90px); overflow-y: auto;
}
.knav-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 22px; }
.knav-col ul { list-style: none; margin: 6px 0 4px; padding: 0; }
.knav-col li { margin: 0; }
.knav-col li a { display: block; color: var(--fg-dim, #b5a8a5); font-size: 12px; padding: 2px 0; border: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.knav-col li a:hover { color: var(--hl, #d8992f); }
.knav-cat { display: block; font-weight: 700; font-size: 13px; color: var(--fg, #e8ddd9); border: none; }
a.knav-cat:hover, .knav-cat.on { color: var(--hl, #d8992f); }
.knav-cat span { color: var(--fg-muted, #9b8f91); font-weight: 400; font-size: 11px; }
.knav-all { font-size: 11px; color: var(--hl, #d8992f); border: none; }
.knav-all:hover { color: var(--accent, #b94738); }
@media (max-width: 760px) { .knav-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .knav-find-l, .knav-kbd { display: none; }
  .knav-menu > summary span { display: none; }
  .knav-panel { left: 8px; right: 8px; padding: 14px; }
  .knav-cols { gap: 14px 16px; }
  header .kofi-label { display: none; }
}
@media (hover: none) and (pointer: coarse) { .knav-kbd { display: none; } }
@media (max-width: 420px) { .knav-right { gap: 6px; } header .bar { gap: 8px; } header a.brand .kb-mark { height: 15px; } }

.knav-more { margin-top: 44px; }
.knav-more-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.knav-more-head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted, #9b8f91); margin: 0; font-weight: 600; }
.knav-more-head a { font-size: 12px; color: var(--hl, #d8992f); border: none; }
.knav-more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.knav-more-grid a { display: block; border: 1px solid var(--rule, #352e39); border-left: 2px solid var(--hl, #d8992f); border-radius: 3px; background: var(--bg-2, #221a20); padding: 9px 12px; color: var(--fg, #e8ddd9); font-size: 12px; }
.knav-more-grid a:hover { background: var(--bg-3, #2b2128); border-color: var(--hl, #d8992f); color: var(--fg, #e8ddd9); }
.knav-more-grid .n { display: block; font-weight: 600; }
.knav-more-grid .d { display: block; color: var(--fg-muted, #9b8f91); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.catbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; border: 1px solid var(--rule, #352e39); border-radius: 999px; background: var(--bg-2, #221a20); color: var(--fg-dim, #b5a8a5); font-size: 12px; padding: 3px 11px; }
.chip:hover { border-color: var(--hl, #d8992f); color: var(--hl, #d8992f); }
.chip span { color: var(--fg-muted, #9b8f91); font-size: 11px; }
h2.section.cat-h { display: flex; align-items: baseline; gap: 12px; margin-top: 44px; color: var(--fg, #e8ddd9); }
h2.section.cat-h a { color: inherit; }
h2.section.cat-h a:hover { color: var(--hl, #d8992f); }
h2.section.cat-h .cat-all { font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--hl, #d8992f); }
h3.sub { font-size: 12px; font-weight: 600; color: var(--fg-muted, #9b8f91); margin: 22px 0 10px; text-transform: none; letter-spacing: 0; }
section.cat > h3.sub:first-of-type { margin-top: 6px; }
.links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 12px 0 0; }
.links .links-l { font-size: 11px; color: var(--fg-muted, #9b8f91); margin-right: 4px; }
.links .chip { font-size: 11px; padding: 2px 9px; }
.catlinks { margin-top: 0; }

#knav-pal { width: min(620px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 80px)); margin: 10vh auto auto; padding: 0;
  background: var(--bg-2, #221a20); color: var(--fg, #e8ddd9); border: 1px solid var(--rule, #352e39); border-radius: 8px; box-shadow: 0 24px 60px #0009; overflow: hidden; font: inherit; }
#knav-pal[open] { display: flex; flex-direction: column; }
#knav-pal::backdrop { background: #0b080acc; }
#knav-pal .kp-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--rule, #352e39); flex: none; }
#knav-pal .kp-in svg { width: 18px; height: 18px; color: var(--fg-muted, #9b8f91); flex: none; }
#knav-q { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--fg, #e8ddd9); font: inherit; font-size: 15px; padding: 14px 0; }
#knav-q::placeholder { color: var(--fg-muted, #9b8f91); }
#knav-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
#knav-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 5px; cursor: pointer; border-left: 2px solid transparent; }
#knav-list li[aria-selected="true"] { background: var(--bg-3, #2b2128); border-left-color: var(--hl, #d8992f); }
#knav-list .pi { color: var(--hl, #d8992f); flex: none; width: 20px; height: 20px; }
#knav-list .pi svg { width: 20px; height: 20px; display: block; }
#knav-list .pt { flex: 1; min-width: 0; }
#knav-list .pn { font-weight: 600; color: var(--fg, #e8ddd9); }
#knav-list .pd { color: var(--fg-dim, #b5a8a5); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#knav-list .pk { flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted, #9b8f91); }
#knav-list .pempty { color: var(--fg-dim, #b5a8a5); font-size: 13px; padding: 14px 10px; cursor: default; }
#knav-pal .kp-foot { flex: none; border-top: 1px solid var(--rule, #352e39); padding: 7px 14px; font-size: 11px; color: var(--fg-muted, #9b8f91); display: flex; gap: 14px; flex-wrap: wrap; }
#knav-pal .kp-foot kbd { font: inherit; color: var(--fg-dim, #b5a8a5); }
@media (max-width: 520px) { #knav-pal { margin-top: 16px; } #knav-pal .kp-foot { display: none; } }

.knav-theme { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; padding: 0; cursor: pointer; color: var(--fg-dim, #b5a8a5); background: var(--bg-2, #221a20); border: 1px solid var(--rule, #352e39); border-radius: 4px; }
.knav-theme svg { width: 15px; height: 15px; display: block; }
.knav-theme:hover, .knav-theme:focus-visible { color: var(--hl, #d8992f); border-color: var(--hl, #d8992f); outline: none; }
.knav-theme[hidden] { display: none; }
.knav-theme .sun { display: none; }
html[data-theme="light"] .knav-theme .sun { display: block; }
html[data-theme="light"] .knav-theme .moon { display: none; }

html[data-theme="dark"] { --accent: #e0705f; --rule: #574b58; --line: #7f7183; }

html[data-theme="light"] {
  color-scheme: light;
  --bg: #e8e4dc; --bg-2: #faf8f3; --bg-3: #f1eee7;
  --fg: #1a1a1a; --fg-dim: #4a4a4a; --fg-muted: #5e5a54;
  --hl: #8b2e1f; --prompt: #8b2e1f; --accent: #b0261c; --link: #1a1a1a;
  --rule: #cdc7bc; --card: #faf8f3; --ok: #2a6b22; --selection: #8b2e1f2e;
  --on-ok: #ffffff; --ok-hover: #22581b; --line: #857f75;
  --blue: #2f5f9e; --green: #2a6b22; --red: #b0261c; --low: #6f5a1c; --err: #b0261c;
  --checker: repeating-conic-gradient(#e8e4dc 0% 25%, #faf8f3 0% 50%) 0 0 / 16px 16px;
}
html[data-theme="light"] header { background: var(--bg-2); }
html[data-theme="light"] .knav-panel, html[data-theme="light"] #knav-pal { box-shadow: 0 18px 50px #1a1a1a2e; }
html[data-theme="light"] #knav-pal::backdrop { background: #1a1a1a4d; }
html[data-theme="light"] #palette::backdrop { background: #1a1a1a4d; }
html[data-theme="light"] input[type=datetime-local] { color-scheme: light; }
:where(html[data-theme="light"]) .arc-editor #panel-zip .btn.ready { color: #ffffff; }
:where(html[data-theme="light"]) .arc-editor #panel-zip .btn.ready:hover { background: #22581b; border-color: #22581b; color: #ffffff; }
:where(html[data-theme="light"]) .frow .res.err, :where(html[data-theme="light"]) .frow .sub2.err, :where(html[data-theme="light"]) .kv .v.bad, :where(html[data-theme="light"]) .sig.bad, :where(html[data-theme="light"]) .verdict p.bad, :where(html[data-theme="light"]) .verdict.err, :where(html[data-theme="light"]) .chg .old, :where(html[data-theme="light"]) .citem .old, :where(html[data-theme="light"]) .difftext .del, :where(html[data-theme="light"]) .pill.del, :where(html[data-theme="light"]) .card.strong .t, :where(html[data-theme="light"]) .badge.danger, :where(html[data-theme="light"]) .pgh.special, :where(html[data-theme="light"]) .verdict.bad .vh { color: #b0261c; }
:where(html[data-theme="light"]) .chg .new, :where(html[data-theme="light"]) .citem .new, :where(html[data-theme="light"]) .pill.add, :where(html[data-theme="light"]) .difftext .add { color: #2a6b22; }
:where(html[data-theme="light"]) .badge.moved, :where(html[data-theme="light"]) .chip.moved b, :where(html[data-theme="light"]) .difftext .hunk, :where(html[data-theme="light"]) table.res td.num { color: #2f5f9e; }
:where(html[data-theme="light"]) .badge.moved { border-color: #2f5f9e; }
:where(html[data-theme="light"]) #notes .warn, :where(html[data-theme="light"]) #note.bad { color: #6f5a1c; }
:where(html[data-theme="light"]) .pane .tag { color: #f2ece9; }
:where(html[data-theme="light"]) .out ins { background: #dcebd3; color: #1c5513; }
:where(html[data-theme="light"]) .out del { background: #f3dcd6; color: #8b2e1f; text-decoration-color: #8b2e1f66; }
html[data-theme="light"] :is(.card, .frow, .mode, .drop, .related a, .knav-more-grid a, .compare, .chip) { box-shadow: 0 1px 2px #1a1a1a12, 0 2px 6px #1a1a1a0a; }
html[data-theme="light"] :is(a.card, .related a, .knav-more-grid a):hover { box-shadow: 0 2px 4px #1a1a1a1a, 0 6px 14px #1a1a1a12; }
:where(html[data-theme]) .opt select, :where(html[data-theme]) .opt input { border-color: var(--line); }
:where(html[data-theme]) .legend b.r, :where(html[data-theme]) .legend b.b { color: var(--fg); }
:where(html[data-theme]) .legend b.r::before, :where(html[data-theme]) .legend b.b::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; box-shadow: inset 0 0 0 1px #00000040; }
:where(html[data-theme]) .legend b.r::before { background: #e0435a; }
:where(html[data-theme]) .legend b.b::before { background: #5b8def; }
:where(html[data-theme="light"]) .difftext .del { color: #8b2e1f; }
