/* ==========================================================================
   Шрифты (Self-Hosted WOFF2)
   ========================================================================== */

/* 1. Unbounded — Заголовки и логотип */
@font-face {
    font-family: 'Unbounded';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/unbounded/Unbounded-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Unbounded';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/unbounded/Unbounded-Medium.woff2') format('woff2');
}

/* 2. GolosText — Основной текст интерфейса и заметок */
@font-face {
    font-family: 'GolosText';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/golostext/golos-text_regular.woff2') format('woff2');
}

@font-face {
    font-family: 'GolosText';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/golostext/golos-text_medium.woff2') format('woff2');
}

@font-face {
    font-family: 'GolosText';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/golostext/golos-text_demibold.woff2') format('woff2');
}

/* 3. GeistMono — Блоки кода, даты, моноширинные данные */
@font-face {
    font-family: 'GeistMono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/geistmono/GeistMono-Regular.woff2') format('woff2');
}

/* 4. ForkAwesome — Иконки интерфейса */
@font-face {
    font-family: 'ForkAwesome';
    font-style: normal;
    font-weight: normal;
    font-display: block;
    src: url('../fonts/forkawesome-webfont.woff2') format('woff2');
}

/* ==========================================================================
   SilverBox — Фирменный стиль (Light Design System)
   ========================================================================== */
:root {
    /* Архитектурная сквозная сетка */
    --content-width: 720px;
    --screen-gap: 10px; /* Отступ от краев экрана */
    --column-width: min(var(--content-width), 100% - (var(--screen-gap) * 2));
    --pylon-width: calc(var(--content-width) + (var(--screen-gap) * 2)); /* 740px */

    /* Палитра градаций серого */
    --gray-50:  #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --text-main: #0a0a0a;

    --border-color: var(--gray-200);
    --border-light: var(--gray-300);

    --text-muted: var(--gray-600);
    --text-dim: var(--gray-500);

    --header-bg: var(--gray-900);
    --header-height: 44px;
    --bottom-nav-height: 52px;

    /* Акцентные цвета */
    --accent: #0066cc;
    --accent-hover: #0052a3;
    --accent-bg: rgba(0, 102, 204, 0.08);
    --accent-gold: #ffd83c;

    --sticky-color: #d97706;
    --sticky-bg: rgba(217, 119, 6, 0.08);

    --private-color: #db2777;
    --private-bg: rgba(219, 39, 119, 0.08);

    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-bg: rgba(220, 38, 38, 0.08);

    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.08);

    --code-bg: var(--gray-50);
    --code-border: var(--gray-200);

    /* Единая система теней */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* Шрифты */
    --font-sans: 'GolosText', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'GeistMono', SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --font-heading: 'Unbounded', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Скругления */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

strong {
    font-weight: 500;
}

/* ==========================================================================
   Базовая структура страницы
   ========================================================================== */
html {
    scroll-padding-top: 54px;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--gray-800);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    isolation: isolate; /* Корневая изоляция: не даёт z-index: -1 провалиться под обои */
}

/* Единственный центральный контейнер-колонка */
.wrapper {
    width: 100%;
    max-width: var(--pylon-width);
    margin: 0 auto;
    padding: var(--header-height) var(--screen-gap) 16px;
    flex: 1 0 auto;
    box-sizing: border-box;
    position: relative; /* Служит ориентиром для фонового псевдоэлемента ::before */
}

/* ==========================================================================
   Кастомный фон и подложка (Классы состояний)
   ========================================================================== */

/* 1. Обои на весь экран */
body.has-custom-bg {
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* 2. Подложка через ::before (не создает контекст наложения на самом wrapper) */
.wrapper.has-pylon::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--pylon-bg);
    box-shadow: var(--shadow-2xl), inset -1px 0 rgba(255,255,255,0.3), inset 1px 0 rgba(255,255,255,0.3);
    pointer-events: none;
    z-index: -1; /* Подложка лежит строго ПОЗАДИ контента и кнопки */
}

