:root {
  --bg: #0b0f16;
  --bg-soft: #111826;
  --panel: #131b2b;
  --panel-2: #182133;
  --line: #24314a;
  --line-soft: #1b2537;
  --text: #e8edf7;
  --muted: #9aa8c0;
  --muted-2: #7286a3;
  --brand: #4d6bfe;
  --brand-2: #7c9cff;
  --brand-deep: #2f4be0;
  --ok: #37d399;
  --warn: #f5b445;
  --danger: #ff6b6b;
  --code-bg: #0a0f18;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 46px rgba(0, 0, 0, .45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(77, 107, 254, .20), transparent 60%),
    radial-gradient(760px 420px at 88% 4%, rgba(124, 156, 255, .12), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11, 15, 22, .82);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand), #8f6bff);
  display: grid; place-items: center; font-size: 15px; color: #fff; font-weight: 800;
  box-shadow: 0 6px 18px rgba(77, 107, 254, .45);
}
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted-2); letter-spacing: .4px; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topnav a {
  color: var(--muted); font-size: 14px; padding: 7px 11px; border-radius: 8px; white-space: nowrap;
}
.topnav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
@media (max-width: 860px) { .topnav { display: none; } }

/* ---------- hero ---------- */
.hero { padding: 62px 0 34px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: rgba(19, 27, 43, .7);
  color: var(--muted); font-size: 12.5px; padding: 5px 12px; border-radius: 999px; margin-bottom: 20px;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(55, 211, 153, .16); }
h1 {
  font-size: clamp(30px, 4.6vw, 46px); line-height: 1.18; margin: 0 0 16px; letter-spacing: -.6px; font-weight: 800;
}
h1 .grad {
  background: linear-gradient(100deg, #8fa6ff 0%, #4d6bfe 45%, #a98bff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { color: var(--muted); font-size: 17px; max-width: 760px; margin: 0 0 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 26px; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  border-radius: 11px; padding: 12px 20px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease;
  font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); background: var(--panel-2); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-color: transparent; color: #fff; box-shadow: 0 12px 30px rgba(47, 75, 224, .38);
}
.btn-primary:hover { background: linear-gradient(135deg, #5f7cff 0%, #3a57ea 100%); }
.btn .size { font-weight: 500; opacity: .82; font-size: 13px; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat {
  border: 1px solid var(--line-soft); background: rgba(19, 27, 43, .55);
  border-radius: var(--radius-sm); padding: 13px 15px;
}
.stat .k { font-size: 12px; color: var(--muted-2); letter-spacing: .3px; }
.stat .v { font-size: 14.5px; font-family: var(--mono); color: var(--text); word-break: break-all; margin-top: 3px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 40px; padding-bottom: 70px; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; gap: 0; } .toc { display: none; } }

.toc { position: sticky; top: 84px; align-self: start; font-size: 14px; max-height: calc(100vh - 110px); overflow: auto; }
.toc h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted-2); }
.toc a { display: block; color: var(--muted); padding: 5px 10px; border-left: 2px solid var(--line-soft); }
.toc a:hover { color: var(--text); text-decoration: none; border-left-color: var(--brand); background: rgba(77, 107, 254, .07); }
.toc a.active { color: var(--brand-2); border-left-color: var(--brand); background: rgba(77, 107, 254, .1); }

