:root {
  --bg: #04070d;
  --bg-elev: #0a1220;
  --bg-code: #060b14;
  --border: #1a2942;
  --border-hi: #29436b;
  --text: #edf3fa;
  --text-2: #9ab0c9;
  --muted: #627793;
  --cobalt: #3b82f6;
  --ice: #7dd3fc;
  --ice-dim: rgba(125, 211, 252, 0.13);
  --cobalt-dim: rgba(59, 130, 246, 0.16);
  --warn: #f59e0b;
  --crit: #f43f5e;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Syne", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); color: var(--text); overflow-x: clip; max-width: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  overflow-x: clip;
  max-width: 100%;
  background: radial-gradient(900px 500px at 15% -10%, rgba(59, 130, 246, 0.1), transparent 60%),
              radial-gradient(800px 500px at 85% -10%, rgba(125, 211, 252, 0.06), transparent 60%),
              var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); }
.ice { color: var(--ice); }
.cobalt { color: var(--cobalt); }
.muted { color: var(--muted); }
a { color: var(--ice); text-decoration: none; }
a:hover { text-decoration: underline; }

.gh-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(4, 7, 13, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.gh-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 58px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.gh-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gh-logo-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(125, 211, 252, 0.45); }
.gh-repo-crumb { display: flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-repo-crumb .slash { color: var(--muted); }
.gh-repo-crumb .repo-name { color: var(--text); font-weight: 700; }
.gh-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-hi); color: var(--text-2); background: rgba(255,255,255,0.02); }
.gh-pill.blue { border-color: rgba(125, 211, 252, 0.45); color: var(--ice); background: var(--cobalt-dim); }
.gh-nav-actions { display: flex; align-items: center; gap: 8px; }
.gh-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 6px; border: 1px solid var(--border-hi); background: var(--bg-elev);
  color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.gh-btn:hover { border-color: var(--ice); color: var(--ice); text-decoration: none; }
.gh-btn.primary { background: linear-gradient(135deg, #3b82f6, #0ea5e9); color: #030812; border: none; }
.gh-btn.primary:hover { filter: brightness(1.1); color: #030812; }

.gh-tabs-bar { border-top: 1px solid rgba(255,255,255,0.04); background: rgba(10,18,32,0.7); }
.gh-tabs-inner { max-width: 1440px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; overflow-x: auto; }
.gh-tabs { display: flex; align-items: center; gap: 4px; }
.gh-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; font-size: 12.5px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.gh-tab:hover { color: var(--text); text-decoration: none; }
.gh-tab.active { color: var(--text); border-bottom-color: var(--cobalt); font-weight: 600; }
.gh-tab-count { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: var(--cobalt-dim); color: var(--ice); }
.gh-meta-badges { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); white-space: nowrap; }

.docs-shell { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 260px minmax(0, 1fr) 230px; gap: 28px; padding: 24px 20px 80px; align-items: start; }

.docs-sidebar { position: sticky; top: 112px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); overflow: hidden; }
.sidebar-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 11px; letter-spacing: 0.06em; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.branch-tag { color: var(--ice); background: var(--cobalt-dim); padding: 1px 6px; border-radius: 4px; }
.tree-group { padding: 8px; }
.tree-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 8px 4px; }
.tree-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; font-size: 12.5px; color: var(--text-2); text-decoration: none; }
.tree-link:hover { background: rgba(255,255,255,0.04); color: var(--text); text-decoration: none; }
.tree-link.active { background: var(--cobalt-dim); color: var(--ice); font-weight: 600; }
.tree-icon { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.75; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 14px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot a { color: var(--text-2); display: flex; justify-content: space-between; }
.sidebar-foot a:hover { color: var(--ice); }

.docs-main { min-width: 0; }
.readme-box { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev); overflow: hidden; }
.readme-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.readme-body { padding: 32px 38px 44px; }