/* 3. Размытие подложки (матовое стекло на ::before) */
.wrapper.has-pylon.has-blur::before {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

/* ==========================================================================
   Шапка (44px, фон на всю ширину)
   ========================================================================== */
.header {
    background: rgba(0,0,0,0.6);
    width: 100%;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 2000;
    height: var(--header-height);
    line-height: var(--header-height);
    box-shadow: var(--shadow-2xl), 0 1px rgba(255,255,255,0.2);
    border: none;
}

.header-container {
    background: rgba(0,0,0,0.6);
    width: calc(100% - 20px);
    max-width: calc(var(--pylon-width) - 20px);
    margin: 0 auto;
    padding: 0 12px;
    height: var(--header-height);
    line-height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    box-shadow: inset -1px 0 rgba(255,255,255,0.2), inset 1px 0 rgba(255,255,255,0.2);
}

.header-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 400;
    letter-spacing: -0.3px;
    height: var(--header-height);
    line-height: var(--header-height);
}

.header-title a {
    color: #ffffff;
    text-decoration: none;
    display: inline-block;
    max-width: calc(100vw - 80px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}

.header-title a:hover {
    color: var(--accent-gold);
    text-decoration: none;
}

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

.header-icon-btn {
    color: #ffffff;
    height: var(--header-height);
    line-height: var(--header-height);
    width: 16px;
    text-align: center;
    font-size: 17px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.2s ease, transform 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-icon-btn:hover,
.header-icon-btn.is-active {
    color: var(--accent-gold);
}

.header-filter-indicator {
    position: absolute;
    top: 10px;
    right: -4px;
    width: 6px;
    height: 6px;
    background-color: var(--accent-gold);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--accent-gold);
}

/* ==========================================================================
   Выдвижная панель поиска из-под шапки (Search Drawer)
   ========================================================================== */
.header-search-panel {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    width: 100%;
    background: var(--gray-900);
    border-bottom: 1px solid var(--gray-800);
    box-shadow: var(--shadow-2xl);
    padding: 14px 0 16px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.2s;
    z-index: 1999;
    box-sizing: border-box;
}

.header-search-panel.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.search-form-drawer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 auto;
    width: 100%;
    max-width: var(--pylon-width);
    padding: 0 14px;
    box-sizing: border-box;
}

