/* ============================================
   ZASIPAYKA NIGHT SKY THEME v2.0
   Сказочная ночная тема с плавными анимациями
   ============================================ */

:root {
    /* Цветовая палитра - Ночная тема (default) */
    --zsb-bg: #0a0e1a;
    --zsb-bg-deep: #05070f;
    --zsb-surface: #1a1f2e;
    --zsb-surface-2: #242a3d;
    --zsb-text: #f0e6d2;
    --zsb-soft-text: #b8a892;
    --zsb-accent: #d4a55c;
    --zsb-accent-2: #f5c77a;
    --zsb-accent-3: #8b6f3a;
    --zsb-border: #3a3f52;
    --zsb-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    
    /* Размеры */
    --zsb-font-scale: 100;
    --zsb-body-size: clamp(16px, 0.95rem + 0.2vw, 20px);
    --zsb-h1: clamp(1.8rem, 1.3rem + 2vw, 3.2rem);
    --zsb-h2: clamp(1.3rem, 1rem + 1vw, 2rem);
    --zsb-wrap-width: min(1400px, 92vw);
    
    /* Анимации */
    --zsb-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Тема Сепия */
body.zsb-theme-sepia {
    --zsb-bg: #f5ebe0;
    --zsb-bg-deep: #e8d5c0;
    --zsb-surface: #fffdf8;
    --zsb-surface-2: #fff9f0;
    --zsb-text: #2a1f15;
    --zsb-soft-text: #5a4a3a;
    --zsb-accent: #8b5a2b;
    --zsb-accent-2: #6b4423;
    --zsb-accent-3: #a67c52;
    --zsb-border: #c9b896;
}

/* Тема Лесная */
body.zsb-theme-forest {
    --zsb-bg: #0f1a15;
    --zsb-bg-deep: #08120d;
    --zsb-surface: #1a2a22;
    --zsb-surface-2: #24352c;
    --zsb-text: #e0ece4;
    --zsb-soft-text: #9cb8a8;
    --zsb-accent: #6fb88a;
    --zsb-accent-2: #8fd4a8;
    --zsb-accent-3: #4a8a65;
    --zsb-border: #2d4a3a;
}

/* ============================================
   БАЗОВЫЕ СТИЛИ
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(var(--zsb-body-size) * var(--zsb-font-scale) / 100);
    line-height: 1.7;
    color: var(--zsb-text);
    background: linear-gradient(180deg, var(--zsb-bg) 0%, var(--zsb-bg-deep) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

body.zsb-menu-open,
body.zsb-has-overlay {
    overflow: hidden;
}

.zsb-wrap {
    width: var(--zsb-wrap-width);
    margin: 0 auto;
}

/* ============================================
   ЗВЁЗДНЫЙ ФОН (оптимизированный)
   ============================================ */
.zsb-stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.zsb-stars__layer {
    position: absolute;
    inset: -50%;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.8) 1px, transparent 1.5px);
    background-size: 120px 120px;
    animation: zsbStarsDrift 80s linear infinite;
    opacity: 0.4;
}

.zsb-stars__layer--2 {
    background-size: 180px 180px;
    animation-duration: 120s;
    animation-direction: reverse;
    opacity: 0.3;
}

.zsb-stars__layer--3 {
    background-size: 240px 240px;
    animation-duration: 160s;
    opacity: 0.2;
}

@keyframes zsbStarsDrift {
    from { transform: translate(0, 0); }
    to { transform: translate(50px, 50px); }
}

/* ============================================
   СВЕТЛЯЧКИ (плавающие огни)
   ============================================ */
.zsb-fireflies {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.zsb-firefly {
    position: absolute;
    bottom: -20px;
    left: var(--x);
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #fff9d4 0%, rgba(255, 249, 212, 0) 70%);
    border-radius: 50%;
    animation: zsbFireflyFloat var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
    opacity: 0;
}

@keyframes zsbFireflyFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    50% {
        transform: translateY(-40vh) translateX(30px);
        opacity: 0.6;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-80vh) translateX(-20px);
        opacity: 0;
    }
}

/* ============================================
   ШАПКА САЙТА
   ============================================ */
.zsb-site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(10, 14, 26, 0.95), rgba(5, 7, 15, 0.9));
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.zsb-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 0;
}

