:root {
    --bg: #1a1a2e;
    --fg: #e0e0e0;
    --accent: #e94560;
    --accent2: #0f3460;
    --code-bg: #16213e;
    --tab-bg: #0f3460;
    --tab-active: #e94560;
    --border: #333;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.7;
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */

.sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: 200px;
    min-width: 200px;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 0.5rem 1.5rem 1rem;
    border-right: 1px solid var(--border);
    font-size: 0.8rem;
}
.sidebar ul { list-style: none; padding-left: 0; }
.sidebar li { margin-bottom: 0; }
.sidebar a { color: var(--fg); text-decoration: none; opacity: 0.7; display: block; padding: 0.25rem 0.5rem; border-radius: 4px; }
.sidebar a:hover { opacity: 1; color: var(--accent); background: rgba(233, 69, 96, 0.1); }

.content {
    flex: 1;
    max-width: 800px;
    padding: 2rem 1.5rem;
}

@media (max-width: 900px) {
    body { display: block; }
    .sidebar { display: none; }
    .content { max-width: 100%; }
}

/* ── Typography ───────────────────────────────────────────────────── */

h1 { color: var(--accent); margin-bottom: 0.5rem; font-size: 2rem; }
h2 { color: var(--accent); margin-top: 2.5rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
h3 { color: var(--fg); margin-top: 1.5rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.3rem; }
a { color: var(--accent); }
.subtitle { color: #888; margin-bottom: 2rem; }

code {
    background: var(--code-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

/* ── Tables ───────────────────────────────────────────────────────── */

table {
    border-collapse: collapse;
    margin-bottom: 1rem;
    width: 100%;
}
th, td {
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    text-align: left;
}
th { background: var(--tab-bg); }

/* ── Code blocks (tabs with SLN/C toggle) ─────────────────────────── */

.tabs {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.tab-bar {
    display: flex;
    background: var(--tab-bg);
}
.tab-bar button {
    background: none;
    border: none;
    color: var(--fg);
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.6;
    transition: opacity 0.15s, border-color 0.15s;
    border-bottom: 2px solid transparent;
}
.tab-bar button.active {
    opacity: 1;
    border-bottom-color: var(--tab-active);
}
.tab-bar button:hover { opacity: 0.9; }
.tab-content {
    display: none;
    background: var(--code-bg);
}
.tab-content.active { display: block; }
.tab-content pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ── Code blocks (single, no tabs) ────────────────────────────────── */

.example {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.example pre {
    background: var(--code-bg);
    padding: 1rem 1.2rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
}

/* ── Output blocks ────────────────────────────────────────────────── */

.output pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ── Copy button ──────────────────────────────────────────────────── */

.copy-button {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--tab-bg);
    border: none;
    color: var(--fg);
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.copy-button:hover { opacity: 1; }
.copy-button.copied { opacity: 1; color: #4caf50; }

/* ── Side-by-side (c-interop) ─────────────────────────────────────── */

.side-by-side { display: flex; gap: 1rem; margin-bottom: 1rem; }
.side-by-side > div { flex: 1; }
.side-by-side pre { margin-bottom: 0; }
@media (max-width: 700px) { .side-by-side { flex-direction: column; } }

/* ── Bare pre (c-interop, standalone code blocks) ─────────────────── */

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}
.tabs pre, .example pre { border: none; border-radius: 0; }
