:root {
    --bg-dark: #0a0c10;
    --bg-light: #f0f4fa;
    --card-dark: #1e1e2a;
    --card-light: #ffffff;
    --text-dark: #eef2ff;
    --text-light: #1e293b;
    --accent: #6b7280;
    --border-dark: #2d3748;
    --border-light: #cbd5e1;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body.light-theme {
    background-color: var(--bg-light);
    color: var(--text-light);
}
/* В светлой теме — все элементы внутри article с инлайн-стилями: светлый фон + тёмный текст */
.light-theme article [style*="background:var(--card-dark)"] {
    background: var(--card-light) !important;
    color: var(--text-light) !important;
}
.light-theme article [style*="background:var(--card-dark)"] h2,
.light-theme article [style*="background:var(--card-dark)"] h3,
.light-theme article [style*="background:var(--card-dark)"] p,
.light-theme article [style*="background:var(--card-dark)"] li,
.light-theme article [style*="background:var(--card-dark)"] span:not(.glossary-tooltip) {
    color: var(--text-light) !important;
}
.light-theme article [style*="background:rgba"] {
    background: var(--card-light) !important;
    color: var(--text-light) !important;
}
/* article-link светлая тема — не синий, а тёмный */
.light-theme .article-link {
    color: #1e293b !important;
    background: var(--card-light) !important;
    border-color: var(--border-light) !important;
}
.light-theme .article-link:hover {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}
/* Селект в светлой теме */
.light-theme select,
.light-theme select option {
    background: var(--card-light) !important;
    color: var(--text-light) !important;
}
/* Address в светлой теме */
.light-theme address {
    background: var(--card-light) !important;
    color: var(--text-light) !important;
    border-color: var(--border-light) !important;
}
/* Кнопка disabled */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== ДЕСКТОПНАЯ ШАПКА ===== */
.desktop-header {
    display: flex;
    position: relative;
    background: url('/images/header-bg.webp') center/cover no-repeat;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid #2d3748;
    z-index: 1000;
}
.desktop-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
}
.desktop-header .logo-link,
.desktop-header nav,
.desktop-header .theme-toggle,
.desktop-header .search-icon {
    position: relative; z-index: 2;
}
.desktop-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
.desktop-header nav a {
    color: #eef2ff;
    text-decoration: none;
    opacity: 0.9;
    transition: 0.2s;
    font-size: 0.9rem;
}
.desktop-header nav a:hover {
    opacity: 1;
    color: #9ca3af;
}
.light-theme .desktop-header nav a {
    color: #eef2ff;
}
.light-theme .desktop-header nav a:hover {
    color: #cbd5e1;
}

/* ===== МОБИЛЬНАЯ ШАПКА ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 1000;
    background: rgba(10, 12, 16, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-dark);
    padding: 0 12px;
    align-items: center;
    justify-content: space-between;
}
body.light-theme .mobile-header {
    background: rgba(240, 244, 250, 0.95);
    border-bottom-color: var(--border-light);
}

.hamburger,
.search-icon,
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-dark);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: 0.2s;
}
.light-theme .hamburger,
.light-theme .search-icon,
.light-theme .theme-toggle {
    color: #1e293b;
}
.light-theme .desktop-header .search-icon,
.light-theme .desktop-header .theme-toggle {
    color: #eef2ff;
}
.light-theme .sidebar-close {
    color: #1e293b;
}
.hamburger:hover, .search-icon:hover, .theme-toggle:hover {
    background: rgba(108, 114, 128, 0.15);
}

/* Социальные SVG-кнопки */
.social-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--card-dark); border: 1px solid var(--border-dark);
    text-decoration: none; color: var(--text-dark); transition: 0.2s;
}
.social-icon-btn:hover {
    border-color: #3b82f6; color: #3b82f6;
}
.light-theme .social-icon-btn {
    background: var(--card-light); border-color: var(--border-light);
    color: var(--text-light);
}

/* SVG-иконки темы: переключение */
.icon-light { display: none; }
.icon-dark  { display: block; }
body.light-theme .icon-light { display: block; }
body.light-theme .icon-dark  { display: none; }

