:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #646a73;
  --border: #e5e6eb;
  --accent: #1677ff;
  --accent-soft: #e8f3ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --max: 1080px;
  --toc: 220px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 16px 64px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(64px, calc(24px + env(safe-area-inset-bottom)));
}

.layout {
  display: grid;
  grid-template-columns: var(--toc) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.toc-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.toc-toggle-label {
  font-size: 15px;
  font-weight: 600;
}

.toc-toggle-icon {
  color: var(--muted);
  font-size: 12px;
  transition: transform .2s ease;
}

.toc.is-open .toc-toggle-icon {
  transform: rotate(180deg);
}

.toc-title {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
}

.toc-list {
  display: block;
}

.toc a {
  display: block;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  min-height: 36px;
}
.toc a:hover { background: #f2f3f5; text-decoration: none; }
.toc a.active { background: var(--accent-soft); color: #0b5ed7; }

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero,
.content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px 24px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: .02em;
  word-break: break-word;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.content {
  padding: 8px 24px 28px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.section { padding-top: 8px; margin-top: 8px; }
.section h2 {
  margin: 24px 0 12px;
  font-size: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section h3 {
  margin: 18px 0 8px;
  font-size: 16px;
}
.section p { margin: 0 0 12px; color: #2b2f36; }
.section ul,
.section ol { margin: 0 0 12px; padding-left: 1.2em; }
.section li { margin: 4px 0; }

.note {
  background: #fff8e6;
  border: 1px solid #ffe1a6;
  color: #8a6116;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 12px 0;
}

.sdk-desktop {
  display: block;
}

.sdk-mobile {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 12px 0 8px;
}

table.sdk {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}
table.sdk th, table.sdk td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
table.sdk th {
  background: #f5f6f8;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
table.sdk tr:last-child td { border-bottom: none; }
table.sdk td.link-cell {
  white-space: nowrap;
}
table.sdk td.link-cell a + a {
  margin-left: 8px;
}

.sdk-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 8px;
}

.sdk-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 14px 14px 12px;
}

.sdk-card-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
  color: var(--text);
}

.sdk-card-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 8px 0;
  border-top: 1px solid #f0f1f3;
  font-size: 13px;
  line-height: 1.55;
}

.sdk-card-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.sdk-card-label {
  color: var(--muted);
  font-weight: 600;
}

.sdk-card-value {
  color: #2b2f36;
  min-width: 0;
}

.sdk-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sdk-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #0b5ed7;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.sdk-link-btn:hover {
  text-decoration: none;
  background: #d6e9ff;
}

.footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.error {
  max-width: 640px;
  margin: 80px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

@media (max-width: 860px) {
  .page {
    padding: 12px 12px 40px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(40px, calc(16px + env(safe-area-inset-bottom)));
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .toc {
    display: none;
  }

  .main {
    gap: 12px;
  }

  .hero,
  .content {
    border-radius: 8px;
    box-shadow: none;
  }

  .hero {
    padding: 18px 16px;
  }

  .hero h1 {
    margin-bottom: 8px;
    font-size: 22px;
  }

  .meta {
    font-size: 12px;
    gap: 6px 12px;
  }

  .content {
    padding: 4px 16px 20px;
  }

  .section h2 {
    margin: 18px 0 10px;
    font-size: 17px;
  }

  .section h3 {
    font-size: 15px;
  }

  .sdk-desktop {
    display: none;
  }

  .sdk-mobile {
    display: block;
  }

  .footer {
    margin-top: 20px;
    font-size: 12px;
  }
}
