:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --text-color: #343a40;
    --link-color: #0056b3;
    --border-color: #e9ecef;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --header-height: 60px;
}

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

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
}
aside[data-ad="true"] {
    height: 300px;
}
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.header-title {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--primary-color);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icon-text {
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--secondary-color);
    font-weight: bold;
}

.search-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: #fff;
    padding: 0 20px;
    align-items: center;
    gap: 10px;
    z-index: 1001;
}

.search-container.active {
    display: flex;
}

.search-input {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.search-button,
.search-close {
    padding: 8px 12px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.search-close {
    background-color: var(--secondary-color);
    padding: 8px 14px;
    font-size: 1.2rem;
    line-height: 1;
}

.burger-menu {
    position: fixed;
    top: 0;
    right: -250px;
    width: 250px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 2000;
    padding: 20px;
    padding-top: var(--header-height);
    overflow-y: auto;
}

.burger-menu.active {
    right: 0;
}

.burger-menu-close {
    position: absolute;
    top: 15px;
    right: 20px;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    color: var(--secondary-color);
}

.burger-menu-heading {
    font-size: 1.2rem;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

/* ИСПРАВЛЕНО: Стили для основного списка меню */
.burger-menu-list {
    list-style: none;
    margin-bottom: 20px;
}

.burger-menu-list li a {
    display: block;
    padding: 10px 0;
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.2s;
}

.burger-menu-list li a:hover {
    color: var(--primary-color);
}

/* ИСПРАВЛЕНИЕ: Стили оглавления в бургер-меню сделаны более точными */
.burger-menu .toc ul {
    list-style: disc;
    padding-left: 20px;
}

.burger-menu .toc ul > li {
    margin-bottom: 15px;
}

.burger-menu .toc ul > li::marker {
    color: var(--primary-color);
}

.burger-menu .toc ul ul {
    list-style: circle;
}

.burger-menu .toc ul ul ul {
    list-style: square;
}

.burger-menu .toc a {
    color: var(--primary-color);
}

.burger-menu .toc a:hover {
    color: var(--link-color);
    text-decoration: underline;
}

.main-content {
    display: flex;
    justify-content: center;
}

.main-column {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    padding-top: calc(var(--header-height) + 20px);
}

.breadcrumbs {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.breadcrumbs a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Стили для рекламы */
.ad-container {
    margin: 20px 0;
    padding: 20px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    text-align: center;
    font-style: italic;
    color: var(--secondary-color);
}

article {
    width: 100%;
}

article a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

article a:hover {
    color: var(--link-color);
    text-decoration: underline;
}

article h1 {
    font-size: 1.60rem;
    margin-top: 0;
    margin-bottom: 20px;
}

.article-meta {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

article h2 {
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
}

article p {
    margin-bottom: 15px;
    text-align: justify;
}

.toc {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    align-self: flex-start;
    padding: 20px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: none;
}

.toc-heading {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.toc ul li {
    margin-bottom: 10px;
}

.toc ul li a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.2s;
}

.toc ul li a:hover {
    color: var(--primary-color);
}

/* Футер */
.footer {
    text-align: center;
    padding: 20px;
    background-color: #343a40;
    color: #f8f9fa;
    margin-top: 40px;
}

.footer a {
    color: #ffc107;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

@media (min-width: 768px) {
    .main-content {
        justify-content: space-between;
        align-items: flex-start;
        padding: 20px 40px;
        padding-top: calc(var(--header-height) + 20px);
        gap: 40px;
    }

    .main-column {
        max-width: 800px;
        padding-right: 0;
        padding-top: 0;
    }

    .toc {
        display: block;
        width: 350px;
        max-height: calc(100vh - var(--header-height) - 40px);
        overflow-y: auto;
    }

    .toc ul {
        list-style: disc;
        padding-left: 20px;
    }
    
    .toc ul > li::marker {
        color: var(--primary-color);
    }
    
    .toc ul ul {
        list-style: circle;
    }
    
    .toc ul ul ul {
        list-style: square;
    }

    .main-content.no-toc {
        justify-content: center;
    }

    .main-content.no-toc .main-column {
        max-width: 900px;
        padding-right: 0;
    }

    .burger-menu #toc-mobile-clone {
        display: none;
    }
}