.search-inputs-row {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.search-input-wrap {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-icon {
    position: absolute;
    left: 12px;
    color: var(--gray-500);
    font-size: 13px;
    pointer-events: none;
    z-index: 2;
}

.drawer-search-input,
.search-input-wrap div.awesomplete > input {
    width: 100%;
    height: 38px !important;
    padding: 0 12px 0 34px !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: var(--radius-sm) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
    outline: none !important;
    box-shadow: none !important;
    transition: all 0.15s ease !important;
}

.drawer-search-input::placeholder,
.search-input-wrap div.awesomplete > input::placeholder {
    color: var(--gray-500) !important;
}

.drawer-search-input:focus,
.search-input-wrap div.awesomplete > input:focus {
    background: rgba(255, 255, 255, 0.14) !important;
    border-color: var(--accent-gold) !important;
    box-shadow: 0 0 0 2px rgba(255, 216, 60, 0.25) !important;
}

.drawer-search-btn {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    background: var(--accent-gold);
    color: var(--text-main);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.drawer-search-btn:hover {
    background: #ffffff;
    color: var(--text-main);
    transform: translateX(1px);
}

.drawer-search-btn i {
    transition: transform 0.15s ease;
}

.drawer-search-btn:hover i {
    transform: translateX(2px);
}

/* ==========================================================================
   Фильтры выдвижной панели поиска
   ========================================================================= */
.drawer-filters {
    display: flex;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-filter-chips {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}

.filter-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
    height: 28px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 400;
    background: rgba(255, 255, 255, 0.07);
    color: var(--gray-300);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
    transition: all 0.15s ease;
    user-select: none;
    box-sizing: border-box;
}

.filter-chip i {
    font-size: 11px;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.filter-chip span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.filter-chip:hover i {
    opacity: 1;
}

.filter-chip.is-active {
    background: var(--accent-gold);
    color: var(--text-main);
    font-weight: 600;
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px rgba(255, 216, 60, 0.25);
    text-decoration: none;
}

.filter-chip.is-active i {
    color: var(--text-main);
    opacity: 1;
}

/* ==========================================================================
   Фиксированное нижнее меню (Фон 100% + центрирующий контейнер)
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(0,0,0,0.6);
    box-shadow: var(--shadow-lg), 0 -1px rgba(255,255,255,0.2);
    border: none;
    z-index: 2000;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

/* Вложенный контейнер: центрирует по сетке пилона (740px) */
.bottom-nav-container {
    width: calc(100% - 20px);
    max-width: calc(var(--pylon-width) - 20px);
    margin: 0 auto;
    height: var(--bottom-nav-height);    /* 52px */
    display: flex;
    box-sizing: border-box;
    box-shadow: inset -1px 0 rgba(255,255,255,0.2), inset 1px 0 rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.6);
}

/* Эталонный расчет: всегда равное место каждому пункту + сжатие */
.bottom-nav-item {
    flex-grow: 1;
    flex-basis: 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #ffffff;
    text-decoration: none !important;
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.2px;
    white-space: nowrap;
    user-select: none;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i,
.bottom-nav-btn i {
    font-size: 20px;
    height: 22px;
    width: 22px;
    line-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    margin: 0;
    padding: 0;
}

.bottom-nav-item span,
.bottom-nav-btn span {
    font-size: 9px;
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: 0.2px;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.bottom-nav-item:hover,
.bottom-nav-item.is-active,
.bottom-nav-item.sb-dropdown.is-open .bottom-nav-btn {
    color: var(--accent-gold);
}

.center-menu-btn {
    display: contents !important;
}

.bottom-nav-item.sb-dropdown {
    display: flex;
    justify-content: stretch;
    align-items: stretch;
}

.bottom-nav-btn {
    all: unset !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    color: inherit !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    letter-spacing: inherit !important;
    cursor: pointer !important;
    user-select: none !important;
    text-align: center !important;
    transition: color 0.15s ease !important;
}

/* ==========================================================================
   Выпадающие меню (SilverBox Dropdown)
   ========================================================================== */
.sb-dropdown {
    position: relative;
    display: inline-block;
}

.sb-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    max-width: calc(100vw - 32px);
    z-index: 2500;
    padding: 6px 0;
    display: none;
    flex-direction: column;
    transform-origin: top right;
    user-select: none;
}

.sb-dropdown-menu--right {
    right: 0;
    left: auto;
}

.sb-dropdown-menu.is-open {
    display: flex;
    animation: sbDropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sbDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sb-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-main);
    background: none;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease, border-left-color 0.12s ease;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.4;
}

.sb-dropdown-item:hover {
    background-color: var(--gray-100);
    color: var(--accent);
    border-left-color: var(--accent-gold);
    text-decoration: none;
}

.sb-dropdown-item i {
    font-size: 14px;
    width: 16px;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.sb-dropdown-item:hover i {
    color: inherit;
}

.sb-dropdown-item.is-danger:hover {
    color: var(--danger);
    background-color: var(--danger-bg);
    border-left-color: var(--danger);
}

.sb-dropdown-item.is-danger:hover i {
    color: var(--danger);
}

.sb-dropdown-item.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.sb-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 5px 0;
}

/* Контекстное меню нижнего бара (Drop-up) */
.sb-dropdown-menu--up {
    top: auto;
    bottom: calc(100% + 8px);
    right: 0;
    left: auto;
    transform-origin: bottom right;
    z-index: 2100;
    margin: 0;
    font-family: var(--font-sans);
    border-radius: 0 !important;
    background: var(--gray-900) !important;
    border: 1px solid var(--gray-700);
    box-shadow: var(--shadow-2xl);
    min-width: 210px;
    padding: 6px 0;
}

@keyframes sbDropdownFadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sb-dropdown-menu--up.is-open {
    display: flex;
    animation: sbDropdownFadeInUp 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.sb-dropdown-menu--up .sb-dropdown-item {
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 400;
    color: var(--gray-100);
    border-radius: 0;
    padding: 9px 16px;
    border-left: 3px solid transparent;
    transition: background-color 0.12s ease, color 0.12s ease, border-left-color 0.12s ease;
}

.sb-dropdown-menu--up .sb-dropdown-item i {
    color: var(--gray-400);
    font-size: 16px;
    width: 18px;
    text-align: center;
    transition: color 0.12s ease;
}

.sb-dropdown-menu--up .sb-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: var(--accent-gold);
}

.sb-dropdown-menu--up .sb-dropdown-item:hover i {
    color: var(--accent-gold);
}

.sb-dropdown-menu--up .sb-dropdown-divider {
    background-color: var(--gray-800);
    height: 1px;
    margin: 4px 0;
}

.sb-dropdown-menu--up .sb-dropdown-item.is-danger {
    color: var(--gray-100);
}

.sb-dropdown-menu--up .sb-dropdown-item.is-danger i {
    color: var(--gray-400);
}

.sb-dropdown-menu--up .sb-dropdown-item.is-danger:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: var(--accent-gold);
}

.sb-dropdown-menu--up .sb-dropdown-item.is-danger:hover i {
    color: var(--accent-gold);
}

/* ==========================================================================
   Информационная строка результатов поиска и Оглавление
   ========================================================================== */
.search-results-bar {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 16px 0 12px;
    font-size: 16px;
    color: var(--text-main);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.2;
}

.filter-badge-remove {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-main);
    text-decoration: none;
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 13px;
    margin-left: 2px;
}

.filter-badge-remove:hover {
    background: var(--gray-200);
    color: var(--danger);
}

/* ==========================================================================
   Оглавление результатов поиска (#ez-titles-search)
   ========================================================================== */
#ez-titles-search {
    width: 100%;
    margin: 12px 0 16px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    border: none;
    user-select: none;
    overflow: hidden;
    box-sizing: border-box;
}

