/* Глобальные стили */
* { box-sizing: border-box; } 
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #223; background: #f3f6f3; }

/* Основной контент */
main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; min-height: 60vh; } 
h1 { margin: 8px 0 20px; font-size: 28px; line-height: 1.25; } 
h2 { margin: 32px 0 14px; font-size: 20px; }
a { color: #1c6b34; } 
.crumbs { color: #667; font-size: 14px; margin-bottom: 20px; }

/* Плитки (категории) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; min-height: 120px; padding: 18px; background: #fff; border: 1px solid #d9e2d9; border-radius: 10px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tile:hover { transform: translateY(-3px); border-color: #2f6b3f; box-shadow: 0 6px 16px rgba(47, 107, 63, .15); }
.tile-title { font-size: 18px; font-weight: 600; color: #1c4d2b; } 
.tile-desc { display: block; margin-top: 6px; font-size: 14px; color: #556; } 
.tile-count { margin-top: 12px; font-size: 13px; color: #778; }

/* Списки статей */
ul.articles { list-style: none; margin: 0; padding: 0; } 
ul.articles li { padding: 12px 0; border-bottom: 1px solid #dde5dd; } 
ul.articles a { font-size: 17px; font-weight: 600; text-decoration: none; } 
ul.articles a:hover { text-decoration: underline; }
.date { margin-left: 10px; font-size: 13px; color: #889; } 
.lead { margin: 4px 0 0; color: #556; font-size: 14px; } 
.empty { color: #778; padding: 30px 0; }

/* Карточки новостей */
.card { background: #fff; border: 1px solid #d9e2d9; border-radius: 10px; padding: 16px 20px; margin-bottom: 14px; } 
.card h2 { margin: 0 0 4px; font-size: 20px; } 
.card h2 a { text-decoration: none; } 
.card .meta { font-size: 13px; color: #889; margin-bottom: 6px; }
.pager { display: flex; gap: 14px; align-items: center; margin-top: 20px; color: #667; } 
.meta { font-size: 14px; color: #778; margin-bottom: 18px; }
.tags a { display: inline-block; background: #e4efe6; border-radius: 12px; padding: 1px 10px; margin-right: 6px; font-size: 13px; text-decoration: none; color: #1c6b34; }
.tags a:hover { background: #d1e5d5; }

/* Статья */
.content { background: #fff; border: 1px solid #d9e2d9; border-radius: 10px; padding: 20px 24px; overflow-wrap: anywhere; } 
.content img { max-width: 100%; height: auto; }
.content p.image { text-align: center; margin: 20px 0; }

/* Спонсорские блоки и футер */
.sponsor-block { margin: 20px 0; text-align: center; }
.site-footer { text-align: center; padding: 20px; background: #2f6b3f; color: #e4f2e7; margin-top: 40px; }
.site-footer p { margin: 0; }

/* Адаптив для мобильных устройств */
@media (max-width: 767px) {
    main { padding: 16px 10px 40px; }
}

/* Идеальная шапка и панорамный баннер 1920x458 от края до края */
.site-header { background: transparent; border-bottom: 0; }
.site-banner { width: 100%; background: #150e09; line-height: 0; overflow: hidden; margin: 0; padding: 0; }
.logo-img { width: 100%; height: auto; display: block; border: none; }

/* ---------- 1. Меню (вкладки-трапеции) ---------- */
:root {
  --menu-bg-1: #eef4ee; --menu-bg-2: #d6e3d8; --menu-line: #1f4d2c;
  --tab-text: #24402b; --tab-hover: #3e7d52; --tab-active: #1f4d2c; --tab-on: #fff;
}
.nav-bar-wrapper {
  background: linear-gradient(var(--menu-bg-1), var(--menu-bg-2));
  border-bottom: 4px solid var(--menu-line);
  padding: 12px 15px 0;
}
.nav-container, .nav-main { align-items: flex-end; }
.nav-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.nav-main { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-main a {
  position: relative; isolation: isolate; margin-bottom: -4px;
  padding: 9px 20px 11px; border-radius: 0; background: none;
  color: var(--tab-text); font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: color .2s;
}
.nav-main a::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: 10px 10px 0 0; background: transparent;
  transform: perspective(14px) rotateX(2.2deg); transform-origin: bottom;
  transition: background .2s;
}
.nav-main a:hover { background: none; color: var(--tab-on); }
.nav-main a:hover::before { background: var(--tab-hover); }
.nav-main a.active, .nav-main a.is-active, .nav-main a[aria-current="page"] {
  color: var(--tab-on); padding-top: 14px;
}
.nav-main a.active::before, .nav-main a.is-active::before, .nav-main a[aria-current="page"]::before {
  background: linear-gradient(#2f6b3f, var(--tab-active));
}
.nav-utils {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  background: transparent; border: 0; border-radius: 0; padding: 0; margin-bottom: 8px;
}
.nav-utils a {
  color: var(--tab-text); padding: 6px 10px; border-radius: 4px; text-decoration: none; font-size: 1.1rem;
  transition: background .2s, color .2s;
}
.nav-utils a:hover { background: #fff; color: var(--tab-active); }

@media (max-width: 700px) {
  .nav-bar-wrapper { padding-top: 8px; }
  .nav-main a { margin-bottom: 0; padding: 7px 12px; }
  .nav-main a::before { transform: none; border-radius: 8px; }
  .nav-main a.active, .nav-main a.is-active, .nav-main a[aria-current="page"] { padding-top: 7px; }
}

/* ---------- 2. Тёмная тема ---------- */
body.theme-dark {
  background: #0e1410 !important; color: #e6eee8 !important;
  --menu-bg-1: #1d2a21; --menu-bg-2: #16201a; --menu-line: #2f6b3f;
  --tab-text: #cfe3d4; --tab-hover: #2f6b3f; --tab-active: #2f6b3f; --tab-on: #fff;
}
body.theme-dark .nav-bar-wrapper { background: linear-gradient(var(--menu-bg-1), var(--menu-bg-2)) !important; border-bottom: 4px solid var(--menu-line) !important; }
body.theme-dark .nav-main a { color: var(--tab-text) !important; background: transparent !important; }
body.theme-dark .nav-main a:hover { color: #fff !important; }
body.theme-dark .nav-main a:hover::before { background: var(--tab-hover) !important; }
body.theme-dark .nav-main a.active { color: var(--tab-on) !important; }
body.theme-dark .nav-main a.active::before { background: linear-gradient(#2f6b3f, var(--tab-active)) !important; }
body.theme-dark .nav-utils { background: transparent !important; border: 0 !important; padding: 0 !important; margin-bottom: 8px !important; }
body.theme-dark .nav-utils a { color: var(--tab-text) !important; background: transparent !important; }
body.theme-dark .nav-utils a:hover { background: #2f6b3f !important; color: #fff !important; }
body.theme-dark .card, body.theme-dark .tile, body.theme-dark .content { background: #17201a !important; border-color: #26332a !important; }
body.theme-dark .card h2 a, body.theme-dark .tile-title { color: #7fd19a !important; }
body.theme-dark .card .meta, body.theme-dark .date, body.theme-dark .lead, body.theme-dark .crumbs, body.theme-dark .crumbs a { color: #9db0a2 !important; }
body.theme-dark .tags a { background: #1f2d23 !important; color: #c4e6cf !important; border: 1px solid #35503c !important; }
body.theme-dark .tags a:hover { background: #35503c !important; color: #fff !important; }
body.theme-dark h1, body.theme-dark h2 { color: #e6eee8 !important; }
body.theme-dark .site-footer { background: #16301e !important; color: #e6eee8 !important; }

/* ---------- 3. Слабовидящие (белый фон, строго черный текст) ---------- */
body.theme-blind {
  background: #fff !important; color: #000 !important;
  --menu-bg-1: #fff; --menu-bg-2: #fff; --menu-line: #000;
  --tab-text: #000; --tab-hover: #000; --tab-active: #000; --tab-on: #fff;
}
/* Скрываем логотип */
body.theme-blind .site-banner { display: none !important; }
body.theme-blind .nav-bar-wrapper { background: #fff !important; border-bottom: 4px solid #000 !important; }
body.theme-blind .nav-main a, body.theme-blind .nav-utils a { color: #000 !important; background: transparent !important; }
body.theme-blind .nav-main a::before { background: transparent !important; }
body.theme-blind .nav-main a:hover, body.theme-blind .nav-main a.active { color: #fff !important; }
body.theme-blind .nav-main a.active::before, body.theme-blind .nav-main a:hover::before { background: #000 !important; }
body.theme-blind .nav-utils a:hover { background: #000 !important; color: #fff !important; }

/* Контент только черный */
body.theme-blind main,
body.theme-blind main a,
body.theme-blind main h1,
body.theme-blind main h2,
body.theme-blind main h3,
body.theme-blind main .date,
body.theme-blind main .meta,
body.theme-blind main .lead,
body.theme-blind .crumbs,
body.theme-blind .crumbs a,
body.theme-blind .site-footer,
body.theme-blind .site-footer p {
    color: #000 !important;
}
body.theme-blind main a { text-decoration: underline !important; }
body.theme-blind .card, body.theme-blind .tile, body.theme-blind .content { background: #fff !important; border: 2px solid #000 !important; box-shadow: none !important; }
body.theme-blind .tags a { background: transparent !important; border: 1px solid #000 !important; color: #000 !important; }

/* ---------- 4. Контраст (чёрный фон, строго белый текст) ---------- */
body.theme-contrast {
  background: #000 !important; color: #fff !important;
  --menu-bg-1: #000; --menu-bg-2: #000; --menu-line: #fff;
  --tab-text: #fff; --tab-hover: #fff; --tab-active: #fff; --tab-on: #000;
}
/* Скрываем логотип */
body.theme-contrast .site-banner { display: none !important; }
body.theme-contrast .nav-bar-wrapper { background: #000 !important; border-bottom: 4px solid #fff !important; }
body.theme-contrast .nav-main a, body.theme-contrast .nav-utils a { color: #fff !important; background: transparent !important; }
body.theme-contrast .nav-main a::before { background: transparent !important; }
body.theme-contrast .nav-main a:hover, body.theme-contrast .nav-main a.active { color: #000 !important; }
body.theme-contrast .nav-main a.active::before, body.theme-contrast .nav-main a:hover::before { background: #fff !important; }
body.theme-contrast .nav-utils a:hover { background: #fff !important; color: #000 !important; }

/* Контент только белый */
body.theme-contrast main,
body.theme-contrast main a,
body.theme-contrast main h1,
body.theme-contrast main h2,
body.theme-contrast main h3,
body.theme-contrast main .date,
body.theme-contrast main .meta,
body.theme-contrast main .lead,
body.theme-contrast .crumbs,
body.theme-contrast .crumbs a,
body.theme-contrast .site-footer,
body.theme-contrast .site-footer p {
    color: #fff !important;
}
body.theme-contrast main a { text-decoration: underline !important; }
body.theme-contrast .card, body.theme-contrast .tile, body.theme-contrast .content { background: #000 !important; border: 2px solid #fff !important; box-shadow: none !important; }
body.theme-contrast .tags a { background: transparent !important; border: 1px solid #fff !important; color: #fff !important; }

/* ---------- 5. Масштабирование для спец-версий ---------- */
body.theme-blind,
body.theme-contrast {
    zoom: var(--zoom-scale, 1.25);
}

/* ---------- 6. Скрытие картинок (только по кнопке!) ---------- */
body.hide-images img, body.hide-images .site-banner, body.hide-images .news-card__media, body.hide-images .content img, body.hide-images .content p.image { display: none !important; }

/* ---------- 7. Блок управления масштабом (Слева) ---------- */
#font-size-controls {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    background: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 10px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    /* Компенсируем зум, чтобы блок не раздувался вместе с текстом */
    zoom: calc(1 / var(--zoom-scale, 1.25));
}
body.theme-blind #font-size-controls,
body.theme-contrast #font-size-controls {
    display: flex;
}
body.theme-contrast #font-size-controls {
    background: #000;
    border-color: #fff;
}
#font-size-controls button {
    width: 36px;
    height: 36px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    background: #f0f0f0;
    border: 1px solid #000;
    border-radius: 4px;
    color: #000;
}
#font-size-controls button:hover {
    background: #ddd;
}
#font-size-controls span {
    font-size: 20px;
}
body.theme-contrast #font-size-controls button {
    background: #222;
    border-color: #fff;
    color: #fff;
}
body.theme-contrast #font-size-controls button:hover {
    background: #444;
}

/* Кнопка "Наверх" */
#back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
    display: block;
    line-height: 0;
}
#back-to-top.show {
    opacity: 1;
    visibility: visible;
}
#back-to-top:hover {
    transform: translateY(-4px);
}
#back-to-top img {
    width: 130px;
    height: auto;
    display: block;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

/* ---------- 8. Форматирование текста обзора (все темы) ---------- */
hr#system-readmore { 
    display: none !important; 
}
.content p { 
    text-indent: 1.5em; 
    text-align: justify; 
}
.content p.image { 
    text-indent: 0; 
    text-align: center; 
}

/* ---------- 9. Горизонтальные карточки и ширина 1280px ---------- */
main { max-width: 1280px !important; }
.nav-container { max-width: 1280px !important; }

/* Лента новостей (Главная и Новости) */
.news-card {
    flex-direction: row !important;
    align-items: stretch;
    min-height: 180px;
}
.news-card__media {
    width: 320px !important;
    height: 180px !important;
    flex-shrink: 0;
    aspect-ratio: auto !important; /* отключаем старую логику пропорций */
}
.news-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.news-card__body {
    padding: 1rem 1.5rem !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.news-card__badge {
    margin-top: 0 !important;
    align-self: flex-start;
}

/* Адаптив для мобилок (если экран узкий, возвращаем вертикальный вид) */
@media (max-width: 767px) {
    .news-card { flex-direction: column !important; }
    .news-card__media { width: 100% !important; height: auto !important; aspect-ratio: 16 / 9 !important; }
}

/* ---------- 10. ФИНАЛЬНЫЕ СТИЛИ КАРТОЧКИ (Лента Новостей) ---------- */
.card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 20px !important;
    background: #fff !important;
    border: 1px solid #d9e2d9 !important;
    border-radius: 10px !important;
    padding: 16px !important;
    margin-bottom: 14px !important;
}
body.theme-dark .card {
    background: #17201a !important;
    border-color: #26332a !important;
}
.card-image {
    flex: 0 0 320px !important;
    width: 320px !important;
    height: 180px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #f0f0f0 !important;
    margin: 0 !important;
}
.card-image img {
    width: 320px !important;
    height: 180px !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 0 !important;
}
.card-info {
    flex: 1 1 0% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    min-width: 0 !important;
}
.card-info > * {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    text-align: left !important;
}
.card-info h2 {
    font-size: 20px !important;
    line-height: 1.3 !important;
    margin-bottom: 2px !important;
}
.card-info .meta {
    font-size: 13px !important;
    color: #889 !important;
}
.card-info .tags {
    margin-top: 2px !important;
    margin-bottom: 2px !important;
}
.card-info .lead {
    font-size: 14px !important;
    color: #556 !important;
    line-height: 1.5 !important;
}
.card-info .read-more-wrap {
    margin-top: 6px !important;
}
@media (max-width: 767px) {
    .card { flex-direction: column !important; }
    .card-image { flex: none !important; width: 100% !important; height: auto !important; aspect-ratio: 16 / 9 !important; }
    .card-image img { width: 100% !important; height: 100% !important; }
}

/* ---------- 12. ГЛАВНАЯ СТРАНИЦА (Сетка карточек 4х4) ---------- */
.home-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 295px) !important;
    gap: 30px !important;
    justify-content: start !important;
    margin-bottom: 40px !important;
}

.home-card {
    display: flex !important;
    flex-direction: column !important;
    background: #fff !important;
    border: 1px solid #d9e2d9 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    transition: transform .2s, box-shadow .2s !important;
    height: 100% !important;
}
.home-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1) !important;
}
.home-card__link {
    text-decoration: none !important;
    color: inherit !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}
.home-card__media {
    width: 295px !important;
    height: 166px !important;
    background: #f0f0f0 !important;
    flex-shrink: 0 !important;
}
.home-card__media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}
.home-card__body {
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    flex-grow: 1 !important;
}
.home-card__title {
    font-size: 18px !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    color: #1c6b34 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}
.home-card__date {
    font-size: 13px !important;
    color: #889 !important;
}
.home-card__excerpt {
    font-size: 14px !important;
    color: #556 !important;
    margin: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Темная тема для Главной */
body.theme-dark .home-card { background: #17201a !important; border-color: #26332a !important; }
body.theme-dark .home-card__title { color: #7fd19a !important; }
body.theme-dark .home-card__date { color: #9db0a2 !important; }
body.theme-dark .home-card__excerpt { color: #cfe3d4 !important; }

/* Адаптив */
@media (max-width: 1280px) {
    .home-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
    }
    .home-card__media {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
    }
}
@media (max-width: 960px) {
    .home-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 600px) {
    .home-grid { grid-template-columns: 1fr !important; }
}

/* ---------- 13. Широкие экраны (1920px и больше) ---------- */
@media (min-width: 1600px) {
    /* Расширяем сайт */
    main, .nav-container {
        max-width: 1680px !important;
    }
    
    /* Сетка главной: 5 колонок по 320px */
    .home-grid {
        grid-template-columns: repeat(5, 320px) !important;
        gap: 20px !important;
    }
    
    /* Карточки главной увеличиваются до 320x180 */
    .home-card {
        width: 320px !important;
    }
    .home-card__media {
        width: 320px !important;
        height: 180px !important;
    }
    
    /* Карточки в ленте Новостей остаются 320x180 (явно указываем, чтобы ничего не сломалось) */
    .card-image {
        width: 320px !important;
        height: 180px !important;
    }
}

/* ---------- 15. Форма поиска (Исправленная) ---------- */
.nav-search-form {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    max-width: 420px !important;
    margin: 0 20px 8px 20px !important;
    gap: 6px !important;
    position: relative !important; /* Важно для абсолютного позиционирования списка */
}
.nav-search-box {
    position: relative !important;
    width: 100% !important;
    display: flex !important;
}
.nav-search-box input {
    width: 100% !important;
    padding: 8px 14px !important;
    border-radius: 20px !important;
    border: 1px solid #c3d4c6 !important;
    background: rgba(255,255,255,0.8) !important;
    font-size: 14px !important;
    outline: none !important;
}
.search-results {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 99999 !important; /* Выше любых элементов */
    background: #fff !important;
    border: 1px solid #d9e2d9 !important;
    border-radius: 8px !important;
    max-height: 350px !important;
    overflow-y: auto !important;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
}
.search-results a {
    display: block !important;
    padding: 10px 14px !important;
    text-decoration: none !important;
    color: #333 !important;
    border-bottom: 1px solid #f0f0f0 !important;
}
.search-results a:hover { background: #f4f7f4 !important; }
.search-btn {
    background: rgba(255,255,255,0.8) !important;
    border: 1px solid #c3d4c6 !important;
    border-radius: 20px !important;
    padding: 0 12px !important;
    cursor: pointer !important;
    height: 36px !important;
    flex-shrink: 0 !important;
}

/* Темная тема */
body.theme-dark .nav-search-box input, body.theme-dark .search-btn { background: rgba(255,255,255,0.1) !important; border-color: #35503c !important; color: #e6eee8 !important; }
body.theme-dark .search-results { background: #17201a !important; border-color: #26332a !important; }
body.theme-dark .search-results a { color: #e6eee8 !important; border-bottom-color: #26332a !important; }
body.theme-dark .search-results a:hover { background: #2f6b3f !important; }
body.theme-dark .search-btn:hover { background: #2f6b3f !important; }

/* Блок глубокого поиска на странице результатов */
.full-search-block {
    margin: 30px 0;
    padding: 20px;
    background: #f4f7f4;
    border: 1px dashed #c3d4c6;
    border-radius: 10px;
    text-align: center;
}
body.theme-dark .full-search-block { background: #17201a; border-color: #35503c; }
.btn-full-search {
    background: #2f6b3f;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-full-search:hover { background: #1f4d2c; }
.btn-full-search:disabled { background: #999; cursor: not-allowed; }
.full-search-warning { font-size: 13px; color: #889; margin-top: 10px; }
.loader-text { font-size: 18px; font-weight: bold; color: #2f6b3f; text-align: center; padding: 40px 0; }
body.theme-dark .loader-text { color: #7fd19a; }

/* Дополнения для пагинации поиска */
.loader-text { text-align: center; padding: 40px 0; font-size: 18px; color: #2f6b3f; font-weight: bold; }
body.theme-dark .loader-text { color: #7fd19a; }
.page-link:hover { background: #e4efe6; }
body.theme-dark .page-link { border-color: #35503c; color: #e6eee8; }
body.theme-dark .page-link:hover { background: #2f6b3f; }

/* ---------- 16. Бейджи тегов (только для Главной) ---------- */
.news-card__badge {
    position: relative !important;
    z-index: 2 !important;
    display: inline-flex !important;
    align-items: center !important;
    align-self: flex-start !important;
    gap: 0.45rem !important;
    max-width: 100% !important;
    padding: 0.25rem 0.8rem 0.25rem 0.4rem !important;
    background: #fff !important;
    color: #1f4d2c !important;
    border: 1px solid #c9dccd !important;
    border-radius: 999px !important;
    box-shadow: 0 2px 6px rgba(23,50,31,.16) !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    margin-bottom: 8px !important;
}
.news-card__badge-icon {
    flex: none !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 4px !important;
}
.news-card__badge-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* На Главной бейдж заходит на картинку */
.home-card .news-card__badge {
    margin-top: -22px !important;
    margin-left: 12px !important;
    margin-bottom: 8px !important;
}

/* Темная тема */
body.theme-dark .news-card__badge {
    background: #1f2d23 !important;
    color: #c4e6cf !important;
    border-color: #35503c !important;
}

/* Режим "Слабовидящие" */
body.theme-blind .news-card__badge {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
    box-shadow: none !important;
}

/* Режим "Контраст" */
body.theme-contrast .news-card__badge {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
    box-shadow: none !important;
}

/* Скрытие картинок (бейдж не должен съезжать) */
body.hide-images .home-card .news-card__badge {
    margin-top: 0 !important;
    margin-left: 0 !important;
}

/* ---------- 17. Спонсоры и подвал ---------- */
.sponsor-above-footer {
    text-align: center;
    margin: 40px 0 20px 0; /* Отступы, чтобы не прилипало к контенту и футеру */
    padding: 10px;
}
.sponsor-inside-footer {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2); /* Разделитель */
}
.site-footer {
    text-align: center !important;
    padding: 20px !important;
    background: #2f6b3f !important;
    color: #e4f2e7 !important;
    margin-top: 0 !important;
}
.footer-legal {
    font-size: 10px !important; /* Уменьшаем шрифт до 10px */
    line-height: 1.6 !important;
    color: #b0c4b6 !important;
}
.footer-legal p {
    margin: 4px 0 !important;
}
.footer-legal a {
    color: #d0e6d6 !important;
    text-decoration: underline !important;
}
.footer-legal a:hover {
    color: #fff !important;
}

/* Темная тема для футера */
body.theme-dark .site-footer { background: #16301e !important; color: #e6eee8 !important; }
body.theme-dark .footer-legal { color: #9db0a2 !important; }
body.theme-dark .footer-legal a { color: #c4e6cf !important; }

/* ---------- 18. Красивые таблицы в документах ---------- */
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #d9e2d9;
}
.content-table th, 
.content-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #d9e2d9;
    text-align: left;
    vertical-align: top;
}
.content-table th {
    background: #f4f7f4;
    font-weight: 600;
    color: #1c4d2b;
}
.content-table tr:last-child td {
    border-bottom: none;
}
/* Первая колонка (ключ) делаем чуть шире и с фоном */
.content-table td:first-child {
    width: 30%;
    font-weight: 600;
    background: #fafbfa;
    color: #333;
}

/* Темная тема */
body.theme-dark .content-table {
    border-color: #26332a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
body.theme-dark .content-table th, 
body.theme-dark .content-table td {
    border-bottom-color: #26332a;
}
body.theme-dark .content-table th {
    background: #1d2a21;
    color: #cfe3d4;
}
body.theme-dark .content-table td:first-child {
    background: #151d17;
    color: #cfe3d4;
}
body.theme-dark .content-table td {
    color: #e6eee8;
}

/* Слабовидящие и Контраст (сбрасываем на черно-белое) */
body.theme-blind .content-table,
body.theme-contrast .content-table { box-shadow: none; border-radius: 0; border: 2px solid currentColor; }
body.theme-blind .content-table th, body.theme-blind .content-table td,
body.theme-contrast .content-table th, body.theme-contrast .content-table td { border-bottom: 2px solid currentColor; background: transparent; color: inherit; }

/* ---------- 19. Сетка категорий (Уроки, Проекты и т.д.) ---------- */
.category-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 295px) !important;
    gap: 30px !important;
    justify-content: start !important;
    margin: 20px 0 40px 0 !important;
}
.category-card {
    display: flex !important;
    flex-direction: column !important;
    text-decoration: none !important;
    background: #fff !important;
    border: 1px solid #d9e2d9 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    transition: transform .2s, box-shadow .2s !important;
}
.category-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1) !important;
}
.category-card__media {
    width: 295px !important;
    height: 166px !important;
    background: #f0f0f0 !important;
}
.category-card__media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}
.category-card__title {
    padding: 12px 16px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1c6b34 !important;
    text-align: center !important;
}

body.theme-dark .category-card { background: #17201a !important; border-color: #26332a !important; }
body.theme-dark .category-card__title { color: #7fd19a !important; }

@media (max-width: 1280px) {
    .category-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 20px !important; }
    .category-card__media { width: 100% !important; height: auto !important; aspect-ratio: 16 / 9 !important; }
}
@media (max-width: 960px) { .category-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 600px) { .category-grid { grid-template-columns: 1fr !important; } }

/* ---------- 20. Центрирование заголовков в Играх ---------- */
.games-grid .home-card__title {
    text-align: center !important;
    padding-bottom: 8px !important;
}

/* ---------- 21. Сетка для Игр (авто-подбор колонок) ---------- */
.games-grid {
    grid-template-columns: repeat(auto-fill, 295px) !important;
    justify-content: center !important; /* Центрируем неполные ряды */
    gap: 30px !important;
}
@media (max-width: 767px) {
    .games-grid { grid-template-columns: repeat(auto-fill, 100%) !important; }
}

/* ---------- 23. Адаптивное меню настроек (Dropdown) ---------- */
.utils-dropdown {
    position: relative;
}
.utils-toggle {
    display: none;
    background: rgba(255,255,255,0.65);
    border: 1px solid #c3d4c6;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    padding: 6px 10px;
    color: var(--tab-text);
    font-weight: 600;
    white-space: nowrap;
    align-items: center;
    gap: 5px;
}
.utils-content {
    display: flex;
    gap: 4px;
    align-items: center;
}

@media (max-width: 1600px) {
    .utils-toggle {
        display: flex; /* Показываем кнопку-триггер */
    }
    .utils-content {
        display: none; /* Скрываем по умолчанию */
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        background: #fff;
        border: 1px solid #d9e2d9;
        border-radius: 8px;
        padding: 8px 12px;
        flex-direction: row; /* Горизонтально! */
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        white-space: nowrap;
    }
    .utils-content.open {
        display: flex; /* Показываем при клике */
    }
    .utils-content a {
        display: inline-block;
        padding: 4px 6px;
        font-size: 1.1rem;
        border-radius: 4px;
        text-decoration: none;
    }
    
    /* Темная тема */
    body.theme-dark .utils-toggle { background: rgba(255,255,255,0.1); border-color: #35503c; color: #cfe3d4; }
    body.theme-dark .utils-content { background: #17201a; border-color: #26332a; }
    body.theme-dark .utils-content a:hover { background: #2f6b3f; }
    
    /* Слабовидящие и Контраст */
    body.theme-blind .utils-toggle { background: #fff; border: 2px solid #000; color: #000; }
    body.theme-blind .utils-content { background: #fff; border: 2px solid #000; }
    body.theme-blind .utils-content a:hover { background: #000; color: #fff; }
    
    body.theme-contrast .utils-toggle { background: #000; border: 2px solid #fff; color: #fff; }
    body.theme-contrast .utils-content { background: #000; border: 2px solid #fff; }
    body.theme-contrast .utils-content a:hover { background: #fff; color: #000; }
}

/* ---------- 25. Полный адаптив для Мобильных (до 768px) ---------- */
.menu-toggle {
    display: none; /* Скрыт на десктопе */
    background: transparent;
    border: 1px solid #c3d4c6;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 1.5rem;
    color: #24402b;
    cursor: pointer;
    margin-right: 10px;
}

@media (max-width: 767px) {
    /* Меняем шапку */
    .nav-container {
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .menu-toggle {
        display: block;
    }
    
    /* Навигация превращается в выпадающий список */
    .nav-main {
        display: none; /* Скрыто по умолчанию */
        flex-direction: column !important;
        width: 100% !important;
        order: 3; /* Переносим под поиск */
        background: #fff;
        border: 1px solid #d9e2d9;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        padding: 10px;
        margin-top: 5px;
    }
    .nav-main.mobile-open {
        display: flex !important;
    }
    .nav-main a {
        width: 100% !important;
        text-align: left !important;
        padding: 10px 15px !important;
        margin-bottom: 0 !important;
        border-radius: 4px !important;
        color: #24402b !important;
        background: transparent !important;
    }
    .nav-main a::before {
        display: none !important; /* Убираем трапеции на телефоне */
    }
    .nav-main a.active {
        background: #2f6b3f !important;
        color: #fff !important;
        padding-top: 10px !important;
    }
    
    /* Поиск и кнопки */
    .nav-search-form {
        order: 2;
        flex: 1 1 100%;
        max-width: none;
        margin: 0 !important;
    }
    .nav-utils {
        order: 1;
        margin-left: auto;
        margin-bottom: 0 !important;
    }
    
    /* Сетка Игр и Категорий (1 колонка) */
    .games-grid {
        grid-template-columns: 1fr !important;
        justify-items: center;
    }
    .category-grid {
        grid-template-columns: 1fr !important;
        justify-items: center;
    }
    
    /* Тёмная тема для бургера и меню */
    body.theme-dark .menu-toggle { color: #cfe3d4; border-color: #35503c; }
    body.theme-dark .nav-main { background: #17201a; border-color: #26332a; }
    body.theme-dark .nav-main a { color: #cfe3d4 !important; }
}

/* На планшетах (769px - 1100px) карточки игр и категорий по 2-3 в ряд */
@media (min-width: 768px) and (max-width: 1100px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, 320px) !important;
        justify-content: center;
    }
    .category-grid {
        grid-template-columns: repeat(auto-fill, 320px) !important;
        justify-content: center;
    }
}

/* ---------- 26. Горизонтальное меню и карточки 80% на мобильных ---------- */
@media (max-width: 767px) {
    /* 1. Горизонтальное меню с переносом */
    .nav-main {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 5px !important;
    }
    .nav-main a {
        width: auto !important; /* Ширина по содержимому */
        flex: 1 1 auto;          /* Равномерно распределяем пространство */
        text-align: center !important;
        padding: 8px 12px !important;
        margin-bottom: 4px !important;
        border-radius: 6px !important;
    }
    .nav-main a.active {
        padding-top: 8px !important; /* Выравниваем активную вкладку */
    }

    /* 2. Карточки контента на 80% ширины */
    .games-grid .home-card,
    .category-grid .category-card,
    .card {
        width: 80% !important;
        max-width: 80% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* 3. Фикс картинок внутри 80% карточек */
    .games-grid .home-card__media,
    .category-grid .category-card__media {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
    }
}
