:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d7dce3;
  --line-strong: #c7ced8;
  --text: #1f2937;
  --muted: #667085;
  --muted-strong: #475467;
  --accent: #111827;
  --code-bg: #111827;
  --code-text: #e5edf5;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --green-soft: #dcfce7;
  --green-text: #166534;
  --orange-soft: #ffedd5;
  --orange-text: #9a3412;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

body.docs-sidebar-open {
  overflow: hidden;
}

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

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

code,
pre,
kbd {
  font-family: "SFMono-Regular", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.docs-shell {
  min-height: 100svh;
}

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(199, 206, 216, 0.72);
  background: rgba(248, 250, 252, 0.86);
  backdrop-filter: blur(12px);
}

.docs-topbar-head {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.docs-brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.docs-brand strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
}

.docs-brand span {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
}

.docs-top-actions {
  display: flex;
  width: auto;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 10px;
}

.docs-top-links,
.docs-top-auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switches {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.language-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.language-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
}

.language-button:hover,
.language-button:focus-visible,
.language-button.is-active {
  transform: translateY(-1px) scale(1.03);
  border-color: var(--line-strong);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  outline: none;
}

.language-button:not(.is-active) {
  opacity: 0.52;
  filter: saturate(0.72);
}

.language-button.is-bouncing {
  animation: docsLangBounce 420ms ease;
}

.docs-button,
.docs-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.docs-button:hover,
.docs-button:focus-visible,
.docs-toggle:hover,
.docs-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  outline: none;
}

.docs-button-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.docs-user-button {
  max-width: min(320px, 34vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
}

.docs-sidebar {
  position: sticky;
  top: 67px;
  align-self: start;
  height: calc(100svh - 67px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 22px 18px 40px;
  border-right: 1px solid rgba(199, 206, 216, 0.72);
  background: rgba(248, 250, 252, 0.8);
}

.docs-sidebar-group + .docs-sidebar-group {
  margin-top: 22px;
}

.docs-sidebar-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-sidebar nav {
  display: grid;
  gap: 4px;
}

.docs-sidebar a {
  display: block;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--muted-strong);
}

.docs-sidebar a:hover,
.docs-sidebar a:focus-visible,
.docs-sidebar a.is-active {
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.docs-main {
  padding: 28px 28px 56px;
  min-width: 0;
}

.docs-content {
  width: min(940px, 100%);
  margin: 0 auto;
  min-width: 0;
}

.docs-hero {
  padding: 6px 0 18px;
}

.docs-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.docs-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4b5563;
}

.docs-hero h1 {
  margin: 18px 0 0;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.docs-hero p {
  max-width: 760px;
  margin: 16px 0 0;
  font-size: 1.05rem;
  line-height: 1.72;
  color: var(--muted-strong);
}

.docs-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.docs-badge {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text);
}

.docs-section {
  padding-top: 28px;
}

.docs-section + .docs-section {
  margin-top: 12px;
}

.docs-section h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.docs-section p {
  margin: 14px 0 0;
  color: var(--muted-strong);
  line-height: 1.74;
}

.docs-section h3 {
  margin: 22px 0 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

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

.docs-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.docs-card strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
}

.docs-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.65;
}

.docs-table-wrap {
  margin-top: 16px;
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

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

th {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--panel-soft);
}

td {
  font-size: 0.95rem;
  line-height: 1.6;
}

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

.docs-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.docs-method-get {
  background: var(--green-soft);
  color: var(--green-text);
}

.docs-method-post {
  background: var(--blue-soft);
  color: var(--blue);
}

.docs-inline-code,
code {
  padding: 2px 6px;
  border-radius: 8px;
  background: #eef2f7;
  color: #111827;
  font-size: 0.92em;
}

pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

pre {
  margin: 0;
  overflow: auto;
  max-width: 100%;
  padding: 18px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.9rem;
  line-height: 1.65;
}

.docs-code {
  margin-top: 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid #1f2937;
  box-shadow: var(--shadow);
  min-width: 0;
}

.docs-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #1f2937;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-code-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: rgba(229, 237, 245, 0.8);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.docs-tab {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(229, 237, 245, 0.72);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.docs-tab.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.docs-code-panel {
  display: none;
}

.docs-code-panel.is-active {
  display: block;
}

