/* DeepRead — веб-читалка.
   Цвета приходят из темы (themes.js задаёт --bg, --surface, --ink, --dim,
   --line, --accent, --page, --page-ink, --bar). Здесь — только устройство:
   1 основа · 2 кнопки и поля · 3 оболочка и боковая панель · 4 полка ·
   5 разделы · 6 листы · 7 читалка · 8 словарь, заметки, статистика ·
   9 темы и украшения. */

/* ─── 1. Основа ─────────────────────────────────────────── */
:root {
  --bg: #f6f3ee; --surface: #ffffff; --ink: #1d232b; --dim: #6c7178; --line: #e4ded4;
  --accent: #2f6f8f; --accent-ink: #ffffff; --bar: rgba(246, 243, 238, 0.96);
  --page: #fbf9f5; --page-ink: #1d232b;
  --shadow: 0 6px 24px rgba(20, 24, 30, 0.12);
  --shadow-s: 0 1px 2px rgba(20, 24, 30, 0.08), 0 2px 8px rgba(20, 24, 30, 0.06);
  --r-s: 8px; --radius: 12px; --r-l: 16px;
  --font-ui: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-book: 'Literata', 'PT Serif', Georgia, serif;
  --wrap: 1180px; --gut: 32px;
  --hover: color-mix(in srgb, var(--ink) 6%, transparent);
  --soft: color-mix(in srgb, var(--accent) 12%, transparent);
  color-scheme: light;
}
:root[data-theme="sepia"] {
  --bg: #efe6d4; --surface: #f8f0de; --line: #dccdb0; --bar: rgba(239, 230, 212, 0.96);
  --page: #f4ead4; --page-ink: #3b2f22; --ink: #2f271d; --dim: #7b6c58; --accent: #8a5a2b;
}
:root[data-theme="dark"] {
  --bg: #15191e; --surface: #1e242b; --ink: #e7e9ec; --dim: #98a0a8; --line: #2c343d;
  --accent: #7fb6d3; --accent-ink: #10161c; --bar: rgba(21, 25, 30, 0.96);
  --page: #181c21; --page-ink: #d9dde1; --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="sepia"]) {
    --bg: #15191e; --surface: #1e242b; --ink: #e7e9ec; --dim: #98a0a8; --line: #2c343d;
    --accent: #7fb6d3; --accent-ink: #10161c; --bar: rgba(21, 25, 30, 0.96);
    --page: #181c21; --page-ink: #d9dde1; --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dim { color: var(--dim); font-size: 14px; }
.hint { color: var(--dim); font-size: 13.5px; margin: 0 0 18px; max-width: 68ch; }
h2 { font-size: 17px; margin: 28px 0 6px; }
.sec-title { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); margin: 28px 0 12px; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ─── 2. Кнопки и поля ──────────────────────────────────── */
.icon {
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  display: inline-grid; place-items: center; flex: none; cursor: pointer;
}
.icon:hover { background: var(--hover); }
.icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.on { color: var(--accent); }
.icon.on svg { fill: color-mix(in srgb, var(--accent) 25%, transparent); }

.btn, .pill {
  height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px;
  padding: 0 14px; font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pill { border-radius: 999px; height: 32px; padding: 0 14px; font-size: 14px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: #c0392b; }
.btn:disabled { opacity: 0.5; cursor: default; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; font-size: 13.5px; cursor: pointer;
}
.chip:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; }

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--dim); margin-bottom: 6px; }
.field input, .field textarea, .search, .field select, .select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none;
}
.field input:focus, .field textarea:focus, .search:focus, .select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 70px; }
select, .select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  font: inherit; color: var(--ink); background-color: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 34px 7px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.code-input { font-size: 26px !important; letter-spacing: 0.4em; text-align: center; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 8px 12px; font-size: 14px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.list-item { padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item.sub { padding-left: 16px; font-size: 14.5px; }
.list-item small { color: var(--dim); display: block; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 30;
  font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow);
}

/* ─── 3. Оболочка и боковая панель ──────────────────────── */
.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.main { flex: 1; min-width: 0; }
.view { min-height: 100%; }

.side {
  width: 232px; flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1px; padding: 14px 10px 8px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-right: 1px solid var(--line); overflow-y: auto; z-index: 12;
  scrollbar-width: thin;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 8px; }
.side-brand img { width: 34px; height: 34px; border-radius: 9px; }
.side-brand b { display: block; font-size: 16px; letter-spacing: -0.01em; }
.side-brand b span { color: var(--accent); }
.side-brand small { display: block; color: var(--dim); font-size: 12px; }
.side-cap { font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--dim); padding: 16px 10px 4px; opacity: 0.85; }
.nav {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; text-align: left;
  border: 0; background: transparent; padding: 6px 10px; border-radius: 9px; font-size: 14px; color: var(--ink);
  text-decoration: none;
}
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: 0.7; }
.nav span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav .cnt { font-style: normal; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.nav:hover { background: var(--hover); }
.nav.on { background: var(--soft); color: var(--accent); font-weight: 600; }
.nav.on svg { opacity: 1; }
.nav-prem { color: var(--accent); font-weight: 600; }
.nav-prem svg { opacity: 1; fill: color-mix(in srgb, var(--accent) 20%, transparent); }
.side-fill { flex: 1; min-height: 12px; }
.side-user {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-top: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 10px;
}
.side-user .ava { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--soft); color: var(--accent); font-weight: 700; }
.side-user .who { min-width: 0; }
.side-user b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { display: block; font-size: 12px; color: var(--dim); }
.side-back { display: none; }
.menu-btn { display: none; }

