:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-soft: #f2f5f8;
  --text: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --accent: #2563eb;
  --code: #111827;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", sans-serif;
  line-height: 1.72;
}
a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 1px; }

.toc { display: flex; flex-direction: column; gap: 2px; }
.toc-group { display: flex; flex-direction: column; margin: 5px 0; }
.toc-main,
.toc-sub {
  border-radius: 7px;
  color: #344054;
  display: block;
  font-size: 14px;
  padding: 7px 9px;
  text-decoration: none;
}
.toc-sub {
  color: #667085;
  font-size: 13px;
  margin-left: 14px;
  padding: 5px 9px;
}
.toc-main:hover,
.toc-sub:hover,
.toc-main.active,
.toc-sub.active {
  background: #e8f3f1;
  color: var(--brand-strong);
  text-decoration: none;
}

.content {
  width: min(100%, 1000px);
  padding: 36px 32px 80px;
}
.hero {
  padding: 34px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.eyebrow,
.section-label {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}
h1, h2, h3 { letter-spacing: 0; line-height: 1.28; }
h1 {
  margin: 8px 0 14px;
  font-size: clamp(32px, 4vw, 52px);
}
h2 {
  margin: 8px 0 18px;
  font-size: 28px;
}
h3 {
  margin: 28px 0 10px;
  font-size: 19px;
}
.hero-desc {
  color: var(--muted);
  max-width: 780px;
  font-size: 17px;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.meta span {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #475467;
  font-size: 13px;
  padding: 5px 10px;
}

.doc-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 18px 0;
  padding: 28px;
  scroll-margin-top: 24px;
}
.doc-section--intro {
  background: #fbfcfe;
}
.doc-section p { margin: 10px 0; }
.bullet {
  position: relative;
  padding-left: 18px;
}
.bullet::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .78em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.copy-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10px 0;
  padding: 10px 10px 10px 14px;
}
.copy-line__text { min-width: 0; overflow-wrap: anywhere; }
.copy-btn {
  flex: 0 0 auto;
  border: 1px solid #b8c5d6;
  border-radius: 7px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  min-height: 32px;
  padding: 8px 11px;
}
.copy-btn:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}
.copy-btn.copied {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.code-card {
  position: relative;
  background: var(--code);
  border-radius: 8px;
  margin: 13px 0;
  overflow: hidden;
}
.copy-btn--code {
  position: absolute;
  top: 10px;
  right: 10px;
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.1);
  color: #fff;
}
pre {
  margin: 0;
  overflow-x: auto;
  padding: 46px 16px 16px;
}
code {
  color: #e5e7eb;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.62;
  white-space: pre;
}

.menu-btn,
.mobile-toc {
  display: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #111827;
  color: #fff;
  border-radius: 8px;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .content {
    width: 100%;
    padding: 18px 14px 52px;
  }
  .hero {
    padding-top: 12px;
  }
  .menu-btn {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font: inherit;
    padding: 6px 12px;
  }
  .mobile-toc {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: -10px 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
  }
  .mobile-toc.open {
    display: block;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
  }
  .doc-section {
    padding: 20px 16px;
  }
  h1 { font-size: 34px; }
  h2 { font-size: 23px; }
  h3 { font-size: 17px; }
  .copy-line {
    align-items: stretch;
    flex-direction: column;
  }
  .copy-btn {
    width: fit-content;
  }
}
