:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --sheet: #ffffff;
  --ink: #151922;
  --ink-2: #3d4654;
  --line: #e2e6ec;
  --accent: #0f7668;
  --accent-soft: #e7f5f2;
  --code: #eef1f4;
  --shadow: 0 1px 2px rgb(21 25 34 / 0.06);
  font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --sheet: #161b22;
    --ink: #e7eaf0;
    --ink-2: #b7c0cc;
    --line: #2a3140;
    --accent: #2dd4bf;
    --accent-soft: #12332f;
    --code: #0e1116;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16.5px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
}

.skip:focus { top: 12px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--sheet);
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.top-nav { display: flex; gap: 16px; }

a { color: var(--accent); }

.top-nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 600; }
.top-nav a:hover { color: var(--accent); }

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px);
  gap: 36px;
  justify-content: center;
  padding: 32px 28px 64px;
}

.toc {
  position: sticky;
  top: 76px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 100px);
  overflow: auto;
}

.toc a {
  color: var(--ink-2);
  font-size: 13.5px;
  text-decoration: none;
}

.toc a:hover { color: var(--accent); }

main h1 {
  margin: 0 0 12px;
  font-size: 40px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

main h2 {
  margin: 40px 0 12px;
  font-size: 24px;
  letter-spacing: -0.02em;
  scroll-margin-top: 80px;
}

main p { margin: 12px 0; }

main ul, main ol { margin: 12px 0; padding-left: 1.3em; }
main li { margin: 4px 0; }

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }

th, td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

tr:last-child td { border-bottom: 0; }

th { background: var(--accent-soft); font-size: 13px; }

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--code);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

img {
  display: block;
  width: 100%;
  height: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
}

footer {
  padding: 24px 28px 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: center;
}

footer p { margin: 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 20px 16px 48px; }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; gap: 8px 14px; }
  main h1 { font-size: 32px; }
  .top { padding: 14px 16px; }
}
