:root {
    --bg-main: #121214;
    --bg-sidebar: #1a1a1e;
    --bg-card: #222227;
    --text-main: #e2e2e9;
    --text-muted: #9a9aa5;
    --accent-wiki: #58a6ff;      
    --accent-hover: #79c0ff;
    --border-wiki: #2d2d34;
    --gold-sponsor: #fcd779;
    --sidebar-width: 300px;
}

body.light-theme {
    --bg-main: #ffffff;
    --bg-sidebar: #f6f8fa;
    --bg-card: #ffffff;
    --text-main: #24292e;
    --text-muted: #586069;
    --accent-wiki: #0366d6;
    --accent-hover: #0056b3;
    --border-wiki: #e1e4e8;
    --gold-sponsor: #bf9000;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    transition: background-color 0.2s, color 0.2s;
}

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

.wiki-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-wiki);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-wiki);
    text-align: center;
}

.sidebar-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-wiki);
    cursor: pointer;
    letter-spacing: 0.5px;
}

.search-wrapper {
    padding: 15px;
    position: relative;
    border-bottom: 1px solid var(--border-wiki);
}

#searchInput {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    padding: 0 12px;
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-wiki);
    outline: none;
    font-size: 0.95rem;
}

#searchInput:focus { border-color: var(--accent-wiki); }

#suggestions {
    list-style: none;
    position: absolute;
    top: 60px;
    left: 15px;
    right: 15px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-wiki);
    border-radius: 6px;
    z-index: 210;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#suggestions li { padding: 10px 15px; cursor: pointer; text-align: left; font-size: 0.9rem; }
#suggestions li:hover { background-color: var(--border-wiki); color: var(--accent-wiki); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto; 
    padding: 10px 0;
}

.nav-group-block {
    border-bottom: 1px solid rgba(45,45,52,0.2);
}

.nav-group-trigger {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-main);
    text-align: left;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-group-trigger:hover { background-color: var(--bg-main); }
.nav-group-trigger .arrow-indicator { color: var(--text-muted); font-size: 0.8rem; }

/*.nav-group-links { 
    list-style: none; 
    padding-left: 0; 
    background-color: var(--bg-main);
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.nav-group-links.hidden {
    max-height: 0 !important;
    display: none !important;
}*/

.nav-group-links { 
    list-style: none; 
    padding-left: 0; 
    background-color: var(--bg-main);
    max-height: 300px;
    overflow-y: auto; 
    transition: max-height 0.3s ease-out;
}

.nav-group-links.hidden {
    max-height: 0 !important;
    overflow: hidden; 
}

.nav-group-links li a {
    display: block;
    padding: 8px 20px 8px 35px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-group-links li a:hover { color: var(--accent-wiki); background-color: var(--bg-card); }

.wiki-main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    max-width: 900px;
    width: calc(100% - var(--sidebar-width));
    overflow-x: hidden; 
}

.wiki-body-view.hidden { display: none; }

.wiki-article-header {
    border-bottom: 1px solid var(--border-wiki);
    padding-bottom: 12px;
    margin-bottom: 24px;
}

.wiki-article-header h2 { 
    font-size: 2.5rem; 
    font-weight: 400; 
    color: var(--text-main);
}

.wiki-lead-text { 
    font-size: 1.15rem; 
    color: var(--text-muted); 
    margin-bottom: 25px; 
}

.wiki-alert-card {
    background-color: var(--bg-sidebar);
    border-left: 4px solid var(--accent-wiki);
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 25px;
}
.wiki-alert-card h3 { margin-bottom: 6px; font-size: 1.1rem; }

.wiki-toolbar-row { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    margin-bottom: 30px; 
}