/* ---------- content ---------- */
article { min-width: 0; }
section { margin-bottom: 54px; scroll-margin-top: 84px; }
h2 {
  font-size: 25px; margin: 0 0 8px; letter-spacing: -.3px; font-weight: 750;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
h2 .num {
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--brand-2);
  background: rgba(77, 107, 254, .13); border: 1px solid rgba(77, 107, 254, .3);
  padding: 2px 9px; border-radius: 7px;
}
h3 { font-size: 18.5px; margin: 32px 0 10px; font-weight: 700; }
h4 { font-size: 16px; margin: 22px 0 8px; color: var(--text); }
p { margin: 0 0 14px; }
.sub { color: var(--muted); margin: -2px 0 20px; }
ul, ol { padding-left: 22px; margin: 0 0 14px; }
li { margin-bottom: 7px; }
li > ul, li > ol { margin-top: 7px; }
strong { color: #fff; font-weight: 680; }
code:not(pre code) {
  font-family: var(--mono); font-size: .88em; background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 6px; padding: 1.5px 6px; color: #cbd8f5;
}

/* ---------- callouts ---------- */
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  background: rgba(19, 27, 43, .72); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 18px 0;
}
.callout .t { font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout.warn { border-left-color: var(--warn); }
.callout.warn .t { color: var(--warn); }
.callout.danger { border-left-color: var(--danger); }
.callout.danger .t { color: var(--danger); }
.callout.ok { border-left-color: var(--ok); }
.callout.ok .t { color: var(--ok); }

/* ---------- cards ---------- */
.card {
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(24, 33, 51, .85), rgba(19, 27, 43, .85));
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.card h4 { margin-top: 0; }
.card .tag {
  display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid rgba(77, 107, 254, .35); background: rgba(77, 107, 254, .12); color: var(--brand-2);
  margin-bottom: 9px; font-weight: 600;
}
.card .tag.best { border-color: rgba(55, 211, 153, .4); background: rgba(55, 211, 153, .12); color: var(--ok); }

/* ---------- download box ---------- */
.dl {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, rgba(47, 75, 224, .16), rgba(19, 27, 43, .9) 55%);
  box-shadow: var(--shadow); margin: 18px 0 22px;
}
.dl-head { padding: 20px 22px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.dl-head .fileicon {
  width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #8f6bff); color: #fff; font-size: 20px;
}
.dl-head .meta { min-width: 0; flex: 1; }
.dl-head .fname { font-family: var(--mono); font-size: 14.5px; color: #fff; word-break: break-all; }
.dl-head .fsub { font-size: 13px; color: var(--muted-2); }
.dl-body { padding: 18px 22px; }
.dl-body .kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.dl-body .kv .k { color: var(--muted-2); }
.dl-body .kv .v { font-family: var(--mono); word-break: break-all; color: var(--text); font-size: 13.5px; }
@media (max-width: 560px) { .dl-body .kv { grid-template-columns: 1fr; gap: 2px 0; } .dl-body .kv .k { margin-top: 8px; } }

/* ---------- code ---------- */
.code {
  position: relative; margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--code-bg); overflow: hidden;
}
.code-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: rgba(24, 33, 51, .6); border-bottom: 1px solid var(--line-soft);
  font-size: 12px; color: var(--muted-2); font-family: var(--mono);
}
.code-head .copy {
  margin-left: auto; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 7px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.code-head .copy:hover { color: #fff; background: var(--panel-2); }
.code-head .copy.done { color: var(--ok); border-color: rgba(55, 211, 153, .45); }
.code pre {
  margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--mono);
  font-size: 13.2px; line-height: 1.7; color: #d6e2fb;
}
.code pre .c { color: #61789c; }
.code pre .p { color: var(--brand-2); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14.2px; min-width: 520px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { background: rgba(24, 33, 51, .6); color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: .2px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(77, 107, 254, .05); }
td code { white-space: nowrap; }

/* ---------- tabs ---------- */
.tabs { margin: 14px 0; }
.tabbar { display: flex; gap: 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabbar button {
  border: none; background: transparent; color: var(--muted); font-family: inherit; font-size: 14px;
  padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabbar button:hover { color: var(--text); }
.tabbar button[aria-selected="true"] { color: var(--brand-2); border-bottom-color: var(--brand); font-weight: 600; }
.tabpanel { display: none; padding-top: 14px; }
.tabpanel.active { display: block; }
.tabpanel .code:first-child, .tabpanel p:first-child { margin-top: 0; }

/* ---------- steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 18px 0; }
.steps > li {
  position: relative; padding-left: 46px; margin-bottom: 26px; counter-increment: step;
}
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(77, 107, 254, .14); border: 1px solid rgba(77, 107, 254, .4);
  color: var(--brand-2); font-family: var(--mono); font-size: 13.5px; font-weight: 700;
}
.steps > li > .st { font-weight: 700; font-size: 16.5px; margin-bottom: 6px; display: block; }

/* ---------- faq ---------- */
details.faq {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(19, 27, 43, .6);
  margin-bottom: 10px; overflow: hidden;
}
details.faq > summary {
  cursor: pointer; padding: 13px 16px; font-weight: 620; font-size: 15px; list-style: none;
  display: flex; align-items: center; gap: 10px;
}
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::before {
  content: "?"; flex: none; width: 21px; height: 21px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(77, 107, 254, .15); border: 1px solid rgba(77, 107, 254, .35); color: var(--brand-2);
  font-size: 12px; font-weight: 800;
}
details.faq[open] > summary { border-bottom: 1px solid var(--line-soft); }
details.faq > summary:hover { background: rgba(77, 107, 254, .06); }
details.faq .body { padding: 14px 16px 4px; }
details.faq .body > :last-child { margin-bottom: 10px; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line-soft); padding: 30px 0 46px; color: var(--muted-2); font-size: 13.5px; }
footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; }
footer h5 { margin: 0 0 9px; font-size: 13px; color: var(--muted); letter-spacing: .4px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--brand-2); }
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: 5px; }
.footer-bottom { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- misc ---------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.badge {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-family: var(--mono);
}
.badge.b-ok { color: var(--ok); border-color: rgba(55, 211, 153, .35); background: rgba(55, 211, 153, .1); }
.badge.b-warn { color: var(--warn); border-color: rgba(245, 180, 69, .35); background: rgba(245, 180, 69, .1); }
.hr { height: 1px; background: var(--line-soft); margin: 34px 0; border: 0; }
.small { font-size: 13px; color: var(--muted-2); }
.nowrap { white-space: nowrap; }
.backtop {
  position: fixed; right: 22px; bottom: 22px; z-index: 40;
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(19, 27, 43, .92); color: var(--muted); cursor: pointer; display: none;
  align-items: center; justify-content: center; font-size: 17px; backdrop-filter: blur(8px);
}
.backtop.show { display: flex; }
.backtop:hover { color: #fff; background: var(--panel-2); }

::selection { background: rgba(77, 107, 254, .35); }
