:root {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --text: #172033;
  --muted: #6b7894;
  --line: rgba(83, 102, 141, 0.16);
  --brand: #5578f0;
  --brand-2: #37c7d5;
  --accent: #2ca779;
  --warm: #d58b28;
  --shadow: 0 24px 80px rgba(72, 93, 144, 0.18);
  --radius: 8px;
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(85, 120, 240, 0.1), rgba(55, 199, 213, 0.08) 46%, rgba(44, 167, 121, 0.08)),
    linear-gradient(180deg, #eef3ff 0%, #f8fbff 52%, #f3f6fb 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(86, 111, 166, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 111, 166, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 82%);
}

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

button {
  font: inherit;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 260px;
  align-items: center;
  gap: 24px;
  padding: 16px 28px;
  backdrop-filter: blur(22px) saturate(160%);
}

.topbar::after {
  position: absolute;
  right: 28px;
  bottom: 0;
  left: 28px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(105, 124, 164, 0.22), transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius);
  color: white;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(135deg, #5878ef, #28c6d0);
  box-shadow: 0 10px 28px rgba(85, 120, 240, 0.28);
}

.brand-mark img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.segment {
  position: relative;
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, 1fr));
  width: min(420px, 100%);
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.34)),
    rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 18px 52px rgba(73, 95, 146, 0.16);
  backdrop-filter: blur(22px) saturate(180%);
}

.segment::before {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc(50% - 5px);
  content: "";
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(236, 244, 255, 0.74)),
    linear-gradient(135deg, rgba(85, 120, 240, 0.2), rgba(55, 199, 213, 0.14));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -16px 26px rgba(85, 120, 240, 0.08),
    0 10px 26px rgba(85, 120, 240, 0.18);
  transition: transform 220ms ease;
}

.segment[data-active="integration"]::before {
  transform: translateX(calc(100% + 0px));
}

.segment-button {
  position: relative;
  z-index: 1;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: #62708c;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: color 180ms ease;
}

.segment-button.active {
  color: #24406f;
}

.segment-button:focus-visible,
.nav-link:focus-visible,
.back-top:focus-visible {
  outline: 3px solid rgba(85, 120, 240, 0.24);
  outline-offset: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 28px;
  padding: 26px 28px 64px;
}

.sidebar {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 108px);
}

.sidebar-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(145%);
}

.sidebar-title {
  padding: 18px 18px 10px;
  color: #23314d;
  font-size: 14px;
  font-weight: 800;
}

.side-nav {
  display: grid;
  max-height: calc(100vh - 166px);
  padding: 0 10px 14px;
  overflow: auto;
  overscroll-behavior: contain;
}

.nav-group {
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.nav-group:first-child {
  border-top: 0;
}

.nav-parent {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: #41506a;
  font-weight: 800;
  font-size: 13px;
}

.nav-parent::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  content: "";
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 4px rgba(85, 120, 240, 0.1);
}

.nav-children {
  display: grid;
  gap: 2px;
  margin: 2px 0 0 17px;
  padding-left: 12px;
  border-left: 1px solid rgba(85, 120, 240, 0.16);
}

.nav-link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #697791;
  font-size: 13px;
  line-height: 1.35;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-link:hover {
  color: #2d426b;
  background: rgba(85, 120, 240, 0.08);
}

.nav-link.active {
  color: #254270;
  background:
    linear-gradient(135deg, rgba(85, 120, 240, 0.14), rgba(55, 199, 213, 0.11)),
    rgba(255, 255, 255, 0.78);
  box-shadow: inset 3px 0 0 var(--brand);
}

.content {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 20px;
  min-height: 0;
  align-items: stretch;
  padding: 30px 34px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.48)),
    linear-gradient(120deg, rgba(85, 120, 240, 0.08), rgba(55, 199, 213, 0.1) 56%, rgba(44, 167, 121, 0.08));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(150%);
}

.hero h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.18;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 680px;
  margin: 14px 0 0;
  color: #5f6e88;
  font-size: 14px;
  line-height: 1.75;
}

.hero-panel {
  position: relative;
  display: grid;
  min-height: 124px;
  overflow: hidden;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(85, 120, 240, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(235, 244, 255, 0.58)),
    linear-gradient(180deg, rgba(85, 120, 240, 0.1), rgba(255, 255, 255, 0.18));
}

.hero-mascot {
  width: min(122px, 78%);
  max-height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(85, 120, 240, 0.18));
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.summary-card {
  min-height: 136px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 18px 48px rgba(72, 93, 144, 0.12);
  backdrop-filter: blur(16px);
}

.summary-card b {
  display: block;
  font-size: 15px;
}

.summary-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.sections {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.product-section {
  min-width: 0;
  scroll-margin-top: 92px;
}

.product-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 32px 2px 10px;
}

