/* Sora — вариативный шрифт проекта (SIL Open Font License 1.1) */
@font-face {
    font-family: 'Sora';
    src: url('/assets/fonts/Sora-Variable.woff2') format('woff2-variations'),
         url('/assets/fonts/Sora-Variable.woff2') format('woff2');
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Основная палитра */
    --brand: #0f8f6f;
    --brand-600: #0c7a5f;
    --brand-700: #095f4a;
    --brand-900: #0a2f26;
    --brand-100: #d8f1e8;
    --brand-50: #eef8f4;

    --accent: #f07a35;
    --accent-600: #d9631f;
    --accent-100: #fde9dc;
    --accent-50: #fff4ed;

    --gold: #f2b134;

    /* Нейтральные */
    --bg: #f1f4f2;
    --surface: #ffffff;
    --surface-soft: #f7f9f8;
    --surface-warm: #fbf7f1;
    --ink: #16211d;
    --ink-soft: #3c4a45;
    --muted: #6d7c76;
    --muted-light: #93a09a;
    --border: #e3e9e6;
    --border-strong: #cfd8d4;

    --danger: #d8453c;
    --danger-bg: #fdecea;
    --success: #16a34a;

    /* Скругления и тени */
    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 30px;
    --r-full: 999px;

    --shadow-xs: 0 1px 2px rgba(16, 42, 34, .06);
    --shadow-sm: 0 4px 14px rgba(16, 42, 34, .06);
    --shadow-md: 0 12px 30px rgba(16, 42, 34, .09);
    --shadow-lg: 0 24px 60px rgba(16, 42, 34, .14);

    --container: 1240px;
    --header-h: 132px;

    --t-fast: .16s ease;
    --t: .24s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, h5 {
    margin: 0;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.02em;
    color: var(--ink);
}

h1 { font-size: clamp(28px, 3.6vw, 44px); font-weight: 700; }
h2 { font-size: clamp(22px, 2.4vw, 30px); }
h3 { font-size: 18px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-600); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-700); }

img { max-width: 100%; display: block; }
button { font-family: inherit; }

:focus-visible {
    outline: 3px solid rgba(15, 143, 111, .45);
    outline-offset: 2px;
    border-radius: 6px;
}