/* Шапка оглавления */
#ez-titles-search summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 400;
    color: var(--text-main);
    background: #ffffff;
    border-bottom: none;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#ez-titles-search summary::-webkit-details-marker {
    display: none;
}

/* Иконка оглавления слева */
#ez-titles-search summary .ez-toc-icon {
    font-size: 15px;
    color: var(--text-main);
    margin-right: 2px;
    display: inline-block;
    transition: color 0.2s ease;
}

/* Правая стрелочка */
#ez-titles-search summary .ez-toc-chevron {
    font-size: 20px;
    transition: transform 0.2s ease, color 0.2s ease;
    line-height: 1;
}

/* При открытом оглавлении */
#ez-titles-search[open] summary {
    background-color: var(--gray-900);
    color: #ffffff;
    border-bottom: none;
}

#ez-titles-search[open] summary .ez-toc-icon {
    color: var(--accent-gold);
}

#ez-titles-search[open] summary .ez-toc-chevron {
    transform: rotate(180deg);
    color: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   Список оглавления (Зебра)
   -------------------------------------------------------------------------- */
#ez-titles-search ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
    background: #ffffff;
}

#ez-titles-search ul li {
    margin: 0;
    padding: 8px 16px;
    line-height: 1.3;
    clear: both;
    box-sizing: border-box;
    border-bottom: none;
}

#ez-titles-search ul li:nth-child(odd) {
    background-color: #ffffff;
}

#ez-titles-search ul li:nth-child(even) {
    background-color: var(--gray-100);
}

/* Чекбокс прижат вправо */
#ez-titles-search .ez-link-checkbox {
    float: right;
    margin-top: 2px;
    cursor: pointer;
}

/* Заголовок статьи */
#ez-titles-search ul li > a.ez-toc-title {
    text-decoration: none !important;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

#ez-titles-search ul li > a.ez-toc-title:hover {
    color: var(--accent);
    border-bottom: 1px dotted var(--text-muted);
}

/* Строка метаданных */
.ez-titles-search-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

.ez-titles-search-meta i {
    font-size: 12px;
    margin-right: 1px;
}

.ez-titles-search-meta .ez-toc-sticky {
    color: var(--sticky-color);
}

.ez-titles-search-meta .ez-toc-private {
    color: var(--private-color);
}