.header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ===== ЛОГОТИП ===== */
.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 0;
    text-decoration: none;
}
.logo-image { height: 60px; width: auto; }
.logo-fallback {
    display: none;
    font-size: 1.2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}
.logo-link.error .logo-image { display: none; }
.logo-link.error .logo-fallback { display: inline-block; }
.mobile-header .logo-image { height: 36px; }
.mobile-header .logo-fallback { font-size: 1.1rem; }

/* ===== БОКОВОЕ МЕНЮ (мобильное) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--card-dark);
    z-index: 2001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid var(--border-dark);
}
body.light-theme .mobile-sidebar {
    background: var(--card-light);
    border-right-color: var(--border-light);
}
.mobile-sidebar.active {
    display: block;
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-dark);
}
body.light-theme .sidebar-header {
    border-bottom-color: var(--border-light);
}
.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}
.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dark);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-menu {
    list-style: none;
    padding: 8px 0;
}
.sidebar-menu li {
    margin: 0;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    transition: 0.2s;
    border-radius: 0;
}
body.light-theme .sidebar-menu a {
    color: var(--text-light);
}
.light-theme .sidebar-title {
    color: #1d4ed8;
}
.sidebar-menu a:hover {
    background: rgba(108, 114, 128, 0.15);
}
.sidebar-menu a:active {
    background: rgba(108, 114, 128, 0.25);
}

/* ===== НИЖНЯЯ НАВИГАЦИЯ ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--card-dark);
    border-top: 1px solid var(--border-dark);
    z-index: 1000;
    padding: 0 8px;
    justify-content: space-around;
    align-items: center;
}
body.light-theme .bottom-nav {
    background: var(--card-light);
    border-top-color: var(--border-light);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-dark);
    opacity: 0.6;
    transition: 0.2s;
    min-width: 60px;
    min-height: 44px;
    padding: 4px 8px;
    border-radius: 8px;
}
body.light-theme .bottom-nav-item {
    color: var(--text-light);
}
.bottom-nav-item:hover {
    opacity: 0.8;
}
.bottom-nav-item.active {
    opacity: 1;
    color: var(--accent);
}
.bottom-nav-icon {
    font-size: 1.3rem;
    line-height: 1;
}
.bottom-nav-label {
    font-size: 0.65rem;
    font-weight: 500;
    margin-top: 2px;
}

/* ===== БЕГУЩАЯ СТРОКА ===== */
.marquee {
    background: rgba(0,0,0,0.4); padding: 0.5rem 1rem;
    white-space: nowrap; overflow: hidden; font-size: 0.85rem;
}
body.light-theme .marquee { background: rgba(0,0,0,0.05); }
.ticker { display: inline-block; animation: scroll 30s linear infinite; }
@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.ticker span {
    display: inline-block;
    margin-right: 2rem;
}
.ticker a {
    color: inherit;
    text-decoration: none;
}

/* ===== ПРЕВЬЮ-БЛОК ===== */
.preview-block {
    position: relative; border-radius: 12px; overflow: hidden;
    background-size: cover; background-position: center;
    text-decoration: none; color: #ffffff; display: block;
}
.preview-block::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55); z-index: 1;
}
.preview-block-title {
    position: relative; z-index: 2; font-weight: 600; line-height: 1.2; color: #ffffff;
}
.preview-block-date {
    position: relative; z-index: 2; color: rgba(255,255,255,0.8); font-size: 0.7rem;
}
.preview-block-label {
    position: absolute; top: 0.4rem; right: 0.4rem; z-index: 3;
    background: var(--accent); color: #fff; font-size: 0.6rem;
    padding: 0.1rem 0.5rem; border-radius: 10px; font-weight: 600;
}
.preview-side {
    height: 80px; margin-bottom: 0.6rem;
}
.preview-side .preview-block-title {
    font-size: 0.8rem; padding: 0.5rem 2rem 0 0.5rem;
    position: absolute; bottom: 1.2rem; left: 0; right: 0;
}
.preview-side .preview-block-date {
    position: absolute; bottom: 0.3rem; left: 0.5rem;
}
.preview-ticker {
    display: inline-block; width: 220px; height: 40px;
    vertical-align: middle; margin-right: 2rem;
}
.preview-ticker .preview-block-title {
    font-size: 0.7rem; padding: 0.2rem 2.5rem 0 0.4rem;
    position: absolute; bottom: 1rem; left: 0; right: 0;
}
.preview-ticker .preview-block-date {
    position: absolute; bottom: 0.1rem; left: 0.4rem; font-size: 0.6rem;
}
.preview-ticker .preview-block-label {
    font-size: 0.55rem; top: 0.2rem; right: 0.2rem;
}
.preview-card {
    height: 160px; transition: transform 0.2s;
}
.preview-card:hover { transform: translateY(-4px); }
.preview-card .preview-block-title {
    font-size: 1rem; padding: 0.8rem 3rem 0 0.8rem;
    position: absolute; bottom: 1.5rem; left: 0; right: 0;
}
.preview-card .preview-block-date {
    position: absolute; bottom: 0.4rem; left: 0.8rem;
}