.visually-hidden, .skip-link:not(:focus) {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 200;
    padding: 10px 16px;
    background: var(--brand);
    color: #fff;
    border-radius: var(--r-sm);
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.main { min-height: 60vh; padding-bottom: 72px; }

.section { margin-top: 56px; }
.section--tight { margin-top: 32px; }

/* ---------------------------------------------------------------
   Кнопки
   --------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: 1px solid transparent;
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }

.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(15, 143, 111, .22); }
.btn--primary:hover { background: var(--brand-600); color: #fff; }

.btn--accent { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(240, 122, 53, .24); }
.btn--accent:hover { background: var(--accent-600); color: #fff; }

.btn--ghost { border-color: var(--border-strong); background: transparent; color: var(--ink); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-600); background: var(--brand-50); }

.btn--soft { background: var(--brand-50); color: var(--brand-700); }
.btn--soft:hover { background: var(--brand-100); color: var(--brand-700); }

.btn--white { background: #fff; color: var(--brand-700); }
.btn--white:hover { background: #fff; color: var(--brand-900); }

/* Кнопка «Скачать через Telegram» на странице книги. Фирменный синий здесь
   уместен: он говорит, куда именно ведёт ссылка, ещё до чтения подписи. */
.btn--telegram { background: #2aabee; color: #fff; box-shadow: 0 8px 20px rgba(42, 171, 238, .22); }
.btn--telegram:hover { background: #1d97d6; color: #fff; }

/*
 * Контурная кнопка на тёмной подложке (герой главной).
 * Раньше это был .btn--ghost с инлайновым color:#fff — инлайн перебивал
 * :hover, фон становился почти белым, а текст оставался белым и пропадал.
 */
.btn--outline-white {
    border-color: rgba(255, 255, 255, .45);
    background: transparent;
    color: #fff;
}
.btn--outline-white:hover,
.btn--outline-white:focus-visible {
    background: rgba(255, 255, 255, .18);
    border-color: #fff;
    color: #fff;
}
.btn--outline-white:active { background: rgba(255, 255, 255, .28); }

.btn--dark { background: var(--brand-900); color: #fff; }
.btn--dark:hover { background: #06231c; color: #fff; }

.btn--danger { background: var(--danger-bg); color: var(--danger); }
.btn--danger:hover { background: #fadbd8; color: var(--danger); }

.btn--lg { padding: 15px 30px; font-size: 15px; }
.btn--sm { padding: 9px 16px; font-size: 13px; }
.btn--xs { padding: 7px 13px; font-size: 12px; }
.btn--block { width: 100%; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid transparent;
    border-radius: var(--r-full);
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-soft); color: var(--brand-600); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--r-full);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
}
.badge--green { background: var(--brand-100); color: var(--brand-700); }
.badge--orange { background: var(--accent-100); color: var(--accent-600); }
.badge--gold { background: #fdf1d8; color: #9a6b04; }
.badge--muted { background: var(--surface-soft); color: var(--muted); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-soft); }
/* Уровень английского: синий не занят другими бейджами, поэтому B1/B2/C1
   видно сразу и его не путают с жанром (зелёный) или серией (оранжевый) */
.badge--level { background: #dfe9fb; color: #24508f; }
a.badge--level:hover { background: #cfdefa; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--t-fast);
}
.chip:hover { border-color: var(--brand); color: var(--brand-700); background: var(--brand-50); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.dot {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--border-strong);
    display: inline-block;
}

/* ---------------------------------------------------------------
   Формы
   --------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field__label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
}
.field__hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.field__error { margin-top: 6px; font-size: 12px; color: var(--danger); }

.input, .select, .textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 143, 111, .13);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.select {
    appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236d7c76' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.input--error { border-color: var(--danger); }

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-soft);
    cursor: pointer;
}
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }

/* ---------------------------------------------------------------
   Шапка
   --------------------------------------------------------------- */
.header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header__bar { padding: 14px 0; }

.header__inner {
    display: flex;
    align-items: center;
    gap: 20px;
}
/* Без min-width: 0 колонки шапки не сжимаются ниже своего содержимого,
   и на узком экране блок с кнопкой «Войти» уезжал за правый край. */
.header__inner > * { min-width: 0; }

.header__burger { display: none; }

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.02em;
    flex-shrink: 0;
}
.logo:hover { color: var(--brand-700); }
.logo__mark { color: var(--brand); display: inline-flex; }
.logo--light, .logo--light:hover { color: #fff; }
.logo--light .logo__mark { color: var(--brand-100); }

.search {
    position: relative;
    flex: 1;
    max-width: 620px;
    display: flex;
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 4px 5px 4px 16px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.search:focus-within {
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(15, 143, 111, .1);
}
.search__icon { color: var(--muted); display: inline-flex; margin-right: 10px; }
.search__input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    padding: 9px 0;
    /* width: 0 обязателен вместе с min-width. У <input> собственная ширина
       задаётся атрибутом size (по умолчанию 20 символов, ~176px), и именно она
       считалась минимальным размером формы поиска: строка шапки переставала
       сжиматься и выталкивала кнопки за экран. */
    width: 0;
    min-width: 0;
}
.search__input:focus { outline: none; }
.search__input::-webkit-search-cancel-button { display: none; }
.search__clear {
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    border-radius: 50%;
}
.search__clear:hover { color: var(--ink); background: var(--border); }
.search__submit {
    border: none;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 20px;
    border-radius: var(--r-full);
    cursor: pointer;
    transition: background var(--t-fast);
}
.search__submit:hover { background: var(--brand-600); }

.header__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.header__action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--r-full);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
.header__action:hover { background: var(--surface-soft); color: var(--brand-700); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}
.avatar--md { width: 40px; height: 40px; font-size: 15px; }

/* Навигация */
.nav { border-top: 1px solid var(--border); background: var(--surface); }
.nav__inner {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav__inner::-webkit-scrollbar { display: none; }

.nav__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 14px 14px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    background: none;
    border-top: none; border-left: none; border-right: none;
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast);
}
.nav__link:hover, .nav__link.is-active { color: var(--brand-700); border-bottom-color: var(--brand); }
.nav__link--catalog { font-weight: 600; color: var(--ink); }
.nav__link--accent { color: var(--accent-600); }
.nav__link--accent:hover { color: var(--accent-600); border-bottom-color: var(--accent); }

.nav__group { position: relative; }

.mega {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: min(880px, 88vw);
    /* Меню шире окна уезжало за правый край — жёстко ограничиваем шириной вьюпорта */
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - var(--header-h) - 40px);
    overflow-y: auto;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    z-index: 70;
}
.mega__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px 26px;
}
.mega__title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    margin-bottom: 8px;
}
.mega__title:hover { color: var(--brand-600); }
.mega__link {
    display: block;
    font-size: 13px;
    color: var(--muted);
    padding: 3px 0;
}
.mega__link:hover { color: var(--brand-600); }
.mega__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.mega__all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}
/* Краткие пересказы — отдельный тип публикации, поэтому вынесены из сетки жанров */
.mega__feature {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    background: var(--brand-50);
    color: var(--brand-700);
}
.mega__feature:hover { background: var(--brand-100); }
.mega__feature-title { display: block; font-weight: 600; font-size: 14px; }
.mega__feature-text { display: block; font-size: 12px; color: var(--muted); }

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 230px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    z-index: 80;
}
.user-menu { position: relative; }
.dropdown__form { margin: 0; }
.dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--r-sm);
    color: var(--ink-soft);
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
.dropdown__item:hover { background: var(--surface-soft); color: var(--brand-700); }
.dropdown__item--danger:hover { background: var(--danger-bg); color: var(--danger); }

