/*
 * Top API Docs — reference-inspired documentation layout
 * Visual structure only. Existing Top API copy, routes and behavior stay intact.
 */

:root {
  --docs-reference-bg: #f7f6f2;
  --docs-reference-paper: #ffffff;
  --docs-reference-ink: #252522;
  --docs-reference-muted: #74736e;
  --docs-reference-line: #d4d4d0;
  --docs-reference-soft: #fafaf7;
  --docs-reference-accent: #b8413a;
  --docs-reference-code: #111316;
}

html body {
  min-height: 100%;
  margin: 0;
  background: var(--docs-reference-bg) !important;
  color: var(--docs-reference-ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

html body *,
html body *::before,
html body *::after {
  box-sizing: border-box;
}

/* Shared top bar: back / brand / action. */
html body .topapi-docs-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--docs-reference-line);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

html body .topapi-docs-topbar-inner {
  display: flex;
  width: 100%;
  max-width: 1200px;
  min-height: 66.75px;
  align-items: center;
  gap: 18px;
  margin: 0 auto;
  padding: 14px 24px;
}

html body .topapi-docs-back,
html body .topapi-docs-mark,
html body .topapi-docs-cta {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: #343431;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
}

html body .topapi-docs-back {
  flex: 1 1 0;
  justify-content: flex-start;
  color: #696963;
}

html body .topapi-docs-mark {
  flex: 0 0 auto;
  justify-content: center;
  color: #161615;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

html body .topapi-docs-cta {
  flex: 1 1 0;
  justify-content: flex-end;
  color: var(--docs-reference-accent);
}

html body .topapi-docs-back svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

html body .topapi-docs-mark {
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

html body .topapi-docs-mark-en {
  color: #7a7974;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10.5px;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.22em;
}

html body .topapi-docs-mark-cn {
  color: #171716;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4em;
  line-height: 1.2;
}

html body .topapi-docs-actions {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

html body .topapi-docs-theme {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #696963;
  background: transparent;
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease;
}

html body .topapi-docs-theme:hover {
  color: #111110;
  background: var(--docs-reference-soft);
}

html body .topapi-docs-theme svg {
  width: 17px;
  height: 17px;
}

html body .topapi-docs-actions .topapi-docs-cta {
  flex: 0 0 auto;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  color: #ffffff;
  background: #111110;
  font-weight: 500;
  transition: background-color 0.16s ease;
}

html body .topapi-docs-actions .topapi-docs-cta:hover {
  color: #ffffff;
  background: var(--docs-reference-accent);
}

html body .topapi-docs-back:hover,
html body .topapi-docs-cta:hover {
  color: #111110;
}

/* 1200px documentation shell. */
html body .doc-wrap {
  display: grid !important;
  grid-template-columns: 260px minmax(0, 1fr) !important;
  width: 100% !important;
  max-width: 1200px !important;
  align-items: start !important;
  gap: 36px !important;
  margin: 0 auto !important;
  padding: 24px !important;
}

/* Sidebar. */
html body .doc-side {
  position: sticky !important;
  top: 80px !important;
  width: 260px !important;
  max-height: calc(100vh - 104px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 0 10px 28px 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  scrollbar-color: #c8c8c3 transparent;
  scrollbar-width: thin;
  transform: none !important;
}

html body .doc-side::-webkit-scrollbar {
  width: 5px;
}

html body .doc-side::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c8c8c3;
}

html body .doc-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 12px !important;
}

html body .doc-side-label {
  color: #2e2e2b;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

html body .doc-side-close {
  display: none !important;
}

html body .doc-side .doc-group {
  margin: 0 0 5px !important;
}

html body .doc-side .doc-grouptitle {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 36px;
  margin: 0 !important;
  padding: 9px 12px !important;
  border-radius: 10px !important;
  color: #666660 !important;
  background: transparent !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  line-height: 18px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  list-style: none !important;
  cursor: pointer;
  user-select: none;
  transition: color 150ms ease, background-color 150ms ease;
}

html body .doc-side .doc-grouptitle::-webkit-details-marker {
  display: none;
}

html body .doc-side .doc-grouptitle::after {
  content: "" !important;
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  margin-left: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.62;
  transform: rotate(45deg) !important;
  transition: transform 150ms ease;
}

html body .doc-side .doc-group:not([open]) > .doc-grouptitle::after {
  transform: rotate(-45deg) !important;
}

html body .doc-side .doc-grouptitle:hover {
  color: #242421 !important;
  background: rgba(255, 255, 255, 0.7) !important;
}

html body .doc-side .doc-group:has(.doc-sidelink.active) > .doc-grouptitle,
html body .doc-side .doc-group.is-active > .doc-grouptitle,
html body .doc-side .doc-group.current > .doc-grouptitle,
html body .doc-side .doc-group[data-current="true"] > .doc-grouptitle {
  color: #ffffff !important;
  background: #111110 !important;
}

html body .doc-side .doc-group:has(.doc-sidelink.active) > .doc-grouptitle:hover,
html body .doc-side .doc-group.is-active > .doc-grouptitle:hover,
html body .doc-side .doc-group.current > .doc-grouptitle:hover,
html body .doc-side .doc-group[data-current="true"] > .doc-grouptitle:hover {
  color: #ffffff !important;
  background: #111110 !important;
}

html body .doc-side .doc-sidelink {
  position: relative !important;
  display: block !important;
  margin: 2px 0 2px 18px !important;
  padding: 7px 10px 7px 17px !important;
  border: 0 !important;
  border-left: 1px solid var(--docs-reference-line) !important;
  border-radius: 0 8px 8px 0 !important;
  color: #6d6c67 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12.5px !important;
  font-weight: 450 !important;
  line-height: 1.45 !important;
  text-decoration: none !important;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

html body .doc-side .doc-sidelink:hover {
  color: #262623 !important;
  background: rgba(255, 255, 255, 0.62) !important;
}

html body .doc-side .doc-sidelink.active,
html body .doc-side .doc-sidelink[aria-current="page"] {
  border-left-color: var(--docs-reference-accent) !important;
  color: var(--docs-reference-accent) !important;
  background: var(--docs-reference-soft) !important;
  box-shadow: none !important;
  font-weight: 650 !important;
}

html body .doc-side .doc-sidelink.active:hover,
html body .doc-side .doc-sidelink[aria-current="page"]:hover {
  color: var(--docs-reference-accent) !important;
  background: var(--docs-reference-soft) !important;
}

/* Main content and article card. */
html body .doc-content {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

html body .doc-bc {
  display: flex !important;
  min-height: 22px;
  align-items: center !important;
  flex-wrap: wrap;
  gap: 6px !important;
  margin: 0 0 20px !important;
  color: #81817b !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

html body .doc-bc a {
  color: #666660 !important;
  text-decoration: none !important;
}

html body .doc-bc a:hover {
  color: var(--docs-reference-accent) !important;
}

html body .doc-article-shell {
  width: 100%;
  min-width: 0;
  padding: 36px 40px;
  border: 1px solid var(--docs-reference-line);
  border-radius: 16px;
  background: var(--docs-reference-paper);
  box-shadow: 0 8px 24px rgba(35, 35, 31, 0.035);
}

html body .doc-article-head {
  margin: 0 0 28px;
  padding: 0 0 26px;
  border-bottom: 1px solid #e2e2de;
}

html body .doc-article-eyebrow {
  display: block;
  margin: 0 0 9px;
  color: var(--docs-reference-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html body .doc-content h1,
html body .doc-article-shell h1 {
  margin: 0 0 12px !important;
  color: #20201e !important;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif !important;
  font-size: clamp(26px, 4vw, 36px) !important;
  font-weight: 700 !important;
  line-height: 1.28 !important;
  letter-spacing: -0.02em !important;
}

html body .doc-article-shell h2 {
  margin: 34px 0 14px !important;
  padding: 0 0 10px !important;
  border-bottom: 1px solid #e2e2de;
  color: #262623 !important;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
  letter-spacing: -0.01em !important;
}

html body .doc-article-shell h3 {
  margin: 26px 0 10px !important;
  color: #2d2d29 !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1.5 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

html body .doc-lead {
  max-width: 760px !important;
  margin: 0 !important;
  color: #64645f !important;
  font-size: 15px !important;
  line-height: 1.8 !important;
}

html body .doc-article-shell,
html body .doc-article-shell p,
html body .doc-article-shell li,
html body .doc-article-shell td,
html body .doc-article-shell th {
  font-size: 14px;
  line-height: 1.75;
}

html body .doc-article-shell p,
html body .doc-article-shell li {
  color: #454540 !important;
}

html body .doc-article-shell p {
  margin: 0.72em 0 !important;
}

html body .doc-article-shell ul,
html body .doc-article-shell ol {
  margin: 12px 0 18px !important;
  padding-left: 1.45rem !important;
}

html body .doc-article-shell li + li {
  margin-top: 5px;
}

html body .doc-article-shell a:not(.doc-action):not(.doc-tool-card):not(.doc-link-card) {
  color: var(--docs-reference-accent);
  text-underline-offset: 3px;
}

html body .doc-article-shell code:not(pre code) {
  padding: 0.13em 0.38em !important;
  border: 1px solid #e2e2de !important;
  border-radius: 5px !important;
  color: #8d332e !important;
  background: #f6f5f1 !important;
  font-size: 0.88em !important;
}

html body .doc-article-shell pre,
html body .doc-content pre {
  position: relative;
  max-width: 100%;
  margin: 16px 0 22px !important;
  padding: 18px 20px !important;
  overflow: auto !important;
  border: 1px solid #24272b !important;
  border-radius: 10px !important;
  color: #f2f3ef !important;
  background: var(--docs-reference-code) !important;
  box-shadow: none !important;
  font-size: 12.5px !important;
  line-height: 1.7 !important;
}

html body .doc-article-shell .doc-pre,
html body .doc-content .doc-pre {
  padding-top: 42px !important;
}

html body .doc-article-shell pre code,
html body .doc-content pre code {
  padding: 0 !important;
  border: 0 !important;
  color: inherit !important;
  background: transparent !important;
  font-size: inherit !important;
}

html body .doc-copy-button {
  top: 9px !important;
  right: 10px !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #d9d9d4 !important;
  background: rgba(255, 255, 255, 0.07) !important;
}

html body .doc-copy-button:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.14) !important;
}

html body .doc-article-shell table {
  width: 100%;
  margin: 16px 0 22px !important;
  border-collapse: collapse;
  border-spacing: 0;
}

html body .doc-article-shell th,
html body .doc-article-shell td {
  padding: 10px 12px !important;
  border: 1px solid #deded9 !important;
  text-align: left;
  vertical-align: top;
}

html body .doc-article-shell th {
  color: #454540 !important;
  background: #f4f3ef !important;
  font-weight: 650 !important;
}

/* Previous / next navigation. */
html body .doc-article-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid #e2e2de;
}

html body .doc-article-foot > a,
html body .doc-article-foot .doc-article-nav {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid #deded9;
  border-radius: 10px;
  color: #343431;
  background: #fbfbf8;
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

html body .doc-article-foot > a:last-child,
html body .doc-article-foot .doc-article-next {
  align-items: flex-end;
  text-align: right;
}

html body .doc-article-foot > a:hover,
html body .doc-article-foot .doc-article-nav:hover {
  border-color: #bdbdb7;
  background: #ffffff;
  transform: translateY(-1px);
}

html body .doc-article-foot small,
html body .doc-article-foot .doc-article-nav-label {
  color: #85857f;
  font-size: 11px;
  font-weight: 600;
}

html body .doc-article-foot-dir {
  color: #85857f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.04em;
}

html body .doc-article-foot-name {
  color: #343431;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: 13.5px;
  font-weight: 600;
}

/* Overview page uses the same editorial shell without wrapping it as an article. */
html body .doc-home .doc-home-hero {
  margin: 0 0 36px !important;
  padding: 12px 0 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .doc-home .doc-home-hero::before,
html body .doc-home .doc-home-hero::after {
  display: none !important;
}

html body .doc-home .doc-eyebrow {
  color: #7a7974 !important;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px !important;
  font-style: italic;
  font-weight: 500 !important;
  letter-spacing: 0.22em !important;
}

html body .doc-home .doc-home-hero h1 {
  max-width: 760px;
  margin: 12px 0 14px !important;
  font-size: clamp(32px, 5vw, 52px) !important;
  line-height: 1.1 !important;
}

html body .doc-home > section:not(.doc-home-hero) {
  margin-top: 34px;
}

html body .doc-home .doc-info-card,
html body .doc-home .doc-step-card,
html body .doc-home .doc-tool-card,
html body .doc-home .doc-help-card {
  border-color: var(--docs-reference-line) !important;
  border-radius: 16px !important;
  background: var(--docs-reference-paper) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

html body .doc-home .doc-info-card:hover,
html body .doc-home .doc-step-card:hover,
html body .doc-home .doc-tool-card:hover {
  border-color: #111110 !important;
  transform: translateY(-2px);
}

/* The new article shell owns the page ending; retire legacy footer/drawer controls. */
html body .doc-footer-v2,
html body .doc-side-toggle,
html body .doc-side-overlay {
  display: none !important;
}

/* Dark mode remains intentionally quiet and readable. */
html.dark body.doc-page-layout-clone {
  background: #111210 !important;
  color: #e7e6e0;
}

html.dark body .topapi-docs-topbar {
  border-bottom-color: #343531;
  background: rgba(18, 19, 17, 0.92);
}

html.dark body .topapi-docs-back,
html.dark body .topapi-docs-mark,
html.dark body .topapi-docs-cta {
  color: #e4e3dd;
}

html.dark body .topapi-docs-mark-en,
html.dark body .topapi-docs-mark-cn,
html.dark body .topapi-docs-theme {
  color: #e4e3dd;
}

html.dark body .topapi-docs-theme:hover {
  background: #242521;
}

html.dark body .topapi-docs-actions .topapi-docs-cta {
  color: #111210;
  background: #f0efe9;
}

html.dark body .topapi-docs-actions .topapi-docs-cta:hover {
  color: #ffffff;
  background: var(--docs-reference-accent);
}

html.dark body .doc-side-label,
html.dark body .doc-side .doc-grouptitle {
  color: #b9b8b1 !important;
}

html.dark body .doc-side .doc-grouptitle:hover {
  color: #f0efe9 !important;
  background: #1b1c19 !important;
}

html.dark body .doc-side .doc-group:has(.doc-sidelink.active) > .doc-grouptitle,
html.dark body .doc-side .doc-group.current > .doc-grouptitle,
html.dark body .doc-side .doc-group[data-current="true"] > .doc-grouptitle {
  color: #ffffff !important;
  background: #050505 !important;
}

html.dark body .doc-side .doc-sidelink {
  border-left-color: #3b3c38 !important;
  color: #aaa9a2 !important;
}

html.dark body .doc-side .doc-sidelink:hover {
  color: #efeee8 !important;
  background: #1b1c19 !important;
}

html.dark body .doc-side .doc-sidelink.active,
html.dark body .doc-side .doc-sidelink[aria-current="page"] {
  border-left-color: #d96d65 !important;
  color: #ee958e !important;
  background: #1b1c19 !important;
}

html.dark body .doc-bc,
html.dark body .doc-bc a {
  color: #9d9c95 !important;
}

html.dark body .doc-article-shell {
  border-color: #343531;
  background: #181917;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

html.dark body .doc-article-head,
html.dark body .doc-article-shell h2,
html.dark body .doc-article-foot {
  border-color: #353632;
}

html.dark body .doc-content h1,
html.dark body .doc-article-shell h1,
html.dark body .doc-article-shell h2,
html.dark body .doc-article-shell h3 {
  color: #f0efe9 !important;
}

html.dark body .doc-lead,
html.dark body .doc-article-shell p,
html.dark body .doc-article-shell li {
  color: #c7c6bf !important;
}

html.dark body .doc-article-shell code:not(pre code) {
  border-color: #3b3c38 !important;
  color: #f0a39d !important;
  background: #22231f !important;
}

html.dark body .doc-article-shell th,
html.dark body .doc-article-shell td {
  border-color: #383934 !important;
}

html.dark body .doc-article-shell th {
  color: #dbdad3 !important;
  background: #22231f !important;
}

html.dark body .doc-article-foot > a,
html.dark body .doc-article-foot .doc-article-nav {
  border-color: #383934;
  color: #deddd6;
  background: #1e1f1c;
}

html.dark body .doc-article-foot > a:hover,
html.dark body .doc-article-foot .doc-article-nav:hover {
  border-color: #555650;
  background: #242521;
}

@media (max-width: 900px) {
  html body .doc-wrap {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 36px !important;
    padding: 24px !important;
  }

  html body .doc-side,
  html body .doc-side.open {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    z-index: auto !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
  }

  html body .doc-side .doc-sidelink {
    margin-right: 4px !important;
  }
}

@media (max-width: 700px) {
  html body .doc-article-shell {
    padding: 28px 22px;
    border-radius: 12px;
  }

  html body .doc-article-head {
    margin-bottom: 23px;
    padding-bottom: 21px;
  }

}

@media (max-width: 480px) {
  html body .topapi-docs-theme {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .topapi-docs-back,
  html body .topapi-docs-cta,
  html body .doc-side .doc-grouptitle,
  html body .doc-side .doc-sidelink,
  html body .doc-article-foot > a,
  html body .doc-article-foot .doc-article-nav {
    transition: none !important;
  }
}