/* ===== ОСНОВНАЯ ОБЁРТКА ===== */
.layout-wrapper {
    display: flex; justify-content: space-between; align-items: stretch;
    width: 100%; margin: 0; padding: 0; gap: 0; min-height: calc(100vh - 140px);
}
.layout-wrapper-full {
    flex-direction: column;
}

/* ===== ЛЕВЫЙ САЙДБАР ===== */
.sidebar-left-fixed {
    width: 120px; flex-shrink: 0; position: sticky; top: 0; left: 0;
    align-self: flex-start; max-height: 100vh; z-index: 500;
}

/* ===== ПЕРСОНАЖ ===== */
.char-side { display: block; width: 100%; max-width: 120px; height: auto; margin-top: 1rem; }
.char-light { display: block; }
.char-dark  { display: none; }
body.light-theme .char-light { display: none; }
body.light-theme .char-dark  { display: block; }

/* ===== ПРАВЫЙ САЙДБАР ===== */
.sidebar-right-fixed {
    width: 252px; flex-shrink: 0; position: sticky; top: 0; right: 0;
    align-self: flex-start; max-height: 100vh; overflow-y: auto; z-index: 400;
}

/* ===== ЦЕНТРАЛЬНЫЙ КОНТЕНТ ===== */
.main-content { flex: 1; min-width: 0; padding: 2rem; position: relative; z-index: 1; }
.container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }

/* ===== СТАТЬЯ ===== */
article { max-width: 800px; margin: 0 auto; }