/* Подсказки поиска */
.suggest {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    max-height: min(70vh, 540px);
    overflow-y: auto;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    z-index: 90;
}
.suggest__group + .suggest__group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.suggest__label {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted-light);
}
.suggest__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    color: var(--ink);
    transition: background var(--t-fast);
}
.suggest__item:hover, .suggest__item.is-active { background: var(--brand-50); color: var(--ink); }
.suggest__cover {
    width: 36px; height: 52px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--surface-soft);
    flex-shrink: 0;
}
.suggest__title { font-size: 14px; font-weight: 500; margin: 0; }
.suggest__meta { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.suggest__all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-600);
}
.suggest__empty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 14px; }

/* Мобильное меню */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: var(--surface);
    padding: 18px 20px 32px;
    overflow-y: auto;
}
.mobile-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.mobile-menu__title { font-weight: 600; font-size: 17px; }
.mobile-menu__nav { display: flex; flex-direction: column; }
.mobile-menu__nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--ink);
    font-size: 16px;
    font-weight: 500;
}
.mobile-menu__nav a:hover { color: var(--brand-600); }
.mobile-menu__foot { display: grid; gap: 10px; margin-top: 24px; }

/* ---------------------------------------------------------------
   Хлебные крошки
   --------------------------------------------------------------- */
.crumbs { padding: 20px 0 6px; }
.crumbs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    color: var(--muted);
}
.crumbs__item { display: inline-flex; align-items: center; gap: 6px; }
.crumbs__item a { color: var(--muted); }
.crumbs__item a:hover { color: var(--brand-600); }
.crumbs__sep { color: var(--border-strong); }

/* ---------------------------------------------------------------
   Заголовки секций
   --------------------------------------------------------------- */
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}
.section-head__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(20px, 2.2vw, 26px);
}
.section-head__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: var(--r-sm);
    background: var(--brand-50);
    color: var(--brand);
}
.section-head__subtitle { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.section-head__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-600);
    white-space: nowrap;
}
.section-head__link:hover { gap: 11px; }

/* ---------------------------------------------------------------
   Карточка книги
   --------------------------------------------------------------- */
.grid-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
    gap: 26px 22px;
}
.grid-books--wide { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.card__cover {
    position: relative;
    display: block;
    aspect-ratio: 2 / 3;
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface-soft);
    box-shadow: var(--shadow-sm);
    transition: transform var(--t), box-shadow var(--t);
}
.card:hover .card__cover { transform: translateY(-6px); box-shadow: var(--shadow-md); }

.cover-img { width: 100%; height: 100%; object-fit: cover; }

