:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --accent: #e8943a;
    --accent-glow: rgba(232, 148, 58, 0.3);
    --accent-light: #f0a84c;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --success: #10b981;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    /* clip, nie hidden: hidden robi z body kontener przewijania i wtedy
       position: sticky w sidebarze przestaje działać */
    overflow-x: clip;
}

.brand {
    color: var(--accent-light);
    font-weight: 600;
}

.content {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.back-link:hover { text-decoration: underline; }

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

h1 .gradient {
    background: linear-gradient(135deg, #e8943a, #f0c040, #ff6b2b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1 .title-icon {
    height: 96px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(232, 148, 58, 0.4));
}

.tagline {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
}

details {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
    scroll-margin-top: 80px;
    position: relative;
}

details::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    transition: width 0.4s ease, left 0.4s ease;
    pointer-events: none;
}

details:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 0 24px rgba(232, 148, 58, 0.28), 0 8px 24px rgba(232, 148, 58, 0.15);
}

details:hover::after {
    width: 80%;
    left: 10%;
}

details[open] {
    border-color: var(--accent);
    transform: none;
    box-shadow: 0 0 20px rgba(232, 148, 58, 0.12);
}

details[open]::after { width: 0; left: 50%; }

summary {
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    user-select: none;
    list-style: none;
    transition: background 0.2s;
}

summary::-webkit-details-marker { display: none; }

summary::after {
    content: '▸';
    margin-left: auto;
    font-size: 1.2rem;
    color: var(--accent);
    transition: transform 0.3s;
}

details[open] > summary::after { transform: rotate(90deg); }
summary:hover {
    background: rgba(232, 148, 58, 0.05);
    box-shadow: inset 0 0 20px rgba(232, 148, 58, 0.06);
}
summary:active {
    background: rgba(232, 148, 58, 0.1);
    transform: scale(0.99);
    transition: all 0.08s ease;
}

.cta-inline-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin: 0 1rem;
    transition: text-shadow 0.2s;
}
.cta-inline-link:hover {
    text-shadow: 0 0 12px rgba(232, 148, 58, 0.5);
}
.cta-inline-link:active {
    text-shadow: 0 0 20px rgba(232, 148, 58, 0.7);
    transition: all 0.08s ease;
}

summary .icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(232, 148, 58, 0.25));
}

.detail-content {
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid var(--border);
}

.detail-content p,
.doc-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 1rem 0 0.8rem;
}

.detail-content strong,
.doc-body strong { color: var(--text-primary); }

.detail-content ol, .detail-content ul,
.doc-body ol, .doc-body ul {
    color: var(--text-secondary);
    padding-left: 1.5rem;
    margin: 0.5rem 0 1rem;
    font-size: 0.95rem;
}

.detail-content li,
.doc-body li { margin-bottom: 0.5rem; }

.detail-content h3,
.doc-body h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-light);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.detail-content h4,
.doc-body h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.2rem;
    margin-bottom: 0.35rem;
    padding-left: 0.6rem;
    border-left: 3px solid var(--accent);
}

code {
    background: var(--bg-secondary);
    color: var(--accent-light);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.8rem 0 1.2rem;
    font-size: 0.82rem;
    line-height: 1.6;
}

pre code { background: none; padding: 0; color: var(--text-secondary); }