/* На десктопе: лого слева, меню центр, инструменты справа */
@media (min-width: 981px) {
    .zsb-header-inner {
        justify-content: space-between;
    }
    
    .zsb-main-nav {
        flex: 1;
        display: flex;
        justify-content: center;
    }
}

.zsb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.zsb-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.zsb-brand-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f5e6d3 !important;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.zsb-brand-tagline {
    font-size: 0.85rem;
    color: rgba(245, 230, 211, 0.85) !important;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.zsb-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: transform var(--zsb-transition);
}

.zsb-logo-link:hover {
    transform: translateY(-2px);
}

.zsb-logo {
    height: clamp(40px, 5vw, 65px);
    width: auto;
    display: block;
}

.zsb-logo--inline svg {
    height: 100%;
    width: auto;
}

.zsb-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--zsb-accent-2);
}

/* Главное меню */
.zsb-main-nav {
    display: flex;
    justify-content: center;
}

.zsb-menu {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.zsb-menu a {
    display: block;
    padding: 8px 14px;
    color: #f5e6d3 !important;
    text-decoration: none;
    border-radius: 20px;
    transition: background var(--zsb-transition), color var(--zsb-transition);
    font-weight: 500;
}

.zsb-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
}

/* Рубрики в шапке - всегда светлый текст */
.zsb-category-chip,
.zsb-subcategory-chip {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #f5e6d3 !important;
    text-decoration: none;
    font-size: 0.9em;
    transition: all var(--zsb-transition);
    white-space: nowrap;
    font-weight: 500;
}

.zsb-category-chip:hover,
.zsb-subcategory-chip:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff !important;
}

.zsb-category-chip.is-active,
.zsb-subcategory-chip.is-active {
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    border-color: transparent;
    color: #fff !important;
}

/* Хлебные крошки в шапке - светлый текст */
.zsb-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: rgba(245, 230, 211, 0.7);
}

.zsb-breadcrumbs a {
    color: #f5e6d3 !important;
    text-decoration: none;
    transition: color var(--zsb-transition);
    font-weight: 500;
}

.zsb-breadcrumbs a:hover {
    color: #fff !important;
}

.zsb-breadcrumbs__sep {
    opacity: 0.4;
}

/* Инструменты шапки */
.zsb-header-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Гамбургер скрыт по умолчанию */
.zsb-menu-toggle {
    display: none;
}

/* На десктопе гамбургер НЕ показываем НИКОГДА */
@media (min-width: 981px) {
    .zsb-header-tools {
        margin-left: auto;  /* Прижимаем вправо на десктопе */
    }
    
    .zsb-menu-toggle {
        display: none !important;
    }
    
    /* Рубрики на десктопе всегда видны */
    .zsb-header-lower {
        display: grid !important;
    }
}

/* На мобильных прижимаем инструменты вправо */
@media (max-width: 980px) {
    .zsb-header-tools {
        margin-left: auto;
    }
}

.zsb-header-search {
    display: flex;
}

.zsb-search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 25px;
    overflow: hidden;
    transition: border-color var(--zsb-transition), background var(--zsb-transition);
}

.zsb-search:focus-within {
    border-color: var(--zsb-accent);
    background: rgba(255, 255, 255, 0.12);
}

.zsb-search__input {
    border: none;
    background: transparent;
    color: #f5e6d3 !important;
    padding: 8px 14px;
    min-width: 150px;
    font-size: 0.95em;
    outline: none;
}

.zsb-search__input::placeholder {
    color: rgba(245, 230, 211, 0.6) !important;
}

.zsb-search__btn {
    border: none;
    background: var(--zsb-accent);
    color: #fff !important;
    padding: 8px 16px;
    cursor: pointer;
    transition: background var(--zsb-transition);
    font-weight: 600;
}

.zsb-search__btn:hover {
    background: var(--zsb-accent-2);
}

/* Кнопки-иконки */
.zsb-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #f5e6d3 !important;
    border-radius: 25px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all var(--zsb-transition);
    font-size: 1.1em;
}

.zsb-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.zsb-icon-btn.is-favorite {
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    border-color: transparent;
    color: #fff !important;
}

.zsb-icon {
    font-style: normal;
}

/* Меню бургер */
.zsb-menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 44px;
    padding: 8px;
}

