:root {
    --bg: #0a0e0d;
    --bg-soft: #0e1413;
    --surface: #121a18;
    --surface-2: #16211f;
    --border: #1f2c29;
    --border-hi: #2b3d39;
    --accent: #13eaba;
    --accent-dim: rgba(19, 234, 186, 0.12);
    --accent-glow: rgba(19, 234, 186, 0.28);
    --text: #ffffff;
    --muted: #828686;
    --radius: 12px;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;
    --sidebar-w: 272px;
    --topbar-h: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
code { font-family: var(--mono); }

/* ---------- topbar ---------- */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
    background: rgba(10, 14, 13, 0.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.topbar-logo .mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent);
    color: #04211a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 13px;
}
.topbar-logo .sub {
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
}
.topbar-sep { width: 1px; height: 22px; background: var(--border-hi); }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}
.topbar-nav a:hover { color: var(--text); background: var(--surface); }
.topbar-nav a.active { color: var(--accent); background: var(--accent-dim); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 9px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    min-width: 200px;
}
.search-btn:hover { border-color: var(--border-hi); color: var(--text); }
.search-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.search-btn kbd {
    margin-left: auto;
    font-size: 11px;
    font-family: var(--mono);
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border-hi);
    border-radius: 5px;
    padding: 1px 5px;
}

.btn-discord {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 9px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
}
.btn-discord:hover { border-color: var(--accent); color: var(--accent); }
.btn-discord svg { width: 15px; height: 15px; fill: currentColor; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    width: 34px; height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.menu-toggle:hover { background: var(--surface); }
.menu-toggle svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---------- layout ---------- */
.docs-shell {
    display: flex;
    padding-top: var(--topbar-h);
    min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    overflow-y: auto;
    padding: 22px 14px 60px;
    border-right: 1px solid var(--border);
    background: var(--bg-soft);
}
.side-group { margin-bottom: 4px; }
.side-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 9px 10px;
    margin-bottom: 0;
    background: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: color .15s, background .15s;
}
.side-title:hover { color: var(--text); background: var(--surface); }
.side-group.current > .side-title { color: var(--accent); }
.side-caret {
    width: 14px; height: 14px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .55;
    transform: rotate(-90deg);
    transition: transform .18s ease;
}
.side-group.open > .side-title .side-caret { transform: rotate(0deg); }
.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
}
.side-link:hover { color: var(--text); background: var(--surface); }
.side-link.active { color: var(--accent); background: var(--accent-dim); }
.side-link .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--border-hi);
    flex-shrink: 0;
}
.side-link.active .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }

.side-sub {
    margin-left: 8px;
    margin-top: 2px;
    margin-bottom: 8px;
    border-left: 1px solid var(--border);
    padding-left: 10px;
    display: none;
}
.side-group.open > .side-sub { display: block; }
.side-sub .side-link { font-size: 13px; font-weight: 500; padding: 6px 8px; }

/* ---------- content ---------- */
.docs-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    padding: 40px 32px 100px;
}
.docs-content { width: 100%; max-width: 760px; }
.docs-toc {
    width: 200px;
    flex-shrink: 0;
    padding: 40px 0 0;
    position: sticky;
    top: calc(var(--topbar-h) + 40px);
    align-self: flex-start;
    height: fit-content;
}
.toc-title { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc-link { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--border); font-size: 13px; color: var(--muted); font-weight: 500; }
.toc-link:hover { color: var(--text); }
.toc-link.active { color: var(--accent); border-color: var(--accent); }