.tip-box {
    background: rgba(232, 148, 58, 0.08);
    border: 1px solid rgba(232, 148, 58, 0.2);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tip-box strong { color: var(--accent-light); }

.byok-highlight {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.10), rgba(20, 184, 166, 0.02));
    border: 1px solid rgba(20, 184, 166, 0.35);
    border-left: 4px solid #14b8a6;
    border-radius: 10px;
    padding: 1.3rem 1.5rem;
    margin: 1.2rem 0 1.8rem;
}
.byok-highlight h4 {
    color: #2dd4bf;
    margin: 0 0 0.6rem;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.byok-highlight p {
    margin: 0.4rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}
.byok-highlight ul {
    margin: 0.6rem 0 0.4rem;
    padding-left: 1.3rem;
    color: var(--text-secondary);
}
.byok-highlight ul li {
    margin: 0.3rem 0;
    font-size: 0.95rem;
}
.byok-highlight strong { color: var(--text-primary); }
.byok-highlight .byok-emph { color: #2dd4bf; font-weight: 700; }

.section-screenshot {
    display: block;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 1rem 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.section-screenshot:hover {
    border-color: rgba(232, 148, 58, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* Wariant obok opisu — dla wąskich, wysokich zrzutów (np. panel AI).
   Obraz pływa po lewej, tekst opływa z prawej; na wąskim ekranie wraca na całą szerokość. */
.screenshot-aside {
    float: left;
    width: 300px;
    max-width: 45%;
    margin: 1rem 1.5rem 1rem 0;
}
@media (max-width: 720px) {
    .screenshot-aside {
        float: none;
        width: 100%;
        max-width: 100%;
        margin: 1rem 0;
    }
}

.screenshot-caption {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin: -0.5rem 0 1rem;
    font-style: italic;
}

.kbd {
    display: inline-block;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.82rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text-primary);
}

/* ── Video Tutorials section ── */
.video-tutorials {
    margin-bottom: 2.5rem;
}

.video-tutorials h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.video-card:hover {
    border-color: rgba(232, 148, 58, 0.4);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.video-card-header {
    padding: 1.1rem 1.4rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

.video-badge {
    display: inline-block;
    background: rgba(232, 148, 58, 0.15);
    border: 1px solid rgba(232, 148, 58, 0.35);
    color: var(--accent-light);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
}

.video-card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

.video-card video {
    display: block;
    width: 100%;
    background: #000;
    max-height: 480px;
}

.video-card-footer {
    padding: 0.9rem 1.4rem;
}

.video-card-footer p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.video-more-note {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

footer {
    border-top: 1px solid var(--border);
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.footer-brand { display: flex; align-items: center; gap: 0.6rem; }
.footer-logo { width: 80px; height: auto; border-radius: 0; filter: drop-shadow(0 0 10px rgba(232, 148, 58, 0.3)); }
.footer-links { display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 1rem; font-weight: 500; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent-light); }
.footer-download { color: var(--accent-light) !important; font-weight: 600 !important; }
.footer-copy { font-size: 0.85rem; color: var(--text-muted); }

footer a { color: var(--accent); text-decoration: none; }

/* Inline links inside any help section — high-contrast accent + subtle underline.
   Without this, browsers fall back to the dark blue / purple defaults, which
   barely show against #0a0e17. */
.detail-content a,
.detail-content a:visited,
.doc-body a,
.doc-body a:visited {
    color: var(--accent-light);
    text-decoration: underline;
    text-decoration-color: rgba(240, 168, 76, 0.45);
    text-underline-offset: 2px;
    transition: color 0.15s, text-decoration-color 0.15s;
}
.detail-content a:hover,
.doc-body a:hover {
    color: #ffbd6c;
    text-decoration-color: var(--accent);
}

@media (max-width: 640px) {
    .content { padding: 2rem 1rem; }
    h1 { font-size: 1.6rem; }
    h1 .title-icon { height: 64px; }
    summary { font-size: 1rem; padding: 1rem; }
    summary .icon { width: 36px; height: 36px; }
}

/* ═══════════ OS Tabs — single global picker (used in #ai-setup) ═══════════ */
.ai-setup-wrapper input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.os-tabs-bar {
    margin: 1.5rem 0 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(232, 148, 58, 0.04);
}
.os-pick-hint {
    margin: 0;
    padding: 0.55rem 1rem 0.1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0.85;
}
.os-tabs-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
}
.os-tabs-buttons label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-right: 1px solid var(--border);
    transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
    user-select: none;
    opacity: 0.75;
}
.os-tabs-buttons label:last-of-type { border-right: none; }
.os-tabs-buttons label:hover { opacity: 1; background: rgba(232, 148, 58, 0.05); }
.os-tabs-buttons .os-icon {
    width: auto;
    height: 4.875em;        /* +25% from 3.9em */
    object-fit: contain;
    display: block;
}
.os-content { margin: 0.5rem 0 2rem; }
.os-content .tab-content { display: none; }
/* Show only the tab matching the selected radio.
   Two selectors per OS:
     1. .os-content directly under .ai-setup-wrapper (Before-you-start, Node, Troubleshooting)
     2. .os-content nested inside .agent-content (the Claude/Codex install blocks)
   The general-sibling combinator `~` only matches siblings of the radio, so the
   nested case needs an extra descendant step. */
.ai-setup-wrapper #os-global-linux:checked ~ .os-content .tab-content.tab-linux,
.ai-setup-wrapper #os-global-linux:checked ~ .agent-content .os-content .tab-content.tab-linux,
.ai-setup-wrapper #os-global-mac:checked   ~ .os-content .tab-content.tab-mac,
.ai-setup-wrapper #os-global-mac:checked   ~ .agent-content .os-content .tab-content.tab-mac,
.ai-setup-wrapper #os-global-win:checked   ~ .os-content .tab-content.tab-win,
.ai-setup-wrapper #os-global-win:checked   ~ .agent-content .os-content .tab-content.tab-win {
    display: block;
}
/* highlight the active tab button (full opacity + accent underline) */
.ai-setup-wrapper #os-global-linux:checked ~ .os-tabs-bar label[for="os-global-linux"],
.ai-setup-wrapper #os-global-mac:checked   ~ .os-tabs-bar label[for="os-global-mac"],
.ai-setup-wrapper #os-global-win:checked   ~ .os-tabs-bar label[for="os-global-win"] {
    opacity: 1;
    background: rgba(232, 148, 58, 0.1);
    box-shadow: inset 0 -3px 0 var(--accent);
}
.os-content pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 0.5rem 0;
    color: var(--text-secondary);
}
.os-content code {
    background: rgba(232, 148, 58, 0.1);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--accent-light);
}
.os-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}
@media (max-width: 640px) {
    .os-tabs-buttons label { padding: 0.4rem 0.5rem; }
    .os-tabs-buttons .os-icon { height: 3.5em; }
}