.zsb-menu-toggle__bar {
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform var(--zsb-transition), opacity var(--zsb-transition);
}

/* Нижняя часть шапки */
.zsb-header-lower {
    padding: 0 0 12px;
}

/* Категории (чипсы) */
.zsb-category-rail,
.zsb-subcategory-rail {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.zsb-category-chip,
.zsb-subcategory-chip {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: var(--zsb-text);
    text-decoration: none;
    font-size: 0.9em;
    transition: all var(--zsb-transition);
    white-space: nowrap;
    font-weight: 500;
}

.zsb-category-chip:hover,
.zsb-subcategory-chip:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--zsb-accent);
}

.zsb-category-chip.is-active,
.zsb-subcategory-chip.is-active {
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    border-color: transparent;
    color: #fff !important;
}

.zsb-subcategory-chip {
    background: rgba(100, 150, 255, 0.1);
    border-color: rgba(100, 150, 255, 0.2);
}

.zsb-subcategory-chip.is-active {
    background: linear-gradient(135deg, #6b9dff, #4a7ae8);
}

/* Хлебные крошки */
.zsb-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: rgba(245, 230, 211, 0.9);
}

.zsb-breadcrumbs a {
    color: #f5e6d3 !important;
    text-decoration: none;
    transition: color var(--zsb-transition);
    font-weight: 500;
}

.zsb-breadcrumbs a:hover {
    color: #fff !important;
}

.zsb-breadcrumbs__sep {
    opacity: 0.5;
    color: rgba(245, 230, 211, 0.6);
}

/* ============================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================ */
.zsb-content-area {
    position: relative;
    z-index: 10;
    padding: 40px 0 60px;
}

/* Сетка карточек */
.zsb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Карточка сказки */
.zsb-card {
    background: linear-gradient(180deg, var(--zsb-surface-2), var(--zsb-surface));
    border: 1px solid var(--zsb-border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform var(--zsb-transition), box-shadow var(--zsb-transition), border-color var(--zsb-transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.zsb-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--zsb-accent);
}

.zsb-card__image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(180deg, #2a3550, #1a2030);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zsb-card__image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

.zsb-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.zsb-card:hover .zsb-card__image img {
    transform: scale(1.03);
}

.zsb-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 48px;
    background: linear-gradient(180deg, #2a3550, #1a2030);
}

.zsb-card__content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.zsb-card__title {
    margin: 0;
    font-size: var(--zsb-h2);
    line-height: 1.3;
}

.zsb-card__title a {
    color: var(--zsb-text);
    text-decoration: none;
    transition: color var(--zsb-transition);
}

.zsb-card__title a:hover {
    color: var(--zsb-accent-2);
}

.zsb-card__excerpt {
    color: var(--zsb-soft-text);
    font-size: 0.95em;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Категории в карточке */
.zsb-card__categories {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.zsb-card__category {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    color: #5a4a3a;
    text-decoration: none;
    font-size: 0.78em;
    font-weight: 500;
    transition: all var(--zsb-transition);
}

.zsb-card__category:hover {
    background: rgba(139, 90, 43, 0.15);
    border-color: #8b5a2b;
    color: #6b4423;
}

/* Для ночной и лесной темы - светлые категории */
body.zsb-theme-night .zsb-card__category,
body.zsb-theme-forest .zsb-card__category {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--zsb-soft-text);
}

body.zsb-theme-night .zsb-card__category:hover,
body.zsb-theme-forest .zsb-card__category:hover {
    background: rgba(212, 165, 92, 0.15);
    border-color: var(--zsb-accent);
    color: var(--zsb-accent-2);
}

.zsb-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    flex-wrap: wrap;
}

/* Кнопки действий в карточках - контрастные для всех тем */
.zsb-card .zsb-icon-btn {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.08);
    color: #5a4a3a !important;
}

.zsb-card .zsb-icon-btn:hover {
    background: rgba(139, 90, 43, 0.15);
    border-color: #8b5a2b;
}

.zsb-card .zsb-icon-btn.is-favorite {
    background: linear-gradient(135deg, #8b5a2b, #6b4423);
    border-color: transparent;
    color: #fff !important;
}

/* Для ночной и лесной темы - светлые кнопки */
body.zsb-theme-night .zsb-card .zsb-icon-btn,
body.zsb-theme-forest .zsb-card .zsb-icon-btn {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    color: #f5e6d3 !important;
}

body.zsb-theme-night .zsb-card .zsb-icon-btn:hover,
body.zsb-theme-forest .zsb-card .zsb-icon-btn:hover {
    background: rgba(212, 165, 92, 0.2);
    border-color: var(--zsb-accent);
}

/* Кнопка "Читать" */
.zsb-read-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    color: #fff !important;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    transition: all var(--zsb-transition);
    margin-left: auto;
}

.zsb-read-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 165, 92, 0.3);
}