.docs-note,
.docs-warning {
  margin-top: 16px;
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.docs-note {
  border-color: #dbeafe;
  background: #f8fbff;
}

.docs-warning {
  border-color: #fed7aa;
  background: #fffaf5;
}

.docs-note strong,
.docs-warning strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.docs-note a,
.docs-warning a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.docs-list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted-strong);
  line-height: 1.8;
}

.docs-footer {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.models-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.models-caption {
  max-width: 240px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 0.92rem;
  line-height: 1.6;
}

.models-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.model-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.model-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-card h3 {
  margin: 0;
  font-size: 1rem;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  background: #eef2f7;
  color: var(--muted-strong);
}

.model-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-meta span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

.model-card p {
  margin: 12px 0 0;
  color: var(--muted-strong);
  line-height: 1.7;
}

.model-card h3 code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.model-description {
  margin-top: 14px;
}

.docs-toggle {
  display: none;
}

@keyframes docsLangBounce {
  0% {
    transform: scale(1);
  }
  35% {
    transform: translateY(-2px) scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 1040px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-toggle {
    display: inline-flex;
  }

  .docs-sidebar {
    position: fixed;
    top: 67px;
    left: 0;
    bottom: 0;
    width: min(88vw, 320px);
    height: auto;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 14px 0 40px rgba(15, 23, 42, 0.12);
  }

  .docs-sidebar.is-open {
    transform: translateX(0);
  }

  .docs-main {
    padding: 24px 18px 48px;
  }

  .docs-grid {
    grid-template-columns: 1fr;
  }

  .models-hero {
    flex-direction: column;
  }

  .models-caption {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .docs-topbar {
    display: grid;
    padding: 14px 14px;
    gap: 14px;
  }

  .docs-topbar-head {
    align-items: flex-start;
  }

  .docs-brand div {
    min-width: 0;
  }

  .docs-brand strong,
  .docs-brand span {
    overflow-wrap: anywhere;
  }

  .language-switches {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 6px;
  }

  .language-button {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .language-button img {
    border-radius: 9px;
  }

  .docs-top-actions,
  .docs-top-links,
  .docs-top-auth {
    width: 100%;
    min-width: 0;
  }

  .docs-top-actions {
    display: grid;
    justify-self: stretch;
    gap: 10px;
  }

  .docs-top-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .docs-top-auth {
    display: block;
  }

  .docs-top-links .docs-button,
  .docs-top-links .docs-toggle,
  .docs-top-auth .docs-button {
    display: flex;
    width: 100%;
  }

  .docs-user-button {
    max-width: none;
  }

  .docs-sidebar {
    top: 0;
    width: min(92vw, 360px);
    padding: 78px 16px 28px;
    background: rgba(248, 250, 252, 0.98);
  }

  body.docs-sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
  }

  .docs-main {
    padding: 22px 12px 42px;
  }

  .docs-content {
    width: 100%;
  }

  .docs-hero h1 {
    font-size: clamp(1.72rem, 8vw, 2.4rem);
  }

  .docs-hero p,
  .docs-section p,
  td {
    font-size: 0.95rem;
  }

  .docs-section h2 {
    font-size: clamp(1.34rem, 6.4vw, 1.8rem);
  }

  .docs-card,
  .model-card,
  .docs-note,
  .docs-warning {
    padding: 16px;
  }

  .docs-code-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .docs-tabs {
    width: 100%;
  }

  .docs-tab {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    text-align: center;
  }

  .docs-section {
    padding-top: 24px;
  }

  .docs-badges,
  .model-meta {
    gap: 8px;
  }

  .model-card-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .docs-brand strong {
    font-size: 0.92rem;
  }

  .docs-brand span {
    font-size: 0.76rem;
  }

  .docs-topbar-head {
    gap: 10px;
  }

  .language-switches {
    gap: 5px;
  }

  .language-button {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .language-button img {
    border-radius: 8px;
  }

  .docs-top-links {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .docs-main {
    padding: 18px 10px 34px;
  }

  .docs-hero {
    padding: 2px 0 16px;
  }

  .docs-kicker,
  .docs-badge,
  .model-meta span,
  .model-pill {
    font-size: 0.76rem;
  }

  .docs-hero p,
  .docs-section p,
  td,
  .model-card p {
    font-size: 0.92rem;
    line-height: 1.68;
  }

  pre {
    padding: 14px;
    font-size: 0.82rem;
  }

  th,
  td {
    padding: 12px 13px;
  }

  .docs-sidebar {
    width: 100%;
    max-width: 100%;
    padding: 74px 14px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation: none !important;
  }
}
