*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #000000; --surface: #1d1d1f; --surface2: #2c2c2e;
  --border: #3d3d40; --blue: #0d6fff; --blue-soft: rgba(13,111,255,0.10);
  --text: #ffffff; --muted: #87878c; --muted2: #565659;
  --green: #30d158; --green-soft: rgba(48,209,88,0.10);
  --amber: #ffd600; --amber-soft: rgba(255,214,0,0.10);
  --red: #ff4245; --red-soft: rgba(255,66,69,0.10);
}
[data-theme="light"] {
  --bg: #f2f2f7; --surface: #ffffff; --surface2: #e8e8ed;
  --border: #c7c7cc; --text: #1d1d1f; --muted: #6e6e73; --muted2: #aeaeb2;
  --amber: #ff9500; --amber-soft: rgba(255,149,0,0.08);
  --red: #ff3b30; --red-soft: rgba(255,59,48,0.08);
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.7; -webkit-font-smoothing: antialiased;
}
.container { max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px,4vw,32px); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 100; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); text-decoration: none; font-size: 14px; font-weight: 500; transition: opacity .2s; }
.back-link:hover { opacity: .75; }
.docs-badge { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 2px 8px; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.lang-pills { display: flex; gap: 4px; }
.lang-pill { padding: 4px 10px; border-radius: 14px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); background: none; color: var(--muted); cursor: pointer; font-family: 'Inter', sans-serif; transition: background .15s, color .15s; }
.lang-pill.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.theme-toggle { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 16px; padding: 2px; gap: 2px; }
.theme-btn { padding: 4px 12px; border: none; background: none; border-radius: 12px; font-size: 12px; font-family: 'Inter', sans-serif; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.theme-btn.active { background: var(--blue); color: #fff; }

.topbar-cta {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--blue); color: #fff;
  border-radius: 18px; padding: 7px 16px;
  font-size: 12.5px; font-weight: 600; text-decoration: none;
  box-shadow: 0 2px 10px rgba(13,111,255,0.35);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.topbar-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(13,111,255,0.45); }
.topbar-cta svg { flex-shrink: 0; }
@media (max-width: 640px) {
  .topbar-cta span { display: none; }
  .topbar-cta { padding: 7px 9px; border-radius: 50%; }
}

/* layout */
.docs-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 48px; padding: 40px 0 80px; }
.docs-side { position: sticky; top: 88px; align-self: start; }
.side-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted2); margin: 0 0 10px 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: block; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.side-nav a:hover { color: var(--text); background: var(--surface); }
.side-nav a.active { color: var(--blue); background: var(--blue-soft); font-weight: 600; }

/* content */
.doc-header { padding-bottom: 24px; border-bottom: 1px solid var(--border); margin-bottom: 36px; }
.doc-label { font-size: 11px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.doc-title { font-size: clamp(26px,3.5vw,36px); font-weight: 800; line-height: 1.15; letter-spacing: -0.03em; margin-bottom: 10px; }
.doc-intro { font-size: 15px; color: var(--muted); max-width: 62ch; }
.doc-body h2 { font-size: 20px; font-weight: 700; margin: 40px 0 12px; letter-spacing: -0.02em; }
.doc-body h3 { font-size: 15px; font-weight: 650; margin: 26px 0 8px; }
.doc-body p { font-size: 14px; color: var(--muted); margin-bottom: 12px; max-width: 70ch; }
.doc-body p strong, .doc-body li strong { color: var(--text); }
.doc-body ul, .doc-body ol { padding-left: 20px; margin-bottom: 14px; }
.doc-body li { font-size: 14px; color: var(--muted); margin-bottom: 7px; line-height: 1.65; }
.doc-body a { color: var(--blue); text-decoration: none; }
.doc-body a:hover { text-decoration: underline; }
.doc-body code { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--text); }

/* tables */
.doc-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 13.5px; }
.doc-table th { text-align: left; font-weight: 600; color: var(--text); padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.doc-table td { padding: 10px 12px; border-bottom: 1px solid var(--separator, var(--border)); color: var(--muted); vertical-align: top; }
.doc-table td:first-child { color: var(--text); }
.table-wrap { overflow-x: auto; }

/* callouts */
.note { display: flex; gap: 12px; align-items: flex-start; border-radius: 10px; padding: 14px 16px; margin: 16px 0 20px; font-size: 13.5px; line-height: 1.65; border: 1px solid var(--border); }
.note p { margin: 0; font-size: 13.5px; }
.note-info { background: var(--blue-soft); border-color: rgba(13,111,255,0.25); }
.note-warn { background: var(--amber-soft); border-color: rgba(255,214,0,0.25); }
.note-danger { background: var(--red-soft); border-color: rgba(255,66,69,0.25); }
.note-icon { flex-shrink: 0; margin-top: 2px; }
.note-info .note-icon { color: var(--blue); }
.note-warn .note-icon { color: var(--amber); }
.note-danger .note-icon { color: var(--red); }

/* step list */
.step-block { border-left: 2px solid var(--border); padding: 2px 0 2px 18px; margin: 14px 0 22px; }
.step-block h4 { font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.step-block p { font-size: 13.5px; margin-bottom: 14px; }
.step-block > *:last-child { margin-bottom: 2px; }

/* prev/next */
.doc-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.pager-link { flex: 1; max-width: 48%; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; text-decoration: none; transition: border-color .2s; }
.pager-link:hover { border-color: var(--blue); }
.pager-dir { font-size: 11px; color: var(--muted2); text-transform: uppercase; letter-spacing: 1px; }
.pager-title { font-size: 13.5px; color: var(--blue); font-weight: 600; }
.pager-next { text-align: right; margin-left: auto; }

/* footer */
.doc-footer { border-top: 1px solid var(--border); padding: 24px 0; }
.doc-footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.doc-footer p { font-size: 12px; color: var(--muted2); }
.doc-footer a { color: var(--blue); text-decoration: none; font-size: 12px; margin-left: 14px; }

.lang-section { display: none; }
.lang-section.active { display: block; }

@media (max-width: 800px) {
  .docs-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .docs-side { position: static; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .side-nav a { border: 1px solid var(--border); border-radius: 16px; padding: 5px 12px; font-size: 12.5px; }
  .side-nav a.active { border-color: var(--blue); }
  .side-label { display: none; }
  .doc-pager { flex-direction: column; }
  .pager-link { max-width: 100%; }
}