/* ============================================
   СТРАНИЦА СКАЗКИ
   ============================================ */
.zsb-single-book {
    background: linear-gradient(180deg, var(--zsb-surface-2), var(--zsb-surface));
    border: 1px solid var(--zsb-border);
    border-radius: 24px;
    padding: clamp(24px, 4vw, 40px);
    box-shadow: var(--zsb-shadow);
}

.zsb-single-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.zsb-single-title {
    margin: 0;
    font-size: var(--zsb-h1);
    line-height: 1.2;
}

.zsb-single-tools {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.zsb-single-cover {
    margin: 0 0 24px;
    border-radius: 16px;
    overflow: hidden;
}

.zsb-single-cover img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.zsb-single-content {
    font-size: calc(1em * var(--zsb-font-scale) / 100);
    line-height: 1.8;
}

.zsb-single-content p {
    margin: 0 0 1.5em;
}

.zsb-single-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1em 0;
}

/* Блок приглашения */
.zsb-story-invite {
    margin-top: 32px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(212, 165, 92, 0.1), rgba(139, 111, 58, 0.15));
    border: 1px solid var(--zsb-accent);
    border-radius: 16px;
    text-align: center;
}

.zsb-story-invite h2 {
    margin: 0 0 8px;
    font-size: var(--zsb-h2);
    color: var(--zsb-accent-2);
}

.zsb-story-invite p {
    margin: 0 0 16px;
    color: var(--zsb-soft-text);
}

.zsb-story-invite__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Навигация по сказкам */
.zsb-story-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
}

/* Скрываем дубли навигации от Rank Math и других плагинов */
.zsb-site-footer .zsb-story-nav,
.zsb-story-nav[aria-label*="навиг"],
article.zsb-single-book + .zsb-story-nav,
main + .zsb-story-nav {
    display: none !important;
}

.zsb-story-nav__prev,
.zsb-story-nav__next {
    display: flex;
    flex: 1;
    min-width: 0;
}

.zsb-story-nav__prev a,
.zsb-story-nav__next a {
    color: var(--zsb-accent-2) !important;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 12px;
    transition: background var(--zsb-transition);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.zsb-story-nav__prev a:hover,
.zsb-story-nav__next a:hover {
    background: rgba(212, 165, 92, 0.15);
}

.zsb-story-nav__all {
    flex-shrink: 0;
}

.zsb-story-nav__all a {
    white-space: nowrap;
}

/* ============================================
   КНОПКИ
   ============================================ */
.zsb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 0.95em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--zsb-transition);
}

.zsb-btn--primary {
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    color: #fff;
}

.zsb-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 165, 92, 0.3);
}

.zsb-btn--outline {
    background: transparent;
    border: 1px solid var(--zsb-accent);
    color: var(--zsb-accent-2);
}

.zsb-btn--outline:hover {
    background: rgba(212, 165, 92, 0.1);
}