/* ===== КАРТИНКИ В СТАТЬЕ ===== */
.article-image {
    display: block; width: 100%; max-width: 400px; height: auto;
    margin: 1.5rem auto; border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.article-image:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 30px rgba(0,0,0,0.4);
}
@media (min-width: 700px) {
    .article-image {
        display: inline-block; width: 45%; margin: 0.5rem 1.5rem 1rem 0;
        float: left;
    }
}
body.light-theme .article-image {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
body.light-theme .article-image:hover {
    box-shadow: 0 6px 30px rgba(0,0,0,0.15);
}
article h1 { font-size: 2rem; margin-bottom: 0.5rem; line-height: 1.2; }
article .date { font-size: 0.85rem; opacity: 0.6; margin-bottom: 1.5rem; }
article h2 { font-size: 1.4rem; margin: 2rem 0 0.8rem; clear: both; }
article h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
article p { margin-bottom: 1rem; }
article ul { margin: 0.5rem 0 1rem 1.5rem; }
article li { margin-bottom: 0.4rem; }
article hr { border: none; border-top: 1px solid var(--border-dark); margin: 2rem 0; }

/* ===== ТАБЛИЦА В СТАТЬЕ ===== */
.article-table {
    width: 100%; border-collapse: collapse; margin: 1.5rem 0;
    border-radius: 10px; overflow: hidden;
    background: var(--card-dark);
}
body.light-theme .article-table {
    background: var(--card-light);
}
.article-table thead th {
    background: var(--accent); color: #fff; padding: 0.7rem 1rem;
    text-align: left; font-weight: 600; font-size: 0.85rem;
}
.article-table tbody td {
    padding: 0.6rem 1rem; border-bottom: 1px solid var(--border-dark);
    font-size: 0.85rem;
}
body.light-theme .article-table tbody td {
    border-bottom-color: var(--border-light);
}
.article-table tbody tr:last-child td {
    border-bottom: none;
}
.article-table tbody tr:hover {
    background: rgba(108, 114, 128, 0.1);
}
body.light-theme .article-table tbody tr:hover {
    background: rgba(0,0,0,0.03);
}
body.light-theme article hr { border-top-color: var(--border-light); }
.article-link {
    display: inline-block;
    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-dark);
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
    margin: 0.3rem;
    transition: 0.2s;
}
.article-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.article-link {
    color: var(--accent);
}
body.light-theme .article-link {
    background: var(--card-light);
    border-color: var(--border-light);
    color: #1d4ed8;
}
body.light-theme .article-link:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* ===== ПОДСВЕТКА ГЛОССАРИЯ ===== */
.glossary-highlight {
    border-bottom: 1px dashed var(--accent);
    cursor: pointer;
    position: relative;
    transition: 0.2s;
}
.glossary-highlight:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.glossary-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-dark);
    color: var(--text-dark);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--accent);
    font-size: 0.8rem;
    white-space: normal;
    max-width: 260px;
    width: max-content;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    line-height: 1.4;
    text-align: left;
    font-weight: normal;
    pointer-events: none;
}
.glossary-highlight.active .glossary-tooltip {
    display: block;
}
body.light-theme .glossary-tooltip {
    background: var(--card-light);
    color: var(--text-light);
    border-color: var(--border-light);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ===== ЛЕВЫЙ БАР (меню) ===== */
.vertical-menu { background: var(--card-dark); border-radius: 16px; padding: 0.5rem 0; }
body.light-theme .vertical-menu { background: var(--card-light); border: 1px solid var(--border-light); }
.menu-item { position: relative; margin: 0.2rem 0; }
.menu-title {
    display: block; padding: 0.6rem 0.5rem; font-size: 0.75rem; font-weight: 500;
    text-align: center; cursor: pointer; border-radius: 8px; transition: 0.2s;
    color: inherit; text-decoration: none;
}
.menu-title:hover { background: rgba(108, 114, 128, 0.2); }
.has-submenu .submenu {
    position: absolute; left: 100%; top: 0; background: var(--card-dark);
    border-radius: 12px; padding: 0.5rem; min-width: 200px;
    opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
    z-index: 9999; border: 1px solid var(--border-dark); box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    pointer-events: none;
}
body.light-theme .has-submenu .submenu { background: var(--card-light); border: 1px solid var(--border-light); }
.has-submenu:hover .submenu { opacity: 1; visibility: visible; pointer-events: auto; }
.submenu a {
    display: block; padding: 0.4rem 0.8rem; font-size: 0.8rem; text-decoration: none;
    color: inherit; white-space: nowrap; border-radius: 6px;
}
.submenu a:hover { background: rgba(108, 114, 128, 0.2); }

/* ===== ПРАВЫЙ БАР (НОВОСТИ) ===== */
.news-block { background: var(--card-dark); border-radius: 16px; padding: 1rem; }
body.light-theme .news-block { background: var(--card-light); }
.news-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.news-header h3 { font-size: 0.9rem; font-weight: 600; }
.news-list { display: flex; flex-direction: column; }
.all-news { color: var(--accent); text-decoration: none; font-size: 0.75rem; }
.all-news:hover { opacity: 0.8; }

/* ===== КАРТОЧКИ ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; margin: 1.5rem 0; }

/* ===== ФУТЕР ===== */
footer {
    margin-top: 2rem; background: #111827; padding: 1rem;
    text-align: center; font-size: 0.7rem; border-top: 1px solid #2d3748;
}
body.light-theme footer { background: #e2e8f0; border-top-color: #cbd5e1; }
body.light-theme .social-links a, body.light-theme .footer-links a { color: #1e293b; }
body.light-theme .copyright { color: #4b5563; }
.footer-content { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.social-links a, .footer-links a { color: #cbd5e1; text-decoration: none; opacity: 0.8; }
.social-links a:hover, .footer-links a:hover { opacity: 1; color: #9ca3af; }
.copyright { color: #9ca3af; font-size: 0.6rem; opacity: 0.6; }

/* ===== КАТЕГОРИИ ИНСТРУКЦИЙ ===== */
h2[id] {
    margin-top: 2.5rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
    scroll-margin-top: 80px;
}

/* ===== Changelog Accordion ===== */
.changelog-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}
.changelog-item {
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-dark);
    transition: box-shadow 0.2s;
}
body.light-theme .changelog-item {
    border-color: var(--border-light);
    background: var(--card-light);
}
.changelog-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.changelog-summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    list-style: none;
    color: var(--text-dark);
}
body.light-theme .changelog-summary {
    background: rgba(0,0,0,0.03);
    color: var(--text-light);
}
.changelog-summary::-webkit-details-marker {
    display: none;
}
.changelog-summary::after {
    content: "\25B6";
    font-size: 0.8em;
    transition: transform 0.2s;
    color: var(--accent);
}
details[open] .changelog-summary::after {
    transform: rotate(90deg);
}
.changelog-version {
    color: var(--accent);
    font-weight: 700;
}
.changelog-date {
    font-size: 0.9em;
    color: var(--text-dark);
    opacity: 0.6;
}
body.light-theme .changelog-date {
    color: var(--text-light);
    opacity: 0.6;
}
.changelog-list {
    padding: 0.5rem 1rem 1rem 2rem;
    margin: 0;
}
.changelog-list li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
    color: var(--text-dark);
}
body.light-theme .changelog-list li {
    color: var(--text-light);
}

/* ===== Welcome Section ===== */
.welcome-section {
    padding: 2rem 0;
    max-width: 700px;
}
.welcome-section h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}
.welcome-section p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-dark);
}
body.light-theme .welcome-section p {
    color: var(--text-light);
}
.welcome-cta {
    margin-top: 1.5rem;
    font-weight: 600;
    color: var(--accent);
}

/* ===== Кнопка ===== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: var(--card-dark);
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid var(--border-dark);
    transition: 0.2s;
}
.btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
body.light-theme .btn {
    background: var(--card-light);
    color: var(--text-light);
    border: 1px solid var(--border-light);
}
body.light-theme .btn:hover {
    background: var(--accent);
    color: #fff;
}

/* ===== КАЛЬКУЛЯТОР ПАМЯТИ ===== */
.light-theme .calc-stat {
    background: var(--card-light) !important;
    border-color: var(--border-light) !important;
    color: var(--text-light) !important;
}
.light-theme .calc-stat-value {
    color: var(--text-light) !important;
}
.light-theme .calc-stat-label {
    color: var(--text-light) !important;
}
.light-theme .chip-card {
    background: var(--card-light) !important;
    border-color: var(--border-light) !important;
    color: var(--text-light) !important;
}
.light-theme .chip-name {
    color: var(--text-light) !important;
}
.light-theme .chip-capacity {
    color: var(--text-light) !important;
}
.light-theme .recommendation {
    background: var(--card-light) !important;
    border-color: var(--border-light) !important;
    color: var(--text-light) !important;
}
.light-theme .recommendation h3 {
    color: var(--text-light) !important;
}
.light-theme .recommendation p {
    color: var(--text-light) !important;
}
.light-theme .chip-bar {
    background: rgba(0,0,0,0.1) !important;
}
.light-theme .vcard-field input {
    background: var(--card-light) !important;
    color: var(--text-light) !important;
    border-color: var(--border-light) !important;
}
.light-theme .vcard-field label {
    color: var(--text-light) !important;
}
.light-theme .vcard-size-info {
    background: var(--card-light) !important;
    border-color: var(--border-light) !important;
    color: var(--text-light) !important;
}
.light-theme .btn-secondary {
    color: var(--text-light) !important;
    border-color: var(--border-light) !important;
}
.light-theme .btn-secondary:hover {
    background: var(--accent) !important;
    color: #fff !important;
}

/* ===== ПЕРЕКРЁСТНЫЕ ССЫЛКИ ===== */
.crosslinks-section {
    margin-top: 2rem;
    padding: 1rem 0;
}
.crosslinks-section h2 {
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
    color: var(--text-dark);
}
body.light-theme .crosslinks-section h2 {
    color: var(--text-light);
}
.crosslinks-hr {
    margin: 2rem 0 0 0;
    border: none;
    border-top: 1px solid var(--border-dark);
}
body.light-theme .crosslinks-hr {
    border-color: var(--border-light);
}
.crosslinks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.crosslinks-grid .preview-block {
    min-height: 120px;
}

/* ===== СПОЙЛЕР ===== */
article details {
    margin: 1rem 0;
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-dark);
}
body.light-theme article details {
    background: var(--card-light);
    border-color: var(--border-light);
}
article details summary {
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.03);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
body.light-theme article details summary {
    background: rgba(0,0,0,0.02);
}
article details summary::-webkit-details-marker { display: none; }
article details summary::before {
    content: "\25B6";
    font-size: 0.7rem;
    transition: transform 0.2s;
    color: var(--accent);
}
article details[open] summary::before { transform: rotate(90deg); }
article details summary:hover { background: rgba(108,114,128,0.08); }
article details .code-block {
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border-top: 1px solid var(--border-dark);
    position: relative;
}
body.light-theme article details .code-block {
    background: rgba(0,0,0,0.04);
    border-color: var(--border-light);
}
.code-block .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
.code-block:hover .copy-btn { opacity: 0.8; }
.code-block .copy-btn:hover { opacity: 1; }

