:root {
  --bg: #0a0b0f;
  --bg-soft: #12141c;
  --bg-card: #14161f;
  --bg-code: #0d0f16;
  --border: #232634;
  --border-soft: #1b1e28;
  --text: #e7e9ee;
  --text-dim: #9aa0ad;
  --text-faint: #6b7280;
  --brand: #7c9bff;
  --brand-2: #a78bfa;
  --accent: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1000px 520px at 78% -8%, rgba(124,155,255,.16), transparent 60%),
    radial-gradient(760px 420px at 8% 4%, rgba(167,139,250,.12), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10,11,15,.78);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 13px 22px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #0a0b0f; font-weight: 800; font-size: 15px;
  box-shadow: 0 0 22px rgba(124,155,255,.5);
}
.brand small { color: var(--text-faint); font-weight: 500; font-size: 12px; margin-left: 2px; }
.nav-links { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav-links a {
  color: var(--text-dim); font-size: 14px; padding: 7px 12px; border-radius: 8px; font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-links a.pill {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #0a0b0f; font-weight: 650;
}
.nav-links a.pill:hover { opacity: .92; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; position: relative; z-index: 1; }
section { scroll-margin-top: 84px; }

/* ---------- Hero ---------- */
.hero { padding: 74px 0 40px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--brand);
  background: rgba(124,155,255,.1); border: 1px solid rgba(124,155,255,.24);
  padding: 6px 13px; border-radius: 999px; letter-spacing: .01em;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.hero h1 {
  font-size: clamp(34px, 6vw, 58px); line-height: 1.05; letter-spacing: -.035em;
  margin: 22px 0 0; font-weight: 800;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--brand-2) 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: clamp(16px, 2.3vw, 20px); color: var(--text-dim); max-width: 680px; margin: 20px 0 0; }
.hero-cta { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 12px 20px; border-radius: 11px;
  font-weight: 620; font-size: 15px; cursor: pointer; border: 1px solid transparent; transition: .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #0a0b0f; }
.btn-primary:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 30px rgba(124,155,255,.28); }
.btn-ghost { background: var(--bg-soft); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { text-decoration: none; border-color: var(--brand); }

/* endpoint strip */
.endpoints { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 38px; }
.ep {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.ep .k { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 600; }
.ep .v { font-family: var(--mono); font-size: 15px; margin-top: 7px; display: flex; align-items: center; gap: 10px; word-break: break-all; }
.ep .v b { color: var(--accent); font-weight: 600; }
.ep .hint { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }

/* ---------- Section headers ---------- */
.section-head { margin: 64px 0 26px; }
.section-head .num { font-family: var(--mono); font-size: 13px; color: var(--brand); font-weight: 600; }
.section-head h2 { font-size: clamp(24px, 4vw, 34px); letter-spacing: -.03em; margin: 8px 0 0; font-weight: 750; }
.section-head p { color: var(--text-dim); margin: 10px 0 0; max-width: 720px; }

/* ---------- Cards / steps ---------- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: .15s;
}
.card:hover { border-color: #2f3446; }
.card .ico { font-size: 24px; }
.card h3 { margin: 12px 0 6px; font-size: 17px; letter-spacing: -.01em; }
.card p { color: var(--text-dim); font-size: 14px; margin: 0; }

/* ---------- Tabs ---------- */
.tabs { margin-top: 8px; }
.tabbar {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 6px;
  background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 13px;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 9px; font-size: 14px; font-weight: 560;
  color: var(--text-dim); cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.tab .ic { font-size: 16px; }
.panel { display: none; margin-top: 20px; animation: fade .2s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.panel-grid.single { grid-template-columns: 1fr; }

/* steps list */
ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
ol.steps > li {
  counter-increment: s; position: relative; padding: 0 0 18px 42px; margin: 0;
}
ol.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: -2px;
  width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(124,155,255,.12); color: var(--brand); border: 1px solid rgba(124,155,255,.3);
  font-family: var(--mono); font-size: 13px; font-weight: 600;
}
ol.steps > li::after {
  content: ""; position: absolute; left: 13px; top: 28px; bottom: 4px; width: 1px; background: var(--border);
}
ol.steps > li:last-child::after { display: none; }
ol.steps > li strong { color: var(--text); font-weight: 620; }
ol.steps > li .desc { color: var(--text-dim); font-size: 14.5px; }
ol.steps code.inline, code.inline {
  font-family: var(--mono); font-size: 13px; background: var(--bg-code);
  border: 1px solid var(--border); padding: 2px 7px; border-radius: 6px; color: var(--brand);
}

/* ---------- Code blocks ---------- */
.code {
  position: relative; background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin: 14px 0;
}
.code-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  border-bottom: 1px solid var(--border-soft); background: rgba(255,255,255,.015);
}
.code-head .fname { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }
.code-head .lang { margin-left: auto; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); }
.copy-btn {
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--text-dim);
  background: var(--bg-soft); border: 1px solid var(--border); padding: 5px 11px;
  border-radius: 7px; cursor: pointer; transition: .12s; margin-left: 10px;
}
.copy-btn:hover { color: var(--text); border-color: var(--brand); }
.copy-btn.ok { color: var(--accent); border-color: var(--accent); }
pre { margin: 0; padding: 15px 16px; overflow-x: auto; }
pre code { font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #d7dbe6; white-space: pre; }
.tok-c { color: #6b7280; font-style: italic; }
.tok-k { color: #c792ea; }
.tok-s { color: #c3e88d; }
.tok-f { color: #82aaff; }
.tok-v { color: #f78c6c; }

/* ---------- Callouts ---------- */
.callout {
  display: flex; gap: 13px; padding: 15px 17px; border-radius: var(--radius-sm);
  border: 1px solid; margin: 16px 0; font-size: 14px;
}
.callout .ci { font-size: 18px; flex-shrink: 0; line-height: 1.5; }
.callout p { margin: 0; }
.callout.info { background: rgba(124,155,255,.07); border-color: rgba(124,155,255,.28); color: #c9d4ff; }
.callout.warn { background: rgba(251,191,36,.07); border-color: rgba(251,191,36,.3); color: #ffe9b8; }
.callout.tip { background: rgba(52,211,153,.07); border-color: rgba(52,211,153,.28); color: #b7f0d8; }
.callout code { background: rgba(0,0,0,.35); }

/* ---------- Model table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.015); }
tr:last-child td { border-bottom: none; }
td code { font-family: var(--mono); font-size: 12.5px; color: var(--brand); }
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(167,139,250,.14); color: var(--brand-2); border: 1px solid rgba(167,139,250,.28);
}
.badge.g { background: rgba(52,211,153,.13); color: var(--accent); border-color: rgba(52,211,153,.28); }
.badge.o { background: rgba(251,191,36,.13); color: var(--warn); border-color: rgba(251,191,36,.28); }

/* faq */
details.faq {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
  padding: 4px 18px; margin-bottom: 11px;
}
details.faq summary {
  cursor: pointer; padding: 13px 0; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "+"; color: var(--brand); font-family: var(--mono); font-size: 18px; }
details.faq[open] summary::before { content: "–"; }
details.faq .a { color: var(--text-dim); font-size: 14.5px; padding: 0 0 14px 28px; }

/* footer */
footer { border-top: 1px solid var(--border-soft); margin-top: 80px; padding: 34px 0 60px; }
.foot-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--text-faint); font-size: 13.5px; }
.foot-inner a { color: var(--text-dim); }

@media (max-width: 820px) {
  .endpoints, .grid-3, .grid-2, .panel-grid { grid-template-columns: 1fr; }
  .nav-links a:not(.pill) { display: none; }
  .hero { padding: 48px 0 28px; }
}
