*,
*::before,
*::after {
    box-sizing: border-box;
}

body.wiki-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0a0f1e;
    color: #e2e8f0;
    line-height: 1.6;
}

.wiki-layout {
    display: flex;
    min-height: 100vh;
}

.wiki-sidebar {
    width: 320px;
    flex-shrink: 0;
    padding: 32px 20px;
    border-right: 1px solid #1e293b;
    background: #0a0f1e;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wiki-sidebar::-webkit-scrollbar {
    display: none;
}

.wiki-sidebar-header {
    display: block;
    margin-bottom: 28px;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.wiki-sidebar-header:hover {
    background: rgba(30, 41, 59, 0.6);
}

.wiki-sidebar-header:hover .wiki-sidebar-title {
    color: #ffffff;
}

.wiki-sidebar-header:hover .wiki-sidebar-subtitle {
    color: #94a3b8;
}

.wiki-sidebar-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.wiki-sidebar-subtitle {
    margin: 4px 0 0;
    font-size: 0.875rem;
    color: #64748b;
}

.wiki-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wiki-nav-top-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #1e293b;
}

.wiki-nav-top-link {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.wiki-nav-top-link:hover {
    background: rgba(30, 41, 59, 0.6);
    color: #ffffff;
}

.wiki-nav-top-link.is-active {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.wiki-nav-category {
    border: 1px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.5);
}

.wiki-nav-category-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.wiki-nav-category-toggle:hover {
    background: rgba(30, 41, 59, 0.6);
    color: #ffffff;
}

.wiki-nav-category-label {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
}

.wiki-nav-category-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wiki-nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.18);
    color: #93c5fd;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.wiki-nav-category.is-open .wiki-nav-count {
    background: rgba(37, 99, 235, 0.3);
    color: #bfdbfe;
}

.wiki-nav-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #64748b;
}

.wiki-nav-category.is-open .wiki-nav-chevron {
    transform: rotate(90deg);
}

.wiki-nav-articles {
    display: none;
    padding: 2px 8px 10px;
    border-top: 1px solid rgba(30, 41, 59, 0.8);
}

.wiki-nav-category.is-open .wiki-nav-articles {
    display: block;
}

.wiki-nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.wiki-nav-link:hover {
    color: #ffffff;
    background: rgba(30, 41, 59, 0.8);
}

.wiki-nav-link.is-active {
    background: #2563eb;
    color: #ffffff;
    font-weight: 500;
}

.wiki-main {
    flex: 1;
    min-width: 0;
    padding: 48px 48px 80px 64px;
}

.wiki-article-layout {
    display: flex;
    gap: 40px;
}

.wiki-article-body {
    flex: 1;
    min-width: 0;
    max-width: 720px;
}

.wiki-breadcrumb {
    margin: 0 0 20px;
    font-size: 0.875rem;
    color: #64748b;
}

.wiki-breadcrumb a {
    color: #64748b;
    text-decoration: none;
}

.wiki-breadcrumb a:hover {
    color: #94a3b8;
}

.wiki-tag {
    display: inline-block;
    margin-bottom: 16px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    font-size: 0.75rem;
    font-weight: 500;
}

.wiki-article-title {
    margin: 0 0 24px;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.wiki-article-content {
    font-size: 0.95rem;
    color: #cbd5e1;
}

.wiki-article-content p {
    margin: 0 0 16px;
}

.wiki-article-content h2 {
    margin: 32px 0 16px;
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
}

.wiki-article-content h3 {
    margin: 24px 0 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
}

.wiki-article-content a {
    color: #60a5fa;
    text-decoration: none;
}

.wiki-article-content a:hover {
    text-decoration: underline;
}

.wiki-article-content ul ul {
    margin-top: 8px;
    margin-bottom: 0;
}

.wiki-article-content .wiki-warning {
    margin: 16px 0;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.1);
    color: #fde68a;
}

.wiki-article-content .wiki-warning p {
    margin: 0;
}

.wiki-article-content .wiki-callout {
    margin: 20px 0;
    padding: 16px 18px;
    border-radius: 10px;
    border: 1px solid #1e293b;
    background: #141b2d;
}

.wiki-article-content .wiki-callout p {
    margin: 0;
}

.wiki-article-content .wiki-callout p + p {
    margin-top: 8px;
}

.wiki-article-content .wiki-callout-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ffffff;
}

.wiki-article-content .wiki-callout-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.wiki-article-content .wiki-callout-danger {
    border-left: 3px solid #ef4444;
}

.wiki-article-content .wiki-callout-danger .wiki-callout-icon {
    color: #ef4444;
}

.wiki-article-content .wiki-callout-danger p:not(.wiki-callout-title) {
    color: #94a3b8;
}

.wiki-article-content ol,
.wiki-article-content ul {
    margin: 0 0 16px;
    padding-left: 1.5rem;
}

.wiki-article-content li {
    margin-bottom: 8px;
}

.wiki-article-content code {
    padding: 2px 6px;
    border-radius: 4px;
    background: #1e293b;
    color: #7dd3fc;
    font-size: 0.875em;
    font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
}

.wiki-code-block {
    margin-top: 16px;
    padding: 20px 24px;
    border-radius: 8px;
    background: #0f172a;
    border: 1px solid #1e293b;
    font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.8;
    color: #94a3b8;
    white-space: pre-wrap;
}

.wiki-placeholder {
    padding: 48px 0;
    color: #64748b;
    font-size: 1rem;
}

.wiki-figure {
    margin: 20px 0 24px;
}

.wiki-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 24px;
    border: 2px dashed #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #64748b;
    font-size: 0.9375rem;
    text-align: center;
}

.wiki-figure figcaption {
    margin-top: 8px;
    color: #64748b;
    font-size: 0.875rem;
    text-align: center;
}

.wiki-article-nav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #1e293b;
}

.wiki-article-nav-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 48%;
    text-decoration: none;
    transition: color 0.15s ease;
}

.wiki-article-nav-prev {
    text-align: left;
}

.wiki-article-nav-next {
    text-align: right;
    margin-left: auto;
}

.wiki-article-nav-label {
    font-size: 0.875rem;
    color: #64748b;
}

.wiki-article-nav-title {
    font-size: 1rem;
    font-weight: 500;
    color: #38bdf8;
    line-height: 1.4;
}

.wiki-article-nav-link:hover .wiki-article-nav-title {
    text-decoration: underline;
}

.wiki-toc {
    width: 240px;
    flex-shrink: 0;
}

.wiki-toc-inner {
    position: sticky;
    top: 32px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 20px 16px;
    border-radius: 12px;
    background: #141b2d;
    border: 1px solid #1e293b;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.wiki-toc-inner::-webkit-scrollbar {
    width: 4px;
}

.wiki-toc-inner::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: #334155;
}

.wiki-toc-title {
    margin: 0 0 16px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.wiki-toc-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wiki-toc-item {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #94a3b8;
    cursor: pointer;
}

.wiki-toc-item:hover {
    color: #cbd5e1;
}

.wiki-toc-item.active {
    background: rgba(67, 56, 202, 0.35);
    color: #ffffff;
    font-weight: 500;
}

.wiki-article-content .wiki-toc-heading[id] {
    scroll-margin-top: 32px;
}

@media (max-width: 1200px) {
    .wiki-toc {
        display: none;
    }

    .wiki-article-body {
        max-width: none;
    }
}

@media (max-width: 900px) {
    .wiki-layout {
        flex-direction: column;
    }

    .wiki-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #1e293b;
    }

    .wiki-main {
        padding: 32px 20px 64px;
    }
}