/* ═══════════ Agent picker (Claude vs Codex) — same trick as OS tabs ═══════════ */
.agent-tabs-bar {
    margin: 0.5rem 0 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(232, 148, 58, 0.04);
}
.agent-tabs-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
}
.agent-tabs-buttons label {
    flex: 1;
    text-align: center;
    padding: 0.7rem 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
    transition: background 0.15s, opacity 0.15s, box-shadow 0.15s, color 0.15s;
    user-select: none;
    opacity: 0.75;
    font-weight: 600;
    line-height: 1.3;
}
.agent-tabs-buttons label:last-of-type { border-right: none; }
.agent-tabs-buttons label:hover { opacity: 1; background: rgba(232, 148, 58, 0.05); }
.agent-vendor {
    display: block;
    font-weight: 400;
    font-size: 0.78em;
    opacity: 0.7;
    margin-top: 0.15em;
}
.agent-content { display: none; margin: 0.5rem 0 1.5rem; }
.ai-setup-wrapper #agent-pick-claude:checked ~ .agent-content.agent-claude,
.ai-setup-wrapper #agent-pick-codex:checked  ~ .agent-content.agent-codex {
    display: block;
}
.ai-setup-wrapper #agent-pick-claude:checked ~ .agent-tabs-bar label[for="agent-pick-claude"],
.ai-setup-wrapper #agent-pick-codex:checked  ~ .agent-tabs-bar label[for="agent-pick-codex"] {
    opacity: 1;
    color: var(--accent-light);
    background: rgba(232, 148, 58, 0.1);
    box-shadow: inset 0 -3px 0 var(--accent);
}

/* ═══════════ Copy-to-clipboard button (injected on every <pre>) ═══════════ */
pre { position: relative; }
.copy-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: rgba(232, 148, 58, 0.15);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.3rem 0.55rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-family: inherit;
}
pre:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover {
    background: rgba(232, 148, 58, 0.3);
    color: var(--accent-light);
    border-color: var(--accent);
}
.copy-btn.copied {
    background: rgba(72, 200, 100, 0.22);
    color: #62cf80;
    border-color: rgba(72, 200, 100, 0.6);
    opacity: 1;
}
.copy-btn .copy-icon {
    width: 0.95em;
    height: 0.95em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
/* always visible on touch devices (no :hover) */
@media (hover: none) {
    .copy-btn { opacity: 0.85; }
}

/* ── Tabela parametrów ── */
.param-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}
.param-table th {
    text-align: left;
    padding: 0.7rem 1rem;
    background: var(--bg-secondary);
    color: var(--accent-light);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.param-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-secondary);
}
.param-table td:first-child {
    white-space: nowrap;
    color: var(--text-primary);
}
.param-table tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   STRONY DZIAŁOWE — sidebar z drzewkiem + treść
   Używane przez help/<dzial>/index.html. Stary help/index.html (spis treści
   w blokach <details>) korzysta z .content i tej sekcji nie dotyka.
   Próg 1000 px: powyżej sidebar stoi po lewej, poniżej chowa się w szufladzie.
   ═══════════════════════════════════════════════════════════════════════════ */

