:root {
  color-scheme: dark;
  --bg: #071224;
  --surface: rgba(9, 22, 44, 0.76);
  --surface-strong: rgba(10, 22, 43, 0.94);
  --surface-soft: rgba(51, 209, 255, 0.1);
  --text: #eaf2ff;
  --muted: #9db0d0;
  --line: rgba(120, 168, 255, 0.25);
  --primary: #33d1ff;
  --primary-dark: #00b5ea;
  --success: #44d38a;
  --accent: #8deaff;
  --code-bg: rgba(3, 10, 21, 0.96);
  --code-text: #d8f7ff;
  --button-text: #012334;
  --shadow: 0 18px 48px rgba(0, 8, 26, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(51, 209, 255, 0.18), transparent 32%),
    linear-gradient(245deg, rgba(68, 211, 138, 0.12), transparent 36%),
    linear-gradient(180deg, #071224 0%, #081a33 48%, #071224 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(120, 168, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 168, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 82%);
}

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

code {
  border: 1px solid rgba(120, 231, 255, 0.26);
  border-radius: 6px;
  background: rgba(51, 209, 255, 0.1);
  color: var(--accent);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.92em;
  padding: 0.12rem 0.34rem;
}

pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

pre code {
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--code-text);
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 33, 0.82);
  padding: 0 2rem;
  box-shadow: 0 10px 30px rgba(0, 8, 26, 0.22);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 220px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(141, 234, 255, 0.55);
  border-radius: 10px;
  background: var(--primary);
  color: var(--button-text);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: #ffffff;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.topnav {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 0.25rem;
}

.topnav a,
.header-link,
.console-link,
.primary-action,
.secondary-action,
.copy-btn {
  border-radius: 12px;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.topnav a {
  color: #b9c9e8;
  padding: 0.52rem 0.8rem;
  font-size: 0.95rem;
}

.topnav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.header-link,
.console-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  white-space: nowrap;
  font-weight: 750;
  padding: 0.48rem 0.9rem;
}

.header-link {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #dce8ff;
}

.header-link:hover {
  border-color: rgba(141, 178, 255, 0.72);
  color: #ffffff;
}

.console-link {
  border: 1px solid rgba(120, 231, 255, 0.55);
  background: var(--primary);
  color: var(--button-text);
  box-shadow: 0 10px 30px rgba(0, 181, 234, 0.24);
}

.console-link:hover {
  border-color: rgba(141, 234, 255, 0.86);
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(9, 22, 44, 0.7);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar-title {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.sidebar a {
  display: block;
  border-radius: 10px;
  color: #b9c9e8;
  padding: 0.48rem 0.6rem;
  font-size: 0.92rem;
}

.sidebar a:hover,
.sidebar a.active {
  background: var(--surface-soft);
  color: #ffffff;
}

.content {
  min-width: 0;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(120, 168, 255, 0.35);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(12, 28, 54, 0.95), rgba(10, 20, 40, 0.88)),
    repeating-linear-gradient(90deg, rgba(120, 168, 255, 0.08) 0 1px, transparent 1px 44px);
  padding: 3.5rem;
  box-shadow: var(--shadow);
}

.eyebrow,
.section-heading p {
  margin: 0 0 0.6rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.22;
}

h1 {
  max-width: 850px;
  color: #ffffff;
  font-size: clamp(2.15rem, 5vw, 4.35rem);
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.36);
}

.lead {
  max-width: 820px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.55rem;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.72rem 1rem;
  font-weight: 800;
}

.primary-action {
  background: var(--primary);
  color: var(--button-text);
  box-shadow: 0 10px 30px rgba(0, 181, 234, 0.32);
}

.primary-action:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.secondary-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #dce8ff;
}

