/* Центрирование кнопок загрузки */
.f_download .value,
.f_mirror .value {
    display: flex;
    justify-content: center; /* центрировать по горизонтали */
    gap: 10px; /* отступ между кнопками */
}

/* Сделать кнопки одинакового размера */
.f_download .btn-lg,
.f_mirror .btn-lg {
    min-width: 256px;
    text-align: center;
}

/* Прижать значения value к правому краю, кроме фото и кнопок */
.icms-content-header__field .value {
    display: flex;
    justify-content: flex-end;
}

/* Исключения */
.icms-content-header__field.f_photo .value,
.icms-content-header__field.f_download .value,
.icms-content-header__field.f_mirror .value {
    justify-content: center;
}


.field.ft_category .value {
    line-height: 2; /* Увеличиваем межстрочный интервал */
}
/* Делаем превью квадратными ТОЛЬКО в списке */
.content_list .field.ft_image .value {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.content_list .field.ft_image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Размещаем категорию поверх изображения ТОЛЬКО в списке */
.content_list .mods_list_item {
    position: relative;
}

.content_list .field.ft_category {
    position: absolute;
    top: 10px;
    left: 20px;
    z-index: 10;
    margin-bottom: 0 !important;
}

/* Убедимся что кнопки категории видны на изображении */
.content_list .field.ft_category .btn-sm {
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}


/* ===== Top-10 Widget — только кружки (работает при классе виджета top-10) ===== */
.top-10 .icms-widget__content_list {
    counter-reset: idx;
}

.top-10 .icms-widget__content_list .content_list_item {
    counter-increment: idx;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* фиксированные и ровные кружки с номерами */
.top-10 .icms-widget__content_list .content_list_item::before {
    content: counter(idx);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    color: #fff;
}

/* все кружки — фирменный цвет (светлая тема: бронза) */
.top-10 .icms-widget__content_list .content_list_item:nth-child(1)::before,
.top-10 .icms-widget__content_list .content_list_item:nth-child(2)::before,
.top-10 .icms-widget__content_list .content_list_item:nth-child(3)::before,
.top-10 .icms-widget__content_list .content_list_item:nth-child(n+4)::before {
    background: #8B6F3F;
    box-shadow: 0 0 3px rgba(0,0,0,0.25);
}

/* адаптив: меньше кружки на телефоне */
@media (max-width: 576px) {
    .top-10 .icms-widget__content_list .content_list_item::before {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        font-size: 0.8rem;
    }
}

/* Скроллинг контента */
.overflow-auto {
    max-height: 400px;
}

/* ===================== Превью: фикс. размер + зум ===================== */
.mod-card__preview {
    overflow: hidden;
}

/* Разделитель между тайтлом мода и описанием в карточке каталога (светлая тема) */
.mod-card .f_content {
    border-top: 1px solid #E3D9C2;
}

.mod-card__preview-inner {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;   /* одинаковая пропорция для всех */
    background: #E7DFCF;    /* пергамент темнее, пока грузится картинка */
    line-height: 0;
}

.mod-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;      /* заполняет весь блок, обрезая лишнее */
    display: block;
    transition: transform .4s ease;
    transform-origin: center;
}

.mod-card:hover .mod-card__img {
    transform: scale(1.08); /* зум внутри рамки */
}

/* ===================== Бейджи ===================== */
.mod-badge {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .25rem .5rem;
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: .25rem;
    color: #fff;
    background: rgba(0, 0, 0, .72);
    white-space: nowrap;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}
.mod-badge svg { width: 12px; height: 12px; flex-shrink: 0; }

.mod-badge--game     { top: .5rem;    left:  .5rem; pointer-events: none; }
.mod-badge--category { top: .5rem;    right: .5rem; background: rgba(139, 111, 63, .92); }
.mod-badge--category:hover { color: #fff; text-decoration: none; }
.mod-badge--update   { bottom: .5rem; left:  .5rem; pointer-events: none; background: rgba(47, 122, 77, .92); }
.mod-badge--version  { bottom: .5rem; right: .5rem; pointer-events: none; background: rgba(0, 0, 0, .6); }
/* ===================== Инфобар ===================== */

.info_bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: .35rem .75rem;
}

.info_bar .bar_item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    line-height: 1;
    min-width: 0;
}