/* Ссылки-теги в оглавлении */
.ez-titles-search-meta .ez-toc-tag {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.ez-titles-search-meta .ez-toc-tag:hover {
    color: var(--accent);
    text-decoration: underline;
}

mark.search-highlight {
    background-color: #ffeb3b !important;
    color: #000000 !important;
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 700;
}

/* ==========================================================================
   Awesomplete
   ========================================================================== */
div.awesomplete {
    display: block;
    position: relative;
    width: 100%;
}

div.awesomplete > input {
    width: 100%;
    box-sizing: border-box;
}

div.awesomplete > ul {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    color: var(--text-main);
    margin: 6px 0 0 0;
    z-index: 2500;
    padding: 4px 0;
    list-style: none;
}

div.awesomplete > ul:before {
    display: none !important;
}

div.awesomplete > ul > li {
    padding: 8px 14px;
    font-size: 13px;
    font-family: var(--font-mono);
    cursor: pointer;
    border-bottom: 1px solid var(--gray-50);
    transition: background 0.1s ease;
}

div.awesomplete > ul > li:last-child {
    border-bottom: none;
}

div.awesomplete > ul > li:hover,
div.awesomplete > ul > li[aria-selected="true"] {
    background: var(--accent);
    color: #ffffff;
}

div.awesomplete mark {
    background: rgba(0, 102, 204, 0.15);
    color: inherit;
    padding: 0 2px;
}

/* ==========================================================================
   Карточки (Общие)
   ========================================================================== */
.card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}

/* ==========================================================================
   Карточка поста
   ========================================================================== */
.card.post {
    background: #ffffff;
    margin: 12px 0;
    border: none !important;
    overflow: visible;
    padding: 0 !important;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); 
    border-radius: 4px;
}

.card.post:first-child {
    margin-top: 16px;
}

.card.post:last-child {
    margin-bottom: 16px;
}

.card.post.is-sticky,
.card.post.is-private {
    border-left: none !important;
}

.post-actions {
    position: -webkit-sticky;
    position: sticky;
    top: 54px;
    margin-right: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    float: right;
    display: block;
    width: 32px;
    height: 32px;
    z-index: 10;
}

.post-actions.is-open {
    z-index: 100 !important; /* Гарантированно выше кнопки подвала (z-index: 10) */
}

.post-action-btn {
    background: #ffffff;
    color: var(--text-main);
    box-shadow: var(--shadow-md);
    border-radius: 100%;
    border: none;
    height: 32px;
    width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 32px;
    padding-top: 2px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}

.post-action-btn:hover,
.post-action-btn.is-active {
    color: var(--accent);
    background: var(--gray-50);
}

.post-header {
    padding: 14px 16px 12px;
}

.card.post.has-actions .post-header {
    padding-right: 48px;
}

.post-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 400;
    font-family: var(--font-heading);
    line-height: 1.35;
    text-wrap: balance;
}