.cover-fallback {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%; height: 100%;
    padding: 18px 16px;
    background: linear-gradient(160deg, #17715c, #0a3b30);
    color: #fff;
}
.cover-fallback--1 { background: linear-gradient(160deg, #2c6e8f, #10334a); }
.cover-fallback--2 { background: linear-gradient(160deg, #a35c2b, #4c2411); }
.cover-fallback--3 { background: linear-gradient(160deg, #5b4a8a, #251c47); }
.cover-fallback--4 { background: linear-gradient(160deg, #8a4a5c, #3d1a26); }
.cover-fallback__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cover-fallback__author { font-size: 11px; opacity: .8; }

.card__badge {
    position: absolute;
    top: 10px; left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, .94);
    color: var(--brand-700);
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.card__body { padding: 13px 2px 0; }
.card__genre {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--accent-600);
    margin-bottom: 5px;
}
.card__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 4px;
}
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--brand-600); }
.card__author { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.card__meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.card__year { color: var(--muted-light); }

.card__hover { display: none; }

.stars { display: inline-flex; align-items: center; gap: 1px; color: var(--border-strong); vertical-align: middle; }
.star { color: var(--border-strong); }
.star--on { color: var(--gold); }
.stars-value { margin-left: 6px; font-weight: 600; color: var(--ink-soft); font-size: 12px; }
.stars-count { margin-left: 5px; color: var(--muted-light); font-size: 12px; }

/* Горизонтальная карточка */
.row-card {
    display: flex;
    align-items: center;
    /* wrap — чтобы кнопки переносились на новую строку в узких контейнерах
       (например, в сайдбаре книги шириной 340px), а не выталкивали карточку вправо */
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.row-card:hover { border-color: var(--brand-100); box-shadow: var(--shadow-sm); }
.row-card__index {
    width: 30px;
    font-size: 20px;
    font-weight: 700;
    color: var(--border-strong);
    text-align: center;
    flex-shrink: 0;
}
.row-card__cover {
    width: 58px;
    aspect-ratio: 2 / 3;
    border-radius: var(--r-xs);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}
/* flex-basis задаёт порог переноса: как только тексту остаётся меньше 150px,
   блок кнопок уходит на следующую строку */
.row-card__body { flex: 1 1 150px; min-width: 0; }
.row-card__title { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.row-card__title a { color: var(--ink); }
.row-card__title a:hover { color: var(--brand-600); }
.row-card__author { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.row-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
}
.row-card__meta svg { vertical-align: -2px; }
.row-card__actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }

/* ---------------------------------------------------------------
   Главная: hero
   --------------------------------------------------------------- */
.hero { padding: 32px 0 0; }
.hero__inner {
    position: relative;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 30px;
    align-items: center;
    padding: 52px 56px;
    border-radius: var(--r-xl);
    background: linear-gradient(135deg, #0f8f6f 0%, #0b6b53 55%, #0a4b3c 100%);
    color: #fff;
    overflow: hidden;
}
.hero__inner::after {
    content: '';
    position: absolute;
    right: -120px; top: -120px;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}
.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, .16);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 20px;
}
.hero__title {
    font-size: clamp(30px, 4vw, 50px);
    line-height: 1.08;
    color: #fff;
    margin-bottom: 16px;
    max-width: 15ch;
}
.hero__text {
    font-size: 16px;
    color: rgba(255, 255, 255, .85);
    max-width: 46ch;
    margin-bottom: 26px;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }
.hero__stats { display: flex; gap: 34px; }
.hero__stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.hero__stat-label { font-size: 12px; color: rgba(255, 255, 255, .7); margin-top: 6px; }

.hero__shelf {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 14px;
    min-height: 260px;
    z-index: 1;
}
.hero__book {
    width: 118px;
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(4, 30, 24, .38);
    transform: rotate(-4deg);
    transition: transform var(--t);
}
.hero__book:nth-child(2) { width: 142px; transform: rotate(0deg) translateY(-18px); z-index: 2; }
.hero__book:nth-child(3) { transform: rotate(5deg); }
.hero__book:hover { transform: translateY(-10px) rotate(0); }

/* Промо-карточки */
.promos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 22px;
}
.promo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 26px;
    border-radius: var(--r-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform var(--t), box-shadow var(--t);
}
.promo:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.promo--accent { background: var(--accent-50); border-color: var(--accent-100); }
.promo--brand { background: var(--brand-50); border-color: var(--brand-100); }
.promo__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent-600);
    margin-bottom: 6px;
}
.promo--brand .promo__label { color: var(--brand-600); }
.promo__title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.promo__text { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.promo__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px; height: 54px;
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

/* Продолжить чтение */
.continue {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.continue__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.continue__cover { width: 52px; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.continue__title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.continue__meta { font-size: 12px; color: var(--muted); }
.progress-bar {
    height: 5px;
    border-radius: var(--r-full);
    background: var(--border);
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar__fill { height: 100%; background: var(--brand); border-radius: var(--r-full); }

/* Полосы карточек с горизонтальным скроллом */
.scroller {
    display: grid;
    grid-auto-flow: column;
    /* Верхняя граница обязательна: с 1fr единственная карточка растягивалась
       на всю ширину секции и превращалась в огромный постер */
    grid-auto-columns: minmax(160px, 200px);
    justify-content: start;
    gap: 22px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
}
.scroller > * { scroll-snap-align: start; }

/* ---------------------------------------------------------------
   Раскладки страниц

   Раньше эти сетки жили инлайновыми стилями прямо в шаблонах, и
   медиазапросы их не перебивали: инлайн сильнее любого правила из файла.
   На телефоне из-за этого сайдбар книги в 340px и колонки «1fr 1fr»
   оставались на месте и выносили страницу за экран.
   --------------------------------------------------------------- */
.book-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 26px;
    margin-top: 26px;
}
.two-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 34px;
}
.two-cols--tight { gap: 20px; }
.two-cols--wide { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; }
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 20px;
}

/* Жанры, авторы, серии */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.tiles--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles--one { grid-template-columns: minmax(0, 1fr); }
.tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--ink);
    font-weight: 500;
    transition: all var(--t-fast);
}
.tile:hover { border-color: var(--brand); color: var(--brand-700); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
/* Длинное название серии или жанра не должно раздвигать плитку:
   на телефоне «Хроники Амбера. Пятикнижие Корвина» уносило страницу за экран */
.tile > * { min-width: 0; overflow-wrap: anywhere; }
.tile__count { flex-shrink: 0; font-size: 12px; color: var(--muted); }

.person {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: all var(--t-fast);
}
.person:hover { border-color: var(--brand-100); box-shadow: var(--shadow-sm); }
.person__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--brand-100), var(--brand-50));
    color: var(--brand-700);
    font-weight: 600;
    flex-shrink: 0;
}
/* Длинное имя автора не должно растягивать карточку на узком экране */
.person > * { min-width: 0; }
/* Имя и число книг — строчные span в общей обёртке: без block счётчик
   продолжал строку имени и переносился как его часть («Александр Грин 6 /
   книг»). Отдельными строками карточка читается как задумано. */