.info_bar .bar_item a,
.info_bar .bar_item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Автор — принудительно во 2-й ряд, в среднюю колонку (под датой) */
.info_bar .bar_item.bi_author {
    grid-column: 2;
    grid-row: 2;
}

.info_bar svg { width: 13px; height: 13px; opacity: .7; flex-shrink: 0; }
.info_bar a   { color: inherit; text-decoration: none; }

.info_bar .bar_item + .bar_item::before { content: none; }

/* ===================== tiles_3: описание категории под пагинацией ===================== */
.category_description {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    max-width: 880px;
    line-height: 1.7;
    background: #EFE7D3;              /* пергамент темнее фона #F5F0E6 */
    border: 1px solid #D8CBA8;
    border-left: 4px solid #8B6F3F;   /* бронза secondary */
    border-radius: .3rem;
    color: #2A2620;
}
.category_description > *:last-child { margin-bottom: 0; }

/* ===================== tiles_3: инфобар (светлая тема) ===================== */
/* Отделен от фона бордерами, а не заливкой-плашкой: */
.info_bar.tiles3-infobar {
    border-top: 1px solid #E3D9C2;
    border-radius: 0 0 .3rem .3rem;
    color: #6B6353;
}
.info_bar.tiles3-infobar a { color: inherit; }
.info_bar.tiles3-infobar a:hover { color: #5E4219; }

/* ===================== tiles_3: инфобар в два ряда ===================== */
/* Ряд 1 — автор на всю ширину, ряд 2 — мета (рейтинг|дата|просмотры).
   Селекторы сдвоены (.info_bar.tiles3-infobar): theme.css грузится ПОЗЖЕ
   custom.css, поэтому выигрываем только за счёт более высокой специфичности. */
.info_bar.tiles3-infobar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
}
.info_bar.tiles3-infobar .bar_item {
    flex: 0 1 auto;
    justify-content: flex-start;
    margin-right: 0;
    min-width: 0;
    line-height: 1;
    white-space: nowrap;
}
/* Иконки блочно внутри flex-айтема — честное центрирование с цифрами */
.info_bar.tiles3-infobar .bar_item svg {
    display: block;
}
/* Пальцы и счёт рейтинга — по одной оси */
.info_bar.tiles3-infobar .bi_rating .rating_widget {
    align-items: center;
}
/* Ряд 2 — дата на всю ширину с разделителем под ней */
.info_bar.tiles3-infobar .bar_item.bi_date_pub {
    flex: 1 1 100%;
    justify-content: flex-start;
    border-bottom: 1px solid #E3D9C2;
    padding-bottom: .35rem;
}
.info_bar.tiles3-infobar .bar_item.bi_author {
    flex: 1 1 100%;
    font-weight: 600;
    line-height: 1.5;
    /* сброс старого правила «автор во 2-м ряду» */
    grid-column: auto;
    grid-row: auto;
}
.info_bar.tiles3-infobar .bar_item.bi_author a,
.info_bar.tiles3-infobar .bar_item.bi_author span {
    min-width: 0;
}
.info_bar.tiles3-infobar .author-label {
    color: #8B6F3F;
    font-weight: 400;
    flex: 0 0 auto;
    white-space: nowrap;
}
.info_bar.tiles3-infobar .bar_item.bi_author svg {
    flex: 0 0 auto;
}
/* Третий ряд: рейтинг слева, просмотры строго по центру, скачивания справа */
.info_bar.tiles3-infobar .bar_item.bi_hits,
.info_bar.tiles3-infobar .bar_item.bi_downloads {
    border-left: 1px solid #E3D9C2;
    padding-left: .5rem;
}
.info_bar.tiles3-infobar .bar_item.bi_hits {
    flex: 1 1 auto;
    justify-content: center;
}
.info_bar.tiles3-infobar .bar_item.bi_downloads {
    justify-content: flex-end;
}
@media (max-width: 575.98px) {
    .info_bar.tiles3-infobar {
        gap: .3rem .4rem;
    }
    .info_bar.tiles3-infobar .bar_item.bi_hits,
    .info_bar.tiles3-infobar .bar_item.bi_downloads {
        padding-left: .4rem;
    }
}