.secondary-action:hover {
  border-color: rgba(141, 178, 255, 0.72);
  color: #ffffff;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.endpoint-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.7rem;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.endpoint-card span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.endpoint-card code {
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy-btn {
  cursor: pointer;
  border: 1px solid rgba(120, 231, 255, 0.35);
  background: rgba(51, 209, 255, 0.1);
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.34rem 0.58rem;
}

.copy-btn:hover {
  border-color: rgba(120, 231, 255, 0.7);
  background: rgba(51, 209, 255, 0.18);
  color: #ffffff;
}

.doc-section {
  scroll-margin-top: 88px;
  border-top: 1px solid rgba(120, 168, 255, 0.18);
  padding: 2.4rem 0;
}

.section-heading {
  margin-bottom: 1.15rem;
}

.section-heading h2 {
  color: #ffffff;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
}

.steps,
.code-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.step,
.guide-block,
.notice,
.warning,
.form-preview,
.table-wrap,
details {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.step {
  padding: 1rem;
}

.step span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(120, 231, 255, 0.45);
  border-radius: 10px;
  background: rgba(51, 209, 255, 0.14);
  color: var(--accent);
  font-weight: 900;
}

.step h3 {
  margin-top: 0.85rem;
  color: #ffffff;
  font-size: 1.05rem;
}

.step p,
.guide-block p,
.tip,
details p,
#sdk > p,
#models > p {
  color: var(--muted);
}

.notice,
.warning {
  margin-top: 1rem;
  padding: 0.95rem 1rem;
}

.notice {
  background: rgba(51, 209, 255, 0.09);
  color: #d8f7ff;
}

.warning {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.12);
  color: #ffd996;
}

.guide-block {
  scroll-margin-top: 88px;
  margin-top: 1rem;
  padding: 1.3rem;
}

.guide-block h3 {
  color: #ffffff;
  font-size: 1.26rem;
}

.guide-block ol,
.guide-block ul {
  margin: 0.75rem 0 0;
  color: #dce8ff;
  padding-left: 1.25rem;
}

.form-preview {
  display: grid;
  gap: 0;
  margin-top: 1rem;
  overflow: hidden;
}

.form-preview div {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  border-top: 1px solid rgba(120, 168, 255, 0.18);
  padding: 0.9rem 1rem;
}

.form-preview div:first-child {
  border-top: 0;
}

.form-preview span {
  color: var(--muted);
  font-weight: 800;
}

.form-preview code {
  overflow-wrap: anywhere;
}

.tip {
  margin: 0.85rem 0 0;
}

.code-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.code-panel {
  overflow: hidden;
  border: 1px solid rgba(120, 168, 255, 0.25);
  border-radius: 16px;
  background: var(--code-bg);
  box-shadow: var(--shadow);
}

.code-grid + .code-panel,
#sdk > .code-panel {
  margin-top: 1rem;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(120, 168, 255, 0.18);
  background: rgba(12, 28, 54, 0.98);
  color: #e7f5ff;
  padding: 0.72rem 0.85rem;
}

.code-head span {
  font-weight: 800;
}

.code-head .copy-btn {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #e7f5ff;
}

.model-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.model-list span {
  border: 1px solid rgba(68, 211, 138, 0.55);
  border-radius: 999px;
  background: rgba(68, 211, 138, 0.14);
  color: #88efb6;
  font-weight: 800;
  padding: 0.65rem 0.8rem;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid rgba(120, 168, 255, 0.18);
  padding: 0.95rem 1rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(51, 209, 255, 0.1);
  color: var(--accent);
}

td {
  color: #dce8ff;
}

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

details {
  margin-top: 0.8rem;
  padding: 1rem;
}

summary {
  cursor: pointer;
  color: #ffffff;
  font-weight: 850;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(122, 168, 255, 0.2);
  color: var(--muted);
  padding: 1.4rem 2rem;
}

.footer p {
  margin: 0;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  color: white;
  box-shadow: var(--shadow);
  padding: 0.7rem 0.9rem;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
  }

  .brand {
    flex: 1;
  }

  .topnav {
    order: 3;
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
  }

  .layout {
    display: block;
    padding: 1rem;
  }

  .sidebar {
    position: static;
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    white-space: nowrap;
  }

  .sidebar-title {
    display: none;
  }

  .hero {
    padding: 2rem;
  }

  .endpoint-grid,
  .steps,
  .code-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 0;
  }

  .brand {
    min-width: 0;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .header-link,
  .console-link {
    padding: 0.48rem 0.7rem;
  }

  .topnav a {
    padding: 0.45rem 0.62rem;
  }

  .hero {
    padding: 1.35rem;
  }

  .lead {
    font-size: 1rem;
  }

  .endpoint-card,
  .form-preview div {
    grid-template-columns: 1fr;
  }

  .copy-btn {
    justify-self: start;
  }

  .footer {
    padding: 1rem;
  }
}