.zsb-btn--telegram {
    background: linear-gradient(135deg, #2a9ee2, #1d7bb8);
    color: #fff;
}

.zsb-btn--youtube {
    background: linear-gradient(135deg, #e62117, #c41a12);
    color: #fff;
}

.zsb-btn__icon {
    font-size: 1.1em;
}

/* ============================================
   ПАГИНАЦИЯ
   ============================================ */
.zsb-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.zsb-pagination .nav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.zsb-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: var(--zsb-text);
    text-decoration: none;
    transition: all var(--zsb-transition);
    font-weight: 500;
}

.zsb-pagination .page-numbers:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.zsb-pagination .current {
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    border-color: transparent;
    color: #fff !important;
}

/* ============================================
   РУБРИКИ (TERM CARDS)
   ============================================ */
.zsb-term-section {
    margin-bottom: 40px;
}

.zsb-term-section__head h2 {
    margin: 0 0 16px;
    font-size: var(--zsb-h2);
    color: var(--zsb-accent-2);
}

.zsb-term-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.zsb-term-card {
    background: linear-gradient(180deg, var(--zsb-surface-2), var(--zsb-surface));
    border: 1px solid var(--zsb-border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform var(--zsb-transition), box-shadow var(--zsb-transition);
}

.zsb-term-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.zsb-term-card__image {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(180deg, #2a3550, #1a2030);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zsb-term-card__image img {
    width: 100%;
    height: auto;
    display: block;
}

.zsb-term-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 60px 0;
    font-size: 56px;
    background: linear-gradient(180deg, #2a3550, #1a2030);
}

.zsb-term-card__content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zsb-term-card__title {
    margin: 0;
    font-size: 1.2em;
}

.zsb-term-card__title a {
    color: var(--zsb-text);
    text-decoration: none;
}

.zsb-term-card__title a:hover {
    color: var(--zsb-accent-2);
}

.zsb-term-card__meta {
    font-size: 0.85em;
    color: var(--zsb-accent-2);
}

.zsb-term-card__desc {
    margin: 0;
    color: var(--zsb-soft-text);
    font-size: 0.9em;
}

/* ============================================
   ПУСТАЯ СТРАНИЦА / 404
   ============================================ */
.zsb-page-head,
.zsb-empty {
    background: linear-gradient(180deg, var(--zsb-surface-2), var(--zsb-surface));
    border: 1px solid var(--zsb-border);
    border-radius: 24px;
    padding: clamp(24px, 4vw, 40px);
    margin-bottom: 32px;
    text-align: center;
}

.zsb-page-head h1,
.zsb-empty h1 {
    margin: 0 0 12px;
    font-size: var(--zsb-h1);
}

.zsb-empty h2 {
    margin: 0 0 12px;
    font-size: var(--zsb-h2);
    color: var(--zsb-soft-text);
}

.zsb-empty p {
    color: var(--zsb-soft-text);
    margin: 0 0 24px;
}

.zsb-empty__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.zsb-archive-desc {
    color: var(--zsb-soft-text);
    margin-top: 12px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ============================================
   МОБИЛЬНАЯ ПАНЕЛЬ
   ============================================ */
.zsb-mobile-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(380px, 90vw);
    height: 100vh;
    background: linear-gradient(180deg, rgba(15, 20, 35, 0.98), rgba(8, 12, 22, 0.98));
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.zsb-mobile-panel.is-open {
    transform: translateX(0);
}

.zsb-mobile-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.zsb-mobile-panel__title {
    margin: 0;
    font-size: 1.1em;
    color: #f5e6d3 !important;
}

.zsb-mobile-panel__head .zsb-icon-btn {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #f5e6d3 !important;
}

.zsb-favorites-panel__head .zsb-icon-btn {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #f5e6d3 !important;
}

.zsb-mobile-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.zsb-mobile-panel__nav .zsb-menu {
    flex-direction: column;
    gap: 4px;
}

.zsb-mobile-panel__nav .zsb-menu a {
    padding: 12px 14px;
}

.zsb-mobile-panel__taxonomy .zsb-category-rail,
.zsb-mobile-panel__taxonomy .zsb-subcategory-rail {
    flex-direction: column;
}

.zsb-mobile-panel__taxonomy .zsb-category-chip,
.zsb-mobile-panel__taxonomy .zsb-subcategory-chip {
    width: 100%;
    text-align: center;
}

/* ============================================
   ПАНЕЛЬ ИЗБРАННОГО
   ============================================ */
.zsb-favorites-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 90vw);
    height: 100vh;
    background: linear-gradient(180deg, var(--zsb-surface-2), var(--zsb-surface));
    border-left: 1px solid var(--zsb-border);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    display: flex;
    flex-direction: column;
    color: var(--zsb-text);
}

.zsb-favorites-panel.is-open {
    transform: translateX(0);
}

.zsb-favorites-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--zsb-border);
    background: rgba(0, 0, 0, 0.1);
}