/* ===================== Виджеты списка контента: ось «иконка — цифра» ===================== */
/* Сдвоенный селектор: theme.css грузится позже custom.css,
   выигрываем только за счёт более высокой специфичности.
   Цветов нет — светлая/тёмная темы и мобильный покрываются автоматически.
   Записи (fields-title, mods_item) и tiles_3/auto_list не задеты — скоуп только по новому классу. */
.info_bar.widget-list-infobar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .6rem;
}
.info_bar.widget-list-infobar .bar_item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    line-height: 1;
    margin-right: 0;
    min-width: 0;
    white-space: nowrap;
}
.info_bar.widget-list-infobar .bar_item svg {
    display: block;
}
.info_bar.widget-list-infobar .bi_rating .rating_widget {
    align-items: center;
}

/* ===================== Виджет big_tiles: место под lazy-фото ===================== */
/* У фото нет размеров в разметке — резервируем высоту, чтобы карточки
   не прыгали при догрузке картинок */
.widget-big-tiles .f_photo {
    min-height: 140px;
    background-color: #E7DFCF;
    border-radius: .3rem;
    overflow: hidden;
}
.widget-big-tiles .f_photo img {
    display: block;
    width: 100%;
}

/* ===================== Слайдер поля «Набор изображений» ===================== */
/* Каркас не схлопывается до старта Slick — меньше скачок вёрстки */
.ft_images .slick-list {
    min-height: 120px;
}

/* ===================== Виджет fields-title: инфобар записи ===================== */
/* Виджет на всю ширину — делаем элементы крупнее и заметнее */
.mod-info .info_bar {
    font-size: 1rem;
    gap: .35rem .6rem;
    padding: .35rem 0;
}
.mod-info .info_bar svg {
    width: 16px;
    height: 16px;
    opacity: .85;
}
.mod-info .info_bar .bar_item {
    gap: .45rem;
}
/* Овальная подложка-пилюля под каждый итем */
.mod-info .info_bar .bar_item {
    background-color: #EFE7D3;
    border: 1px solid #D8CBA8;
    border-radius: 999px;
    padding: .25rem .7rem;
    color: #2A2620;
}
/* Надпись «Оценить:» — отступ справа, чтобы не заезжала на рейтинг */
.mod-info .info_bar .rating_label {
    margin-right: .5rem;
    white-space: nowrap;
}

/* ===================== Логотип в шапке ===================== */
/* Фиксированная высота: не зависит от размеров файла (SVG/растр) */
.navbar-brand img {
    height: 48px;
    width: auto;
    max-width: 100%;
    vertical-align: middle;
}
/* Мобильная иконка — меньше */
.navbar-brand img.d-sm-none {
    height: 40px;
}

/* ===================== Фильтр: чекбоксы списков ровной адаптивной сеткой ===================== */
/* Только панель фильтра — формы добавления/редактирования не трогаем */
.icms-filter-panel .input_checkbox_list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .4rem .75rem;
    align-items: start;
}
.icms-filter-panel .input_checkbox_list .custom-checkbox {
    margin-bottom: 0 !important;
    min-width: 0;
}

