:root {
  color-scheme: light;
  --bg: #ffffff;
  --page: #f7f8fb;
  --surface: #ffffff;
  --text: #2c3e50;
  --muted: #6f7f8f;
  --heading: #24384b;
  --nav-text: #40566b;
  --sidebar-text: #43566a;
  --line: #e5e9f0;
  --brand: #28a9e0;
  --brand-dark: #1686bf;
  --sidebar: #f4f6f8;
  --hover-bg: #e9eef3;
  --active-bg: #e0f3fb;
  --code-bg: #f6f8fa;
  --code-text: #cf5b2e;
  --pre-bg: #f5f7fa;
  --pre-text: #33485b;
  --table-head: #f3f6f9;
  --table-stripe: #fbfcfd;
  --warning-bg: #fff6e6;
  --warning-line: #f0b65a;
  --notice-bg: #eef8fd;
  --notice-line: #45b6e8;
  --shadow: 0 1px 3px rgba(37, 54, 71, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111923;
  --page: #0d141d;
  --surface: #111923;
  --text: #d5dee8;
  --muted: #91a2b4;
  --heading: #edf4fb;
  --nav-text: #c3d0dc;
  --sidebar-text: #bdcbd8;
  --line: #2a3746;
  --brand: #55c2f3;
  --brand-dark: #63c9f5;
  --sidebar: #0f1720;
  --hover-bg: #1b2835;
  --active-bg: #123446;
  --code-bg: #1a2632;
  --code-text: #ff9b72;
  --pre-bg: #0d141c;
  --pre-text: #c6d5e3;
  --table-head: #18232e;
  --table-stripe: #141e28;
  --warning-bg: #342913;
  --warning-line: #d89b38;
  --notice-bg: #102b38;
  --notice-line: #3fa9d6;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-size: 15px;
  line-height: 1.75;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}

a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  color: var(--heading);
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

.brand:hover {
  color: var(--heading);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  min-width: 0;
  font-size: 14px;
}

.topnav a {
  color: var(--nav-text);
  white-space: nowrap;
}

.theme-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--nav-text);
  font: inherit;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--brand);
  background: var(--hover-bg);
  color: var(--brand-dark);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.theme-icon {
  line-height: 1;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 900px) 220px;
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
  background: var(--surface);
}

.sidebar,
.toc {
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.sidebar {
  padding: 28px 22px 40px 28px;
}

.sidebar-section {
  margin-bottom: 26px;
}

.sidebar-title,
.toc-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar a {
  display: block;
  margin: 2px 0;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--sidebar-text);
  font-size: 14px;
  line-height: 1.45;
}

.sidebar a:hover {
  background: var(--hover-bg);
  color: var(--brand-dark);
  text-decoration: none;
}

.sidebar a.active {
  background: var(--active-bg);
  color: var(--brand-dark);
  font-weight: 600;
}

.content {
  min-width: 0;
  padding: 38px 56px 72px;
  background: var(--surface);
}

article {
  max-width: 820px;
}

.crumb {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3 {
  color: var(--heading);
  line-height: 1.35;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  font-size: 34px;
  font-weight: 600;
}

h2 {
  margin: 46px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 25px;
  font-weight: 600;
}

h3 {
  margin: 28px 0 10px;
  font-size: 18px;
  font-weight: 600;
}

p {
  margin: 12px 0;
}

blockquote {
  margin: 18px 0 24px;
  padding: 2px 0 2px 16px;
  border-left: 4px solid var(--line);
  color: var(--muted);
}

ul,
ol {
  padding-left: 26px;
  margin: 12px 0 18px;
}

li + li {
  margin-top: 5px;
}

code {
  padding: 0.16em 0.36em;
  border-radius: 3px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

pre {
  margin: 18px 0 24px;
  padding: 18px 20px;
  overflow: auto;
  border-radius: 4px;
  background: var(--pre-bg);
  border: 1px solid var(--line);
}

pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--pre-text);
  font-size: 13px;
  line-height: 1.65;
}

table {
  width: 100%;
  margin: 18px 0 28px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
}

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

th {
  background: var(--table-head);
  color: var(--heading);
  font-weight: 600;
}

tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

.install-gallery {
  display: grid;
  gap: 22px;
  margin: 18px 0 34px;
}

.install-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.install-step-figure {
  margin: 16px 0 20px;
}

.install-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.install-figure figcaption {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.install-figure figcaption strong {
  color: var(--heading);
}

.notice,
.warning {
  margin: 22px 0;
  padding: 14px 16px;
  border-left: 4px solid;
  border-radius: 4px;
}

.notice {
  background: var(--notice-bg);
  border-color: var(--notice-line);
}

.warning {
  background: var(--warning-bg);
  border-color: var(--warning-line);
}

.doc-figure {
  margin: 24px 0 30px;
}

.doc-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.doc-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 46px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.pager a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--brand-dark);
}

.pager a:hover {
  border-color: var(--brand);
  text-decoration: none;
}

.toc {
  padding: 30px 24px;
  border-right: none;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.toc a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.toc a:hover {
  border-left-color: var(--brand);
  color: var(--brand-dark);
  text-decoration: none;
}

.footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    height: auto;
    min-height: 58px;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
    gap: 12px;
  }

  .topnav {
    width: 100%;
    justify-content: flex-start;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-section {
    margin-bottom: 14px;
  }

  .sidebar a {
    display: inline-flex;
    margin-right: 4px;
  }

  .content {
    padding: 28px 20px 52px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .brand {
    min-width: 0;
    font-size: 16px;
  }

  .content {
    padding: 24px 16px 44px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .pager {
    flex-direction: column;
  }
}