.doc-layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 264px minmax(0, 900px);
    justify-content: center;
    gap: 3.5rem;
    padding: 2.5rem 2rem 5rem;
    align-items: start;
}

/* ── Sidebar ── */
.doc-sidebar {
    /* fixed, nie sticky: sticky wypycha sidebar w górę, gdy strona dojeżdża
       do końca układu, więc przy skoku odnośnikiem widać ruch.
       Kolumna w siatce zostaje pusta i trzyma miejsce.
       left: lewa krawędź pierwszej kolumny — 610 px to połowa szerokości
       układu (264 sidebar + 56 przerwa + 900 treść). */
    position: fixed;
    top: 98px;
    width: 264px;
    left: max(2rem, calc(50% - 610px));
    max-height: calc(100vh - 118px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 0.75rem 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.doc-sidebar::-webkit-scrollbar { width: 8px; }
.doc-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.doc-sidebar-naglowek {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 0 0.8rem 0.9rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.8rem;
}

/* ── Drzewko działów ── */
.doc-tree, .doc-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.doc-tree a {
    display: block;
    padding: 0.42rem 0.75rem 0.42rem 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    line-height: 1.35;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.doc-tree a:hover {
    color: var(--text-primary);
    background: rgba(232, 148, 58, 0.06);
}

/* dział, na którym stoisz */
.doc-tree > li.aktywny > a {
    color: var(--accent-light);
    font-weight: 600;
    border-left-color: var(--accent);
    background: rgba(232, 148, 58, 0.08);
}

/* sekcje strony — widoczne wyłącznie pod aktywnym działem */
/* selektor z .doc-tree, bo samo .doc-tree-sekcje przegrywa
   z resetem .doc-tree ul { margin: 0 } i wcięcie znika */
.doc-tree .doc-tree-sekcje {
    display: none;
    margin: 0.15rem 0 0.5rem 1.1rem;
    padding-left: 0.2rem;
    border-left: 1px solid var(--border);
}
.doc-tree > li.aktywny > .doc-tree-sekcje { display: block; }
.doc-tree .doc-tree-sekcje .doc-tree-sekcje { display: block; }
.doc-tree-sekcje a {
    font-size: 0.86rem;
    padding: 0.3rem 0.6rem 0.3rem 0.85rem;
    color: var(--text-muted);
    border-radius: 0 5px 5px 0;
}
.doc-tree-sekcje a.widoczna {          /* sekcja aktualnie na ekranie */
    color: var(--accent-light);
    background: rgba(232, 148, 58, 0.07);
    border-left-color: var(--accent);
}
.doc-tree-licznik {
    float: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

/* ── Treść ── */
.doc-main {
    min-width: 0;
    /* sidebar jest fixed i nie zajmuje swojej kolumny — bez tego
       treść wskoczyłaby na jego miejsce */
    grid-column: 2;
}

.doc-main h1 {
    display: block;                    /* globalne h1 jest flexem na środku */
    text-align: left;
    font-size: 2rem;
    margin-bottom: 0.4rem;
}
.doc-body h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2.6rem 0 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 90px;
}
.doc-body > h2:first-of-type { margin-top: 2rem; }
.doc-body code {
    background: rgba(232, 148, 58, 0.1);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--accent-light);
}
.doc-body pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    padding: 0.9rem 1.1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
}
.doc-body pre code { background: none; padding: 0; color: inherit; }
.doc-body .tagline {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

/* ── Przycisk szuflady (tylko wąskie ekrany) ── */
.doc-nav-toggle {
    display: none;
    align-items: center;
    gap: 0.55rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
}
.doc-nav-toggle svg {
    width: 1.15em;
    height: 1.15em;
    stroke: var(--accent);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}
.doc-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 59;
}
.doc-backdrop.otwarty { display: block; }
.doc-sidebar-zamknij { display: none; }

@media (max-width: 1000px) {
    .doc-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.2rem;
        padding: 1.2rem 1.1rem 4rem;
    }
    .doc-nav-toggle {
        display: flex;
        position: sticky;
        top: 66px;
        z-index: 40;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    }
    .doc-sidebar {
        position: fixed;
        top: 58px;
        left: 0;
        bottom: 0;
        width: min(88vw, 330px);
        max-height: none;
        background: var(--bg-secondary);
        border-right: 1px solid var(--border);
        padding: 1.2rem 0.9rem 2rem;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 60;
    }
    .doc-sidebar.otwarty { transform: none; }
    .doc-main { grid-column: auto; }
    .doc-sidebar-zamknij {
        display: block;
        width: 100%;
        margin-top: 1.5rem;
        padding: 0.7rem;
        background: none;
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text-secondary);
        font: inherit;
        cursor: pointer;
    }
    .doc-main h1 { font-size: 1.65rem; }
    .doc-body h2 { font-size: 1.2rem; margin-top: 2rem; }
}