/* ===================== Виджет fields-downloads: ровный список с линиями ===================== */
.mod-downloads .icms-content-header__field {
    margin: 0;
    padding: .25rem 0;
}
.mod-downloads .icms-content-header__field:not(.f_download):not(.f_mirror):not(.f_photo) {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    border-bottom: 1px solid #E3D9C2;
}
.mod-downloads .title_left {
    flex: 0 0 180px;
    float: none;
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #2A2620;
}
.mod-downloads .title_left .icms-svg-icon {
    color: #8B6F3F;
    flex: 0 0 auto;
}
.mod-downloads .icms-content-header__field:not(.f_download):not(.f_mirror):not(.f_photo) > .value {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    text-align: right;
}
.mod-downloads .f_mod_category > .value a,
.mod-downloads .f_author > .value a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
@media (max-width: 575.98px) {
    .mod-downloads .icms-content-header__field:not(.f_download):not(.f_mirror):not(.f_photo) {
        flex-wrap: nowrap;
        gap: .25rem .4rem;
    }
    .mod-downloads .title_left {
        flex: 0 0 auto;
        min-width: 0;
    }
    .mod-downloads .icms-content-header__field:not(.f_download):not(.f_mirror):not(.f_photo) > .value {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
    }
}

/* ===================== Контент записи: ритм и блоки кода ===================== */
.ft_html p,
.ft_html ul,
.ft_html ol {
    margin-bottom: .75rem;
}
.ft_html > div {
    margin-bottom: .75rem;
}
.ft_html > div:empty {
    display: none;
}
.ft_html > *:last-child {
    margin-bottom: 0;
}
.ft_html hr {
    margin: 1.25rem 0;
}
/* Подсветка кода GeSHi ([code] редактора): карточка вокруг <pre> */
.bb_tag_code {
    background-color: #FFFFFF;
    border: 1px solid #E3D9C2;
    border-radius: .3rem;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    overflow-x: auto;
}
.bb_tag_code pre {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}
.bb_tag_code ol {
    margin-bottom: 0;
}

/* ===================== Плашка «Мод обновлён» (поле update_info) ===================== */
.f_update_info blockquote {
    background-color: #E7F2EA;
    border: 1px solid #CFE3D6;
    border-left: 4px solid #2F7A4D;
    border-radius: .3rem;
    padding: .75rem 1rem;
    margin: 0 0 .75rem;
    font-size: .9rem;
    color: #2A2620;
}
.f_update_info blockquote::before {
    content: none;
}
.f_update_info blockquote p {
    margin-bottom: .25rem;
}
.f_update_info blockquote > *:last-child {
    margin-bottom: 0;
}
.f_update_info blockquote time {
    font-weight: 600;
}

/* ===================== Футер (светлая тема): hover ссылок ===================== */
/* Фон футера тёмно-синий — ховер делаем пергаментным, а не тёмно-синим */
.icms-footer__middle a:hover,
.icms-footer__bottom a:hover {
    color: #F5F0E6;
}

/* ===================== Топ-10 v2 (auto_list/list_v2): строки без медалей ===================== */
.icms-toplist {
    display: flex;
    flex-direction: column;
    gap: 0;
}
/* Ужимаем паддинг тела виджета вокруг списка */
.icms-widget:has(.icms-toplist) > .card-body {
    padding: .5rem;
}
.icms-toplist__item {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #E3D9C2;
    border-radius: .3rem;
    padding: 0;
    background-color: #F5F0E6;
}
.icms-toplist__item:hover {
    background-color: #F7F2E7;
}
/* Соседние рамки схлопываем, чтобы не было двойной линии.
   Селектор усилен: theme.css позже задаёт margin-top:3rem с той же
   специфичностью — выигрываем только большим весом */
.icms-toplist > .content_list_item + .content_list_item {
    margin-top: -1px;
}
/* Страж от кружков v1, если на виджете остался класс top-10 */
.icms-toplist .content_list_item::before {
    content: none;
}
.icms-toplist__rank {
    flex: 0 0 2ch;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    color: #8B6F3F;
    text-align: center;
}
.icms-toplist__title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.icms-toplist__title a {
    color: inherit;
}
.icms-toplist__count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #6B6353;
    font-size: .85rem;
    white-space: nowrap;
}
.icms-toplist__count .icms-svg-icon {
    width: 14px;
    height: 14px;
    opacity: .7;
}

