@font-face {
  font-family: "OpenAI Sans";
  src: local("OpenAI Sans"), local("OpenAISans");
  font-weight: 100 900;
}

:root {
  color-scheme: light;
  --page: #ffffff;
  --panel: #f9f9f9;
  --selected: #ededed;
  --text: #282828;
  --text-strong: #0d0d0d;
  --muted: #5d5d5d;
  --faint: #8f8f8f;
  --border: rgba(40, 40, 40, 0.1);
  --ring: oklab(0.159065 0.00000723451 0.00000317395 / 0.08);
  --blue: #155dfc;
  --orange: #ea580c;
  --green: #00692a;
  --purple: #6f42c1;
  --code-blue: #1971a8;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-card: 10px;
  --font-sans: "OpenAI Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --topbar-h: 64px;
  --left-rail: 240px;
  --content-w: 820px;
  --toc-w: 240px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -48px;
  z-index: 20;
  border-radius: var(--radius);
  background: var(--text-strong);
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  transition: top 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.skip-link:focus { top: 16px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: var(--left-rail) minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.4px;
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand-beta {
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.sidebar a,
.toc-panel a {
  color: var(--text);
  text-decoration: none;
}

.search-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-self: end;
  width: min(100%, 360px);
  z-index: 1;
}

.search-shell input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #fff;
  color: var(--text);
  padding: 8px 42px 8px 18px;
  outline: none;
  font-size: 14px;
  line-height: 20px;
  transition: border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-shell input:focus-visible {
  border-color: rgba(21, 93, 252, 0.44);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, 0.1);
}

.search-key {
  position: absolute;
  right: 12px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: var(--panel);
  color: var(--faint);
  font-size: 12px;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(520px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - var(--topbar-h) - 24px));
  overflow-y: auto;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ring);
  padding: 6px;
}

.search-results[hidden] { display: none; }

.search-result {
  display: grid;
  gap: 2px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
}

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

.search-result-meta {
  color: var(--faint);
  font-size: 11px;
  line-height: 16px;
}

.search-result strong {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 650;
  line-height: 20px;
}

.search-result-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-empty {
  margin: 0;
  padding: 18px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}

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

.mobile-nav-toggle { display: none; }

.docs-shell {
  display: grid;
  grid-template-columns: var(--left-rail) minmax(0, var(--content-w)) var(--toc-w);
  justify-content: center;
  gap: 0;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 24px 18px 48px 24px;
  border-right: 1px solid var(--border);
}

.sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }

.nav-section { margin: 0 0 24px; }

.nav-title {
  margin: 0 0 8px;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
  letter-spacing: -0.14px;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list a,
.nav-list .nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-list a:hover,
.nav-list a.active { background: var(--selected); }

.nav-list .nav-item.pending {
  color: var(--faint);
  cursor: default;
  opacity: 0.72;
}

.nav-list .pending::after {
  content: "Coming Soon";
  flex: 0 0 auto;
  margin-left: 8px;
  border-radius: 9999px;
  background: transparent;
  color: var(--faint);
  padding: 1px 6px;
  font-size: 10px;
  line-height: 16px;
}

.content {
  min-width: 0;
  padding: 64px 48px 96px;
}

.content:focus {
  outline: none;
}

.doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 20px;
}

.doc h1 {
  margin: 0 0 20px;
  color: var(--text-strong);
  font-size: 30px;
  font-weight: 400;
  line-height: 42px;
  letter-spacing: -0.6px;
}

.doc-header h1 {
  min-width: 0;
  margin: 0;
}

.copy-markdown {
  flex: 0 0 auto;
  margin-top: 3px;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ring);
  color: var(--text);
  cursor: pointer;
  padding: 7px 12px;
  font-size: 14px;
  line-height: 20px;
}

.copy-markdown:hover { background: var(--selected); }

.doc h2 {
  margin: 48px 0 14px;
  color: var(--text-strong);
  font-size: 21px;
  font-weight: 400;
  line-height: 30px;
  letter-spacing: -0.28px;
}

.doc h3 {
  margin: 34px 0 12px;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 400;
  line-height: 26px;
  letter-spacing: -0.16px;
}

.doc h4 {
  margin: 24px 0 8px;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: -0.14px;
}

.doc.api-reference-page h3 {
  margin: 42px 0 14px;
  font-size: 21px;
  font-weight: 400;
  line-height: 30px;
  letter-spacing: -0.28px;
}

.doc p,
.doc li {
  color: var(--text);
}

.doc p { margin: 0 0 16px; }

.doc ul,
.doc ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.doc li + li { margin-top: 6px; }

.doc a {
  color: var(--text-strong);
  text-decoration-color: rgba(40, 40, 40, 0.3);
  text-underline-offset: 3px;
}

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

.doc hr {
  display: none;
}

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

.doc code:not(pre code) {
  border-radius: 4px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ring);
  padding: 2px 5px;
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.code-block {
  position: relative;
  margin: 18px 0 24px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ring);
}

.code-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  border-bottom: 1px solid var(--border);
  padding: 0 12px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.code-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-code {
  border: 0;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ring);
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 16px;
}

.copy-code:hover { background: var(--selected); }

pre {
  margin: 0;
  overflow-x: auto;
  padding: 16px 18px 20px;
}

pre code {
  color: #24292e;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
}