/* ── Zrzut ekranu na pełny ekran po kliknięciu ── */
.doc-body .section-screenshot { cursor: zoom-in; }
.img-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(4, 6, 11, 0.94);
    padding: 2rem;
    cursor: zoom-out;
}
.img-lightbox.otwarty {
    display: flex;
    align-items: center;
    justify-content: center;
}
.img-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.img-lightbox-podpis {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1.2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0 2rem;
}

/* ═══════════ Referencja API — lista funkcji z wyszukiwarką ═══════════ */
.api-search-bar {
    position: sticky;
    top: 66px;
    z-index: 30;
    background: var(--bg-primary);
    padding: 1rem 0 0.9rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.api-search-pole {
    position: relative;
    display: flex;
    align-items: center;
}
.api-search-pole svg {
    position: absolute;
    left: 0.85rem;
    width: 1.05em;
    height: 1.05em;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
    pointer-events: none;
}
.api-search {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.95rem;
}
.api-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232, 148, 58, 0.12);
}
.api-search::placeholder { color: var(--text-muted); }
.api-search-info {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    min-height: 1.2em;
}

.api-group { margin-bottom: 2rem; }
.api-group.ukryta { display: none; }

/* pozycja funkcji — details bez efektów, jakie ma spis działów */
.api-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    scroll-margin-top: 130px;
}
.api-item:hover {
    border-color: rgba(232, 148, 58, 0.55);
    transform: none;
    box-shadow: none;
}
.api-item::after { display: none; }
.api-item[open] {
    border-color: var(--accent);
    box-shadow: none;
}
.api-item.ukryta { display: none; }

.api-item > summary {
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    gap: 0.7rem;
    align-items: baseline;
    flex-wrap: wrap;
}
.api-item > summary:hover { background: rgba(232, 148, 58, 0.05); }
.api-nazwa {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent-light);
    white-space: nowrap;
}
.api-skrot {
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 400;
    flex: 1 1 240px;
    min-width: 0;
}
.api-tresc {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border);
}
.api-tresc p { margin: 0.9rem 0 0.6rem; }
.api-sygnatura {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    margin: 0.9rem 0;
    overflow-x: auto;
    white-space: pre;
}
.api-uwaga {
    border-left: 3px solid var(--accent);
    background: rgba(232, 148, 58, 0.06);
    padding: 0.6rem 0.9rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.8rem 0 0;
}
.api-pusto {
    display: none;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
}
.api-pusto.widoczna { display: block; }

@media (max-width: 1000px) {
    .api-search-bar { top: 122px; }        /* pod przyciskiem szuflady */
    .api-item > summary { padding: 0.65rem 0.8rem; }
    .api-nazwa { white-space: normal; }
}

/* pozycja drzewka wskazująca stronę, na której stoisz */
.doc-tree a.biezaca { color: var(--accent-light); font-weight: 600; }
.doc-tree-sekcje a.biezaca { border-left-color: var(--accent); }

/* ── Pozycja spisu treści prowadząca na osobną stronę działu ── */
.dzial-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1.2rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}
.dzial-link:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 0 24px rgba(232, 148, 58, 0.28), 0 8px 24px rgba(232, 148, 58, 0.15);
}
.dzial-link .icon { width: 48px; height: 48px; object-fit: contain; }
.dzial-link-strzalka {
    margin-left: auto;
    color: var(--accent);
    font-size: 1.3rem;
    transition: transform 0.25s ease;
}
.dzial-link:hover .dzial-link-strzalka { transform: translateX(4px); }

/* pozycja działu, którego rozdziału jeszcze nie ma */
.doc-tree-wkrotce {
    display: block;
    padding: 0.42rem 0.75rem 0.42rem 0.9rem;
    font-size: 0.92rem;
    color: var(--text-muted);
    opacity: 0.55;
    cursor: default;
}
.doc-tree-wkrotce em {
    font-style: normal;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05em 0.35em;
    margin-left: 0.3em;
}

/* spis treści zachowuje wyśrodkowany tytuł z ikoną */
.doc-main h1.tytul-srodek {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 2.2rem;
}
.doc-main .tagline { text-align: center; }