/* ===================== Топ-10 v3 (auto_list/list_v3): строки-лидеры ===================== */
.icms-toplist3 {
    display: flex;
    flex-direction: column;
}
.icms-toplist3__item {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding: .42rem .25rem;
}
.icms-toplist3__item + .icms-toplist3__item {
    border-top: 1px solid #E3D9C2;
}
.icms-toplist3__rank {
    flex: 0 0 2.2ch;
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: #8B6F3F;
    text-align: right;
}
.icms-toplist3__title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: .95rem;
}
.icms-toplist3__title a {
    color: inherit;
    text-decoration: none;
}
.icms-toplist3__item:hover .icms-toplist3__title a {
    color: #5E4219;
}
.icms-toplist3__count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #6B6353;
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.icms-toplist3__count .icms-svg-icon {
    width: 13px;
    height: 13px;
    opacity: .7;
}

/* ===================== Переключатель темы (кнопка-виджет в хедере) ===================== */
/* Кнопка скрыта, пока theme.js не выставит правильное состояние (класс theme-ready).
   Класс js на <html> ставит инлайн-скрипт в <head>: без JS кнопка просто видна */
html.js:not(.theme-ready) [data-theme-toggle] {
    visibility: hidden;
}
.theme-toggle {
    background: transparent;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    margin-right: .75rem;
}
.theme-toggle:hover,
.theme-toggle:focus {
    text-decoration: none;
}
.theme-toggle > span {
    display: inline-flex;
    align-items: center;
}
.theme-toggle .icms-svg-icon {
    margin-right: .45rem;
}
/* Кнопка стоит на тёмно-синем фоне шапки — текст светлый, как у хедера */
.icms-header__top .theme-toggle,
.icms-header__middle .theme-toggle {
    color: #F2E8D2;
}
.icms-header__top .theme-toggle:hover,
.icms-header__middle .theme-toggle:hover {
    color: #fff;
}
.overflow-auto {
    max-height: 500px;
}

/* Категории-дерево и кнопки-инфо: бронза вместо $primary (var(--primary) из theme.css) */
html:not([data-theme="dark"]) body {
    --primary: #8B6F3F;
}
html:not([data-theme="dark"]) .icms-navcats__item.is-active > .icms-navcats__row > .icms-navcats__link,
html:not([data-theme="dark"]) .icms-navcats__item.is-active > .icms-navcats__row > .icms-navcats__toggle {
    color: #6F4E1E;
}
html:not([data-theme="dark"]) .btn-outline-info {
    color: #6F4E1E;
    border-color: rgba(139, 111, 63, .55);
}
html:not([data-theme="dark"]) .btn-outline-info:hover,
html:not([data-theme="dark"]) .btn-outline-info:focus {
    background-color: #8B6F3F;
    border-color: #8B6F3F;
    color: #F5F0E6;
}

/* Активный пункт меню — бронза в тон ссылкам (перебиваем $primary темы) */
html:not([data-theme="dark"]) body .navbar-light .navbar-nav .nav-link.active,
html:not([data-theme="dark"]) body .navbar-light .navbar-nav .active > .nav-link,
html:not([data-theme="dark"]) body .navbar-light .navbar-nav .nav-link.show,
html:not([data-theme="dark"]) body .navbar-light .nav-link.active,
html:not([data-theme="dark"]) body .icms-navbar .nav-link.active {
    color: #6F4E1E;
}
html:not([data-theme="dark"]) body .icms-navbar .nav-link.active::before,
html:not([data-theme="dark"]) body .nav-tabs .nav-link.active::before {
    background-color: #8B6F3F;
}