/* ===== 1. Ð‘ÐÐ—ÐžÐ’Ð«Ð• ÐŸÐ•Ð Ð•ÐœÐ•ÐÐÐ«Ð• ===== */
:root {
    --bg: #f8fafc;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #6366f1;
    --danger: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --bg-soft: #f1f5f9;
    --radius: 16px; /* Ð§ÑƒÑ‚ÑŒ Ð¼ÑÐ³Ñ‡Ðµ Ð´Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ */
    --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.08);
}

/* ===== 2. ÐžÐ‘Ð©Ð˜Ð• Ð¡Ð¢Ð˜Ð›Ð˜ ===== */
* { box-sizing: border-box; }

body { 
    margin: 0; 
    font-family: 'Inter', sans-serif; 
    background: var(--bg); 
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}


/* Контейнер картинки в библиотеке */
/* ===== СТИЛИ ДЛЯ МОБИЛЬНОГО МЕНЮ ===== */

/* На десктопе прячем кнопку и мобильное меню */

/* Основной контейнер иконки */
.premium-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    margin-right: 16px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #fff;
    /* Эффект многослойной тени для глубины */
    box-shadow: 
        0 4px 10px rgba(0,0,0,0.05),
        inset 0 -3px 0 rgba(0,0,0,0.1);
}

.premium-icon-wrapper svg {
    width: 22px;
    height: 22px;
    z-index: 2;
}

/* Цветовые схемы с неоновым свечением */
.icon-vip { 
    background: linear-gradient(135deg, #fbbf24, #f59e0b); 
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(245, 158, 11, 0.5);
}

.icon-romance { 
    background: linear-gradient(135deg, #f472b6, #ec4899); 
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(236, 72, 153, 0.5);
}

/* Обновляем Fantasy */
.icon-fantasy { 
    background: linear-gradient(135deg, #a78bfa, #7c3aed); /* Глубокий фиолетовый */
    color: #fff;
    box-shadow: 0 8px 25px -5px rgba(124, 58, 237, 0.6);
    animation: crystal-glow 3s infinite ease-in-out; /* Магическая пульсация */
}

/* Эффект пульсации для фэнтези */
@keyframes crystal-glow {
    0%, 100% { box-shadow: 0 8px 20px -5px rgba(124, 58, 237, 0.5); transform: scale(1); }
    50% { box-shadow: 0 12px 30px -2px rgba(139, 92, 246, 0.8); transform: scale(1.03); }
}

/* Добавим «магический» отблеск на SVG */
.icon-fantasy svg {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
}

.icon-drama { 
    background: linear-gradient(135deg, #fb7185, #f43f5e); 
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(244, 63, 94, 0.5);
}

.icon-thriller { 
    background: linear-gradient(135deg, #475569, #1e293b); 
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(30, 41, 59, 0.5);
}

/* Анимация при наведении на секцию */
section:hover .premium-icon-wrapper {
    transform: translateY(-4px) scale(1.05);
}

/* Эффект блика на иконке */
.premium-icon-wrapper::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 50%);
    border-radius: inherit;
    z-index: 1;
}

/* Стилизация заголовка h2 для выравнивания */
h2 {
    display: flex;
    align-items: center;
    font-family: 'Space Grotesk', sans-serif; /* Под твой новый премиум-дизайн */
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 24px;
}


/* Бейдж PRO в хедере пользователя */
.header-pro-badge {
    background: linear-gradient(135deg, #7c3aed, #a855f7); /* Фиолетовый градиент */
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(168, 85, 247, 0.3);
}


.admin-link {
    color: #6366f1;
    font-weight: 700;
    text-decoration: none;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: 0.2s;
}

.admin-link:hover {
    color: #4f46e5;
    text-decoration: underline;
}
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 3. Ð¥Ð•Ð”Ð•Ð  ===== */
.main-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95); /* Чуть плотнее фон */
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 70px; /* Было 50px */
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo-img {
    height: 30px;    /* Фиксируем высоту, чтобы логотип не «кричал» */
    width: auto;      /* Ширина рассчитается сама исходя из пропорций 79:10 */
    display: block;
    object-fit: contain;
    transition: transform 0.3s ease;
}
.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Запрещаем флексу сжимать логотип в кашу */
}

.main-nav {
    display: flex;
    gap: 28px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600; /* Сделали жирнее */
    font-size: 17px;  /* Было 15px */
    transition: 0.2s;
    cursor: pointer;
}

.nav-link:hover { color: var(--primary); }

/* Dropdown Genres */
.nav-dropdown { position: relative; padding: 20px 0; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%; left: 0;
    background: white;
    min-width: 180px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 8px;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-main);
    border-radius: 8px;
    transition: 0.2s;
}
.nav-dropdown-menu a:hover { background: var(--bg-soft); color: var(--primary); }

/* ===== 4. HERO СЕКЦИЯ (МАКЕТ КАК НА СКРИНШОТЕ) ===== */
.main-content { 
    padding-top: 250px; 
}

#main-story-container {
    /* Добавляем отступ сверху, чтобы блок не залез под хедер 80px */
    padding-top: 100px; 
    margin-bottom: 60px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    
}