.zsb-favorites-panel__head h2 {
    margin: 0;
    font-size: 1.1em;
    color: var(--zsb-text);
}

.zsb-favorites-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.zsb-favorites-panel__body .zsb-empty-state {
    color: var(--zsb-soft-text);
    text-align: center;
    padding: 40px 20px;
}

.zsb-favorites-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--zsb-border);
}

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

.zsb-favorites-item a {
    color: var(--zsb-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--zsb-transition);
}

.zsb-favorites-item a:hover {
    color: var(--zsb-accent-2);
}

/* ============================================
   НАСТРОЙКИ ЧТЕНИЯ
   ============================================ */
.zsb-reading-controls {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zsb-reading-controls.is-collapsed .zsb-reading-controls__panel {
    display: none;
}

.zsb-reading-controls__toggle {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    color: #fff !important;
    font-size: 24px;
    cursor: pointer;
    transition: transform var(--zsb-transition);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.zsb-reading-controls__toggle:hover {
    transform: scale(1.05);
}

/* Панель настроек открывается над кнопками */
.zsb-reading-controls__panel {
    position: absolute;
    right: 0;
    bottom: 62px;
    width: 240px;
    background: rgba(15, 20, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    z-index: 151;
}
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.zsb-reading-controls__panel-head strong {
    font-size: 0.95em;
    color: #f5e6d3 !important;
}

.zsb-reading-controls__close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: #f5e6d3 !important;
    cursor: pointer;
    font-size: 18px;
    transition: background var(--zsb-transition);
}

.zsb-reading-controls__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.zsb-reading-controls.is-collapsed .zsb-reading-controls__panel {
    display: none;
}

.zsb-reading-controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9em;
    color: #f5e6d3 !important;
}

.zsb-reading-controls select,
.zsb-reading-controls input {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #f5e6d3 !important;
    font-size: 0.9em;
}

.zsb-reading-controls select option {
    background: var(--zsb-surface);
    color: var(--zsb-text);
}

/* Для сепии - тёмный текст в select */
body.zsb-theme-sepia .zsb-reading-controls select,
body.zsb-theme-sepia .zsb-reading-controls input {
    background: rgba(255, 255, 255, 0.8);
    color: var(--zsb-text) !important;
    border-color: var(--zsb-border);
}

.zsb-reading-controls input[type="range"] {
    background: rgba(255, 255, 255, 0.2);
    height: 6px;
    border-radius: 3px;
}

.zsb-reading-controls input[type="range"]::-webkit-slider-thumb {
    background: var(--zsb-accent);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
}

/* ============================================
   ЗАТЕМНЕНИЕ ФОНА
   ============================================ */
.zsb-site-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zsb-site-overlay:not([hidden]) {
    opacity: 1;
}

.zsb-site-overlay[hidden] {
    display: none;
}

/* ============================================
   УВЕДОМЛЕНИЕ О COOKIE
   ============================================ */
.zsb-cookie-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: linear-gradient(180deg, rgba(15, 20, 35, 0.98), rgba(8, 12, 22, 0.98));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 0;
    backdrop-filter: blur(12px);
    animation: zsbSlideUp 0.4s ease-out;
}

@keyframes zsbSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.zsb-cookie-notice__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.zsb-cookie-notice__text {
    margin: 0;
    font-size: 0.9em;
    color: var(--zsb-soft-text);
    flex: 1;
    min-width: 200px;
}

/* ============================================
   ПОДВАЛ
   ============================================ */
.zsb-site-footer {
    position: relative;
    z-index: 10;
    background: linear-gradient(180deg, rgba(10, 14, 26, 0.95), rgba(5, 7, 15, 0.98));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 60px;
    padding-bottom: 120px;  /* Место для плавающих кнопок */
}

/* Защита от дублирования навигации в подвале (плагины, виджеты) */
.zsb-site-footer .zsb-story-nav,
.zsb-site-footer .zsb-single-book,
.zsb-site-footer .zsb-story-invite,
.zsb-site-footer [class*="story"],
.zsb-site-footer [class*="nav"] {
    display: none !important;
}

.zsb-footer-inner {
    padding: 60px 0 40px;  /* Увеличенный подвал */
}