.wiki-btn {
    background-color: var(--bg-sidebar);
    color: var(--text-main);
    border: 1px solid var(--border-wiki);
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px; 
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.wiki-btn:hover { 
    background-color: var(--bg-card); 
    border-color: var(--accent-wiki);
}

#table-of-contents {
    display: inline-block;
    min-width: 260px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-wiki);
    padding: 15px;
    margin-bottom: 30px;
    border-radius: 4px;
}
.toc-title { 
    font-weight: 700; 
    margin-bottom: 8px; 
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
#table-of-contents ul { list-style: none; padding-left: 5px; }
#table-of-contents li { font-size: 0.95rem; margin-bottom: 6px; }
#table-of-contents a { color: var(--accent-wiki); text-decoration: none; }
#table-of-contents a:hover { text-decoration: underline; }

.wiki-article-body { 
    font-size: 1.15rem; 
    line-height: 1.8; 
    color: var(--text-main);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.wiki-article-body p { 
    margin-bottom: 1.5rem; 
}

.wiki-article-body a { 
    color: var(--accent-wiki); 
    text-decoration: none; 
    transition: color 0.15s;
}

.wiki-article-body a:hover { 
    color: var(--accent-hover);
    text-decoration: underline;
}

.wiki-article-body h1 { 
    font-size: 1.75rem; 
    font-weight: 400; 
    border-bottom: 1px solid var(--border-wiki); 
    margin: 40px 0 20px; 
    padding-bottom: 6px; 
    color: var(--text-main);
}

.wiki-article-body img { 
    display: block; 
    max-width: 100%; 
    height: auto; 
    margin: 30px auto 10px auto; 
    border-radius: 10px; 
    border: 1px solid var(--border-wiki);
}

.wiki-article-body sub {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.4;
}

.support-btn-gold {
    position: fixed;
    bottom: 25px;
    left: calc(var(--sidebar-width) + 25px);
    z-index: 150;
    display: none;
    background-color: var(--gold-sponsor);
    color: #121212 !important;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s;
}
.support-btn-gold:hover { opacity: 0.95; background-color: #e5c165; }

.sponsor-highlight-badge {
    background-color: rgba(252, 215, 121, 0.1) !important;
    color: var(--gold-sponsor) !important;
    font-weight: bold;
}

.wiki-footer { 
    margin-top: 80px; 
    padding-top: 25px; 
    border-top: 1px solid var(--border-wiki); 
}
.footer-links { 
    list-style: none; 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 20px; 
}
.footer-links li {
    display: inline-block;
}
.footer-links a { 
    color: var(--text-muted); 
    text-decoration: none; 
    font-size: 0.85rem;
    transition: color 0.15s;
}
.footer-links a:hover { 
    color: var(--accent-wiki); 
}

.promo-link {
    display: inline-block;
    text-decoration: none;
    overflow: hidden;
    border-radius: 12px;
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.5s;
}
.promo-img {
    display: block;
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.promo-link:hover .promo-img {
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#scrollTopBtn { 
    display: none; 
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 150;
    border: none;
    background-color: var(--accent-wiki);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#scrollTopBtn svg { display: block; width: 1.5em; height: 1.5em; margin: auto; }
.highlight { background-color: rgba(241, 196, 15, 0.25); color: inherit; padding: 2px 4px; border-radius: 4px; }

@media (max-width: 850px) {
    .mobile-header {
        display: flex;
        background-color: var(--bg-sidebar);
        border-bottom: 1px solid var(--border-wiki);
        height: 55px;
        align-items: center;
        padding: 0 15px;
        position: sticky;
        top: 0;
        z-index: 300;
    }
    .menu-toggle {
        background: none;
        border: 1px solid var(--border-wiki);
        color: var(--text-main);
        padding: 4px 10px;
        border-radius: 4px;
        cursor: pointer;
    }
    .mobile-logo { font-weight: 700; color: var(--accent-wiki); margin-left: 15px; font-size: 1.05rem; }
    
    .wiki-sidebar { 
        transform: translateX(-100%); 
        top: 55px;
        height: calc(100vh - 55px); 
        width: 280px; 
    }
    .wiki-sidebar.open { transform: translateX(0); }
    
    .wiki-main-content { 
        margin-left: 0; 
        padding: 20px; 
        width: 100%;
    }
    .wiki-article-header h2 { font-size: 1.8rem; }
    .wiki-toolbar-row { gap: 4px; }

    .support-btn-gold {
        left: 20px;
        bottom: 20px;
    }
}