.doc-section { scroll-margin-top: 115px; padding-bottom: 34px; margin-bottom: 34px; border-bottom: 1px solid var(--border); }
.doc-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.doc-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.shield { display: inline-flex; align-items: center; border-radius: 4px; overflow: hidden; font-size: 11px; border: 1px solid var(--border-hi); }
.shield-k { padding: 3px 8px; background: #101c30; color: var(--text-2); }
.shield-v { padding: 3px 8px; background: var(--cobalt-dim); color: var(--ice); font-weight: 600; }

.docs-main h1 { font-family: var(--display); font-size: clamp(26px, 3.4vw, 36px); line-height: 1.15; margin: 0 0 12px; }
.docs-main h2 { font-family: var(--display); font-size: 21px; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.docs-main h2 .sec-num { font-family: var(--mono); font-size: 12px; color: var(--ice); background: var(--cobalt-dim); border: 1px solid rgba(125,211,252,0.35); padding: 2px 7px; border-radius: 4px; }
.docs-main h3 { font-size: 16px; margin: 22px 0 8px; color: var(--text); }
.docs-main p, .docs-main ul { margin: 0 0 14px; color: var(--text-2); font-size: 14.5px; }
.docs-main ul { padding-left: 22px; }
.docs-main li { margin-bottom: 6px; }
.docs-main strong { color: var(--text); }
.docs-main code { font-family: var(--mono); font-size: 12.2px; background: rgba(125,211,252,0.08); border: 1px solid rgba(125,211,252,0.14); padding: 1.5px 5px; border-radius: 4px; color: #bae6fd; }

.callout { border: 1px solid var(--border-hi); border-left: 3px solid var(--cobalt); background: rgba(59,130,246,0.06); border-radius: 6px; padding: 14px 16px; margin: 16px 0; font-size: 13.5px; color: var(--text-2); }
.callout-title { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--ice); margin-bottom: 6px; letter-spacing: 0.04em; }

.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }
td { color: var(--text-2); }

.math-block { background: var(--bg-code); border: 1px solid var(--border-hi); border-radius: 8px; padding: 16px 18px; margin: 14px 0; font-family: var(--mono); font-size: 12.8px; line-height: 1.75; color: #e0f2fe; overflow-x: auto; }
.m-comment { color: var(--muted); }
.m-accent { color: var(--ice); font-weight: 600; }

.code-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 16px 0; background: var(--bg-code); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: rgba(255,255,255,0.025); border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.copy-code-btn { background: transparent; border: 1px solid var(--border-hi); color: var(--text-2); font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 5px; cursor: pointer; }
.copy-code-btn:hover { border-color: var(--ice); color: var(--ice); }
.code-card pre { margin: 0; padding: 16px; overflow-x: auto; font-family: var(--mono); font-size: 12.2px; line-height: 1.65; color: #d6e4f0; }
.code-card pre code { background: none; border: none; padding: 0; color: inherit; }
.tok-kw { color: #7dd3fc; }
.tok-fn { color: #60a5fa; }
.tok-str { color: #cbd5e1; }
.tok-cm { color: #627793; }
.tok-num { color: #f59e0b; }

.arch-box { border: 1px solid var(--border-hi); border-radius: 8px; background: var(--bg-code); padding: 18px; margin: 16px 0; overflow-x: auto; }
.arch-svg { width: 100%; min-width: 620px; height: auto; display: block; }

.proof-suite { border: 1px solid rgba(125,211,252,0.35); border-radius: 10px; background: linear-gradient(180deg, rgba(59,130,246,0.08) 0%, rgba(6,11,20,0.96) 28%); overflow: hidden; margin: 18px 0; box-shadow: 0 0 40px rgba(59,130,246,0.1); }
.proof-suite-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.proof-title-wrap { display: flex; align-items: center; gap: 10px; }
.live-pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ice); box-shadow: 0 0 10px var(--cobalt); }
.proof-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.proof-summary-bar { padding: 10px 18px; border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.28); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.proof-list { display: flex; flex-direction: column; }
.proof-row { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.05); display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.proof-row:last-child { border-bottom: none; }
.proof-status { display: inline-flex; align-items: center; justify-content: center; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; border: 1px solid var(--border-hi); color: var(--muted); }
.proof-status.pass { background: var(--cobalt-dim); border-color: rgba(125,211,252,0.45); color: var(--ice); }
.proof-status.fail { background: rgba(244,63,94,0.12); border-color: rgba(244,63,94,0.45); color: var(--crit); }
.proof-status.running { background: rgba(255,255,255,0.06); color: var(--text-2); }
.proof-name { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.proof-detail { font-size: 11.8px; color: var(--text-2); word-break: break-all; line-height: 1.55; }
.proof-ms { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.endpoint-card { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-code); margin: 14px 0; overflow: hidden; }
.endpoint-head { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.method-badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; margin-right: 8px; background: var(--cobalt-dim); color: var(--ice); }
.endpoint-out { margin: 0; padding: 12px 14px; font-size: 11.8px; color: #bae6fd; max-height: 240px; overflow: auto; background: #03060c; }

.docs-toc { position: sticky; top: 112px; display: flex; flex-direction: column; gap: 14px; }
.toc-card { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); padding: 14px; }
.toc-title { font-size: 11px; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 10px; }
.toc-links { display: flex; flex-direction: column; gap: 5px; }
.toc-links a { font-size: 12.5px; color: var(--text-2); padding: 4px 0 4px 10px; border-left: 2px solid transparent; text-decoration: none; }
.toc-links a.active { color: var(--ice); border-left-color: var(--cobalt); font-weight: 600; }
.verify-mini { border: 1px solid rgba(125,211,252,0.3); border-radius: 8px; background: rgba(59,130,246,0.06); padding: 14px; font-size: 12px; }
.verify-mini-row { display: flex; justify-content: space-between; margin-top: 6px; color: var(--text-2); }

.toast { position: fixed; bottom: 22px; right: 22px; background: var(--bg-elev); border: 1px solid var(--ice); color: var(--ice); padding: 9px 14px; border-radius: 6px; font-size: 12px; z-index: 90; }
.toast.hidden { opacity: 0; pointer-events: none; }

@media (max-width: 1160px) { .docs-shell { grid-template-columns: 230px minmax(0, 1fr); } .docs-toc { display: none; } }
@media (max-width: 860px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); padding: 14px 12px 60px; }
  .docs-sidebar { position: static; }
  .readme-body { padding: 20px 16px 28px; }
  .gh-meta-badges, .hide-xs { display: none; }
  .proof-row { grid-template-columns: 78px minmax(0, 1fr); }
  .proof-ms { grid-column: 2; }
}