/* Плавающие кнопки (ниже подвала) */
.zsb-floating-buttons {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Кнопка "Наверх" */
.zsb-scroll-top-btn {
    position: fixed;
    right: 20px;
    bottom: 82px;  /* Ниже настроек */
    z-index: 150;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--zsb-accent), var(--zsb-accent-3));
    color: #fff !important;
    font-size: 24px;
    cursor: pointer;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: none !important;  /* Скрыта по умолчанию */
}

.zsb-scroll-top-btn.is-visible {
    display: flex !important;  /* Показываем при прокрутке */
    align-items: center;
    justify-content: center;
}

.zsb-scroll-top-btn:hover {
    transform: scale(1.05);
}

.zsb-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.zsb-footer-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Простые ссылки в подвале (не кнопки) */
.zsb-footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.zsb-footer-link-item {
    color: rgba(245, 230, 211, 0.8);
    text-decoration: none;
    font-size: 0.9em;
    transition: color var(--zsb-transition);
}

.zsb-footer-link-item:hover {
    color: #f5e6d3;
    text-decoration: underline;
}

.zsb-footer-copy {
    margin: 0;
    color: #f5e6d3 !important;
    font-size: 0.9em;
}

.zsb-footer-tagline {
    margin: 0;
    color: rgba(245, 230, 211, 0.7);
    font-size: 0.85em;
    font-style: italic;
}

/* Социальные кнопки */
.zsb-footer-social {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.zsb-social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all var(--zsb-transition);
}

.zsb-social-link--telegram {
    background: linear-gradient(135deg, #2a9ee2, #1d7bb8);
    color: #fff !important;
}

.zsb-social-link--telegram:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(42, 158, 226, 0.3);
}

.zsb-social-link--youtube {
    background: linear-gradient(135deg, #e62117, #c41a12);
    color: #fff !important;
}

.zsb-social-link--youtube:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(230, 33, 23, 0.3);
}

.zsb-social-link__icon {
    font-size: 1.1em;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */
@media (max-width: 980px) {
    .zsb-header-inner {
        flex-wrap: wrap;
        gap: 12px;
    }

    .zsb-main-nav {
        display: none !important;  /* Скрываем меню на мобильных */
    }

    .zsb-header-lower {
        display: none !important;  /* Скрываем рубрики и хлебные крошки на мобильных */
    }

    .zsb-header-search {
        display: none;
    }

    /* Показываем гамбургер на мобильных */
    .zsb-menu-toggle {
        display: inline-flex;
    }

    .zsb-footer-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .zsb-footer-left {
        align-items: center;
    }

    .zsb-footer-links {
        justify-content: center;
    }

    .zsb-footer-social {
        justify-content: center;
        width: 100%;
    }

    .zsb-grid {
        grid-template-columns: 1fr;
    }

    /* Навигация по сказкам на мобильных */
    .zsb-story-nav {
        flex-direction: column;
        gap: 10px;
    }

    .zsb-story-nav__prev,
    .zsb-story-nav__next {
        width: 100%;
        justify-content: center;
    }

    .zsb-story-nav__prev a,
    .zsb-story-nav__next a {
        text-align: center;
        width: 100%;
    }

    .zsb-story-nav__all {
        width: 100%;
        text-align: center;
    }

    .zsb-story-nav__all a {
        display: inline-block;
    }
}

    /* Навигация по сказкам на мобильных */
    .zsb-story-nav {
        flex-direction: column;
        gap: 10px;
    }

    .zsb-story-nav__prev,
    .zsb-story-nav__next {
        width: 100%;
        justify-content: center;
    }

    .zsb-story-nav__prev a,
    .zsb-story-nav__next a {
        text-align: center;
        width: 100%;
    }

    .zsb-story-nav__all {
        width: 100%;
        text-align: center;
    }

    .zsb-story-nav__all a {
        display: inline-block;
    }
}

@media (max-width: 640px) {
    .zsb-content-area {
        padding: 24px 0 40px;
    }
    
    .zsb-single-head {
        flex-direction: column;
    }
    
    .zsb-single-tools {
        width: 100%;
        justify-content: flex-start;
    }
    
    .zsb-cookie-notice__inner {
        flex-direction: column;
        text-align: center;
    }
    
    .zsb-reading-controls {
        right: 12px;
        bottom: 60px;
    }
}

/* ============================================
   PREFERS REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

}
