:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d8e0ea;
  --line-strong: #c4cedb;
  --text: #172033;
  --muted: #657086;
  --muted-2: #8a95a8;
  --accent: #4d66f6;
  --accent-dark: #3149cf;
  --code-bg: #1e1e1e;
  --code-text: #d4d4d4;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 72px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 156px;
}

.brand img {
  display: block;
  width: 156px;
  height: auto;
}

.topnav {
  display: flex;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

.language-switch {
  display: flex;
  margin-left: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.lang-button {
  min-width: 78px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.lang-button.is-active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(77, 102, 246, 0.24);
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 240px;
  gap: 0;
  min-height: calc(100vh - 72px);
}

.sidebar,
.rightbar {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  overflow: auto;
}

.sidebar {
  padding: 28px 20px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 8px 24px;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
}

.sidebar-head strong {
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--accent-dark);
  background: #eef2ff;
  font-size: 13px;
}

.toc {
  display: grid;
  gap: 4px;
}

.toc a {
  display: block;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.42;
}

.toc a:hover,
.toc a.is-active {
  color: var(--accent-dark);
  background: #f0f3ff;
}

.toc .level-1 {
  margin-top: 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.toc .level-2 {
  padding-left: 22px;
  font-size: 15px;
}

.toc .level-3 {
  padding-left: 22px;
  color: var(--muted);
  font-size: 15px;
}

.main {
  min-width: 0;
  padding: 42px 40px 72px;
}

.hero {
  max-width: 920px;
  margin: 0 auto 28px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hero h1 {
  margin-bottom: 14px;
  font-size: 52px;
  line-height: 1.06;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
}

.primary-action {
  color: #ffffff;
  background: var(--accent);
}

.secondary-action {
  color: var(--accent-dark);
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.doc-shell {
  max-width: 920px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.markdown-body {
  padding: 34px 44px 52px;
}

.markdown-body h1 {
  margin: 42px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
}

.markdown-body h1:first-child {
  margin-top: 0;
}

.markdown-body h2 {
  margin: 36px 0 14px;
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: 0;
}

.markdown-body h3 {
  margin: 26px 0 12px;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: 0;
}

.markdown-body p,
.markdown-body li {
  color: #344055;
  font-size: 15px;
  line-height: 1.75;
}

.markdown-body p {
  margin: 0 0 14px;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 24px;
  margin: 0 0 18px;
}

.markdown-body strong {
  color: var(--text);
  font-weight: 800;
}

.markdown-body code {
  border-radius: 5px;
  padding: 2px 5px;
  color: #c586c0;
  background: #f3f5f8;
  font-size: 0.9em;
}

.code-block {
  position: relative;
  overflow: hidden;
  margin: 20px 0 28px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: var(--code-bg);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.2);
}

.code-block::before {
  content: attr(data-language);
  display: block;
  height: 38px;
  padding: 0 92px 0 64px;
  border-bottom: 1px solid #30363d;
  color: #d7dce2;
  background: linear-gradient(180deg, #2a2d34 0%, #23262d 100%);
  font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 38px;
  text-transform: uppercase;
}

.code-block::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 17px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff5f56;
  box-shadow: 13px 0 #ffbd2e, 26px 0 #27c93f;
}

.code-block pre {
  overflow: auto;
  margin: 0;
  padding: 18px 0 20px;
  color: var(--code-text);
  background:
    linear-gradient(90deg, #252526 0 52px, transparent 52px),
    #1e1e1e;
  font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13.5px;
  line-height: 1.78;
  tab-size: 2;
  counter-reset: code-line;
}

.code-block code {
  display: block;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
}

.code-line {
  display: block;
  min-height: 24px;
  padding: 0 22px 0 68px;
  white-space: pre;
  counter-increment: code-line;
}

.code-line::before {
  content: counter(code-line);
  display: inline-block;
  width: 34px;
  margin-left: -56px;
  margin-right: 22px;
  color: #858585;
  text-align: right;
  user-select: none;
}

.code-line:hover {
  background: rgba(255, 255, 255, 0.045);
}

.token-property {
  color: #9cdcfe;
}

.token-string {
  color: #ce9178;
}

.token-number {
  color: #b5cea8;
}

.token-constant {
  color: #569cd6;
}

.token-comment {
  color: #6a9955;
  font-style: italic;
}

.token-keyword {
  color: #569cd6;
}

.token-function {
  color: #dcdcaa;
}

.token-punctuation {
  color: #d4d4d4;
}

.copy-code {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 58px;
  min-height: 24px;
  border: 1px solid #3e3e42;
  border-radius: 6px;
  color: #cccccc;
  background: #2d2d30;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.copy-code:hover {
  color: #ffffff;
  background: #37373d;
}

.code-block pre::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.code-block pre::-webkit-scrollbar-thumb {
  background: #424242;
}

.code-block pre::-webkit-scrollbar-track {
  background: #1e1e1e;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 14px;
}

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

th {
  color: var(--text);
  background: var(--surface-soft);
  font-weight: 850;
}

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

th:last-child,
td:last-child {
  border-right: 0;
}

.endpoint-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.method {
  padding: 4px 8px;
  border-radius: 6px;
  color: #ffffff;
  background: #18a957;
  font-size: 12px;
}

.endpoint-line code {
  color: var(--accent-dark);
  background: #eef2ff;
  font-weight: 800;
}

.doc-image {
  margin: 18px 0 26px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.doc-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.rightbar {
  padding: 24px 18px;
  border-left: 1px solid var(--line);
  background: #ffffff;
}

.tool-panel {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.tool-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.tool-panel code {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

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

  .rightbar {
    display: none;
  }
}

@media (max-width: 820px) {
  html {
    scroll-padding-top: 126px;
  }

  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 72px;
    padding: 14px 18px;
    gap: 14px;
  }

  .brand {
    min-width: min(136px, calc(100vw - 156px));
  }

  .brand img {
    width: min(136px, calc(100vw - 156px));
  }

  .topnav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 119px;
    z-index: 20;
    height: auto;
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    padding: 28px 16px 54px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .markdown-body {
    padding: 26px 18px 38px;
  }

  .markdown-body h1 {
    font-size: 28px;
  }
}