.hero-card {
    display: flex;
    align-items: center;
    gap: 40px; /* Отступ между фото и текстом */
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
}

.hero-img {
    width: 60%; /* Картинка занимает большую часть слева */
    height: auto;
    object-fit: cover;
    border-radius: 24px;
}

.hero-info {
    flex: 1;
    padding-right: 20px;
}

.hero-title { 
    font-size: 48px; 
    margin: 0 0 16px; 
    font-weight: 800; 
    color: #1a1a1a;
}

.hero-meta {
    color: #8b5cf6; /* Фиолетовый цвет для жанра */
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 18px;
}

.hero-desc { 
    font-size: 20px; 
    color: #64748b; 
    margin-bottom: 30px; 
}
.btn-primary {
    background: #a855f7; /* Тот самый фиолетовый */
    color: white;
    border: none;
    padding: 16px 48px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(168, 85, 247, 0.4);
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.btn-primary:hover {
    transform: translateY(-3px);
    background: #9333ea;
    box-shadow: 0 12px 20px -3px rgba(168, 85, 247, 0.5);
}
/* Кнопка как на скриншоте */
.btn-primary.novel-cta {
    background: #a855f7;
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px; /* Сильное закругление */
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(168, 85, 247, 0.4);
    transition: 0.3s;
}

.btn-primary.novel-cta:hover {
    transform: translateY(-3px);
    background: #9333ea;
}
/* user.css */
.user-profile-block {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}

.btn-logout:hover {
    background: var(--bg-soft);
    color: var(--danger);
    border-color: var(--danger);
}
/* Специальный класс для вертикального отображения на странице novel.html */
.hero-card.vertical-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 5px; /* Уменьшаем зазоры между элементами */
    width: 100%;
    height: 95vh; /* Используем почти всю высоту */
    justify-content: flex-start;
}

.hero-card.vertical-layout .hero-info {
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Разрешаем скролл ТОЛЬКО внутри инфо-блока, если текст очень длинный */
    overflow-y: auto; 
    padding: 0 10px;
}

/* Стили для обложки в вертикальном макете */
.hero-img-vertical {
    width: 100%;
    max-width: 300px;       /* Уменьшаем ширину обложки */
    height: auto;           /* Сохраняем пропорции */
    aspect-ratio: 3/2;
    border-radius: 24px;
    object-fit: cover;
    margin: 20px 0;         /* Отступы сверху и снизу */
    box-shadow: var(--shadow);
}

/* Корректировка заголовка для центра */
.hero-card.vertical-layout .hero-title {
    margin-bottom: 10px;
}

/* Убираем отображение списка глав, если JS всё еще пытается его рендерить */
.chapters-section {
    display: none;
}

/* ===== 5. Ð¡Ð•Ð¢ÐšÐ ÐšÐÐ˜Ð“ (VIP & OTHERS) ===== */
.vip-section, 
.genre-section {
    width: 100%;
    max-width: 1200px;    /* Ограничиваем ширину, чтобы совпадало с хедером */
    margin: 0 auto;       /* Центрируем блок на больших экранах */
    padding-left: 24px;   /* Сдвигаем всё чуть правее от края */
    padding-right: 24px;
}
.vip-section { 
    padding-top: 40px; 
}
.vip-section h2 { 
    font-size: 24px; 
    margin-bottom: 24px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}
.books-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 20px; /* Отступ снизу для красоты скролла */
    scroll-snap-type: x mandatory; /* Плавная "прилипающая" прокрутка */
    scrollbar-width: none; /* Прячем скроллбар в Firefox */
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
}
.books-row::-webkit-scrollbar {
    display: none;
}

.book-card {
    flex: 0 0 260px; 
    width: 260px;       /* ДОБАВЛЕНО: Жестко фиксируем ширину */
    max-width: 260px;
    scroll-snap-align: start; 
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* ДОБАВЛЕНО: Заставляем все карточки выстраиваться по верхнему краю */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.book-card:hover { transform: translateY(-8px); }

.book-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2; /* ГОРИЗОНТАЛЬНЫЙ ФОРМАТ 3:2 */
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #e2e8f0;
    margin-bottom: 12px;
    display: block; /* Убрали flex, он здесь больше не нужен */
}