.post-title a {
    color: var(--text-main);
    border-bottom: 2px solid var(--gray-100);
    text-decoration: none !important;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.post-title a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.post-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.post-date {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.post-date:hover {
    color: var(--text-main);
    text-decoration: none;
}

.post-shorturl {
    color: var(--text-dim);
}

/* ==========================================================================
   Лента статусов и тегов (Горизонтальный скролл)
   ========================================================================== */
.post-info {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-items: center;
    gap: 5px;
    padding: 5px;
    margin: 0;
    clear: both;
    user-select: none;
}

.post-info::-webkit-scrollbar {
    display: none;
}

/* Базовый стиль плашек (теги и статусы) */
.post-info .tag,
.post-info .badge {
    background: linear-gradient(#fff, #f5f5f5);
    height: 20px;
    line-height: 20px;
    padding: 0 8px;
    border-radius: 3px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    display: inline-block;
    vertical-align: top;
    text-decoration: none !important;
    box-sizing: border-box;
    flex-shrink: 0;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.2), 0 1px 2px -1px rgb(0 0 0 / 0.2); 
}

/* Иконки внутри плашек */
.post-info .tag i,
.post-info .badge i {
    font-size: 11px;
    margin-right: 1px;
    line-height: inherit;
}

/* 1. ТЕГИ */
.post-info .tag {
    color: var(--text-main);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.post-info .tag:hover {
    color: #2979ff;
}

.post-info .tag i {
    color: var(--gray-900);
}

.post-info .tag:hover i {
    color: #2979ff;
}

/* 2. ЗАКРЕПЛЕНО */
.post-info .badge-sticky {
    background: var(--gray-900);
    color: #ffffff;
}

.post-info .badge-sticky i {
    color: var(--accent-gold) !important;
}

/* 3. ЛИЧНОЕ */
.post-info .badge-private i {
    color: #00c853;
}

/* Тело поста (Markdown) */
.post-body {
    padding: 14px 16px;
    border-top: 1px solid var(--gray-200);
    clear: both;
}

/* ==========================================================================
   Компактная пагинация (EZ Paging — 3 колонки, чистый baseline)
   ========================================================================== */
.ez-paging {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 2px;
    user-select: none;
    box-sizing: border-box;
}

.ez-paging-prev,
.ez-paging-next {
    flex: 1 1 0;
    min-width: 0;
}

.ez-paging-prev {
    text-align: left;
}

.ez-paging-next {
    text-align: right;
}

.ez-paging-counter {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
    padding: 1px 12px;
    border-radius: 99px;
    display: inline-block;
    color: #fff;
    background: rgba(0,0,0,0.6);
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: 0.3s;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2), 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

.ez-paging a,
.ez-daily-tudasuda a {
    padding: 1px 7px;
    border-radius: 999px;
    display: inline-block;
    color: #fff;
    background: rgba(0,0,0,0.6);
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: 0.3s;
    white-space: nowrap;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.6), 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

.ez-paging a:hover,
.ez-daily-tudasuda a:hover {
    color: #fff;
    background: rgba(0,0,0,0.8);
}

.ez-paging-next i,
.ez-paging-prev i {
    color: #ffea00;
}

/* ==========================================================================
   Подвал сайта (На всю ширину экрана 100%)
   ========================================================================== */
.footer {
    width: 100%;
    background: rgba(0,0,0,0.6);
    color: var(--gray-200);
    margin-top: auto;
    padding: 0;
    box-shadow: var(--shadow-2xl), 0 -1px rgba(255,255,255,0.2);
    border: none;
    box-sizing: border-box;
}

.footer-container {
    width: 100%;
    max-width: var(--pylon-width);
    margin: 0 auto;
    padding: 0 var(--screen-gap) 76px;
    box-sizing: border-box;
    box-shadow: inset -1px 0 rgba(255,255,255,0.2), inset 1px 0 rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.6);
}

.footer-copy-btn {
    width: 100%;
    background: linear-gradient(var(--gray-800), var(--gray-900));
    color: var(--gray-300);
    border: none;
    border-radius: 3px;
    height: 34px;
    line-height: 34px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.2), inset 0 1px rgba(255,255,255,0.2);
    top: -16px;
    position: relative;
    z-index: 10;
}

.footer-copy-btn:hover {
    color: #ffffff;
}

.footer-description {
    color: var(--gray-300);
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-800);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.footer-description i {
    color: var(--gray-500);
    margin-top: 4px;
    flex-shrink: 0;
}

.footer-copyright {
    color: var(--gray-500);
    font-size: 13.5px;
    margin-bottom: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.footer-copyright a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
}

.footer-copyright a:hover {
    color: var(--accent-gold);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: -6px;
    user-select: none;
}

.footer-link {
    color: var(--gray-500);
    font-size: 13px;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 999px;
    background: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-link:hover {
    background-color: var(--gray-800);
    color: #ffffff;
    text-decoration: none;
}

.footer-link i {
    transition: color 0.2s ease;
}

.footer-link:hover .fa-rss-square {
    color: #f97316;
}

.footer-link:hover .fa-cube {
    color: var(--accent-gold);
}

/* ==========================================================================
   Кнопки и Формы
   ========================================================================== */
input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

textarea {
    resize: vertical;
    min-height: 160px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #ffffff;
    text-decoration: none;
}

.btn-secondary {
    background: #ffffff;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger-bg);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
    text-decoration: none;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* ==========================================================================
   Ползунок диапазона (Range Slider)
   ========================================================================== */
.range-group {
    margin-top: 6px;
    margin-bottom: 20px;
}

.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.range-value-badge {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    background: var(--accent);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 32px;
    text-align: center;
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 999px;
    outline: none;
    margin: 8px 0;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
}

.range-slider:focus {
    box-shadow: none !important;
    border-color: transparent !important;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 2.5px solid #ffffff;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: var(--accent-hover);
}

.range-slider::-webkit-slider-thumb:active {
    transform: scale(1.25);
    background: var(--accent-hover);
}

.range-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 2.5px solid #ffffff;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.15s ease;
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    background: var(--accent-hover);
}

.range-slider::-moz-range-track {
    height: 6px;
    background: var(--gray-200);
    border-radius: 999px;
}

.range-limits {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    font-family: var(--font-mono);
    color: var(--text-dim);
    padding: 0 2px;
    user-select: none;
}

/* ==========================================================================
   Уведомления (Flash messages)
   ========================================================================== */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid;
}

.flash-success {
    background: var(--success-bg);
    border-color: rgba(220, 38, 38, 0.2);
    color: #15803d;
}

.flash-error {
    background: var(--danger-bg);
    border-color: rgba(220, 38, 38, 0.3);
    color: #b91c1c;
}

/* ==========================================================================
   Сессии и Устройства
   ========================================================================== */
.session-row {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.session-row.is-current {
    border-left-color: var(--success);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-ip {
    font-family: var(--font-mono);
    font-weight: 600;
}

.session-agent {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.session-date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}

.login-card {
    max-width: 400px;
    margin: 40px auto;
}

/* ==========================================================================
   Вспомогательные утилиты
   ========================================================================== */
.w-full { width: 100%; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mt-0 { margin-top: 0; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-center { text-align: center; }
.d-none { display: none !important; }
.cursor-pointer { cursor: pointer; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* ==========================================================================
   EasyMDE — Адаптация под светлую тему
   ========================================================================== */
.EasyMDEContainer {
    margin-top: 6px;
    margin-bottom: 16px;
}

.EasyMDEContainer .editor-toolbar {
    background: var(--gray-50);
    border-color: var(--border-color);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.EasyMDEContainer .editor-toolbar button {
    color: var(--gray-800) !important;
}

.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
    background: var(--gray-200) !important;
    border-color: var(--gray-300) !important;
    color: var(--accent) !important;
}

.EasyMDEContainer .CodeMirror {
    background: #ffffff;
    color: var(--text-main);
    border-color: var(--border-color);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-family: var(--font-mono);
}

.EasyMDEContainer .editor-preview {
    background: #ffffff;
    color: var(--text-main);
}

.EasyMDEContainer .editor-statusbar {
    color: var(--text-dim);
}

/* ==========================================================================
   ImgBox — Панель загрузки и список файлов
   ========================================================================== */
.imgbox-panel {
    margin-top: 24px;
}

.imgbox-dropzone {
    background-color: var(--gray-900);
    color: var(--gray-200);
    border-radius: var(--radius-md);
    padding: 24px 48px 24px 24px;
    position: relative;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.6;
    min-height: 90px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease;
    border: 2px solid transparent;
}

.imgbox-dropzone:hover,
.imgbox-dropzone.dragover {
    background-color: var(--text-main);
    border-color: var(--accent);
}

.imgbox-clip-icon {
    position: absolute;
    right: 20px;
    bottom: 18px;
    font-size: 22px;
    color: var(--gray-500);
    transform: rotate(45deg);
}

.imgbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.imgbox-row {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    min-height: 86px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.imgbox-row-bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 45%;
    background-size: cover;
    background-position: center right;
    background-repeat: no-repeat;
    pointer-events: none;
    mask-image: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,1) 80%);
    -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,1) 80%);
}

.imgbox-row-content {
    position: relative;
    z-index: 2;
    max-width: 65%;
}

.imgbox-row-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 10px;
    font-family: var(--font-sans);
    word-break: break-all;
}

.imgbox-row-title i {
    font-size: 16px;
    color: var(--text-main);
    flex-shrink: 0;
}

.imgbox-row-title .fa-check {
    font-weight: bold;
    color: var(--text-main);
}

.imgbox-row-title .fa-spinner {
    color: var(--gray-600);
}

.imgbox-row-title a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.15s ease;
}