/* Шапка страницы: та же ширина и отступы, что у содержимого. */
.top {
  position: sticky; top: 0; z-index: 5; min-height: 64px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px max(var(--gut), calc((100% - var(--wrap)) / 2 + var(--gut)));
  background: var(--bar); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.page-head { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.page-title { flex: 1; margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head .page-title { flex: 0 1 auto; }
.page-sub { color: var(--dim); font-size: 13.5px; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.library { max-width: var(--wrap); margin: 0 auto; padding: 20px var(--gut) 72px; }

@media (max-width: 899px) {
  :root { --gut: 16px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform 0.2s; box-shadow: var(--shadow); background: var(--bg); }
  body.side-open .side { transform: none; }
  body.side-open .side-back { display: block; position: fixed; inset: 0; background: rgba(10, 14, 18, 0.4); z-index: 11; }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .top { min-height: 56px; padding-top: 8px; padding-bottom: 8px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .page-title { font-size: 19px; }
}
@media (max-width: 560px) {
  .add-btn span { display: none; }
  .add-btn { width: 38px; padding: 0; justify-content: center; }
  .page-sub { display: none; }
}
body.in-reader .shell { display: none; }

/* ─── 4. Полка ──────────────────────────────────────────── */
.toolbar { display: flex; gap: 8px; align-items: center; }
.searchbox {
  flex: 1; min-width: 0; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
}
.searchbox:focus-within { border-color: var(--accent); }
.searchbox svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--dim); stroke-width: 1.8; stroke-linecap: round; }
.searchbox input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font: inherit; color: var(--ink); outline: none; }
.toolbar .select { width: auto; height: 40px; font-size: 14px; }

.crumbs { display: flex; align-items: center; gap: 6px; margin: 14px 0 0; font-size: 14px; }
.crumb { border: 0; background: transparent; color: var(--accent); padding: 4px 6px; border-radius: 6px; font-size: 14px; }
.crumb:hover { background: var(--soft); }
.crumb.x { color: var(--dim); font-size: 17px; line-height: 1; padding: 2px 8px; }
.crumb-sep { color: var(--dim); }

.continue-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cont-card {
  display: flex; gap: 14px; align-items: center; text-align: left; padding: 10px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.cont-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.cont-card .cover { width: 58px; flex: none; border-radius: 5px; }
.cont-card .gen b, .cont-card .gen small { display: none; }
.cont-card .gen { padding: 0; }
.cont-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cont-info b { font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cont-info small { color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont-prog { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.cont-prog .bar-prog { flex: 1; }
.bar-prog { display: block; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar-prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 26px 20px; margin-top: 18px; }
.continue + .grid, .continue:not([hidden]) ~ .grid { margin-top: 0; }
.card { position: relative; cursor: pointer; min-width: 0; outline: none; }
.cover {
  aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-s); position: relative; display: block;
  transition: transform 0.18s, box-shadow 0.18s;
}
.card:hover .cover, .card:focus-visible .cover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Корешок: лёгкая тень у левого края — обложка читается как книга. */
.cover::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0,0,0,.16), rgba(255,255,255,.06) 3%, transparent 7%); }

.gen {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 16% 10% 12%; color: #fff; text-align: center;
  background: linear-gradient(170deg, var(--c1), var(--c2));
}
.gen::before { content: ''; position: absolute; inset: 6%; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 2px; pointer-events: none; }
.gen b { font-family: var(--font-book); font-weight: 400; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; hyphens: auto; }
.gen small { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.78; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.cover-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, 0.28); }
.cover-prog i { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 0 0.5px rgba(255,255,255,.4); }
.cover .badge { position: absolute; left: 6px; top: 6px; z-index: 2; font-size: 11px; background: rgba(0, 0, 0, 0.55); color: #fff; padding: 2px 7px; border-radius: 6px; }
.card.cloud .cover { opacity: 0.8; }

.card .t { font-size: 14px; font-weight: 600; margin-top: 10px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; font-size: 12.5px; color: var(--dim); }
.card .meta .a { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta .pct { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
.card .meta .done { color: var(--accent); font-weight: 700; }

.card-act { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; z-index: 2; }
.card-act button {
  width: 28px; height: 28px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgba(20, 22, 26, 0.6); color: #fff; font-size: 15px; line-height: 1;
  opacity: 0; transition: opacity 0.15s; backdrop-filter: blur(4px);
}
.card:hover .card-act button, .card:focus-within .card-act button { opacity: 1; }
.card-act .fav.on { color: #ff9b9b; }
.card .meta .heart { color: #d9534f; font-size: 12px; }
@media (hover: none) { .card-act .more { opacity: 0.85; } }
.remote .cover { opacity: 0.6; }

.empty { color: var(--dim); padding: 40px 0; text-align: center; grid-column: 1 / -1; }
.empty.first {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 20px;
  border: 1.5px dashed var(--line); border-radius: var(--r-l); background: color-mix(in srgb, var(--surface) 50%, transparent);
}
.empty.first b { color: var(--ink); font-size: 18px; }
.empty.first span { max-width: 44ch; }

.drop-overlay { display: none; }
body.dragging .drop-overlay {
  display: grid; place-items: center; position: fixed; inset: 12px; z-index: 25; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: 20px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  color: var(--accent); font-size: 20px; font-weight: 700; text-align: center;
}
.drop-overlay small { display: block; font-size: 14px; font-weight: 500; color: var(--dim); margin-top: 4px; }

/* ─── 5. Разделы: полки и указатели ─────────────────────── */
.shelves { display: flex; flex-direction: column; gap: 10px; }
.shelf { border-top: 1px solid var(--line); padding-top: 14px; }
.shelf:first-child { border-top: 0; padding-top: 0; }
.shelf-head {
  display: flex; align-items: baseline; gap: 10px; width: 100%; border: 0; background: transparent; padding: 0; text-align: left; margin-bottom: 12px;
}
.shelf-head b { font-size: 17px; letter-spacing: -0.01em; }
.shelf-head small { color: var(--dim); font-size: 13px; }
.shelf-head .go { margin-left: auto; font-size: 13.5px; color: var(--accent); font-weight: 600; opacity: 0.85; }
.shelf-head:hover .go { opacity: 1; text-decoration: underline; }
.shelf-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 104px; gap: 14px;
  overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.mini-card { display: flex; flex-direction: column; align-self: start; border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; scroll-snap-align: start; min-width: 0; }
.mini-card .cover { width: 100%; }
.mini-card .gen b { font-size: 11px; -webkit-line-clamp: 4; }
.mini-card .gen small { font-size: 8px; }
.mini-card:hover .cover { transform: translateY(-2px); box-shadow: var(--shadow); }
.mini-card .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 7px; font-size: 12.5px; line-height: 1.3; color: var(--ink); }

.facet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.facet {
  display: flex; align-items: center; gap: 14px; text-align: left; min-width: 0;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 10px 14px;
  cursor: pointer; color: var(--ink); transition: border-color 0.15s;
}
.facet:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.facet .stack { display: flex; flex: none; width: 50px; }
.facet .stack span { width: 28px; height: 42px; border-radius: 3px; margin-left: -17px; box-shadow: 0 1px 4px rgba(0,0,0,.22); background-size: cover; background-position: center; border: 1px solid rgba(255,255,255,.5); }
.facet .stack span:first-child { margin-left: 0; }
.facet-txt { min-width: 0; }
.facet b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facet small { color: var(--dim); font-size: 12.5px; }
.letter-group { display: grid; grid-template-columns: 34px 1fr; gap: 8px; margin-bottom: 16px; }
.letter { font-size: 20px; font-weight: 700; color: var(--accent); padding-top: 14px; }

.lang-table { display: flex; flex-direction: column; gap: 6px; }
.lang-row { display: grid; grid-template-columns: 30px 1fr 200px 200px; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.lang-row .mini { width: 30px; height: 44px; border-radius: 3px; background-size: cover; background-position: center; }
.lang-row .t { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-row select { font-size: 14px; padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 640px) { .lang-row { grid-template-columns: 30px 1fr; } .lang-row select { grid-column: 2; } }

@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 20px 12px; }
  .gen b { font-size: 12px; }
  .gen small { font-size: 8.5px; }
  .card .t { font-size: 13px; }
  .shelf-row { grid-auto-columns: 92px; gap: 12px; }
  .continue-row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; }
  .cont-card { scroll-snap-align: start; }
  .letter-group { grid-template-columns: 1fr; gap: 4px; }
  .letter { padding-top: 0; }
}

/* ─── 6. Листы ──────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(10, 14, 18, 0.45); }
.sheet-body {
  position: relative; width: min(640px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-body.narrow { width: min(440px, 100%); }
@media (min-width: 720px) { .sheet { align-items: center; } .sheet-body { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; padding: 12px 10px 4px 22px; }
.sheet-head h3 { flex: 1; margin: 0; font-size: 17px; }
.sheet-content { overflow: auto; padding: 4px 22px 22px; }
.sheet-content > p:first-child { margin-top: 4px; }

/* ─── 7. Читалка ────────────────────────────────────────── */
#view-reader { position: fixed; inset: 0; background: var(--page); display: flex; flex-direction: column; z-index: 14; }
.bar {
  display: flex; align-items: center; gap: 4px; padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: var(--bar); color: var(--ink); z-index: 4; transition: transform 0.2s, opacity 0.2s;
}
.reader-top { border-bottom: 1px solid var(--line); }
.reader-bottom { border-top: 1px solid var(--line); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
.r-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#r-seek { flex: 1; min-width: 60px; accent-color: var(--accent); }
.r-pos { font-size: 13px; color: var(--dim); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-stage { flex: 1; position: relative; min-height: 0; }
.r-epub { position: absolute; inset: 0; }
.r-pdf { position: absolute; inset: 0; overflow: auto; background: #3a4048; -webkit-overflow-scrolling: touch; }
.r-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); background: var(--page); }
body.reading-full .reader-top { transform: translateY(-100%); opacity: 0; pointer-events: none; position: absolute; left: 0; right: 0; top: 0; }
body.reading-full .reader-bottom { transform: translateY(100%); opacity: 0; pointer-events: none; position: absolute; left: 0; right: 0; bottom: 0; }
.pdf-page { position: relative; margin: 10px auto; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.textLayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; z-index: 2; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer ::selection { background: rgba(47, 111, 143, 0.35); }

.tr-pair { padding: 10px 0; border-bottom: 1px solid var(--line); }
.tr-pair .o { color: var(--dim); font-size: 14px; white-space: pre-wrap; }
.tr-pair .t { margin-top: 4px; white-space: pre-wrap; }
.tr-word { font-size: 20px; font-weight: 700; }
.tr-main { font-size: 17px; margin: 4px 0 8px; }
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.msg { padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; max-width: 92%; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.ai { align-self: flex-start; background: var(--bg); }
.msg.wait { color: var(--dim); font-style: italic; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; position: sticky; bottom: 0; background: var(--surface); padding-top: 6px; }
.chat-input input { flex: 1; }
.sel-pop {
  position: fixed; z-index: 15; display: flex; background: var(--ink); color: var(--bg);
  border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; transform: translateX(-50%);
}
.sel-pop button { border: 0; background: transparent; color: inherit; padding: 9px 12px; font-size: 14px; white-space: nowrap; }
.sel-pop button + button { border-left: 1px solid color-mix(in srgb, var(--bg) 20%, transparent); }
@media (max-width: 420px) {
  .r-pos { font-size: 12px; min-width: 0; }
  .sel-pop button { padding: 9px 9px; font-size: 13.5px; }
}

/* ─── 8. Словарь, заметки, дневник, статистика ──────────── */
.search { margin-bottom: 14px; }
.vocab-list, #list-body > .note-item { max-width: 820px; }
.vocab-item, .note-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; }
.vocab-item { cursor: pointer; }
.vocab-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.vocab-item .w { font-weight: 700; font-size: 17px; }
.vocab-item .tr { font-size: 15.5px; }
.vocab-item .f { color: var(--dim); font-size: 13.5px; }
.vocab-item .s { font-style: italic; font-size: 14px; margin-top: 6px; color: var(--dim); }
.vocab-item .n, .note-item .c { margin-top: 6px; font-size: 14px; border-left: 3px solid var(--accent); padding-left: 10px; }
.vocab-item .b { font-size: 12.5px; color: var(--accent); margin-top: 6px; }
.note-item q { display: block; font-family: var(--font-book); font-style: italic; color: var(--ink); quotes: '«' '»'; }
.note-item small { display: block; color: var(--dim); margin-top: 6px; font-size: 12.5px; }
.note-item .chip { height: 28px; font-size: 13px; }

.diary-head { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.diary-head h2 { flex: 1; margin: 0; text-align: center; }
.cal-person { padding: 14px 0; border-bottom: 1px solid var(--line); max-width: 820px; }
.cal-person b { font-size: 16px; }
.cal-person .m { color: var(--accent); font-size: 12.5px; margin: 2px 0 4px; }
.cal-person p { margin: 0; font-size: 14.5px; line-height: 1.6; }

.year-card { background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 80%, #000), var(--accent)); color: var(--accent-ink); border-radius: var(--r-l); padding: 20px 24px; }
.year-card b { font-size: 21px; display: block; }
.year-card .row { gap: 32px; margin-top: 10px; }
.year-card .row div { font-size: 13px; opacity: 0.88; }
.year-card .row strong { display: block; font-size: 24px; opacity: 1; letter-spacing: -0.02em; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 18px; }
.stat b { display: block; font-size: 26px; letter-spacing: -0.02em; }
.stat span { color: var(--dim); font-size: 13px; }
.goal-bar { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 10px 0 2px; }
.goal-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.days { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 10px 0 0; }
.day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.day i { width: 100%; max-width: 30px; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.day.met i { background: var(--accent); }
.day small { font-size: 11px; color: var(--dim); }
.heat { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 4px; margin-top: 10px; overflow-x: auto; }
.heat i { border-radius: 3px; background: var(--line); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.heat i.l3 { background: color-mix(in srgb, var(--accent) 80%, var(--line)); }
.heat i.l4 { background: var(--accent); }
.book-time { padding: 10px 0; border-bottom: 1px solid var(--line); }
.book-time:last-child { border-bottom: 0; }
.book-time .t { font-weight: 600; }
.book-time small { color: var(--dim); font-size: 12.5px; }

/* ─── 9. Темы, шрифты, украшения ────────────────────────── */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.theme-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 6px 6px 8px; min-width: 0;
}
.theme-tile .sw { width: 100%; height: 46px; border-radius: 8px; background: var(--tb); display: grid; place-items: center; border: 1px solid rgba(0,0,0,.08); }
.theme-tile .sw i { font-style: normal; font-family: Georgia, serif; font-size: 18px; color: var(--tf); border-bottom: 3px solid var(--ta); line-height: 1.2; }
.theme-tile b { font-size: 13px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.theme-tile small { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.theme-tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.theme-tile.locked .sw { opacity: 0.8; }
.theme-tile .lock { position: absolute; top: 10px; right: 10px; font-style: normal; font-size: 13px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.theme-preview { border: 1px solid; border-radius: 12px; padding: 16px 18px; font-family: Georgia, serif; line-height: 1.6; margin-bottom: 10px; }
.theme-preview p { margin: 6px 0 0; }
.font-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.font-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 15px; cursor: pointer; color: var(--ink); }
.font-chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.font-chip.add { font-family: var(--font-ui) !important; font-size: 14px; color: var(--accent); border-style: dashed; }

/* Украшения (decor.js) — за содержимым и приглушённые: настроение, а не помеха. */
#decor { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; opacity: 0.55; }
body.in-reader #decor { display: none; }
#decor .flake { position: absolute; top: -40px; animation: dr-fall linear infinite; will-change: transform; }
#decor .flake.tint { color: var(--accent); }
#decor .flake.spin { animation-name: dr-fall-spin; }
#decor .flake.rise { top: auto; bottom: -40px; animation-name: dr-rise; }
#decor .flake.twinkle { animation: dr-twinkle 3s ease-in-out infinite; }
#decor .drop { position: absolute; top: -60px; width: 1px; height: 40px; background: linear-gradient(transparent, color-mix(in srgb, var(--accent) 70%, transparent)); animation: dr-rain linear infinite; }
#decor .paw { position: absolute; font-size: 26px; opacity: 0.16; }
#decor .cat-tail { position: absolute; right: 18px; bottom: -40px; width: 90px; height: 170px; transform-origin: 50% 100%; animation: dr-tail 4s ease-in-out infinite; }
@keyframes dr-fall { from { transform: translate(0, 0); } 50% { transform: translate(var(--sway), 55vh); } to { transform: translate(0, 112vh); } }
@keyframes dr-fall-spin { from { transform: translate(0, 0) rotate(0); } 50% { transform: translate(var(--sway), 55vh) rotate(200deg); } to { transform: translate(0, 112vh) rotate(380deg); } }
@keyframes dr-rise { from { transform: translate(0, 0); } 50% { transform: translate(var(--sway), -55vh); } to { transform: translate(0, -112vh); } }
@keyframes dr-twinkle { 0%, 100% { opacity: 0.15; transform: scale(0.8); } 50% { opacity: 0.6; transform: scale(1.1); } }
@keyframes dr-rain { from { transform: translateY(0); } to { transform: translateY(115vh); } }
@keyframes dr-tail { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(9deg); } }
@media (prefers-reduced-motion: reduce) {
  #decor .flake, #decor .drop { animation: none; top: auto; }
  #decor .flake { top: calc(var(--y, 50) * 1%); }
  #decor .cat-tail { animation: none; }
  .cover, .card:hover .cover { transition: none; transform: none; }
}
.row > .field { flex: 1 1 200px; margin: 6px 0; }

/* Выбор голоса */
.voice { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.voice:last-child { border-bottom: 0; }
.voice-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 10px 0; text-align: left; }
.voice .radio { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--line); }
.voice.on .radio { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); background: var(--accent); }
.voice-txt { min-width: 0; }
.voice-txt b { display: block; font-size: 14.5px; }
.voice-txt small { display: block; color: var(--dim); font-size: 12.5px; }
.voice .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.voice .tags em { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--hover); color: var(--dim); }
.voice .tags em.good { background: var(--soft); color: var(--accent); font-weight: 600; }
.voice-more { margin-top: 8px; }
.voice-more summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; padding: 8px 0; }
.voice-help p { font-size: 13.5px; margin: 0 0 8px; color: var(--ink); }

/* Перевод страницы: две колонки — оригинал слева, перевод справа */
.sheet-body.wide { width: min(1040px, 100%); max-height: 92vh; }
.tr-bar { margin-bottom: 12px; gap: 10px; }
.tr-bar .seg button { padding: 6px 10px; font-size: 13px; }
.tr-cols .tr-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.tr-cols .tr-pair .t { margin-top: 0; }
.tr-cols .tr-pair .o { color: var(--ink); opacity: 0.72; font-size: 15px; }
.tr-cols .tr-pair .t { font-size: 15px; }
@media (max-width: 560px) {
  .tr-cols .tr-pair { gap: 10px; }
  .tr-cols .tr-pair .o, .tr-cols .tr-pair .t { font-size: 13.5px; line-height: 1.45; }
}

/* Книги в облаке */
.dl-prog:not(:empty) { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.cl-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.cl-tools .search { flex: 1 1 280px; margin: 0; }
.cl-tools .seg button { font-size: 13px; padding: 7px 10px; }
.cl-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 12px; }
.cl-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cl-row:last-of-type { border-bottom: 0; }
.cl-all { font-size: 13.5px; color: var(--dim); cursor: pointer; }
.cl-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.cl-row input[type=checkbox], .cl-all input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); cursor: pointer; }
.cb-here { width: 18px; flex: none; text-align: center; color: var(--accent); font-weight: 700; }
.cl-txt { min-width: 0; }
.cl-txt b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-txt small { display: block; font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-row.here .cl-txt b { font-weight: 500; color: var(--dim); }
.cl-status { flex: none; font-size: 13px; }
.cl-status .busy { color: var(--accent); font-weight: 600; }
.cl-status .err { color: #c0392b; }
.cl-dl { height: 30px; padding: 0 10px; font-size: 13px; }
.cl-del { width: 30px; height: 30px; color: var(--dim); font-size: 14px; opacity: .6; }
.cl-del:hover { opacity: 1; }
.cl-del.armed { width: auto; padding: 0 8px; color: #c0392b; opacity: 1; font-weight: 600; font-size: 13px; }
@media (max-width: 560px) { .cl-del { display: none; } .cl-tools .seg { width: 100%; overflow-x: auto; } }
.cl-thumb { width: 30px; height: 45px; flex: none; border-radius: 3px; overflow: hidden; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,.2); background: var(--line); }
.cl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cl-thumb .gen { padding: 0; }
.cl-thumb .gen b, .cl-thumb .gen small, .cl-thumb .gen::before { display: none; }

/* Группы на полке — сворачиваются по щелчку на заголовке */
.group { margin-top: 22px; }
.group:first-of-type { margin-top: 18px; }
.group-head {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 6px 0; margin-bottom: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); text-align: left;
  border-bottom: 1px solid var(--line);
}
.group-head:hover { color: var(--ink); }
.group-head em { font-style: normal; font-weight: 600; letter-spacing: 0; text-transform: none; background: var(--hover); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.group-head .chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: 0 4px 3px 2px; transition: transform 0.15s; }
.group.folded .chev { transform: rotate(-45deg); margin-bottom: 0; }
.group.folded .group-body { display: none; }
.group .grid { margin-top: 0; }
.group .hint { margin-bottom: 14px; }
.card.cloud .badge { font-size: 12px; padding: 1px 6px; }
.groups .group:first-child { margin-top: 4px; }
.group-head .g-name { text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--ink); font-weight: 700; }
.group-head .g-open { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--accent); opacity: 0; transition: opacity .15s; }
.group-head:hover .g-open { opacity: .9; }
@media (hover: none) { .group-head .g-open { opacity: .8; } }

/* Книги в облаке — сеткой */
.cl-all-wrap { margin-bottom: 16px; }
.cl-grid { margin-top: 0; }
.cl-card .cover { outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .12s, transform .18s, box-shadow .18s; }
.cl-card.sel .cover { outline-color: var(--accent); }
.cl-check { position: absolute; top: 7px; left: 7px; width: 22px; height: 22px; border-radius: 6px; z-index: 2;
  background: rgba(255,255,255,.85); border: 2px solid rgba(0,0,0,.35); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.cl-card.sel .cl-check { background: var(--accent); border-color: var(--accent); }
.cl-card.sel .cl-check::after { content: ''; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.cl-here { position: absolute; top: 7px; left: 7px; z-index: 2; font-size: 11.5px; font-weight: 700; color: #fff; background: rgba(30,120,70,.85); padding: 2px 7px; border-radius: 6px; }
.cl-card.here .cover img, .cl-card.here .cover .gen { opacity: .75; }
.cl-info { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 14px 8px 6px; font-size: 11.5px; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); text-align: right; letter-spacing: .02em; }
.cl-one { position: absolute; top: 6px; right: 6px; z-index: 3; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(20,22,26,.65); color: #fff; font-size: 16px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.cl-card:hover .cl-one { opacity: 1; }
@media (hover: none) { .cl-one { opacity: .9; } }
.cl-state { display: none; }
.cl-state.on, .cl-state.err { display: grid; place-items: center; position: absolute; inset: 0; z-index: 4; background: rgba(0,0,0,.5); color: #fff; font-weight: 700; font-size: 13px; }
.cl-state.err { background: rgba(160,30,30,.6); }
.cl-card .gen small { display: none; }

/* «Премиум и тарифы облака» в боковой панели — заметно */
.side .nav-prem { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 700; margin: 2px 0; }
.side .nav-prem:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* Лист «Премиум и облако» */
.acc-status { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.acc-status > div { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 0; }
.acc-status small { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 700; }
.acc-status b { display: block; font-size: 15px; margin: 2px 0; }
.acc-status span { display: block; font-size: 12.5px; color: var(--dim); }
.plan-h { margin: 22px 0 6px; font-size: 17px; }
.perks { margin: 0 0 12px; padding-left: 18px; color: var(--ink); font-size: 14px; }
.perks li { margin: 3px 0; }
.plans { display: grid; gap: 10px; }
.plans.two { grid-template-columns: repeat(2, 1fr); }
.plans.four { grid-template-columns: repeat(4, 1fr); }
.plan { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color .15s, transform .15s; }
.plan:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.plan:disabled { opacity: .6; cursor: default; }
.plan-name { font-size: 14px; font-weight: 600; color: var(--dim); }
.plan-price { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.plan-sub { font-size: 12.5px; color: var(--dim); }
.plan-badge { position: absolute; top: -10px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.acc-books { margin-top: 20px; padding: 14px; border-radius: var(--radius); background: var(--bg); border: 1px dashed var(--line); }
.acc-books b { display: block; margin-bottom: 10px; }
@media (max-width: 560px) {
  .acc-status { grid-template-columns: 1fr; }
  .plans.four { grid-template-columns: repeat(2, 1fr); }
}

/* Две книги рядом */
.r-stage { display: flex; }
.r-pane { position: relative; flex: 1 1 0; min-width: 0; min-height: 0; }
.r-stage.split #r-main { flex: 0 0 var(--split, 50%); }
.r-split { flex: 0 0 7px; cursor: col-resize; background: var(--line); position: relative; touch-action: none; }
.r-split::after { content: ''; position: absolute; left: 2px; right: 2px; top: 50%; height: 36px; margin-top: -18px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 30%, transparent); }
.r-split:hover { background: color-mix(in srgb, var(--accent) 35%, var(--line)); }
body.splitting iframe, body.splitting .r-pdf { pointer-events: none; }
body.splitting { cursor: col-resize; user-select: none; }
.r-side { display: flex; flex-direction: column; background: var(--page); }
.side-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; background: var(--bar); border-bottom: 1px solid var(--line); }
.side-title { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px 6px; border-radius: 8px; }
.side-title::after { content: ' ▾'; color: var(--dim); font-weight: 400; }
.side-title:hover { background: var(--hover); }
.s-btn { border: 0; background: transparent; height: 30px; min-width: 30px; padding: 0 8px; border-radius: 8px; font-size: 14px; color: var(--ink); white-space: nowrap; }
.s-btn:hover { background: var(--hover); }
.s-btn.on { background: var(--soft); color: var(--accent); font-weight: 700; }
.s-pos { font-size: 12px; color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.side-stage { flex: 1; position: relative; min-height: 0; }
.side-tools { padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); max-height: 40vh; overflow: auto; }
.side-tools .row { flex-wrap: wrap; gap: 6px; }
.side-tools .search { margin: 0; flex: 1 1 140px; min-width: 0; padding: 7px 10px; font-size: 14px; }
.side-tools .btn { height: 34px; font-size: 13.5px; padding: 0 10px; }
.side-index { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.letters { display: flex; flex-wrap: wrap; gap: 6px; }
.letter-chip { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg); }
.letter-chip button { border: 0; background: transparent; padding: 4px 11px; font-size: 16px; color: var(--ink); }
.letter-chip button:hover { background: var(--soft); }
.letter-chip .x { padding: 4px 8px; font-size: 13px; color: var(--dim); border-left: 1px solid var(--line); }
@media (max-width: 760px) {
  .r-stage.split { flex-direction: column; }
  .r-split { cursor: row-resize; }
  .r-split::after { left: 50%; right: auto; top: 2px; bottom: 2px; height: auto; width: 36px; margin: 0 0 0 -18px; }
  body.splitting { cursor: row-resize; }
  .s-btn { padding: 0 6px; }
}

/* ─── Настройки оформления (look.js) ─── */
.look-preview { border: 1px solid var(--line); border-radius: var(--radius); margin: 2px 0 18px; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), var(--shadow-s); max-height: 210px; overflow: hidden; position: relative; transition: background .2s, color .2s; }
.look-preview::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 36px; background: linear-gradient(transparent, var(--lp-fade, rgba(0,0,0,0))); pointer-events: none; }
.look-preview .lp-title { font-weight: 700; font-size: 1.15em; margin-bottom: .4em; text-align: center; letter-spacing: normal; }
.look-preview p { margin: 0 0 .2em; }
.set-sec { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.set-sec:first-child { border-top: 0; padding-top: 0; }
.set-sec h4 { margin: 0 0 10px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); flex-wrap: wrap; }
.set-row:last-of-type { border-bottom: 0; }
.set-label { min-width: 150px; flex: 1 1 150px; }
.set-label b { display: block; font-size: 14.5px; font-weight: 600; }
.set-label small { display: block; font-size: 12px; color: var(--dim); margin-top: 1px; }
.set-slider { display: flex; align-items: center; gap: 6px; flex: 1 1 280px; max-width: 360px; }
.set-slider input[type=range] { flex: 1; min-width: 80px; accent-color: var(--accent); }
.set-step { width: 30px; height: 30px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 17px; line-height: 1; display: grid; place-items: center; }
.set-step:hover { border-color: var(--accent); color: var(--accent); }
.set-val { min-width: 74px; text-align: right; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.set-row .seg button { padding: 7px 11px; font-size: 13px; }
.set-fonts { margin-bottom: 6px; }
.set-fonts .font-chips { gap: 8px; }
.set-fonts .font-chip { padding: 8px 16px; font-size: 16px; border-radius: 10px; }
.set-fonts .font-chip.add { font-size: 13.5px; }
.theme-grid.basic { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 560px) { .theme-grid.basic { grid-template-columns: repeat(3, 1fr); } }
.theme-tile.more { border-style: dashed; }
.theme-tile.more .sw { background: var(--bg); }
.theme-tile.more .sw i { border: 0; color: var(--accent); font-size: 26px; font-family: var(--font-ui); }
details.more-themes > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; padding: 4px 0 10px; }
details.more-themes > summary::-webkit-details-marker { display: none; }
details.more-themes > summary span { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
details.more-themes > summary span::after { content: ' ▸'; }
details.more-themes[open] > summary span::after { content: ' ▾'; }
details.more-themes > summary small { color: var(--dim); font-size: 12.5px; }
.act-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 18px; }
.act-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.25; text-align: center; }
.act-tile:hover { border-color: var(--accent); }
.act-tile .ai { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--accent); font-size: 16px; font-weight: 700; }
@media (max-width: 560px) {
  .act-grid { grid-template-columns: repeat(3, 1fr); }
  .set-slider { max-width: none; }
}

/* ─── Дневник-календарь ─── */
.diary { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: start; }
.diary-side { position: sticky; top: 84px; }
.dcal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px 12px 14px; box-shadow: var(--shadow-s); }
.dcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dcal-head b { font-size: 16px; }
.dcal-wd, .dcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dcal-wd span { text-align: center; font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase; padding: 4px 0; }
.dc { position: relative; aspect-ratio: 1; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.dc.pad { pointer-events: none; }
.dc:hover { background: var(--hover); }
.dc.l1 { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.dc.l2 { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.dc.l3 { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.dc.l4 { background: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--accent-ink); }
.dc.today { font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--accent); }
.dc.sel { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.dc.note::after { content: ''; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #d9822b; }
.dcal-legend { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--dim); }
.dcal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dcal-legend .btn { margin-left: auto; height: 30px; font-size: 13px; padding: 0 10px; }
.lg-dot { width: 6px; height: 6px; border-radius: 50%; background: #d9822b; }
.lg-read { width: 12px; height: 12px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 40%, transparent); }
.dday { display: flex; align-items: center; gap: 10px; }
.dday-t { flex: 1; display: flex; align-items: center; gap: 14px; }
.dday-n { font-family: var(--font-book); font-size: 56px; line-height: 1; font-weight: 700; color: var(--accent); }
.dday-t b { display: block; font-size: 20px; }
.dday-t small { display: block; color: var(--dim); font-size: 14px; }
.dstats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip-s { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--accent); font-weight: 600; }
.chip-s.off { background: var(--hover); color: var(--dim); font-weight: 500; }
.dsec { margin-top: 22px; }
.dsec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.dsec-h h3 { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.dn-saved { font-size: 12px; color: var(--dim); }
.dn-paper { width: 100%; min-height: 170px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; outline: none;
  font: 17px/32px var(--font-book); color: var(--page-ink); background-color: var(--page);
  background-image: linear-gradient(transparent 31px, color-mix(in srgb, var(--accent) 16%, transparent) 31px); background-size: 100% 32px; background-attachment: local; background-position: 0 10px; }
.dn-paper:focus { border-color: var(--accent); }
.lit-list { display: flex; flex-direction: column; gap: 10px; }
.lit { display: grid; grid-template-columns: 64px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.lit-year { font-family: var(--font-book); font-size: 22px; font-weight: 700; color: var(--accent); line-height: 1.1; padding-top: 2px; }
.lit-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.lit-name b { font-size: 16px; }
.lit-ev { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.lit-ev.b { background: color-mix(in srgb, #2e9d5b 16%, transparent); color: #24834b; }
.lit-ev.d { background: var(--hover); color: var(--dim); }
.lit p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.6; }
@media (max-width: 900px) {
  .diary { grid-template-columns: 1fr; }
  .diary-side { position: static; }
  .dday-n { font-size: 44px; }
}
.theme-grid.basic .theme-tile b, .theme-grid.basic .theme-tile small { white-space: normal; }

/* Возврат после перехода по ссылке в книге; текст сноски */
.link-back { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 6; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--bg); padding: 10px 18px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; }
.note-text { font-family: var(--font-book); font-size: 16px; line-height: 1.6; margin: 0 0 6px; white-space: pre-wrap; }
#view-reader { height: 100%; height: 100dvh; }

/* Оглавление: номер страницы справа, текущая глава выделена */
.toc-row { display: flex; align-items: baseline; gap: 12px; }
.toc-t { flex: 1; min-width: 0; }
.toc-p { flex: none; font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.toc-row.here { color: var(--accent); font-weight: 700; }
.toc-row.here .toc-p { color: var(--accent); }
/* Без панелей текст не должен уходить под системную полоску внизу
   (встроенные браузеры рисуют страницу до самого края экрана). */
body.reading-full .r-stage { padding-bottom: max(18px, env(safe-area-inset-bottom)); padding-top: max(6px, env(safe-area-inset-top)); }

/* dr-folders: плитки папок на полке */
.card.folder .folder-cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--accent); }
.card.folder .folder-cover::after { display: none; }
.card.folder .folder-ico svg { width: 56px; height: 56px; fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.card.folder .folder-n { font-size: 13px; font-weight: 700; opacity: .8; }
.folder-hint { grid-column: 1 / -1; }

/* ─── dr-audio: плеер аудиокниг и песен ─────────────────── */
.player { position: fixed; inset: 0; z-index: 16; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; }
.player[hidden] { display: none; }
.pl-top { border-bottom: 1px solid var(--line); }
.pl-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 16px; padding: 5px 10px; font-size: 13px; font-weight: 600; margin-left: 4px; white-space: nowrap; }
.pl-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pl-chip.on { border-color: var(--accent); color: var(--accent); background: var(--soft); }
.pl-body { flex: 1; min-height: 0; display: flex; }
.pl-main { flex: 1; min-width: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 22px 18px max(24px, env(safe-area-inset-bottom)); }
.pl-art { width: min(400px, 72vw, 46vh); aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); position: relative; flex: none; }
.pl-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-art .gen { border-radius: 0; }
.pl-art.video { width: min(960px, 100%, calc(64vh * 16 / 9)); aspect-ratio: 16 / 9; background: #000; } /* dr-audio2 */
.pl-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.pl-info { text-align: center; margin-top: 18px; max-width: 560px; }
.pl-info b { display: block; font-size: 20px; line-height: 1.3; }
.pl-info span { display: block; color: var(--dim); margin-top: 2px; }
.pl-part { color: var(--accent); font-size: 13.5px; margin-top: 6px; font-weight: 600; }
.pl-bar { width: min(640px, 100%); margin-top: 16px; }
.pl-seek { width: 100%; accent-color: var(--accent); }
.pl-times { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.pl-ctrl { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; }
.pl-ctrl .pl-big svg { width: 30px; height: 30px; }
.pl-ctrl .icon { width: 48px; height: 48px; }
.pl-gap { width: 48px; }
.pl-play { width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: var(--shadow); }
.pl-play svg { width: 30px; height: 30px; fill: currentColor; stroke: none; }
.pl-total { color: var(--dim); font-size: 13px; margin-top: 10px; min-height: 1em; }
.pl-chapters { width: min(560px, 100%); margin-top: 18px; border-top: 1px solid var(--line); max-height: 40vh; overflow: auto; }
.pl-ch-head { font-size: 12px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; padding: 12px 4px 6px; }
.pl-ch { display: flex; align-items: baseline; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--ink); text-align: left; padding: 9px 6px; border-radius: 8px; font-size: 14px; }
.pl-ch:hover { background: var(--hover); }
.pl-ch .n { color: var(--dim); min-width: 24px; font-variant-numeric: tabular-nums; }
.pl-ch .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-ch .d { color: var(--dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pl-ch.on { color: var(--accent); font-weight: 700; background: var(--soft); }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 4px 0 8px; }
.pl-lyrics { width: min(520px, 46%); border-left: 1px solid var(--line); overflow: auto; padding: 16px 22px 40px; background: var(--surface); }
.pl-lyrics[hidden] { display: none; }
.ly-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; position: sticky; top: -16px; background: var(--surface); padding: 6px 0 8px; z-index: 1; }
.ly-bar b { margin-right: auto; font-size: 16px; }
.ly-bar .select { width: auto; }
.ly-hint { margin: 2px 0 10px; font-size: 13px; }
.ly-line { margin: 0 0 8px; }
.ly-o { font-size: 17px; line-height: 1.45; }
.ly-t { color: var(--accent); font-size: 14.5px; line-height: 1.4; margin-top: 1px; }
.ly-gap { height: 14px; }
.ly-w { cursor: pointer; border-radius: 3px; }
.ly-w:hover { background: var(--soft); }
.ly-loose { margin-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 820px) {
  .pl-body { flex-direction: column; overflow: auto; }
  .pl-main { flex: none; overflow: visible; }
  .player.with-lyrics .pl-art:not(.video) { width: min(180px, 45vw); }
  .pl-lyrics { width: 100%; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .ly-bar { top: 0; }
}
.pl-mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 12;
  width: min(560px, calc(100% - 20px)); display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.pl-mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--ink); text-align: left; padding: 0; }
.pl-mini-art { width: 42px; height: 42px; border-radius: 8px; overflow: hidden; flex: none; position: relative; background: var(--bg); }
.pl-mini-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-mini-art .gen { padding: 4px; } .pl-mini-art .gen b, .pl-mini-art .gen small { display: none; }
.pl-mini-t { min-width: 0; display: flex; flex-direction: column; }
.pl-mini-t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-mini-t small { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.pl-mini-play svg { fill: currentColor !important; stroke: none !important; }
body.in-player { overflow: hidden; }

/* ─── dr-audio3: повтор, альбом, фильмы с субтитрами ─── */
.pl-lyrics { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pl-tabs { display: flex; gap: 2px; padding: 8px 14px 0; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; }
.pl-tab { border: 0; background: transparent; color: var(--dim); padding: 8px 12px; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.pl-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.pl-side-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 20px 40px; }
.pl-side-body .ly-bar { top: -12px; }
.pl-search { width: 100%; margin: 2px 0 8px; }
.pl-ch small { color: var(--dim); font-weight: 400; }
.pl-ch.on small { color: inherit; }
.cue { display: flex; gap: 10px; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
.cue:hover { background: var(--hover); }
.cue.on { background: var(--soft); }
.cue.on .ly-o { color: var(--accent); }
.cue-t { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 4px; min-width: 40px; }
.cue-x { flex: 1; min-width: 0; }
.cue .ly-o { font-size: 15.5px; line-height: 1.4; }
.cue .ly-t { font-size: 14px; }
.pl-subline { position: absolute; left: 5%; right: 5%; bottom: 7%; text-align: center; pointer-events: none; z-index: 2; }
.pl-subline.empty, .pl-subline[hidden] { display: none; }
.pl-subline .o, .pl-subline .t { display: block; width: fit-content; max-width: 100%; margin: 0 auto; background: rgba(0, 0, 0, .62); color: #fff;
  padding: 3px 10px; border-radius: 6px; font-size: clamp(14px, 2vw, 22px); line-height: 1.35; white-space: pre-wrap; }
.pl-subline .t { margin-top: 4px; color: #ffd98a; font-size: clamp(13px, 1.7vw, 19px); }
.pl-art:fullscreen { width: 100vw; height: 100vh; max-width: none; border-radius: 0; aspect-ratio: auto; }
.pl-art:fullscreen .pl-subline .o { font-size: clamp(18px, 2.6vw, 34px); }
.pl-art:fullscreen .pl-subline .t { font-size: clamp(16px, 2.2vw, 28px); }
@media (max-width: 820px) {
  .pl-lyrics { height: 62vh; flex: none; overflow: hidden; }
}

/* dr-audio4 */

/* dr-video ─ боковая панель: сворачивается в полоску значков, по наведению выезжает поверх */
.side { transition: width 0.24s cubic-bezier(.2,.8,.2,1), margin-right 0.24s cubic-bezier(.2,.8,.2,1), box-shadow 0.24s; overflow-x: hidden; }
.side-brand { position: relative; min-width: 0; }
.side-brand > div { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; }
.side-pin { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--dim); cursor: pointer; transition: transform 0.24s, background 0.15s; }
.side-pin svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.side-pin:hover { background: var(--hover); color: var(--ink); }
.side .nav, .side-user { overflow: hidden; }
.side .nav .cnt, .side-user .who { transition: opacity 0.18s; }
@media (max-width: 899px) { .side-pin { display: none; } }
@media (min-width: 900px) {
  body.side-mini .side { width: 64px; padding-left: 8px; padding-right: 8px; }
  body.side-mini .side-pin { transform: rotate(180deg); }
  body.side-mini .side:not(:hover) .side-cap { color: transparent; height: 0; padding: 0; margin: 9px 10px; border-top: 1px solid var(--line); }
  body.side-mini .side:not(:hover) .nav .cnt,
  body.side-mini .side:not(:hover) .side-user .who,
  body.side-mini .side:not(:hover) .side-brand > div,
  body.side-mini .side:not(:hover) .side-pin { opacity: 0; }
  body.side-mini .side:not(:hover) .side-user { padding: 8px 9px; border-color: transparent; background: transparent; }
  body.side-mini .side:hover:not(.side-shut) { width: 232px; margin-right: -168px; padding-left: 10px; padding-right: 10px; box-shadow: 8px 0 32px rgba(10, 14, 18, 0.18); transition-delay: 0.12s; }
  body.side-mini .side.side-shut .side-cap { color: transparent; height: 0; padding: 0; margin: 9px 10px; border-top: 1px solid var(--line); }
  body.side-mini .side.side-shut .nav .cnt, body.side-mini .side.side-shut .side-user .who, body.side-mini .side.side-shut .side-brand > div { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .side, .side-pin { transition: none; } }

/* dr-video ─ кнопки «Добавить папку» / «Добавить файлы» */
.add-folder { background: var(--surface); }
@media (max-width: 760px) { .add-folder span { display: none; } .add-folder { width: 38px; padding: 0; justify-content: center; } }

/* dr-video ─ переделка видео для браузера */
.pl-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; text-align: center;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 14px; z-index: 2; pointer-events: none; }
.pl-wait[hidden] { display: none; }
.pl-wait i { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: pl-spin 0.9s linear infinite; }
@keyframes pl-spin { to { transform: rotate(360deg); } }
.pl-conv { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin-top: 12px; font-size: 13px; color: var(--dim); max-width: 560px; text-align: center; }
.pl-conv[hidden] { display: none; }
.pl-conv-bar { flex: 1 0 100%; height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pl-conv-bar i { display: block; height: 100%; background: var(--accent); transition: width 0.4s; }
.pl-conv-note { font-size: 12.5px; }

/* dr-folders2: свои папки, выбор нескольких, перетаскивание */
.pick-btn { height: 40px; }
.folder-hint b { display: block; margin-bottom: 6px; }
@media (max-width: 760px) { .pick-btn span { display: none; } .pick-btn { width: 40px; padding: 0; justify-content: center; } }
.pick-mark { display: none; position: absolute; z-index: 3; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%;
  align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .35); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
body.picking .card[data-id] .pick-mark { display: flex; color: transparent; }
body.picking .card.picked .pick-mark { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
body.picking .card.picked .cover { outline: 3px solid var(--accent); outline-offset: 2px; }
body.picking .card[data-id] .card-act { display: none; }
.pick-bar { position: sticky; bottom: 12px; z-index: 20; margin: 18px auto 0; width: fit-content; max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pick-bar .pick-n { font-size: 14px; font-weight: 600; padding: 0 6px; }
.card.folder .card-act .more { opacity: 0; }
.card.folder:hover .card-act .more, .card.folder:focus-within .card-act .more { opacity: 1; }
@media (hover: none) { .card.folder .card-act .more { opacity: 1; } }
.drop-on { outline: 3px dashed var(--accent) !important; outline-offset: 3px; border-radius: 8px; }
.card.folder.drop-on .cover { transform: scale(1.04); }
body.drag-books .card.folder .cover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.crumb.new-folder { margin-left: auto; border: 1px solid var(--line); }
.fold-list { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow: auto; margin-bottom: 14px; }
.fold-pick { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 9px 12px; border-radius: 8px; font-size: 15px; cursor: pointer; }
.fold-pick:hover { background: var(--soft); }
.fold-pick.here { color: var(--dim); }
.fold-pick small { margin-left: auto; color: var(--dim); font-size: 12px; }
.fold-pick .fold-ico svg { width: 20px; height: 20px; fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; display: block; }

/* dr-dl1: скачать */
.dl-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.dl-part { justify-content: flex-start; text-align: left; white-space: normal; }

/* dr-pages1: панели поверх текста, область текста одна и та же с панелями и без */
#view-reader .reader-top { position: absolute; left: 0; right: 0; top: 0; }
#view-reader .reader-bottom { position: absolute; left: 0; right: 0; bottom: 0; }
#view-reader .r-stage, body.reading-full #view-reader .r-stage { padding-top: var(--r-top, 51px); padding-bottom: var(--r-bot, 51px); }
.r-mini { display: none; position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none;
  bottom: calc(var(--r-bot, 51px) / 2 - 8px); text-align: center; font-size: 12px; line-height: 16px;
  color: var(--dim); opacity: 0.85; font-variant-numeric: tabular-nums; }
body.reading-full .r-mini:not(:empty) { display: block; }
/* Боковое меню: пункты не сжимаются, а прокручиваются — «Войти» внизу виден целиком */
.side > * { flex-shrink: 0; }
.side { height: 100dvh; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

/* dr-del1: кружок выбора — в правом верхнем углу, не поверх длительности «♪ 2:41» */
.pick-mark { left: auto; right: 8px; }

/* dr-trwords */
.sel-pop { z-index: 26; }
.tr-pair .o { cursor: pointer; }
.tr-inline { position: relative; margin: 0 0 12px; padding: 12px 40px 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--page, var(--bg)); }
.tr-inline .tr-x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--dim); cursor: pointer; padding: 4px 8px; }
.tr-inline .tr-pair { padding: 6px 0; }
