:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a2230;
  --muted: #5d6878;
  --line: #e2e6ec;
  --brand: #0b6bcb;
  --brand-soft: #e8f1fb;
  --code-bg: #f1f3f6;
  --pre-bg: #111827;
  --pre-text: #e5e9f0;
  --ok: #17803d;
  --warn-bg: #fff6e0;
  --warn-line: #e9b949;
  --get: #17803d;
  --post: #b25e09;
  --put: #6b3fc4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --surface: #171e28;
    --text: #e6eaf0;
    --muted: #9aa6b6;
    --line: #2a3442;
    --brand: #6bb1f5;
    --brand-soft: #18293c;
    --code-bg: #222c3a;
    --pre-bg: #0a0e14;
    --pre-text: #dfe5ee;
    --warn-bg: #2e2610;
    --warn-line: #a17c1c;
    --get: #5ec98a;
    --post: #f0a44b;
    --put: #b79bf2;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.logo { font-weight: 700; font-size: 18px; color: var(--text); }
.logo span { color: var(--brand); }
.topbar nav { margin-left: auto; display: flex; gap: 16px; font-size: 14px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 16px 64px; }
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
.toc { position: sticky; top: 72px; align-self: start; font-size: 14px; max-height: calc(100vh - 90px); overflow-y: auto; }
.toc b { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.toc a { display: block; padding: 4px 0; color: var(--muted); }
.toc a:hover { color: var(--brand); text-decoration: none; }
.allposts { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.allposts .grp { display: block; margin: 4px 0 2px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.allposts a { padding: 5px 0 5px 10px; border-left: 2px solid var(--line); line-height: 1.4; }
.allposts a.cur { color: var(--brand); border-left-color: var(--brand); font-weight: 600; }
@media (max-width: 820px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); margin-bottom: 20px; }
}

h1 { font-size: 30px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 44px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); scroll-margin-top: 70px; }
h3 { font-size: 17px; margin: 28px 0 8px; scroll-margin-top: 70px; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 20px; }
.crumbrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.crumb { font-size: 14px; color: var(--muted); }
.mdtools { display: flex; gap: 6px; }
.btn {
  font: 500 13.5px/1 inherit; font-family: inherit; cursor: pointer;
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.ghost { color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
h2.cat { border-top: 0; margin-top: 28px; }
.meta { font-size: 13px; color: var(--muted); }

code {
  background: var(--code-bg); padding: 1px 6px; border-radius: 5px;
  font: 13.5px/1.5 ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  overflow-wrap: anywhere;
}
pre {
  background: var(--pre-bg); color: var(--pre-text);
  padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: 10px 0 16px;
}
pre code { background: none; padding: 0; color: inherit; overflow-wrap: normal; }

.tbl { overflow-x: auto; margin: 10px 0 18px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--brand-soft); font-weight: 600; white-space: nowrap; }

article img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; margin: 14px 0; background: #fff; }
.note p { margin: 0; }
.note {
  background: var(--warn-bg); border-left: 4px solid var(--warn-line);
  padding: 10px 14px; border-radius: 6px; margin: 14px 0;
}
.ep {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; margin: 10px 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.ep code { background: none; padding: 0; font-size: 14.5px; }
.m { font: 700 12px/1 ui-monospace, Consolas, monospace; padding: 4px 7px; border-radius: 5px; border: 1px solid currentColor; }
.m.get { color: var(--get); } .m.post { color: var(--post); } .m.put { color: var(--put); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; display: block; color: var(--text);
}
.card:hover { border-color: var(--brand); text-decoration: none; }
.card h3 { margin: 6px 0; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.tag { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 99px; }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; padding: 20px 16px; }