.imgbox-row-title a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.imgbox-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.imgbox-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--gray-100);
    color: var(--gray-800);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.imgbox-btn:hover {
    background-color: var(--gray-200);
    color: var(--text-main);
}

.imgbox-btn i {
    font-size: 13px;
}

.imgbox-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-main);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.imgbox-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Список файлов для утилиты очистки
   ========================================================================== */
.cleanup-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    background: var(--gray-50);
    margin-bottom: 16px;
}

.cleanup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

.cleanup-item:last-child {
    border-bottom: none;
}

/* ==========================================================================
   Навигация по разделам настроек
   ========================================================================== */
.settings-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    overflow-x: auto;
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.settings-tab:hover {
    color: var(--text-main);
    background: var(--gray-200);
    text-decoration: none;
}

.settings-tab.active {
    background: var(--accent);
    color: #ffffff;
}

/* ==========================================================================
   Плавающая круглая кнопка добавления поста (FAB)
   ========================================================================== */
.fab-new-post {
    position: fixed;
    right: 24px;
    bottom: 72px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 18px;
    text-decoration: none;
    z-index: 1900;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.fab-new-post:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: var(--shadow-xl);
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* ==========================================================================
   Интерфейс настроек фона (Персонализация)
   ========================================================================== */
.bg-toggle-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--gray-300);
    transition: .2s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: var(--shadow-xs);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label-wrap {
    display: flex;
    flex-direction: column;
}