.person__name { display: block; font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.person__meta { display: block; font-size: 12px; color: var(--muted); }

/* Подборки */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.collection-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: transform var(--t), box-shadow var(--t);
}
.collection-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.collection-card__covers { display: flex; gap: -10px; }
.collection-card__covers img, .collection-card__covers span {
    width: 54px;
    aspect-ratio: 2/3;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: var(--shadow-xs);
    margin-right: -14px;
    border: 2px solid var(--surface);
}
.collection-card__title { font-size: 17px; font-weight: 600; color: var(--ink); }
.collection-card__text { font-size: 13px; color: var(--muted); }
.collection-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--brand-600);
    font-weight: 600;
}

/* CTA-полоса */
.cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 26px;
    padding: 36px 44px;
    border-radius: var(--r-xl);
    background: var(--brand-900);
    color: #fff;
}
.cta__title { font-size: clamp(20px, 2.4vw, 28px); color: #fff; margin-bottom: 8px; }
.cta__text { color: rgba(255, 255, 255, .72); font-size: 15px; max-width: 60ch; }

/* ---------------------------------------------------------------
   Каталог: фильтры
   --------------------------------------------------------------- */
.page-head { padding: 26px 0 22px; }
.page-head__title { margin-bottom: 10px; }
.page-head__lead { color: var(--muted); font-size: 15px; max-width: 70ch; }
.page-head__meta { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

/* minmax(0, 1fr), а не 1fr: колонка грида по умолчанию не сжимается ниже
   min-content своего содержимого. Ряд сортировок в панели над каталогом
   растягивал её до 628px, и весь каталог уезжал за правый край экрана. */
.catalog { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 30px; align-items: start; }
.catalog > * { min-width: 0; }

.filters {
    position: sticky;
    top: 150px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.filters__group + .filters__group { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.filters__title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; }
.filters__list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.filters__list a { font-size: 14px; color: var(--ink-soft); }
.filters__list a:hover, .filters__list a.is-active { color: var(--brand-600); font-weight: 600; }
.filters__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters__actions { display: grid; gap: 10px; margin-top: 20px; }
/* Шапка панели фильтров нужна только в мобильном режиме, когда панель
   раскрывается на весь экран (см. responsive.css) */
.filters__head { display: none; }

/* Подкатегории внутри фильтра: раскрываются только у выбранной ветки */
.filters__sub { display: none; flex-direction: column; gap: 6px; margin: 2px 0 6px 12px; padding-left: 10px; border-left: 2px solid var(--border); }
.filters__sub.is-open { display: flex; }
.filters__sub a { font-size: 13px; color: var(--muted); }
.filters__sub a:hover, .filters__sub a.is-active { color: var(--brand-600); font-weight: 600; }

/* Панель подкатегорий над каталогом */
.subgenres {
    padding: 16px 18px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.subgenres__title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}
.subgenres__title a { color: var(--ink); }
.subgenres__title a:hover { color: var(--brand-600); }
.subgenres__hint { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: lowercase; }
.subgenres__list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip__count { font-size: 12px; color: var(--muted-light); }
.chip.is-active .chip__count { color: rgba(255, 255, 255, .75); }

/* Уровни английского внутри раздела: та же плашка, что и у подкатегорий
   жанра — вкладки живут на одном уровне и не должны спорить за внимание */
.level-tabs {
    padding: 16px 18px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.level-tabs__title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}
.level-tabs__list { display: flex; flex-wrap: wrap; gap: 8px; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.toolbar__sorts { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar__count { font-size: 14px; color: var(--muted); }
.filters-toggle { display: none; }

/* Пагинация */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    flex-wrap: wrap;
}
.pagination__page, .pagination__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px; height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--t-fast);
}
.pagination__page:hover, .pagination__arrow:hover { border-color: var(--brand); color: var(--brand-700); }
.pagination__page.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination__arrow.is-disabled { opacity: .4; pointer-events: none; }
.pagination__gap { color: var(--muted-light); padding: 0 4px; }

/* Пустые состояния */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 24px;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
}
.empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--brand-50);
    color: var(--brand);
    margin-bottom: 16px;
}
.empty__title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty__text { color: var(--muted); font-size: 14px; margin-bottom: 18px; max-width: 46ch; }

