/* ==========================================================================
   MAXMIND API DOCS (v11)
   Faithful to MiniMax / Mintlify high-craft dark & light docs aesthetic.
   - Fixed header + full-height mobile drawer (zero scroll-overlap bugs)
   - Google Sans + PingFang SC, zero tap blue boxes, zero horizontal scroll
   ========================================================================== */

:root,
html[data-theme="dark"] {
  --bg: #0A0C0B;
  --surface: #111413;
  --surface-2: #171B19;
  --code-bg: #0E1110;
  --code-bar: #141816;
  --ink: #F2F4F3;
  --ink-2: #9EA6A2;
  --ink-3: #68716D;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #18D489;
  --accent-bg: rgba(24, 212, 137, 0.13);
  --header-bg: rgba(10, 12, 11, 0.88);
  --mask-bg: rgba(0, 0, 0, 0.62);
  --pop-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.6), 0 4px 14px -4px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  --bg: #FFFFFF;
  --surface: #F6F7F6;
  --surface-2: #ECEEED;
  --code-bg: #F7F8F7;
  --code-bar: #EFEFEF;
  --ink: #121413;
  --ink-2: #525956;
  --ink-3: #838B87;
  --line: rgba(18, 20, 19, 0.09);
  --line-strong: rgba(18, 20, 19, 0.16);
  --accent: #0B9E63;
  --accent-bg: rgba(11, 158, 99, 0.1);
  --header-bg: rgba(255, 255, 255, 0.9);
  --mask-bg: rgba(0, 0, 0, 0.36);
  --pop-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.28), 0 3px 10px -3px rgba(0, 0, 0, 0.12);
}

:root {
  --header-h: 58px;
  --sidebar-w: 272px;
  --font: "Google Sans", "PingFang SC", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

*, *::before, *::after, a, button {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

a:focus, button:focus, a:active, button:active {
  outline: none;
  box-shadow: none;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

body {
  background: var(--bg);
  color: var(--ink);
  line-height: 1.72;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

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

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: default;
}

/* Fixed Top Header (Never scrolls away or breaks) */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.docs-header-inner {
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.docs-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-btn {
  display: none;
  width: 34px;
  height: 34px;
  position: relative;
  align-items: center;
  justify-content: center;
}

.sidebar-btn span {
  position: absolute;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.35s var(--ease);
}

.sidebar-btn span:first-child { transform: translateY(-3.5px); }
.sidebar-btn span:last-child { transform: translateY(3.5px); }

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

.docs-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: block;
}

.docs-brand-name {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.header-home {
  font-size: 14px;
  color: var(--ink-2);
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.header-home:hover {
  color: var(--ink);
  background: var(--surface-2);
}

/* MiniMax-style Theme Pill Switcher */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.theme-opt {
  width: 28px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-opt svg {
  width: 14px;
  height: 14px;
}

.theme-opt.is-active {
  background: var(--surface-2);
  color: var(--ink);
}

/* Sidebar (Desktop Fixed Left / Mobile Full-Height Top-to-Bottom Drawer) */
.docs-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 20px 16px 36px;
  overflow-y: auto;
  z-index: 50;
}

.drawer-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

/* Section Picker Card (MiniMax Developer Guides dropdown style) */
.section-picker {
  margin-bottom: 18px;
  position: relative;
  z-index: 60;
}

.picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  transition: border-color 0.2s ease;
}

.picker-chevron {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
  transition: transform 0.26s var(--ease);
}

.section-picker.is-open .picker-chevron {
  transform: rotate(180deg);
}

.picker-menu {
  /* 图层弹出：绝对定位悬浮在上层，不占文档流，下面的导航一动不动 */
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 70;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--pop-shadow);
  /* 盖住被点的那个按钮，从左上一角快速弹出、纯减速落定，无回弹 */
  top: -1px;
  left: -1px;
  right: -1px;
  transform-origin: 0 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.62);
  pointer-events: none;
  will-change: transform, opacity;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.15s ease-out,
    visibility 0s linear 0.3s;
}

.section-picker.is-open .picker-menu {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
  transition:
    transform 0.34s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.16s ease-out,
    visibility 0s linear 0s;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-2);
  transition:
    opacity 0.18s ease,
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.18s ease,
    color 0.18s ease;
  opacity: 0;
  transform: translateY(-4px);
}

/* 逐条入场，间隔 36ms，像原生弹层一层层铺开 */
.section-picker.is-open .picker-item {
  opacity: 1;
  transform: none;
}
.section-picker.is-open .picker-item:nth-child(1) { transition-delay: 0.04s; }
.section-picker.is-open .picker-item:nth-child(2) { transition-delay: 0.076s; }
.section-picker.is-open .picker-item:nth-child(3) { transition-delay: 0.112s; }
.section-picker.is-open .picker-item:nth-child(4) { transition-delay: 0.148s; }
.section-picker.is-open .picker-item:nth-child(5) { transition-delay: 0.184s; }

.picker-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.picker-item.is-current {
  color: var(--accent);
  font-weight: 500;
}

.picker-item svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

/* Side Navigation */
.side-group + .side-group {
  margin-top: 22px;
}

.side-group-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 0 12px;
  margin-bottom: 6px;
}