.product-header h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.product-header p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.device-code {
  flex: 0 0 auto;
  color: #5d6c86;
  font-size: 12px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.info-card {
  min-width: 0;
  scroll-margin-top: 96px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 52px rgba(72, 93, 144, 0.12);
  backdrop-filter: blur(16px) saturate(145%);
}

.info-card h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.info-card .lead {
  margin: 10px 0 0;
  color: #5d6b84;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(85, 120, 240, 0.14);
  border-radius: 999px;
  color: #405170;
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
}

.info-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.info-list li {
  position: relative;
  padding-left: 18px;
  color: #34435d;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.info-list li::before {
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  content: "";
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.code-block {
  overflow: auto;
  max-width: 100%;
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid rgba(58, 77, 115, 0.14);
  border-radius: var(--radius);
  color: #243049;
  background: rgba(246, 249, 255, 0.86);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.7;
}

.doc-card {
  grid-column: span 2;
}

.endpoint-details {
  margin-top: 18px;
}

.endpoint-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(85, 120, 240, 0.16);
  border-radius: var(--radius);
  color: #2c4064;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(238, 245, 255, 0.68)),
    rgba(255, 255, 255, 0.62);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.endpoint-toggle:hover {
  border-color: rgba(85, 120, 240, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(233, 243, 255, 0.78)),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 30px rgba(72, 93, 144, 0.1);
}

.endpoint-toggle:focus-visible {
  outline: 3px solid rgba(85, 120, 240, 0.22);
  outline-offset: 2px;
}

.endpoint-toggle[aria-expanded="true"] {
  border-color: rgba(85, 120, 240, 0.32);
  box-shadow: 0 14px 34px rgba(72, 93, 144, 0.12);
}

.endpoint-toggle-main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.endpoint-toggle-main span {
  font-size: 13px;
  font-weight: 800;
}

.endpoint-toggle-main small {
  min-width: 0;
  color: #697791;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.endpoint-arrow {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(85, 120, 240, 0.16);
  border-radius: 999px;
  color: #4267d7;
  background: rgba(255, 255, 255, 0.74);
  font-size: 20px;
  line-height: 1;
  transition:
    transform 220ms ease,
    background 180ms ease;
}

.endpoint-toggle[aria-expanded="true"] .endpoint-arrow {
  background: rgba(85, 120, 240, 0.1);
  transform: rotate(90deg);
}

.endpoint-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    grid-template-rows 240ms ease,
    opacity 200ms ease,
    transform 240ms ease;
}

.endpoint-panel.open {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
}

.endpoint-panel > .endpoint {
  min-height: 0;
  overflow: hidden;
}

.endpoint {
  margin-top: 14px;
  padding-top: 18px;
  border-top: 1px solid rgba(83, 102, 141, 0.16);
}

.endpoint-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(58, 77, 115, 0.14);
  border-radius: var(--radius);
  background: rgba(246, 249, 255, 0.9);
}

.endpoint-head code,
.request-item span,
.kv-table code,
.param-table code {
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.method {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, #4d6ee6, #26aeb9);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.doc-subsection {
  margin-top: 16px;
}

.doc-subsection h4 {
  margin: 0 0 8px;
  color: #273753;
  font-size: 13px;
}

.doc-empty {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(58, 77, 115, 0.12);
  border-radius: var(--radius);
  color: #64738c;
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.6;
}

.kv-table,
.param-table {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(58, 77, 115, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
}

.kv-table {
  grid-template-columns: minmax(130px, 0.34fr) minmax(0, 1fr);
}

.param-table {
  grid-template-columns: minmax(120px, 0.9fr) minmax(92px, 0.7fr) minmax(64px, 0.4fr) minmax(0, 1.7fr);
}

.kv-table > div,
.param-table > div {
  min-width: 0;
  padding: 10px 12px;
  border-top: 1px solid rgba(58, 77, 115, 0.1);
  color: #40506b;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.kv-table > div:nth-child(-n + 2),
.param-table > div:nth-child(-n + 4) {
  border-top: 0;
  color: #263651;
  background: rgba(238, 244, 255, 0.78);
  font-weight: 800;
}

.kv-table > div:nth-child(2n + 1) {
  color: #263651;
  font-weight: 700;
}

.request-list {
  display: grid;
  gap: 12px;
}

.request-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(58, 77, 115, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.request-item strong,
.request-item span {
  display: block;
}

.request-item strong {
  color: #263651;
  font-size: 13px;
}

.request-item span {
  margin-top: 6px;
  color: #65738b;
  font-size: 12px;
  line-height: 1.55;
}

.compact {
  gap: 8px;
  margin-top: 8px;
}

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  color: #29436f;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 16px 42px rgba(72, 93, 144, 0.22);
  cursor: pointer;
  backdrop-filter: blur(16px);
}

.back-top.show {
  display: block;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 220px 1fr;
  }

  .topbar::before {
    display: none;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .hero-panel {
    display: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    padding: 14px 16px 16px;
  }

  .brand {
    justify-self: center;
  }

  .segment {
    width: 100%;
  }

  .layout {
    display: block;
    padding: 18px 16px 52px;
  }

  .sidebar {
    position: sticky;
    top: 104px;
    z-index: 12;
    margin-bottom: 16px;
  }

  .sidebar-card {
    border-radius: var(--radius);
  }

  .side-nav {
    display: flex;
    max-height: none;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 10px 12px;
  }

  .sidebar-title,
  .nav-children {
    display: none;
  }

  .nav-group {
    flex: 0 0 auto;
    border: 0;
    padding: 0;
  }

  .nav-parent {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.72);
  }

  .nav-parent.active {
    color: #254270;
    box-shadow: inset 0 -3px 0 var(--brand);
  }

  .hero {
    padding: 24px 22px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .summary-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .doc-card {
    grid-column: span 1;
  }

  .product-header {
    display: block;
  }

  .device-code {
    display: inline-block;
    margin-top: 8px;
  }
}

@media (max-width: 560px) {
  .segment {
    grid-template-columns: 1fr;
    border-radius: var(--radius);
  }

  .segment::before {
    display: none;
  }

  .segment-button.active {
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 8px 20px rgba(85, 120, 240, 0.12);
  }

  .hero {
    min-height: 0;
  }

  .hero-panel {
    display: none;
  }

  .endpoint-head,
  .kv-table,
  .param-table {
    display: block;
  }

  .endpoint-head code {
    display: block;
    margin-top: 8px;
  }

  .endpoint-toggle {
    grid-template-columns: minmax(0, 1fr) 28px;
  }

  .kv-table > div,
  .param-table > div {
    border-top: 1px solid rgba(58, 77, 115, 0.1);
  }

  .param-table > div:nth-child(-n + 4) {
    display: none;
  }
}