/* Скелетоны */
.skeleton {
    background: linear-gradient(90deg, var(--surface-soft) 25%, #eef2f0 50%, var(--surface-soft) 75%);
    background-size: 400% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--r-sm);
}
.skeleton--cover { aspect-ratio: 2/3; border-radius: var(--r-md); }
.skeleton--line { height: 12px; margin-top: 10px; }
@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* ---------------------------------------------------------------
   Страница книги
   --------------------------------------------------------------- */
.book-hero {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    margin-top: 8px;
}
.book-hero__cover {
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
    aspect-ratio: 2/3;
    box-shadow: var(--shadow-md);
    background: var(--surface-soft);
}
.book-hero__aside { display: flex; flex-direction: column; gap: 14px; }
.book-hero__actions { display: grid; gap: 10px; }
.book-hero__title { margin-bottom: 10px; }
.book-hero__authors { font-size: 16px; color: var(--muted); margin-bottom: 16px; }
.book-hero__authors a { font-weight: 500; }
.book-hero__badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.book-hero__rating {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--surface-soft);
    border-radius: var(--r-md);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.book-hero__rating-value { font-size: 34px; font-weight: 700; line-height: 1; }
.book-hero__annotation { font-size: 15px; color: var(--ink-soft); line-height: 1.75; }
.book-hero__annotation p { margin-bottom: 14px; }