.side-link {
  display: block;
  font-size: 14.5px;
  color: var(--ink-2);
  padding: 8px 12px;
  border-radius: 10px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.side-link:hover {
  color: var(--ink);
  background: var(--surface);
}

.side-link.is-active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}

/* Main Body Area */
.docs-body {
  padding-top: var(--header-h);
  padding-left: var(--sidebar-w);
  width: 100%;
}

.docs-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 36px 88px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 48px;
}

.docs-main {
  min-width: 0;
  max-width: 780px;
}

.doc-crumb {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 8px;
}

.doc-h1 {
  font-size: clamp(28px, 3.8vw, 38px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 28px;
  color: var(--ink);
}

.doc-sec {
  scroll-margin-top: 82px;
  margin-top: 42px;
}

.doc-sec:first-of-type {
  margin-top: 0;
}

.doc-sec h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.doc-subsec {
  scroll-margin-top: 82px;
  margin-top: 28px;
}

.doc-subsec h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink);
}

.doc-sec p {
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 14px;
}

.doc-sec strong {
  color: var(--ink);
  font-weight: 600;
}

code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 14px 0 18px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

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

th {
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  white-space: nowrap;
}

td {
  color: var(--ink-2);
}

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

/* Code Blocks */
.code-box {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--code-bg);
  overflow: hidden;
  margin: 14px 0 20px;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--code-bar);
}

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

.code-tab {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 4px 10px;
  border-radius: 7px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.code-tab.is-active {
  background: var(--surface-2);
  color: var(--ink);
}

.code-lang-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.copy-btn {
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.copy-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.code-panel {
  display: none;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0;
}

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

.code-panel code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.72;
  color: var(--ink);
  white-space: pre;
}

/* Callout */
.callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 16px 18px;
}

.callout p {
  margin: 0;
  font-size: 14.5px;
}

/* Reference Cards */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ref-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 20px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ref-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.ref-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.ref-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

/* Right TOC */
.docs-toc {
  position: sticky;
  top: 90px;
  align-self: start;
}

.toc-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.toc-link {
  font-size: 13px;
  color: var(--ink-3);
  padding: 5px 0 5px 14px;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-link:hover {
  color: var(--ink);
}

.toc-link.is-active {
  color: var(--accent);
  font-weight: 500;
  border-left-color: var(--accent);
}

.doc-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-3);
}

/* Mask (Covers entire viewport including header on mobile) */
.sidebar-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--mask-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0.32s;
}

.sidebar-mask.is-open {
  opacity: 1;
  visibility: visible;
}

/* Responsive */
@media (max-width: 1120px) {
  .docs-container {
    grid-template-columns: minmax(0, 1fr);
    padding: 32px 28px 72px;
  }
  .docs-toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .docs-header-inner {
    padding: 0 16px;
  }

  .sidebar-btn {
    display: inline-flex;
  }

  .desktop-theme {
    display: none;
  }

  /* Full-height drawer from top: 0 covering header seamlessly just like MiniMax */
  .docs-sidebar {
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 316px);
    height: 100dvh;
    z-index: 100;
    padding: 18px 16px 36px;
    transform: translateX(-104%);
    /* 抽屉同样只减速、不回弹 */
    transition: transform 0.34s var(--ease);
    will-change: transform;
  }

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

  .drawer-head {
    display: flex;
  }

  .docs-body {
    padding-left: 0;
  }

  .docs-container {
    padding: 24px 18px 64px;
  }

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

/* 尊重系统「减弱动态效果」 */
@media (prefers-reduced-motion: reduce) {
  .picker-menu,
  .picker-item,
  .picker-chevron,
  .docs-sidebar,
  .sidebar-mask {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* 全局默认指针：接入文档所有可交互元素不再变成小手 */
a, button, [role="button"], [role="tab"], [role="link"], label, summary, select,
input[type="checkbox"], input[type="radio"], input[type="submit"], input[type="button"],
.sidebar-btn, .docs-brand, .theme-opt, .header-home, .picker-trigger, .picker-item,
.side-link, .copy-btn, .code-tab, .toc-link, .sidebar-mask, [onclick], [tabindex] {
  cursor: default !important;
}
