:root {
    --primary: #facc15;
    --bg: #0d0d0d;
    --bg-alt: #141414;
    --surface: #1a1a1a;
    --border: #2a2a2a;
    --text: #f5f5f5;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 4rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    touch-action: manipulation;
}

* {
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

.lang-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem;
}

.lang-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.lang-btn.active {
    background: var(--primary);
    color: #000;
    font-weight: 500;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.sidebar {
    width: 260px;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    left: 0;
    top: 0;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1002;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.overlay.active {
    display: block;
}

.sidebar-logo {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 1.125rem;
}

.sidebar-logo img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.sidebar-nav {
    padding: 0 0.75rem;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--surface);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary);
    color: #000;
    font-weight: 500;
}

.main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem 3rem;
    max-width: 900px;
    overflow-x: hidden;
    width: 100%;
}

.toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    display: none;
}

.toc-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.toc-list a:hover {
    background: var(--surface-elevated);
    color: var(--text);
}

.doc-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary);
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

ul {
    margin: 0.5rem 0 1rem 1.5rem;
    color: var(--text-secondary);
}

li {
    margin-bottom: 0.5rem;
}

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

a:hover {
    text-decoration: underline;
}

code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--surface);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--primary);
}

pre {
    background: var(--surface);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border);
    max-width: 100%;
    word-wrap: break-word;
    white-space: pre-wrap;
    word-break: break-word;
}

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

.code-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 1rem 0;
}

.code-header {
    display: flex;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.code-content {
    padding: 1rem 1.25rem;
}

.code-content code {
    background: none;
    padding: 0;
}

.note {
    background: var(--surface);
    border-left: 3px solid var(--primary);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
}

.note-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.note p {
    margin: 0;
    font-size: 0.875rem;
}

.keyword {
    color: #ff79c6;
}

.string {
    color: #f1fa8c;
}

.function {
    color: #50fa7b;
}

.comment {
    color: #6272a4;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    overflow-x: auto;
    display: block;
    max-width: 100%;
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    background: var(--surface-elevated);
    font-weight: 600;
}

table tr:hover {
    background: var(--surface);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 1.5rem;
        padding-top: 4rem;
        width: 100%;
        max-width: 100%;
    }

    .toc {
        display: block;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .code-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    pre {
        font-size: 0.8rem;
        padding: 0.75rem 1rem;
    }

    code {
        font-size: 0.8rem;
    }

    table {
        font-size: 0.8rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }
}

@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: none;
    }
}