.rate-widget { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rate-stars { display: inline-flex; gap: 3px; }
.rate-stars button {
    border: none;
    background: transparent;
    color: var(--border-strong);
    cursor: pointer;
    padding: 2px;
    line-height: 0;
    transition: color var(--t-fast), transform var(--t-fast);
}
.rate-stars button:hover { transform: scale(1.15); }
.rate-stars button.is-on { color: var(--gold); }
.rate-widget__hint { font-size: 13px; color: var(--muted); }

.meta-list { display: grid; gap: 0; }
.meta-list__row {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.meta-list__row:last-child { border-bottom: none; }
.meta-list__key { color: var(--muted); }
.meta-list__value { color: var(--ink); }

.panel {
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.panel + .panel { margin-top: 20px; }
.panel__title { font-size: 19px; margin-bottom: 16px; }

.formats { display: grid; gap: 10px; }
.format-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-soft);
}
.format-row__ext {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    border-radius: var(--r-sm);
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}
.format-row__body { flex: 1; min-width: 0; }
/* Название и подсказка — <span>, поэтому без display: block они слипались
   в одну строку: «FB2 — 1.2 МБ Лучший выбор для читалок и смартфонов». */
.format-row__name { display: block; font-weight: 600; font-size: 14px; }
.format-row__meta { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.chapters-list { display: grid; gap: 2px; max-height: 460px; overflow-y: auto; }
.chapters-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    color: var(--ink-soft);
    font-size: 14px;
}
.chapters-list a:hover { background: var(--brand-50); color: var(--brand-700); }
.chapters-list__num { color: var(--muted-light); font-size: 12px; min-width: 26px; }

.rating-dist { display: grid; gap: 7px; min-width: 220px; flex: 1; }
.rating-dist__row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.rating-dist__bar { flex: 1; height: 7px; border-radius: var(--r-full); background: var(--border); overflow: hidden; }
.rating-dist__fill { height: 100%; background: var(--gold); }

.comment-form { display: grid; gap: 14px; }
.comments { display: grid; gap: 16px; margin-top: 22px; }
.comment {
    padding: 18px 20px;
    background: var(--surface-soft);
    border-radius: var(--r-md);
}
.comment__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.comment__author { font-weight: 600; font-size: 14px; margin: 0; }
.comment__date { font-size: 12px; color: var(--muted); margin: 0; }
.comment__rating { margin-left: auto; }
.comment__body { font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.comment__actions { display: flex; gap: 8px; margin-top: 12px; }
.vote {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-fast);
}
.vote:hover { border-color: var(--brand); color: var(--brand-700); }
.vote.is-voted { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }

.series-strip { display: grid; gap: 10px; }
.series-strip__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
}
.series-strip__item.is-current { background: var(--brand-50); border-color: var(--brand-100); }
.series-strip__num {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--surface-soft);
    font-size: 12px; font-weight: 600; color: var(--muted);
    flex-shrink: 0;
}

/* ---------------------------------------------------------------
   Скачивание
   --------------------------------------------------------------- */
.download-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 30px; align-items: start; margin-top: 10px; }
.download-card {
    padding: 30px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
}
.format-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border: 2px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--t-fast);
    margin-bottom: 12px;
}
.format-option:hover { border-color: var(--brand-100); background: var(--brand-50); }
.format-option input { accent-color: var(--brand); width: 18px; height: 18px; }
.format-option.is-selected { border-color: var(--brand); background: var(--brand-50); }

.timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px;
    text-align: center;
}
.timer__ring { position: relative; width: 128px; height: 128px; }
.timer__ring svg { transform: rotate(-90deg); }
.timer__ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.timer__track { stroke: var(--border); }
.timer__progress { stroke: var(--brand); transition: stroke-dashoffset 1s linear; }
.timer__value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
}
.timer__text { color: var(--muted); font-size: 14px; }

.download-note {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    border-radius: var(--r-md);
    background: var(--accent-50);
    color: var(--accent-600);
    font-size: 13px;
    line-height: 1.6;
}
.download-note svg { flex-shrink: 0; margin-top: 2px; }