.book-cover { 
    width: 100%; 
    height: 100%; /* Картинка заполняет весь блок 3:2 */
    display: block;
    object-fit: cover; /* Идеально обрезает края, чтобы не было искажений */
}
.vip-badge {
    position: absolute;
    top: 10px; right: 10px;
    background: #fbbf24;
    color: #78350f;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.book-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    
    /* ДОБАВЛЕНО: Обрезаем длинный текст названия, если он не влезает в одну строку */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.book-genre {
    font-size: 13px;
    color: var(--text-muted);
    
    /* ДОБАВЛЕНО: На всякий случай обрезаем и длинный жанр тоже */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ===== 6. ÐŸÐ ÐžÐ¤Ð˜Ð›Ð¬ Ð˜ ÐšÐÐžÐŸÐšÐ˜ ===== */
.profile-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.profile-btn:hover { border-color: var(--primary); background: var(--bg-soft); }
/* Страница новеллы */
.novel-layout {
    padding-top: 100px !important; /* Опускаем контент ниже хедера (60px + запас) */
    min-height: 100vh;             /* Минимальная высота на весь экран */
    display: flex;
    align-items: flex-start;       /* Прижимаем к верху с учетом отступа */
    justify-content: center;
    overflow-y: auto;              /* Разрешаем скролл всей страницы */
}
/* ===== VIP GOLD BORDER ===== */
.vip-gold-border .book-cover-wrapper {
    /* Основная золотая рамка */
    border: 3px solid #fbbf24;
    /* Убираем обычную тень и добавляем неоновое золотое свечение */
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4), inset 0 0 10px rgba(251, 191, 36, 0.2);
    /* Немного скругляем сильнее для красоты рамки */
    border-radius: calc(var(--radius) + 2px); 
    /* Плавный переход для ховера */
    transition: all 0.3s ease;
}

/* Эффект при наведении: свечение усиливается */
.vip-gold-border:hover .book-cover-wrapper {
    border-color: #f59e0b;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6), inset 0 0 15px rgba(245, 158, 11, 0.3);
}
/* ============================================================
   PREMIUM MAIN STORY (HERO SECTION)
   ============================================================ */

.premium-hero {
    position: relative;
    background: #ffffff;
    border-radius: 32px;
    padding: 40px;
    /* Глубокая красивая тень с фиолетовым оттенком */
    box-shadow: 0 25px 50px -12px rgba(99, 102, 241, 0.15); 
    border: 1px solid rgba(99, 102, 241, 0.1);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.premium-hero:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -15px rgba(99, 102, 241, 0.25);
}

/* Эффект легкого свечения в правом углу карточки */
.hero-bg-glow {
    position: absolute;
    top: -30%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.hero-content-wrapper {
    display: flex;
    align-items: center;
    gap: 50px;
    position: relative;
    z-index: 1;
    width: 100%;
}

/* Обертка для картинки */
.hero-image-container {
    position: relative;
    flex-shrink: 0;
    width: 300px; /* Жестко фиксируем ширину, чтобы вертикальные обложки не ломали верстку */
}

.hero-img-premium {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3; /* Идеальные пропорции книжной обложки */
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 3D эффект при наведении на главную карточку */
.premium-hero:hover .hero-img-premium {
    transform: scale(1.03) rotate(-2deg);
}

/* Красивый бейдж над обложкой */
.hero-badge-hot {
    position: absolute;
    /* Позиционируем в правый верхний угол ОБЛОЖКИ с небольшим отступом внутрь */
    top: 12px;
    right: 12px;
    left: auto; /* Сбрасываем старое позиционирование слева */
    transform: none; /* Сбрасываем трансформации, если были */

    /* Тот же красивый градиент */
    background: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    color: white;
    
    /* УМЕНЬШЕННЫЕ РАЗМЕРЫ */
    padding: 5px 12px;  /* Было 8px 18px */
    font-size: 11px;    /* Было 13px */
    
    border-radius: 20px;
    font-weight: 800;
    /* Чуть более аккуратная тень для маленького размера */
    box-shadow: 0 5px 15px rgba(255, 8, 68, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    
    /* Запрещаем выделение текста */
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px; /* Отступ между иконкой огня и текстом */
}

.hero-info-premium {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-meta-premium {
    display: inline-block;
    color: #7c3aed;
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.hero-title-premium {
    font-size: clamp(36px, 4vw, 56px); /* Адаптивный огромный текст */
    font-weight: 900;
    color: #0f172a;
    margin: 0 0 20px 0;
    line-height: 1.1;
    letter-spacing: -1px;
}

.hero-desc-premium {
    font-size: 18px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 35px;
    /* Жестко обрезаем текст до 4 строк с многоточием, чтобы карточка не разъезжалась */
    display: -webkit-box;
    -webkit-line-clamp: 4; 
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Кнопка с эффектом пульсации (зовет кликнуть) */
.pulse-button {
    display: inline-flex;
    align-items: center;
    padding: 16px 40px !important;
    font-size: 18px !important;
    animation: heroPulse 2s infinite;
}

@keyframes heroPulse {
    0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(168, 85, 247, 0); }
    100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

/* --- АДАПТИВНОСТЬ ДЛЯ ПЛАНШЕТОВ И ТЕЛЕФОНОВ --- */
@media (max-width: 900px) {
    .hero-content-wrapper {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    
    .hero-image-container {
        width: 60%;
        max-width: 280px;
    }
    
    .hero-badge-hot {
        top: 10px;
        right: 10px;
        left: auto;
        transform: none;
    }
    
    .hero-action {
        justify-content: center;
    }
    
    .premium-hero {
        padding: 30px 20px;
        border-radius: 24px;
    }
    
    .hero-title-premium {
        font-size: 32px;
    }
}


.hero-card.vertical-layout .hero-info {
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Заголовок */
.hero-card.vertical-layout .hero-title {
    font-size: clamp(20px, 4vh, 28px); /* Шрифт подстраивается под высоту */
    margin: 0;
    line-height: 1.2;
}

/* Обложка — теперь она динамически сжимается */


/* Жанр */
.hero-meta {
    font-size: 14px;
    margin-bottom: 5px;
}

/* Описание — обрезаем лишнее, чтобы не вылезло за экран */
.hero-desc {
    font-size: clamp(14px, 2vh, 18px);
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
    /* Убираем обрезку текста */
    display: block; 
    -webkit-line-clamp: unset; 
    overflow: visible; 
    height: auto;
}

/* Кнопка */
.btn-primary.novel-cta {
    padding: 10px 30px;
    font-size: 16px;
    border-radius: 30px;
}
.chapters-section {
    margin-top: 50px;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.chapter-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
}

.chapter-btn:hover {
    border-color: var(--primary);
    background: #f5f7ff;
    transform: translateY(-2px);
}

.chapter-btn span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ===== READER DESIGN ===== */
.reader-container {
    padding-top: 100px;
    max-width: 800px; /* Узкая колонка для удобства чтения */
    margin-bottom: 50px;
}

.reader-content {
    background: #fff;
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.reader-chapter-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 30px;
    color: #1a1a1a;
    border-bottom: 2px solid var(--bg-soft);
    padding-bottom: 15px;
}
/* ===== TOC (ОГЛАВЛЕНИЕ) ===== */

.reader-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}

/* ===== ОБНОВЛЕННЫЙ ПРЕМИУМ-ДИЗАЙН ДЛЯ TOC BTN ===== */

.toc-btn {
    /* Базовые сбросы */
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    
    /* Размеры и форма */
    width: 46px; /* Чуть увеличили для солидности */
    height: 46px;
    border-radius: 14px; /* Мягкий квадрат, как у премиум-иконок в библиотеке */
    
    /* Цвета и Фон: Используем легкий градиент для "дорогого" матового эффекта */
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    color: var(--text-main); /* Цвет иконки по умолчанию */
    
    /* Рамка: Тонкая, едва заметная */
    border: 1px solid rgba(226, 232, 240, 0.8);
    
    /* Эффект глубины: Многослойная тень + внутренняя тень */
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05), 
        0 2px 4px -1px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.9); /* Блик сверху внутри */
    
    /* Анимация: Плавное cubic-bezier для премиального ощущения */
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden; /* Для эффекта блика */
}

/* Стили для SVG внутри кнопки */
.toc-btn svg {
    transition: transform 0.3s ease, color 0.3s ease;
    z-index: 2; /* Чтобы быть над эффектом блика */
}

/* --- Эффекты при наведении (Hover) --- */
.toc-btn:hover {
    background: #ffffff; /* Чистый белый при наведении */
    border-color: rgba(99, 102, 241, 0.3); /* Легкий фиолетовый оттенок рамки */
    color: var(--primary); /* Иконка становится фиолетовой */
    
    /* Усиливаем тень, приподнимая кнопку */
    box-shadow: 
        0 10px 15px -3px rgba(99, 102, 241, 0.1),
        0 4px 6px -2px rgba(99, 102, 241, 0.05);
    
    transform: translateY(-2px); /* Легкое всплытие */
}

/* Немного сдвигаем линии иконки при наведении для микро-взаимодействия */
.toc-btn:hover svg {
    transform: scale(1.05);
}

/* --- Эффект при нажатии (Active) --- */
.toc-btn:active {
    transform: translateY(0px) scale(0.97); /* Кнопка вдавливается */
    box-shadow: 
        0 2px 4px 0 rgba(0, 0, 0, 0.06),
        inset 0 2px 4px 0 rgba(0, 0, 0, 0.06); /* Внутренняя тень при нажатии */
    transition: all 0.1s ease; /* Быстрая реакция на клик */
}


/* --- Адаптивность для мобильных устройств (уже есть в вашем файле, но на всякий случай) --- */
@media (max-width: 600px) {
    .toc-btn {
        width: 42px; /* Чуть компактнее на мобильных */
        height: 42px;
        border-radius: 12px;
    }
}
.toc-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 280px; /* Чуть шире для удобства пальцев */
    max-height: 70vh; /* Ограничиваем высоту по экрану телефона */
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 10px;
    display: none;
    z-index: 1200; /* Должно быть выше чем .topbar (1100) */
    overflow-y: auto;
}

.toc-dropdown.active {
    display: block;
}

.toc-item {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
/* ===== PRO BADGE IN TOC ===== */

.toc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toc-pro-badge {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-item.locked {
    opacity: 0.85;
}

.toc-item.locked:hover {
    background: #fef2f2;
}

.toc-item:hover {
    background: var(--bg-soft);
}

.toc-item.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.reader-text-area {
    font-size: 19px; /* Оптимальный размер для чтения */
    line-height: 1.8;
    color: #334155;
    white-space: pre-wrap; /* Сохраняет абзацы из админки */
}

.reader-navigation {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    border-top: 2px solid var(--bg-soft);
    padding-top: 30px;
}

/* ===== ОБНОВЛЕННЫЙ ТОПБАР (HEADER) ===== */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
    z-index: 1100;
    display: flex;
    align-items: center;
}

.topbar .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* КНОПКА НАЗАД */
.back-circle {
    width: 40px;
    height: 40px;
    background: var(--bg-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-main);
    transition: 0.3s;
    border: 1px solid var(--border);
}

.back-circle:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-3px);
    border-color: var(--primary);
}

.back-circle span {
    font-size: 20px;
    font-weight: bold;
}

/* ЛОГОТИП В ЦЕНТРЕ */
.topbar .logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.topbar .logo span {
    color: var(--primary);
}

/* КОРРЕКЦИЯ ОТСТУПА КОНТЕНТА */


/* Кнопка в хедере вместо иконки */
.btn-auth-nav {
    background: #a855f7; /* Тот самый фиолетовый */
    color: white;
    border: none;
    padding: 10px 24px;   /* Компактные отступы для хедера */
    border-radius: 50px;  /* Сильное закругление */
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;  /* Чтобы текст не переносился */
}

.btn-auth-nav:hover {
    background: #9333ea;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(168, 85, 247, 0.4);
}

.btn-auth-nav:active {
    transform: translateY(0);
}

/* Модальное окно */
/* ============================================================
   ПРЕМИУМ МОДАЛКА АВТОРИЗАЦИИ
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Красивый темный блюр-фон */
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px; /* Чтобы не прилипало к краям на мобилках */
}

/* Сама карточка */
.premium-modal {
    background: #ffffff;
    width: 100%;
    max-width: 480px; /* Сделали шире (было 400px) */
    padding: 40px;    /* Больше воздуха внутри */
    border-radius: 32px; /* Более мягкие, современные углы */
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transform: translateY(20px);
    opacity: 0;
    animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalFadeIn {
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 20px; right: 24px;
    background: #f1f5f9;
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; 
    color: #64748b;
    transition: 0.2s;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Приветственный блок */
.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #f3e8ff, #e0e7ff);
    color: #7c3aed;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    box-shadow: 0 8px 16px -4px rgba(124, 58, 237, 0.2);
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
    justify-content: center; /* Центрируем заголовок */
}

.modal-header p {
    font-size: 15px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Вкладки */
.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    background: #f8fafc;
    padding: 6px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-weight: 700;
    font-size: 15px;
    border-radius: 12px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn.active {
    background: #ffffff;
    color: #7c3aed;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Формы */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form.hidden { display: none; }

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-left: 4px;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 16px;
    color: #0f172a;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.input-wrapper input::placeholder {
    color: #94a3b8;
}

.input-wrapper input:focus { 
    background: #ffffff;
    border-color: #a855f7;
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
    outline: none;
}

.modal-btn {
    margin-top: 10px;
    padding: 18px;
    font-size: 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

/* Юридическая приписка */
.modal-footer-legal {
    margin-top: 25px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.6;
}

.modal-footer-legal a {
    color: #64748b;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s;
}

.modal-footer-legal a:hover {
    color: #7c3aed;
}

/* Адаптив для мобилок */
@media (max-width: 480px) {
    .premium-modal {
        padding: 30px 20px;
        border-radius: 24px;
    }
    
    .modal-header h2 {
        font-size: 24px;
    }
    
    .modal-icon {
        width: 48px; height: 48px;
        margin-bottom: 15px;
    }
    
    .input-wrapper input {
        padding: 14px 16px;
    }
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: 32px;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}


/* Вкладки */
.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-soft);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* Формы */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form.hidden { display: none; }

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.input-group input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
}

.input-group input:focus { border-color: var(--primary); }

.full-width { width: 100%; }
.paywall-box {
    text-align: center;
    background: #fff;
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary);
}

.paywall-box h2 {
    margin-bottom: 10px;
    font-size: 24px;
}

.paywall-box p {
    color: var(--text-muted);
    margin-bottom: 20px;
}
/* ===== MODERN PAYWALL ===== */

.paywall-modern {
    background: var(--card-bg); /* Белый фон как у остальных карточек */
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px 30px;
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
    box-shadow: var(--shadow);
}

.paywall-title {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%;
}

.plan-card {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: 0.3s;
    background: #f8fafc;
    width: 100%;
    user-select: none;
    transition: 0.2s ease;
}

.plan-card input[type="radio"] {
    pointer-events: none;
}


.plan-card:hover {
    transform: translateY(-2px);
}

.plan-card.active {
    border-color: #7c3aed;
    background: #f3e8ff;
    transform: scale(0.98);
}

.plan-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plan-name {
    font-size: 18px;
    font-weight: 700;
}

.plan-price {
    font-size: 14px;
    color: #64748b;
}

.plan-perday {
    background: #e2e8f0;
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
}

.plan-perday span {
    display: block;
    font-size: 11px;
    font-weight: 500;
}

.plan-perday.highlight {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
}

.popular-badge {
    position: absolute;
    top: -10px;
    right: 20px;
    background: #6366f1;
    color: white;
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: bold;
}

.paywall-note {
    font-size: 12px;
    color: #64748b;
    margin: 20px 0;
    line-height: 1.4;
}

.paywall-btn {
    background: #6366f1;
    color: white;
    border: none;
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}
.paywall-btn small {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    font-weight: normal;
}

.paywall-btn:hover {
    transform: translateY(-3px);
}

.secure-note {
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
}

/* АДАПТИВНОСТЬ ДЛЯ МОБИЛОК */
/* ============================================================
   ОБЩИЕ ИСПРАВЛЕНИЯ ДЛЯ АДАПТИВНОСТИ
   ============================================================ */

/* Улучшаем контейнер для мобилок */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Footer Styles */
.main-footer {
    background-color: #121212; /* Темный фон */
    padding: 40px 20px;
    margin-top: 60px;
    border-top: 1px solid #333;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.footer-links a {
    color: #ffffff; /* Белые ссылки */
    text-decoration: none;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 1;
}

.footer-copy {
    color: #666;
    font-size: 12px;
}

/* Стили для юридических страниц */
.legal-page {
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
    padding: 100px 20px 60px;
    max-width: 800px;
    margin: 0 auto;
}

.legal-page h1 { color: #fff; margin-bottom: 30px; }
.legal-page h2 { color: #fff; margin-top: 25px; }

/* Фикс хедера: скрываем навигацию и адаптируем лого */
@media (max-width: 768px) {
    .main-header {
        height: 60px;
    }
    .header-inner {
        padding: 0 15px;
    }
    .logo-img {
        height: 20px !important; /* На мобилке еще компактнее */
        width: auto !important;
    }
    .main-nav {
        display: none; /* Скрываем десктопное меню */
    }
    .user-email {
        display: none; /* Прячем email, оставляем только Logout или иконку */
    }
    #mobile-pro-badge {
        display: inline-flex;
        margin-left: 10px;
        align-items: center;
    }
}
/* ===== МОБИЛЬНОЕ МЕНЮ (КНОПКА И ОКНО) ===== */

/* Скрываем кнопку на десктопе */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 4px;
    transition: 0.3s;
}

/* Полноэкранный оверлей */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: -100%; /* Спрятано слева */
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 2500;
    transition: transform 0.4s cubic-bezier(0.77,0.2,0.05,1.0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.mobile-menu-overlay.active {
    transform: translateX(100%); /* Выезжает плавно */
}

.mobile-menu-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 40px;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
    text-align: center;
    width: 100%;
}

.mobile-nav-link {
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-main);
    transition: 0.2s;
}

.mobile-nav-link:hover {
    color: var(--primary);
}

.mobile-menu-content hr {
    width: 50px;
    border: 1px solid var(--border);
    margin: 10px auto;
}
.payment-methods {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 20px;
    padding: 10px;
}

.pay-icon {
    height: 18px; /* Единая высота для всех */
    width: auto;
    filter: grayscale(0%); /* Делаем их серыми, чтобы не отвлекали */
    opacity: 0.6;
    transition: 0.3s;
}

.pay-icon:hover {
    filter: grayscale(0%); /* При наведении становятся цветными */
    opacity: 1;
}
/* Иконка главной библиотеки (Индиго/Фиолетовый) */
.icon-library-main {
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(99, 102, 241, 0.5);
    width: 50px; /* Чуть больше для главного заголовка */
    height: 50px;
}

/* Иконка истории (Благородный серый/Слейт) */
.icon-history {
    background: linear-gradient(135deg, #94a3b8, #475569);
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(71, 85, 105, 0.4);
}

/* Фикс для заголовка H1, чтобы иконка стояла ровно */
h1 .premium-icon-wrapper {
    margin-right: 20px;
}
/* Общие стили обертки иконок (если еще нет) */
.premium-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.premium-icon-wrapper svg {
    width: 24px;
    height: 24px;
}

/* Werewolf — Темно-синий/Индиго ночного неба */
.icon-werewolf {
    background: linear-gradient(135deg, #4f46e5, #1e1b4b);
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(79, 70, 229, 0.5);
}

/* Romance — Глубокий розовый/Красный */
.icon-romance {
    background: linear-gradient(135deg, #f43f5e, #881337);
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(244, 63, 94, 0.5);
}

/* Billionaire — Золотой/Янтарный люкс */
.icon-billionaire {
    background: linear-gradient(135deg, #f59e0b, #78350f);
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(245, 158, 11, 0.5);
}

/* New Adult — Изумрудный/Бирюзовый (свежесть) */
.icon-newadult {
    background: linear-gradient(135deg, #10b981, #064e3b);
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(16, 185, 129, 0.5);
}

/* Paranormal — Магический фиолетовый */
.icon-paranormal {
    background: linear-gradient(135deg, #8b5cf6, #4c1d95);
    color: #fff;
    box-shadow: 0 8px 20px -5px rgba(139, 92, 246, 0.5);
}
/* ============================================================
   СПИСОК ЖАНРОВ (КАРТИНКА СЛЕВА, ТЕКСТ СПРАВА С ОБРЕЗКОЙ)
   ============================================================ */
/* ============================================================
   СПИСОК ЖАНРОВ (КАРТИНКА СЛЕВА, ТЕКСТ СПРАВА С ОБРЕЗКОЙ)
   ============================================================ */
.vertical-books-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    padding-bottom: 50px;
}

.genre-list-card {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 900px; /* Максимальная ширина карточки на ПК */
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border);
}

.genre-list-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.15);
}

.genre-list-cover-wrapper {
    width: 240px; /* Ширина картинки на компьютере */
    flex-shrink: 0;
    background: #e2e8f0;
}

.genre-list-cover {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Обрезает края, сохраняя пропорции */
    display: block;
}

.genre-list-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden; /* Важно для обрезки текста */
}

.genre-list-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 8px;
    color: #1a1a1a;
}

.genre-list-meta {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.genre-list-desc {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
    
    /* Магия CSS для обрезки текста по высоте с троеточием */
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Максимальное количество строк (4) */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- АДАПТИВНОСТЬ ДЛЯ ТЕЛЕФОНОВ --- */
@media (max-width: 768px) {
    .genre-list-cover-wrapper {
        width: 160px; /* Картинка поменьше на планшетах */
    }
    .genre-list-title { font-size: 20px; }
}

@media (max-width: 480px) {
    .genre-list-card {
        border-radius: 16px;
    }
    .genre-list-cover-wrapper {
        width: 130px; /* На телефоне картинка узкая, чтобы влез текст */
    }
    .genre-list-info {
        padding: 15px;
    }
    .genre-list-title {
        font-size: 17px;
        margin-bottom: 4px;
        /* Обрезка длинного названия в 2 строки на смартфонах */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .genre-list-meta {
        font-size: 12px;
        margin-bottom: 8px;
    }
    .genre-list-desc {
        font-size: 14px;
        -webkit-line-clamp: 3; /* Оставляем 3 строки текста на телефоне */
    }
}


/* Адаптив для мобилок */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex; /* Показываем бургер */
    }

    .header-inner {
        justify-content: flex-start; /* Прижимаем элементы к началу */
        gap: 20px;
    }

    .header-auth {
        display: none !important;  /* Кнопку логина (если она остается) толкаем вправо */
    }
    
    /* Скрываем кнопку логина в хедере, если она дублируется в меню */
    .main-header .btn-auth-nav {
        display: none;
    }
}
/* Контейнер для жанров (сетка 2х2) */
.mobile-genres-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 10px 0;
    width: 100%;
}

/* Стиль конкретной кнопки жанра */
.mobile-nav-link.genre-item {
    font-size: 16px; /* Чуть меньше основных ссылок */
    padding: 12px 10px;
    background: #f3e8ff; /* Очень светлый фиолетовый */
    color: #9333ea;      /* Насыщенный фиолетовый текст */
    border-radius: 12px;
    border: 1px solid #e9d5ff;
    text-align: center;
    font-weight: 600;
    transition: 0.3s;
}

/* Эффект при нажатии */
.mobile-nav-link.genre-item:active {
    background: #9333ea;
    color: #ffffff;
    transform: scale(0.95);
}

/* Уточнение для обычных ссылок, чтобы они не слипались с сеткой */
.mobile-nav-link {
    display: block;
    width: 100%;
}
/* ============================================================
   INDEX.HTML (DISCOVER PAGE)
   ============================================================ */
@media (max-width: 768px) {
    #main-story-container {
        padding-top: 80px;
        margin-bottom: 30px;
    }

    .hero-card {
        flex-direction: column; /* Текст под картинку */
        gap: 20px;
        padding: 0 15px;
    }

    .hero-img {
        width: 100%;
        border-radius: 16px;
    }

    .hero-info {
        padding: 0;
        text-align: center;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-desc {
        font-size: 16px;
        margin-bottom: 20px;
    }

    
    .book-card {
        flex: 0 0 220px;
        width: 220px;       /* ДОБАВЛЕНО */
        max-width: 220px; /* На телефоне карточки делаем чуть компактнее */
    }
    
    .vip-section, .genre-section {
        padding-left: 16px;
        padding-right: 16px;
    }

    .books-row {
        display: flex;
        gap: 15px;
        padding-bottom: 15px; /* Оставляем только отступ снизу */
    }
}
.profile-page-layout {
    padding-top: 120px;
    display: flex;
    justify-content: center;
}

.profile-card {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
    text-align: center;
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.p-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 15px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.p-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.p-content { display: none; text-align: left; }
.p-content.active { display: block; animation: fadeIn 0.3s ease; }

/* Карточки подписки */
.sub-card {
    padding: 24px;
    border-radius: 16px;
    margin-top: 20px;
}

.sub-card.free {
    background: #f1f5f9;
    color: #64748b;
    text-align: center;
}

.sub-card.pro {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.4);
}

.sub-label {
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 12px;
    margin-bottom: 5px;
}

/* Кнопка выхода */
.logout-minimal {
    margin-top: 40px;
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.logout-minimal:hover {
    color: var(--danger);
    text-decoration: underline;
}

.big-avatar {
    font-size: 50px;
    margin-bottom: 10px;
}

.legal-links-list a {
    display: block;
    padding: 12px;
    border-bottom: 1px solid var(--bg-soft);
    text-decoration: none;
    color: var(--text-main);
}
/* ============================================================
   NOVEL.HTML (INFO PAGE)
   ============================================================ */
@media (max-width: 768px) {
    .novel-layout {
        padding-top: 70px;
        height: auto; /* Позволяем скроллить описание */
        overflow-y: visible;
    }

    .hero-card.vertical-layout {
        height: auto;
        padding-bottom: 40px;
    }

    .hero-img-vertical {
        max-width: 90%; /* На мобилках даем занять почти всю ширину экрана */
        height: auto;
        margin: 15px auto;
    }

    .hero-card.vertical-layout .hero-info {
        max-width: 100%;
        padding: 0 20px;
    }

    .hero-card.vertical-layout .hero-title {
        font-size: 26px;
    }
}

/* ============================================================
   READER.HTML (READING PAGE)
   ============================================================ */
@media (max-width: 600px) {
    .topbar {
        height: 56px;
    }

    .reader-container {
        padding-top: 70px !important;
        margin-bottom: 20px;
    }

    .reader-content {
        padding: 20px 15px !important; /* Уменьшаем поля, чтобы текст был шире */
        border-radius: 0;
        box-shadow: none;
    }

    .reader-chapter-title {
        font-size: 24px !important;
        margin-bottom: 20px;
    }

    /* Идеальный текст для чтения на телефоне */
    .reader-text-area {
        font-size: 22px !important; /* Чуть меньше 30px, чтобы влезало больше смысла */
        line-height: 1.6 !important;
        letter-spacing: -0.01em;
        word-wrap: break-word;
    }

    .reader-text-area p {
        margin-bottom: 1.2em !important;
    }

    /* Навигация внизу */
    .reader-navigation {
        padding: 20px 10px;
        flex-direction: column;
        gap: 15px;
    }
    
    .paywall-modern {
        padding: 20px 15px;
        margin: 20px 10px;
    }

    .plan-card {
    background: #f8fafc;;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}
.plan-card.active {
    border-color: #6366f1;
    background: #f3e8ff;
}
    
    .plan-name {
        font-size: 16px;
    }
}

/* Специальный фикс для очень маленьких экранов (iPhone SE и т.д.) */
@media (max-width: 380px) {
    .hero-title {
        font-size: 22px;
    }
    .reader-text-area {
        font-size: 20px !important;
    }
    .book-card {
        flex: 0 0 85vw; /* На супер-маленьких экранах карточка занимает 85% экрана */
    }
}