/* ---------- typography ---------- */
.docs-content h1 { font-size: 34px; font-weight: 900; letter-spacing: -0.02em; margin-bottom: 10px; }
.docs-content .lead { font-size: 17px; color: var(--muted); margin-bottom: 28px; line-height: 1.65; }
.docs-content h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 44px 0 14px; scroll-margin-top: 80px; }
.docs-content h2:first-of-type { margin-top: 28px; }
.docs-content h3 { font-size: 16px; font-weight: 800; margin: 26px 0 10px; scroll-margin-top: 80px; }
.docs-content p { color: #d3dbd9; margin-bottom: 14px; font-size: 15px; }
.docs-content ul, .docs-content ol { color: #d3dbd9; margin: 0 0 16px 20px; font-size: 15px; }
.docs-content li { margin-bottom: 6px; }
.docs-content strong { color: var(--text); font-weight: 700; }
.docs-content code:not(pre code) {
    background: var(--surface-2);
    border: 1px solid var(--border-hi);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 13px;
}
.docs-content pre {
    background: #0d1412;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.6;
}
.docs-content pre code { color: #d3dbd9; background: none; border: none; padding: 0; }
.docs-content a:not(.badge-tag) { color: var(--accent); font-weight: 600; }
.docs-content a:not(.badge-tag):hover { text-decoration: underline; }

.docs-content table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; }
.docs-content th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-hi);
}
.docs-content td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: #d3dbd9; vertical-align: top; }
.docs-content tr:last-child td { border-bottom: none; }

.callout {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--muted);
    margin: 0 0 18px;
    font-size: 14px;
}
.callout.tip { border-left-color: var(--accent); }
.callout.warn { border-left-color: var(--text); }
.callout p { margin: 0; color: #d3dbd9; }
.callout .icon { flex-shrink: 0; font-size: 16px; }

/* ---------- badges / tags ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tag {
    font-size: 12px;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border-hi);
    color: var(--muted);
}
.tag.accent { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* ---------- prev/next ---------- */
.docs-footnav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.footnav-link {
    flex: 1;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}
.footnav-link:hover { border-color: var(--accent); }
.footnav-link.next { text-align: right; }
.footnav-dir { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.footnav-name { font-size: 14px; font-weight: 700; color: var(--text); }

/* ---------- landing (index) ---------- */
.docs-hero { max-width: 640px; margin: 0 auto 48px; text-align: center; padding-top: 20px; }
.docs-hero h1 { font-size: 38px; font-weight: 900; letter-spacing: -0.02em; margin-bottom: 12px; }
.docs-hero p { color: var(--muted); font-size: 17px; }

.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.product-card {
    display: block;
    padding: 22px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .15s, transform .15s;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.product-card .p-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}
.product-card h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.product-card p { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin-bottom: 14px; }
.product-card .cta { font-size: 13px; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 5px; }

.help-band {
    margin-top: 56px;
    padding: 26px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.help-band h3 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.help-band p { font-size: 14px; color: var(--muted); }
.help-band .btn-discord { padding: 10px 18px; }

/* ---------- search modal ---------- */
.search-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(4, 7, 6, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}
.search-overlay.open { display: flex; }
.search-modal {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search-input-row svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.search-input-row input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
    font-family: var(--font);
}
.search-input-row input::placeholder { color: var(--muted); }
.search-results { overflow-y: auto; padding: 8px; }
.search-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.search-result {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
}
.search-result:hover, .search-result.active { background: var(--accent-dim); }
.search-result .r-page { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.search-result .r-title { font-size: 14px; font-weight: 700; color: var(--text); }
.search-result .r-snippet { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
mark { background: var(--accent-dim); color: var(--accent); border-radius: 3px; padding: 0 1px; }

/* ---------- overlay for mobile sidebar ---------- */
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 55; }
.mobile-overlay.open { display: block; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
    .docs-toc { display: none; }
}
@media (max-width: 860px) {
    .menu-toggle { display: flex; }
    .topbar-nav { display: none; }
    .search-btn { min-width: 0; width: 38px; padding: 8px; justify-content: center; }
    .search-btn span, .search-btn kbd { display: none; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        z-index: 56;
        box-shadow: 20px 0 40px rgba(0,0,0,0.4);
    }
    .sidebar.open { transform: translateX(0); }
    .docs-main { margin-left: 0; padding: 28px 18px 80px; }
    .product-grid { grid-template-columns: 1fr; }
    .docs-hero h1 { font-size: 28px; }
}