/* ---------------------------------------------------------------
   Формы входа / статические страницы
   --------------------------------------------------------------- */
.auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    max-width: 940px;
    margin: 40px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.auth__form { padding: 44px; }
.auth__side {
    padding: 44px;
    background: linear-gradient(150deg, #0f8f6f, #0a4b3c);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth__side h2 { color: #fff; margin-bottom: 14px; }
.auth__side p { color: rgba(255, 255, 255, .82); font-size: 14px; }
.auth__list { display: grid; gap: 12px; margin-top: 22px; }
.auth__list div { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: rgba(255,255,255,.9); }
.auth__title { margin-bottom: 8px; }
.auth__lead { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.auth__foot { margin-top: 22px; font-size: 14px; color: var(--muted); text-align: center; }

.alert {
    display: flex;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--r-sm);
    font-size: 14px;
    margin-bottom: 18px;
}
.alert--error { background: var(--danger-bg); color: var(--danger); }
.alert--info { background: var(--brand-50); color: var(--brand-700); }
.alert--warn { background: var(--accent-50); color: var(--accent-600); }

.prose { font-size: 15px; line-height: 1.8; color: var(--ink-soft); max-width: 78ch; }
.prose h2 { margin: 32px 0 12px; font-size: 22px; }
.prose h3 { margin: 24px 0 10px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-box {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.stat-box__value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-box__label { font-size: 13px; color: var(--muted); margin-top: 8px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 26px; }
.letters a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px; height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-soft);
    font-weight: 500;
    font-size: 14px;
}
.letters a:hover { border-color: var(--brand); color: var(--brand-700); }
.letters a.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-cloud a { font-size: calc(12px + var(--w, 0) * 5px); }

/* ---------------------------------------------------------------
   Преимущества и футер
   --------------------------------------------------------------- */
.benefits { margin-top: 64px; padding: 30px 0; background: var(--surface); border-top: 1px solid var(--border); }
.benefits__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.benefit { display: flex; align-items: center; gap: 14px; }
.benefit__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px; height: 46px;
    border-radius: var(--r-md);
    background: var(--brand-50);
    color: var(--brand);
    flex-shrink: 0;
}
.benefit__title { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.benefit__text { font-size: 12px; color: var(--muted); margin: 0; }

.footer { background: var(--brand-900); color: rgba(255, 255, 255, .72); padding: 56px 0 26px; }
.footer__inner {
    display: grid;
    grid-template-columns: 1.6fr repeat(4, 1fr);
    gap: 36px;
}
.footer__about { font-size: 13px; line-height: 1.7; margin: 16px 0; max-width: 34ch; }
.footer__mail { display: inline-flex; align-items: center; gap: 8px; color: var(--brand-100); font-size: 13px; }
.footer__mail:hover { color: #fff; }
.footer__title { color: #fff; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.footer__col { display: flex; flex-direction: column; gap: 9px; }
.footer__col a { color: rgba(255, 255, 255, .68); font-size: 13px; }
.footer__col a:hover { color: #fff; }
.footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 44px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 12px;
    color: rgba(255, 255, 255, .5);
}
.footer__bottom p { margin: 0; }
.footer__note a { color: var(--brand-100); text-decoration: underline; }

/* ---------------------------------------------------------------
   Тосты, модалка, таббар, кнопка наверх
   --------------------------------------------------------------- */
.toasts {
    position: fixed;
    right: 20px; bottom: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    background: var(--ink);
    color: #fff;
    border-radius: var(--r-md);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: toast-in .25s ease;
    pointer-events: auto;
    max-width: 360px;
}
.toast--success { background: #106b4f; }
.toast--error { background: #b4322a; }
.toast__icon { flex-shrink: 0; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Атрибут hidden сильнее любого display в наших правилах */
[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 190; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(10, 30, 24, .55); backdrop-filter: blur(3px); }
.modal__dialog {
    position: relative;
    width: min(560px, 100%);
    max-height: 84vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.modal__title { font-size: 19px; }

.to-top {
    position: fixed;
    right: 20px; bottom: 20px;
    z-index: 150;
    width: 46px; height: 46px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--brand-700);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--t-fast);
}
.to-top:hover { transform: translateY(-3px); }

.tabbar { display: none; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