.token-string { color: var(--green); }
.token-keyword { color: var(--purple); }
.token-comment { color: var(--faint); }
.token-number { color: var(--orange); }
.token-command { color: var(--code-blue); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0 26px;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--ring);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
  line-height: 20px;
}

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

th {
  color: var(--text-strong);
  font-weight: 650;
  background: var(--panel);
}

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

.doc tr.coming-soon-row td {
  background: var(--panel);
  color: var(--faint);
}

.doc tr.coming-soon-row code {
  color: var(--faint);
}

.doc tr.coming-soon-row {
  pointer-events: none;
  user-select: text;
}

.doc blockquote {
  margin: 20px 0;
  border-left: 3px solid #0088ff;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(0, 136, 255, 0.05);
  padding: 14px 16px;
}

.doc blockquote p:last-child { margin-bottom: 0; }

.tabs {
  margin: 20px 0 26px;
  border-radius: var(--radius-card);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ring);
  overflow: hidden;
}

.tab-list {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 8px;
}

.tab-list button {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 18px;
}

.tab-list button[aria-selected="true"] {
  background: #fff;
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px var(--ring);
}

.tab-panel { display: none; padding: 4px 16px 16px; }
.tab-panel.active { display: block; }
.tab-panel .code-block { margin-bottom: 0; }

.toc-panel {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 64px 24px 48px 0;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.toc-panel::-webkit-scrollbar { display: none; }

.toc-card {
  border-radius: var(--radius-card);
  padding: 14px;
}

.toc-label {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
}

.toc-panel nav {
  display: grid;
  gap: 4px;
}

.toc-panel a,
.toc-panel .toc-item {
  border-radius: var(--radius-sm);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
}

.toc-panel a:hover { background: var(--panel); color: var(--text); }

.toc-panel .toc-item.pending {
  color: var(--faint);
  cursor: default;
}

.toc-empty {
  color: var(--faint);
  font-size: 13px;
  line-height: 18px;
}

.empty-state {
  border-radius: var(--radius-card);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ring);
  padding: 24px;
}

.coming-soon-state {
  max-width: 620px;
  border-radius: var(--radius-card);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ring);
  padding: 32px;
}

.coming-soon-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 20px;
  border-radius: 9999px;
  background: var(--selected);
  color: var(--muted);
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
}

.coming-soon-state h1 {
  margin-bottom: 12px;
}

.coming-soon-state p {
  max-width: 520px;
  margin: 0 0 24px;
  color: var(--muted);
}

.doc .coming-soon-back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: var(--radius);
  background: var(--text-strong);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}

.doc .coming-soon-back:hover {
  background: var(--text);
  color: #fff;
}

.page-pagination {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(0, 2fr) minmax(96px, 1fr);
  align-items: stretch;
  margin: 64px 0 0;
  border-radius: var(--radius-card);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ring);
  padding: 6px;
}

.page-pagination-link,
.page-pagination-current,
.page-pagination-empty {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 56px;
  padding: 10px 16px;
}

.page-pagination-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  text-decoration: none;
}

.page-pagination-link:hover {
  border-radius: var(--radius);
  background: var(--selected);
  color: var(--text-strong);
}

.page-pagination-link.next { justify-content: flex-end; }

.page-pagination-current {
  justify-content: center;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ring);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 650;
  line-height: 20px;
  text-align: center;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (max-width: 1180px) {
  .docs-shell {
    grid-template-columns: var(--left-rail) minmax(0, 1fr);
  }

  .toc-panel { display: none; }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    padding: 0 16px;
  }

  .brand > span:last-child { display: none; }

  .search-shell { width: 100%; min-width: 0; }

  .search-shell input {
    min-width: 0;
    padding-left: 14px;
  }

  .search-key { display: none; }

  .search-results {
    position: fixed;
    top: calc(var(--topbar-h) - 4px);
    right: 16px;
    left: 16px;
    width: auto;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    border: 0;
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text-strong);
    padding: 8px 12px;
  }

  .docs-shell { display: block; }

  .sidebar {
    position: fixed;
    inset: var(--topbar-h) auto 0 0;
    z-index: 9;
    width: min(82vw, 320px);
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 16px 48px -18px rgba(15, 23, 42, 0.45);
  }

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

  .content { padding: 36px 20px 84px; }

  .doc-header {
    flex-direction: column;
    gap: 12px;
  }

  .copy-markdown { margin-top: 0; }

  .doc h1 { font-size: 28px; line-height: 38px; }
}

@media (max-width: 560px) {
  .page-pagination {
    grid-template-areas:
      "current current"
      "previous next";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .page-pagination .previous { grid-area: previous; }
  .page-pagination .next { grid-area: next; }
  .page-pagination-current { grid-area: current; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.doc-image {
  display: flex;
  width: 100%;
  margin: 24px 0;
}

.doc-image-left { justify-content: flex-start; }
.doc-image-center { justify-content: center; }
.doc-image-right { justify-content: flex-end; }

.doc-image img {
  display: block;
  width: min(var(--doc-image-width, 100%), 100%);
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px #ededed;
}

.doc-video {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 24px 0;
  overflow: hidden;
  border-radius: 10px;
  background: #0d0d0d;
  box-shadow: inset 0 0 0 1px #ededed;
}

.doc-video video,
.doc-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
