:root {
  --bg: #ffffff;
  --surface: #fbfbfb;
  --surface-2: #f6f6f6;
  --surface-3: #eeeeee;
  --text: #171717;
  --muted: #6f6f6f;
  --muted-2: #8a8a8a;
  --line: #e7e2de;
  --line-2: #f0ece8;
  --accent: #dd7627;
  --accent-2: #b95616;
  --accent-soft: #fff4eb;
  --accent-line: #f5c8a8;
  --code-bg: #111111;
  --code-text: #f4f4f4;
  --shadow: 0 20px 70px rgba(28, 24, 20, .08);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0c0c0c;
  --surface: #101010;
  --surface-2: #171717;
  --surface-3: #232323;
  --text: #f3f3f3;
  --muted: #a6a6a6;
  --muted-2: #7f7f7f;
  --line: #292929;
  --line-2: #202020;
  --accent: #f09243;
  --accent-2: #ffb36d;
  --accent-soft: rgba(221, 118, 39, .13);
  --accent-line: rgba(240, 146, 67, .32);
  --code-bg: #050505;
  --code-text: #eeeeee;
  --shadow: none;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 252px;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #f2b15f);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0;
  box-shadow: 0 10px 24px rgba(221, 118, 39, .22);
}

.brand-name {
  font-size: 15px;
}

.search-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(420px, 40vw);
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
}

.search-button:hover {
  border-color: var(--accent-line);
  background: var(--bg);
  color: var(--text);
}

.search-placeholder {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keys {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

kbd {
  min-width: 22px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  padding: 1px 5px;
  font-size: 11px;
  line-height: 1.35;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.top-links a {
  text-decoration: none;
}

.top-links a:hover,
.top-links [aria-current="page"] {
  color: var(--text);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.theme-icon,
.menu-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.theme-icon::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  border: 2px solid currentColor;
  box-shadow: 5px -3px 0 -1px var(--bg);
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
}

.menu-icon::before {
  top: 2px;
}

.menu-icon::after {
  bottom: 2px;
}

.mobile-only,
.mobile-nav {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 246px;
  max-width: 1540px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 56px;
  height: calc(100dvh - 56px);
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.sidebar-inner {
  height: 100%;
  overflow-y: auto;
  padding: 14px 12px 28px;
  scrollbar-width: thin;
}

.signup-card {
  display: block;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.signup-card:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.signup-title {
  display: block;
  color: var(--text);
  font-weight: 650;
}

.signup-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav-group {
  margin: 8px 0;
}

.nav-group-button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  text-align: left;
  cursor: pointer;
}

.nav-group-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-group-title {
  flex: 1;
  font-size: 13px;
  font-weight: 650;
}

.chevron {
  transition: transform .18s ease;
}

.nav-group.closed .chevron {
  transform: rotate(-90deg);
}

.nav-links {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 10px;
  padding-left: 13px;
}

.nav-links::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 1px;
  background: var(--line);
}

.nav-group.closed .nav-links {
  display: none;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--muted);
  line-height: 1.42;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 650;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -13px;
  width: 1px;
  background: var(--accent);
}

.main {
  min-width: 0;
  min-height: calc(100dvh - 56px);
  border-right: 1px solid var(--line-2);
  background: var(--bg);
}

.doc-container {
  max-width: 872px;
  margin: 0 auto;
  padding: 32px 44px 64px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs a {
  text-decoration: none;
}

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

.doc:focus {
  outline: 0;
}

.doc h1 {
  margin: 0 0 13px;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: 0;
}

.doc h2 {
  margin: 40px 0 13px;
  padding-top: 22px;
  border-top: 1px solid var(--line-2);
  font-size: 24px;
  line-height: 1.28;
  letter-spacing: 0;
}

.doc h3 {
  margin: 27px 0 10px;
  font-size: 18px;
  line-height: 1.35;
}

.doc p,
.doc li {
  color: color-mix(in srgb, var(--text) 84%, var(--muted));
  font-size: 15px;
  line-height: 1.84;
}

.lead {
  margin-top: 0;
  color: var(--muted) !important;
  font-size: 16px !important;
}

.doc ul,
.doc ol {
  padding-left: 23px;
}

.doc strong {
  color: var(--text);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.doc-card {
  display: block;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 15px;
  text-decoration: none;
}

.doc-card:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.doc-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.doc-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.68;
}

.callout {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--accent-line);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--accent-soft);
}

.callout.warning {
  border-color: #f1b65f;
  background: color-mix(in srgb, #fff8e8 82%, var(--bg));
}

[data-theme="dark"] .callout.warning {
  background: rgba(241, 182, 95, .12);
}

.callout p {
  margin: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
}

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

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

th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 650;
}

code {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  padding: 1px 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}

.code-block {
  position: relative;
  margin: 16px 0;
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: 8px;
  background: var(--code-bg);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  min-height: 36px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  padding: 0 10px 0 14px;
  color: rgba(255, 255, 255, .62);
  font-size: 12px;
}

.copy-button {
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
}

.copy-button:hover {
  background: rgba(255, 255, 255, .15);
}

pre {
  margin: 0;
  padding: 15px;
  overflow-x: auto;
}

pre code {
  display: block;
  border: 0;
  background: transparent;
  color: var(--code-text);
  padding: 0;
  line-height: 1.7;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.model-card {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
}

.model-card:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.model-card code {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.steps {
  counter-reset: step;
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.step {
  position: relative;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 12px 14px 12px 48px;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 13px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.step strong {
  display: block;
  margin-bottom: 3px;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 48px;
}

.pager a {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 12px;
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.pager span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.pager .next {
  text-align: right;
}

.toc {
  position: sticky;
  top: 56px;
  height: calc(100dvh - 56px);
  overflow-y: auto;
  padding: 32px 18px;
  background: var(--surface);
}

.toc-title {
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 650;
}

.toc a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

.toc a.level-3 {
  padding-left: 12px;
  font-size: 12px;
}

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

.toc-note {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  padding: 8vh 16px;
  background: rgba(0, 0, 0, .45);
}

.search-overlay.open {
  display: block;
}

.search-dialog {
  max-width: 680px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 24px 100px rgba(0, 0, 0, .28);
  overflow: hidden;
}

.search-dialog input {
  width: 100%;
  height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 0 18px;
  font-size: 16px;
}

.search-results {
  max-height: 58vh;
  overflow-y: auto;
  padding: 9px;
}

.search-result {
  display: block;
  border-radius: 8px;
  padding: 10px 11px;
  text-decoration: none;
}

.search-result:hover,
.search-result.active {
  background: var(--surface-2);
}

.search-result strong {
  display: block;
}

.search-result span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

  .toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    padding: 0 12px;
  }

  .mobile-only {
    display: inline-grid;
  }

  .brand {
    min-width: 0;
  }

  .search-button,
  .top-links {
    display: none;
  }

  .mobile-nav {
    position: sticky;
    top: 56px;
    z-index: 50;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    padding: 8px 12px;
  }

  .mobile-nav-button {
    flex: 1;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    text-align: center;
    text-decoration: none;
    padding: 7px 10px;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    z-index: 80;
    display: none;
    width: min(86vw, 330px);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .28);
  }

  .sidebar.open {
    display: block;
  }

  .main {
    border-right: 0;
  }

  .doc-container {
    padding: 28px 20px 56px;
  }

  .doc h1 {
    font-size: 32px;
  }

  .doc h2 {
    font-size: 22px;
  }

  .card-grid,
  .model-grid,
  .pager {
    grid-template-columns: 1fr;
  }

  .pager .next {
    text-align: left;
  }
}
