:root {
  --night: #161113; --wing: #221b1d; --wing2: #2a2124; --line: #3a2e32;
  --text: #f2ece4; --muted: #b3a7a0; --dim: #7d716c;
  --lime: #c3e126; --lime-ink: #1b2205;
  --top: 60px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; background: var(--night); color: var(--text); font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 10; height: var(--top); display: flex; align-items: center; gap: 1.2rem;
  padding: 0 1.25rem; background: #161113e6; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand em { font-style: normal; color: var(--lime); font-weight: 600; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 36px; height: 36px; font-size: 1.1rem; cursor: pointer; }
.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search input {
  width: 100%; background: var(--wing); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  font: inherit; font-size: .95rem; padding: .5rem .85rem; outline: 0;
}
.search input:focus { border-color: #c3e12699; box-shadow: 0 0 0 3px #c3e1261f; }
.results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: .35rem; list-style: none;
  background: var(--wing); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px #000a;
  max-height: 70vh; overflow: auto;
}
.results li a { display: block; padding: .55rem .7rem; border-radius: 8px; color: var(--text); }
.results li a:hover, .results li a.sel { background: #c3e1261a; text-decoration: none; }
.results .rt { font-size: .78rem; color: var(--dim); }
.results .rs { font-weight: 600; }
.results .rx { font-size: .85rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results mark { background: none; color: var(--lime); }
.results .none { padding: .7rem; color: var(--muted); }
.links { display: flex; gap: 1.1rem; }
.links a { color: var(--muted); font-size: .92rem; }
.links a:hover { color: var(--text); text-decoration: none; }

/* layout */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; max-width: 1360px; margin: 0 auto; }
.side, .toc { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow: auto; padding: 1.5rem 1rem; }
.side ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.side-label { margin: 0 0 .6rem .6rem; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.side a { display: block; padding: .38rem .7rem; border-radius: 8px; color: var(--muted); font-size: .95rem; }
.side a:hover { color: var(--text); background: var(--wing); text-decoration: none; }
.side a.on { color: var(--lime); background: #c3e12614; font-weight: 600; }
.toc a { display: block; padding: .25rem .6rem; color: var(--dim); font-size: .87rem; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.on { color: var(--lime); border-left-color: var(--lime); }

.content { padding: 2rem 2.5rem 3rem; min-width: 0; }
article { max-width: 760px; }
h1 { font-size: 2.4rem; line-height: 1.1; letter-spacing: -.02em; margin: .3rem 0 .5rem; }
.desc { color: var(--muted); font-size: 1.12rem; margin: 0 0 2rem; }
h2 { font-size: 1.5rem; margin: 2.4rem 0 .8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; margin: 1.8rem 0 .6rem; }
h4 { font-size: 1rem; margin: 1.4rem 0 .5rem; color: var(--muted); }
.hash { margin-left: .45rem; color: var(--dim); opacity: 0; font-weight: 400; }
h2:hover .hash, h3:hover .hash, h4:hover .hash, .hash:focus { opacity: 1; text-decoration: none; }
article p, article li { color: #e2dbd2; }
article ul, article ol { padding-left: 1.4rem; }
article li { margin: .3rem 0; }
article li > ul, article li > ol { margin: .3rem 0; }
strong { color: var(--text); }
code, kbd {
  font: .87em ui-monospace, Menlo, Consolas, monospace; background: #c3e12612; color: var(--text);
  border: 1px solid #c3e1262e; border-radius: 6px; padding: .08em .38em;
}
kbd { border-bottom-width: 2px; white-space: nowrap; }
pre { background: #0f0b0c; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; overflow: auto; }
pre code { background: none; border: 0; padding: 0; font-size: .88rem; line-height: 1.55; }
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
tr:hover td { background: #ffffff05; }
a.ext::after { content: "↗"; font-size: .75em; margin-left: .15em; opacity: .7; }
blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 3px solid var(--lime); background: var(--wing); border-radius: 0 10px 10px 0; color: var(--muted); }

.prevnext { display: flex; justify-content: space-between; gap: 1rem; max-width: 760px; margin: 3rem 0 2rem; }
.pn { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; color: var(--text); font-weight: 600; }
.pn span { display: block; font-size: .78rem; color: var(--dim); font-weight: 500; }
.pn:hover { border-color: #c3e12666; text-decoration: none; }
.pn.next { text-align: right; margin-left: auto; }
.content footer { max-width: 760px; color: var(--dim); font-size: .85rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.content footer a { color: var(--muted); }

@media (max-width: 1150px) { .layout { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .menu-btn { display: inline-block; }
  .links { display: none; }
  .layout { display: block; }
  .side { position: fixed; z-index: 9; left: 0; top: var(--top); width: 280px; background: var(--night); border-right: 1px solid var(--line); transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; }
  .content { padding: 1.5rem 1.2rem 2rem; }
  h1 { font-size: 2rem; }
}
@media (max-width: 520px) { .brand span { display: none; } }
.notfound { text-align: center; padding-top: 15vh; }
.toc li.l3 a { padding-left: 1.3rem; font-size: .83rem; }