/* ===== ЧЕК-ЛИСТ ===== */
.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0;
    line-height: 1.5;
}
.checklist-box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--accent);
    margin-top: 1px;
}
.checklist-box.checked {
    color: #10b981;
    font-weight: bold;
}

/* ===== ПОИСК ===== */
.search-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9998;
    backdrop-filter: blur(4px);
}
.search-overlay.active { display: block; }
.search-modal {
    display: none;
    position: fixed;
    top: 20%; left: 50%;
    transform: translateX(-50%);
    width: 90%; max-width: 640px;
    z-index: 9999;
    background: var(--card-dark);
    border-radius: 16px;
    border: 1px solid var(--border-dark);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
body.light-theme .search-modal {
    background: #ffffff;
    border-color: var(--border-light);
}
.search-modal.active { display: block; }
.search-modal-content { padding: 1rem; }
.search-modal-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.search-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: var(--text-dark);
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}
body.light-theme .search-input {
    background: rgba(0,0,0,0.03);
    color: var(--text-light);
    border-color: var(--border-light);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: rgba(255,255,255,0.3); }
body.light-theme .search-input::placeholder { color: rgba(0,0,0,0.3); }
.search-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 0 0.5rem;
    line-height: 1;
    opacity: 0.6;
    transition: 0.2s;
}
.light-theme .search-close {
    color: #1e293b;
}
.search-close:hover { opacity: 1; }
.search-results { max-height: 60vh; overflow-y: auto; }
.search-hint {
    padding: 1.5rem 0.5rem;
    text-align: center;
    opacity: 0.5;
    font-size: 0.9rem;
}
.light-theme .search-hint {
    color: #1e293b;
}
.light-theme .search-stats {
    color: #1e293b;
}
.search-stats {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    opacity: 0.4;
}
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.search-result-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-dark);
    transition: 0.15s;
}
body.light-theme .search-result-item { color: var(--text-light); }
.search-result-item:hover { background: rgba(108,114,128,0.15); }
.search-result-label {
    font-size: 0.6rem;
    background: var(--accent);
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
}
.search-result-title {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
}
.search-result-date {
    font-size: 0.7rem;
    opacity: 0.5;
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.preview-card { animation: fadeIn 0.3s ease; }
.preview-card:active { transform: scale(0.98); }

/* ===== МЕДИА-ЗАПРОСЫ ===== */
/* Планшеты */
@media (max-width: 1100px) {
    .sidebar-left-fixed { width: 80px; }
    .sidebar-right-fixed { width: 200px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
    .crosslinks-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 900px) {
    .layout-wrapper { flex-direction: column; }
    .sidebar-left-fixed, .sidebar-right-fixed {
        width: 100%; position: static; max-height: none;
        padding: 0 1rem; margin-bottom: 0.5rem;
    }
    .sidebar-left-fixed { display: flex; justify-content: center; }
    .sidebar-left-fixed .vertical-menu { display: flex; flex-wrap: wrap; justify-content: center; padding: 0.3rem; gap: 0.2rem; }
    .sidebar-left-fixed .menu-item { margin: 0; }
    .sidebar-left-fixed .menu-title { font-size: 0.65rem; padding: 0.3rem 0.4rem; }
    .sidebar-left-fixed .has-submenu .submenu { left: auto; right: 0; top: 100%; }
    .main-content { padding: 1rem; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.8rem; }
    .crosslinks-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .logo-image { height: 40px; }
    .article-image { float: none; width: 100%; max-width: 100%; margin: 0 0 1rem 0; }
    .preview-card { height: 130px; }
    .preview-card .preview-block-title { font-size: 0.85rem; padding: 0.5rem 2.5rem 0 0.5rem; }
    .preview-side { height: 70px; }
    .news-block { padding: 0.8rem; }
    .welcome-section h1 { font-size: 1.5rem; }
    .welcome-section p { font-size: 0.95rem; }
    article h1 { font-size: 1.5rem; }
    article h2 { font-size: 1.15rem; }
    .instr-nav { gap: 0.3rem; }
    .instr-nav .article-link { font-size: 0.8rem; padding: 0.3rem 0.8rem; }
}

/* Мобильные телефоны (основной брейкпоинт) */
@media (max-width: 768px) {
    /* Шапки */
    .desktop-header { display: none; }
    .mobile-header { display: flex; }
    
    /* Отступы */
    .marquee { margin-top: 56px; }
    body { padding-bottom: 0; }
    .main-content { padding: 1rem 16px; width: 100%; }
    
    /* Скрываем боковые панели */
    .sidebar-left-fixed { display: none !important; }
    .sidebar-right-fixed { display: none !important; }
    
    /* Нижняя навигация — отключена */
    .bottom-nav { display: none !important; }
    
    /* Карточки в 1 колонку */
    .layout-wrapper { flex-direction: column; }
    .card-grid { grid-template-columns: 1fr; gap: 16px; margin: 1rem 0; }
    .crosslinks-grid { grid-template-columns: 1fr; gap: 12px; }
    
    /* Карточки крупнее */
    .preview-card { height: 180px; border-radius: 14px; }
    .preview-card .preview-block-title {
        font-size: 1.05rem;
        padding: 0.8rem 3.5rem 0 1rem;
        bottom: 2rem;
    }
    .preview-card .preview-block-date {
        font-size: 0.75rem;
        bottom: 0.5rem;
        left: 1rem;
    }
    .preview-card .preview-block-label {
        font-size: 0.65rem;
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.15rem 0.6rem;
    }
    
    /* Типографика */
    article h1 { font-size: 1.5rem; }
    article h2 { font-size: 1.2rem; margin: 1.5rem 0 0.6rem; }
    article h3 { font-size: 1rem; }
    article p, article li { font-size: 0.95rem; }
    .welcome-section h1 { font-size: 1.4rem; }
    .welcome-section p { font-size: 0.95rem; }
    
    /* Гориз. фильтры категорий */
    .instr-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 0.4rem;
        padding-bottom: 0.5rem;
        margin-bottom: 1.5rem;
    }
    .instr-nav::-webkit-scrollbar { display: none; }
    .instr-nav .article-link {
        flex-shrink: 0;
        scroll-snap-align: start;
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
        border-radius: 20px;
        white-space: nowrap;
        min-height: 40px;
        display: flex;
        align-items: center;
    }
    
    /* Поиск полноэкранный */
    .search-modal {
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        border: none;
    }
    .search-modal-content { padding: 56px 1rem 1rem; }
    .search-input { font-size: 1.1rem; padding: 1rem; }
    .search-results { max-height: calc(100vh - 140px); }
    
    /* Кнопки крупнее */
    .article-link { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
    .btn { padding: 0.7rem 1.5rem; font-size: 0.9rem; }
}

@media (max-width: 400px) {
    .preview-card { height: 150px; }
    .preview-card .preview-block-title { font-size: 0.9rem; }
    article h1 { font-size: 1.3rem; }
    article p { font-size: 0.9rem; }
    .main-content { padding: 0.8rem 12px; }
}