/* Ранобэ: стили по макету. Все цвета в переменных: светлая тема по умолчанию, тёмная в [data-theme=dark]. */
:root {
  --bg: #F4F4F6;
  --surface: #FFFFFF;
  --surface-2: #F2F1F5;
  --chip: #E9E8ED;
  --text: #16151A;
  --text-2: #55545E;
  --muted: #6B6A75;
  --faint: #8A8994;
  --line: #E6E5EA;
  --line-2: #EFEEF2;
  --control: #DAD9E0;
  --accent: #D62246;
  --accent-ink: #B01737;
  --accent-soft: #FCE8EC;
  --star: #E8A317;
  --hero: #16151A;
  --hero-text: #FFFFFF;
  --hero-muted: #B9B8C2;
  --hero-line: #3D3C45;
  --hero-chip: #2A2930;
  --ok-bg: #183A27;
  --ok-text: #7EE2A8;
  --radius: 14px;
  --font: Manrope, "Segoe UI", system-ui, sans-serif;
  --display: Unbounded, Manrope, "Segoe UI", sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #121116;
  --surface: #1B1A20;
  --surface-2: #24232A;
  --chip: #2A2930;
  --text: #ECEBF0;
  --text-2: #B4B3BD;
  --muted: #9C9BA6;
  --faint: #85848F;
  --line: #2E2D35;
  --line-2: #27262D;
  --control: #3A3942;
  --accent-ink: #F07A92;
  --accent-soft: #3A1620;
  --hero: #0B0A0E;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.muted { color: var(--muted); }

/* Шапка */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 20px; }
.logo-mark { height: 36px; min-width: 36px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; letter-spacing: .02em; line-height: 1; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.main-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.search { flex: 1 1 180px; min-width: 0; max-width: 460px; margin-left: auto; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; background: var(--surface-2); border-radius: 12px; }
.search input { border: 0; background: transparent; flex: 1; min-width: 0; outline: none; }
.search kbd { font-family: inherit; font-size: 12px; color: var(--muted); border: 1px solid var(--control); border-radius: 6px; padding: 1px 7px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text); flex: none; }
.btn { height: 48px; padding: 0 22px; border-radius: 12px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { color: #fff; filter: brightness(1.06); }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-ghost { border: 1px solid var(--hero-line); color: var(--hero-text); background: transparent; }
.btn-ghost:hover { color: var(--hero-text); border-color: var(--hero-muted); }
.btn-outline { border: 1px solid var(--control); background: var(--surface); }

main.page { padding-top: 32px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { font-size: 26px; }
.section-head a { font-weight: 700; text-decoration: none; color: var(--accent-ink); }
.page-title { font-size: 36px; }
.lead-h1 { font-family: var(--font); font-size: 15px; font-weight: 600; color: var(--muted); margin: -12px 0 -28px; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: inherit; }

/* Главная: герой */
.hero-row { display: flex; gap: 20px; flex-wrap: wrap; }
.hero { flex: 999 1 560px; min-width: 0; background: var(--hero); color: var(--hero-text); border-radius: 20px; padding: 28px; display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.hero img { width: 168px; height: 234px; object-fit: cover; border-radius: 12px; }
.hero-body { flex: 1 1 280px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #F07A92; }
.hero-title { font-size: 34px; color: var(--hero-text); text-decoration: none; font-family: var(--display); font-weight: 700; line-height: 1.15; }
.hero-meta { color: var(--hero-muted); }
.progress { display: flex; flex-direction: column; gap: 8px; max-width: 460px; }
.progress-bar { height: 6px; border-radius: 3px; background: #33323A; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); }
.progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--hero-muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.tip-card { flex: 1 1 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.tip-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); }
.tip-card h2 { font-weight: 500; font-size: 22px; }
.tip-card p { margin: 0; color: var(--text-2); }
.tip-card .btn { margin-top: auto; }

/* Сетка обложек */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 24px 20px; }
.card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--text); min-width: 0; }
.card:hover .card-title { color: var(--accent); }
.cover { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--control); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; display: flex; gap: 4px; align-items: center; }
.badge-type { left: 8px; top: 8px; background: #16151A; color: #fff; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.badge-rating { right: 8px; bottom: 8px; background: #fff; color: #16151A; }
.badge-rank { left: 0; bottom: 0; padding: 6px 12px 4px; border-radius: 0 12px 0 0; background: #16151A; color: #fff; font-family: var(--display); font-weight: 700; font-size: 22px; }
.card-title { font-weight: 700; line-height: 1.3; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-sub { font-size: 12px; color: var(--faint); display: flex; gap: 10px; }

/* Свежие главы */
.two-col { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.two-col > .main-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.two-col > aside { flex: 1 1 320px; display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.update-row { display: flex; gap: 16px; align-items: center; padding: 14px 20px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line-2); }
.update-row:last-child { border-bottom: 0; }
.update-row img { width: 48px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; }
.update-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.update-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.update-ch { font-size: 14px; color: var(--text-2); }
.update-ch span { color: var(--faint); }
.pill-new { padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.update-time { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 92px; text-align: right; }
.side-title { font-size: 20px; margin-bottom: 14px; }
.mini { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 12px; }
.mini img { width: 56px; height: 76px; border-radius: 8px; object-fit: cover; flex: none; }
.numbered { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); padding: 10px 0; border-bottom: 1px solid var(--line); }
.numbered b { width: 28px; font-family: var(--display); color: #B5B4BE; }
.genre-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: 14px; }
.chip small { color: var(--faint); font-weight: 600; }
.chip[aria-pressed="true"], .chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Каталог */
.catalog { display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-start; }
.filters { flex: 1 1 260px; max-width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 22px; }
.filters fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.filters legend { font-weight: 800; margin-bottom: 10px; }
.filters label.check { display: flex; gap: 10px; align-items: center; }
.filters input[type=checkbox], .filters input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.filters .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filters .chips label { position: relative; }
.filters .chips input { position: absolute; opacity: 0; }
.filters .chips span { display: inline-flex; height: 36px; padding: 0 14px; align-items: center; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; }
.filters .chips input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; }
.filters .chips input:focus-visible + span { outline: 2px solid var(--accent); }
.genre-list { max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.year-range { display: flex; gap: 8px; align-items: center; }
.year-range input, .field input, .field select, .field textarea { width: 100%; height: 44px; border: 1px solid var(--control); border-radius: 10px; padding: 0 12px; background-color: var(--surface); }
.field select { padding-right: 30px; }
.field textarea { height: auto; padding: 10px 12px; }
.results { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sort { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; font-weight: 600; }
.sort select { border: 0; background-color: transparent; font-weight: 700; }
.intro { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; color: var(--text-2); margin: 0; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); background: var(--surface); border-radius: 16px; border: 1px dashed var(--control); }

.pager { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.pager a, .pager span { min-width: 44px; height: 44px; padding: 0 14px; border-radius: 12px; text-decoration: none; font-weight: 700; display: grid; place-items: center; }
.pager .edge { background: var(--surface); border: 1px solid var(--line); }
.pager [aria-current="page"] { background: var(--text); color: var(--bg); }
.pager .gap { color: var(--faint); min-width: 24px; padding: 0; }

/* Книга */
.book-hero { background: var(--hero); color: var(--hero-text); }
.book-hero .wrap { padding-top: 40px; padding-bottom: 40px; display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.book-cover { width: 240px; height: 320px; object-fit: cover; border-radius: 16px; flex: none; }
.book-info { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.book-hero .crumbs { color: #A3A2AD; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { padding: 5px 10px; border-radius: 8px; background: var(--hero-chip); font-size: 12px; font-weight: 700; }
.tag-type { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tag-ok { background: var(--ok-bg); color: var(--ok-text); }
.book-title { font-size: 36px; max-width: 760px; }
.book-alt { color: #A3A2AD; font-size: 16px; }
.stats { margin: 8px 0 0; display: flex; gap: 36px; flex-wrap: wrap; }
.stats dt { font-size: 13px; color: #A3A2AD; }
.stats dd { margin: 4px 0 0; font-family: var(--display); font-weight: 700; font-size: 22px; display: flex; align-items: center; gap: 8px; }
.stats dd small { font-family: var(--font); font-weight: 500; font-size: 13px; color: #A3A2AD; }
/* Закладка на странице книги: кнопка с меню статусов (вместо системного списка) */
.bm-menu { position: relative; }
.bm-toggle { height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--hero-line); background: transparent; color: var(--hero-text); display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.bm-toggle:hover, .bm-toggle[aria-expanded="true"] { border-color: var(--hero-muted); }
.bm-toggle.is-set { background: var(--hero-chip); }
.bm-toggle .chev { width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); opacity: .7; transition: transform .15s; }
.bm-toggle[aria-expanded="true"] .chev { transform: translateY(2px) rotate(-135deg); }
.bm-list { position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; min-width: 100%; width: max-content; padding: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .22); display: grid; gap: 2px; animation: pop .12s ease-out; }
.bm-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: none; text-align: left; font-weight: 600; cursor: pointer; }
.bm-list button:hover, .bm-list button:focus-visible { background: var(--surface-2); outline: none; }
.bm-list button[aria-checked="true"] { color: var(--accent-ink); background: var(--accent-soft); }
.bm-list .bm-remove { color: var(--muted); border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.s-reading { background: #2F9E5B; } .s-planned { background: #3B7DDD; } .s-done { background: #8A5CF6; }
.s-paused { background: #E8A317; } .s-dropped { background: #D62246; } .s-nope { background: #8A8994; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.rate { display: flex; align-items: center; gap: 4px; }
.rate button { background: none; border: 0; padding: 4px; cursor: pointer; color: #5A5964; }
.rate button.on, .rate button:hover, .rate button:hover ~ button { color: var(--star); }
.rate:hover button { color: var(--star); }
.rate button:hover ~ button { color: #5A5964; }
.rate-note { font-size: 13px; color: #A3A2AD; margin-left: 6px; }
.book-main { padding-top: 0; padding-bottom: 64px; display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.book-main > div { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 32px; padding-top: 28px; }
.book-main > aside { flex: 1 1 300px; display: flex; flex-direction: column; gap: 24px; padding-top: 28px; min-width: 0; }
.desc p { margin: 0 0 12px; font-size: 16px; line-height: 1.65; }
.toc-row { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 16px; align-items: center; padding: 13px 20px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line-2); }
.toc-row:last-child { border-bottom: 0; }
.toc-row .vol { font-size: 13px; color: var(--muted); }
.toc-row .ch-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-row .ch-views, .toc-row .ch-date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.toc-row.read .ch-name { color: var(--faint); font-weight: 500; }
.info dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; font-weight: 600; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.box h2 { font-size: 18px; margin-bottom: 14px; }
.license { font-size: 13px; color: var(--muted); }

/* Подвал */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.site-footer .wrap { padding-top: 40px; padding-bottom: 40px; display: flex; gap: 48px; flex-wrap: wrap; justify-content: space-between; }
.site-footer nav { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.site-footer nav a { text-decoration: none; color: var(--text-2); }
.site-footer b { font-weight: 800; }
.site-footer p { margin: 0; font-size: 14px; color: var(--text-2); max-width: 300px; }

/* Админка */
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.admin-table th { background: var(--surface-2); font-weight: 700; }
.form { display: grid; gap: 16px; max-width: 820px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); font-weight: 500; }
.alert { padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.notice { padding: 12px 16px; border-radius: 12px; background: #E3F4EA; color: #145A32; font-weight: 600; }

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .site-header .wrap { gap: 10px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .main-nav a { white-space: nowrap; padding: 8px 12px; }
  .search { order: 4; max-width: none; flex-basis: 100%; }
  .search kbd { display: none; }
  .header-login { display: none; }
  main.page { padding-top: 20px; gap: 36px; }
  .hero { padding: 20px; gap: 18px; }
  .hero img { width: 104px; height: 146px; }
  .hero-title { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
  .page-title, .book-title { font-size: 26px; }
  .section-head h2 { font-size: 22px; }
  .update-row { padding: 12px 14px; gap: 12px; }
  .update-time { display: none; }
  .filters { max-width: none; }
  .book-cover { width: 150px; height: 200px; }
  .book-hero .wrap { gap: 20px; padding-top: 24px; padding-bottom: 24px; }
  .stats { gap: 20px; }
  .toc-row { grid-template-columns: 1fr auto; padding: 12px 14px; }
  .toc-row .vol, .toc-row .ch-views { display: none; }
}

/* Аккаунт */
.account-link { gap: 8px; padding: 0 14px; }
.account-link span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-form { width: 100%; max-width: 460px; margin: 0 auto; }
.account-page { align-items: stretch; max-width: 560px; gap: 20px; }
.account-page .account-form { max-width: none; display: grid; gap: 14px; }
.account-form .page-title { font-size: 28px; }
.account-form p { margin: 0; }
.field-error { color: var(--accent-ink); font-weight: 600; font-size: 13px; }
.auth-modal { width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.auth-modal::backdrop { background: rgba(16, 15, 20, .55); }
.auth-modal .account-form { max-width: none; border: 0; padding: 28px 24px 24px; }
.auth-modal .auth-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; font-size: 14px; }
.auth-modal .auth-error { margin: 24px 24px 0; }

/* Комментарии */
.comments { display: flex; flex-direction: column; gap: 16px; }
.comments .side-title { margin: 0; }
.comments-count { color: var(--muted); font-family: var(--font); font-size: 16px; font-weight: 600; margin-left: 6px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; }
.comment-form textarea { width: 100%; border: 1px solid var(--control); border-radius: 12px; padding: 12px 14px; background: var(--surface); resize: vertical; min-height: 64px; }
.comment-form-row { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.comment-form-row .btn { height: 40px; padding: 0 18px; }
.comment-error { color: var(--accent-ink); font-weight: 600; font-size: 14px; margin-right: auto; }
.comment-login { margin: 0; padding: 14px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.comment-list { display: flex; flex-direction: column; }
.comment { padding: 14px 0; border-top: 1px solid var(--line); }
.comment-replies .comment { padding: 12px 0 0; border-top: 0; }
.comment-replies { margin-left: 22px; padding-left: 16px; border-left: 2px solid var(--line); }
.comment-replies:empty { display: none; }
.comment > .comment-form { margin: 12px 0 0 38px; }
.comment-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.comment-head time { font-size: 13px; color: var(--muted); }
.comment-body { margin-top: 4px; line-height: 1.6; overflow-wrap: anywhere; }
.comment-gone { margin: 0; color: var(--faint); font-style: italic; }
.comment-actions { display: flex; gap: 14px; margin-top: 6px; }
.comment-actions:empty { display: none; }
.comment-actions button { border: 0; background: none; padding: 0; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.comment-actions button:hover { color: var(--accent); }
.comments [data-comments-more] { align-self: flex-start; }
.reader .comments { margin-top: 48px; }

/* Когда шапка не влезает в строку, от кнопки аккаунта остаётся иконка, имя в aria-label */
.header-login svg { display: none; }
@media (max-width: 1279px) {
  .account-link span, .header-login span { display: none; }
  .header-login svg { display: block; }
  .account-link, .header-login { width: 44px; padding: 0; }
}
@media (max-width: 720px) {
  .comment-replies { margin-left: 8px; padding-left: 12px; }
  .comment > .comment-form { margin-left: 0; }
}

/* Админка: импорт из парсера */
.parser-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.parser-form label { display: flex; gap: 6px; align-items: center; }
.parser-form input[type=number] { width: 90px; height: 36px; border: 1px solid var(--control); border-radius: 8px; padding: 0 8px; background: var(--surface); }
.parser-form .btn { height: 36px; padding: 0 14px; }
.parser-detail > td { background: var(--surface-2); }
.parser-progress { display: flex; flex-direction: column; gap: 10px; }
.parser-bar { height: 10px; border-radius: 5px; background: var(--control); overflow: hidden; }
.parser-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.parser-bar.is-done span { background: #2E9E5B; }
.parser-stats { display: flex; gap: 18px; flex-wrap: wrap; font-weight: 600; }
.parser-stats b { font-family: var(--display); }
.parser-log { max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.parser-log div { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; padding: 5px 12px; border-bottom: 1px solid var(--line-2); }
.parser-log div:last-child { border-bottom: 0; }
.parser-log .file { color: var(--muted); }
.st-added { color: #1E8A4C; } .st-updated { color: #B07A00; } .st-skipped { color: var(--muted); } .st-error { color: var(--accent-ink); font-weight: 700; }
.parser-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }

/* Выпадающие списки: лёгкая стилизация без скриптов. Закрытый список одинаков везде;
   раскрытый в Chrome, Edge и Яндекс Браузере рисуется в стиле сайта (appearance: base-select),
   в остальных браузерах остаётся системным. */
select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238A8994' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
@supports (appearance: base-select) {
  select, ::picker(select) { appearance: base-select; }
  select { display: inline-flex; align-items: center; }
  select::picker-icon { display: none; }
  ::picker(select) { margin-top: 6px; padding: 6px; max-height: min(60vh, 420px); overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .22); }
  option { padding: 8px 12px; border-radius: 9px; font-weight: 600; }
  option::checkmark { display: none; }
  option:hover, option:focus-visible { background: var(--surface-2); outline: none; }
  option:checked { color: var(--accent-ink); background: var(--accent-soft); }
}

/* Нижнее меню и мобильная шапка (телефоны и узкие планшеты) */
.tabbar, .search-toggle, .filters-toggle { display: none; }
@media (max-width: 900px) {
  .site-header .wrap { flex-wrap: nowrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .site-header .main-nav, .site-header .header-login, .site-header .account-link { display: none; }
  .site-header .search-toggle { display: grid; margin-left: auto; }
  .site-header .search { display: none; }
  .site-header.search-open .wrap { flex-wrap: wrap; }
  .site-header.search-open .search { display: flex; order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .search kbd { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); font-weight: 700; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  /* Главная: компактная карточка «Продолжить», популярное лентой */
  .lead-h1 { margin: -8px 0 -24px; font-size: 13px; }
  .hero-row .tip-card { display: none; }
  .hero { position: relative; flex-wrap: nowrap; padding: 14px; gap: 14px; border-radius: 16px; align-items: center; }
  .hero img { width: 64px; height: 88px; border-radius: 8px; flex: none; }
  .hero-body { gap: 6px; flex: 1 1 auto; }
  .hero .eyebrow { font-size: 11px; }
  .hero-title { font-size: 18px; }
  .hero-meta { font-size: 13px; }
  .hero .progress-text span:last-child { display: none; }
  .hero .actions { position: static; }
  .hero .actions .btn-ghost { display: none; }
  .hero .actions .btn-accent { position: absolute; inset: 0; opacity: 0; } /* вся карточка ведёт к чтению */
  .section-head h2 { font-size: 20px; }
  .section-head { margin-bottom: 14px; }
  .grid-scroll { display: flex; overflow-x: auto; gap: 12px; margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 0 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .grid-scroll::-webkit-scrollbar { display: none; }
  .grid-scroll > .card { flex: 0 0 128px; scroll-snap-align: start; }
  .grid-scroll .card-sub, .grid-scroll .card-meta { display: none; }
  .grid-scroll .card-title { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .grid-scroll .badge-rank { font-size: 18px; padding: 4px 10px 2px; }
  .update-row { padding: 12px 14px; gap: 12px; }
  .update-row img { width: 40px; height: 54px; }
  .update-row .pill-new { display: none; }
  .update-time { display: block; min-width: 0; font-size: 12px; }
  .wrap { padding: 0 16px; }

  /* Каталог: сначала книги, фильтры по кнопке */
  .filters-toggle { display: inline-flex; height: 44px; padding: 0 16px; }
  .catalog .filters { display: none; order: -1; flex-basis: 100%; max-width: none; }
  .catalog .filters.is-open { display: flex; }
  .toolbar { align-items: center; gap: 10px; }
  .toolbar > div:first-child { flex-basis: 100%; }
  .sort label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

  /* Книга: обложка поменьше, кнопки в две строки */
  .book-cover { width: 120px; height: 160px; border-radius: 12px; }
  .book-hero .actions { display: grid; grid-template-columns: 1fr auto; width: 100%; }
  .book-hero .actions > .btn-accent { grid-column: 1 / -1; }
  .book-hero .bm-toggle { width: 100%; justify-content: center; }
  .update-ch { font-size: 13px; }
}