.toggle-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.toggle-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.bg-preview-wrapper {
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.bg-preview-box {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-image 0.15s ease;
}

.bg-preview-mockup {
    width: 140px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    padding: 8px 10px;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.bg-mockup-header {
    height: 8px;
    width: 70%;
    background: var(--header-bg);
    border-radius: 2px;
    margin-bottom: 6px;
}

.bg-mockup-card {
    height: 32px;
    background: var(--gray-100);
    border-radius: 2px;
}

.bg-preview-badges {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    z-index: 2;
}

.bg-meta-badge {
    background: rgba(33, 33, 33, 0.82) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: var(--font-mono);
}

.bg-dropzone {
    position: relative;
    background-color: #ffffff;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bg-dropzone:hover,
.bg-dropzone.is-dragover {
    border-color: var(--accent);
    background-color: var(--gray-50);
}

.bg-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
    margin: 0 !important;
    padding: 0 !important;
}

.bg-dropzone-content {
    display: flex;
    align-items: center;
    gap: 16px;
    pointer-events: none;
}

.bg-dropzone-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent-bg);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bg-dropzone-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bg-dropzone-text strong {
    font-size: 14px;
    color: var(--text-main);
    word-break: break-all;
}

.bg-dropzone-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.bg-browse-btn {
    pointer-events: none;
    flex-shrink: 0;
}

.bg-spec-hints {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.bg-hint-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.bg-hint-item code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    background: var(--gray-200);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--text-main);
}

/* Блок настроек тонирования (Затемнение / Осветление) */
.bg-overlay-settings {
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.overlay-color-selector {
    display: flex;
    gap: 10px;
}

.overlay-color-option {
    flex: 1 1 0;
    cursor: pointer;
    margin: 0;
}

.overlay-color-option input[type="radio"] {
    display: none;
}

.overlay-color-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    user-select: none;
}

.overlay-color-option:hover .overlay-color-card {
    border-color: var(--gray-300);
}

.overlay-color-option input[type="radio"]:checked + .overlay-color-card {
    border-color: var(--accent);
    background: #f0f7ff;
    color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.dot-black { background-color: var(--gray-900); }
.dot-white { background-color: #ffffff; border-color: var(--gray-300); }