/* Нови книги — in the house style of tazivecher.bg (in its own colours:
   six palettes below), Sofia Sans Extra Condensed set big for everything that
   names something (titles, days, authors), Sofia Sans for the rest, and
   the colour coming from the covers themselves. Dark is the default;
   light is cool paper with the same ink.

   Token names: --ink is the page, --ink-2 raised surfaces, --ink-3 rules;
   --paper is the text, --paper-dim secondary text; --gold the marker
   (fills), --gold-text the marker as text, --accent links and primary
   buttons. A book's page redefines them from its cover (body.tinted). */

@font-face { font-family: "Sofia Sans"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/sofiasans-cyrillic.woff2?v=1") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/sofiasans-latin.woff2?v=1") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF; }
@font-face { font-family: "Sofia Sans Extra Condensed"; font-style: normal; font-weight: 500 900; font-display: swap;
  src: url("fonts/sofiasans-xcond-cyrillic.woff2?v=1") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans Extra Condensed"; font-style: normal; font-weight: 500 900; font-display: swap;
  src: url("fonts/sofiasans-xcond-latin.woff2?v=1") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF; }

/* ---------- tokens ----------
   Six palettes × dark/light, chosen with the theme button (theme.js), in
   tazivecher.bg's order but for the house one first:
     penguin— "Пингвин": graphite and the orange of the old paperbacks
     night  — "Софийска нощ", tazivecher.bg's own: indigo night, yellow marker
     dracula— the Dracula colour theme (light: its "Alucard")
     mono-green, mono — one green / black and white only; the book page
              keeps them (no colours from the cover)
     crt    — an old monitor: amber, with scanlines over covers and page
   html[data-palette][data-theme]; the default is penguin, dark. --nav-a and
   --nav-b tint the two pill groups of the menu. */
:root,
[data-palette="penguin"][data-theme="dark"] {
  --ink: #151719; --ink-2: #1e2124; --ink-3: #33373c;
  --paper: #f2efe9; --paper-dim: #aeb0b3;
  --gold: #ff8a1f; --gold-text: #ff9f45; --gold-ink: #1a1005;
  --accent: #ffc58a; --on-accent: #151719; --fav: #ff7aa2;
  --nav-a: #ffc58a; --nav-b: #ff8a1f;
  --shadow: 0 14px 30px -20px rgb(0 0 0 / 0.75); --glow-strength: 0.55;
  color-scheme: dark;
}
[data-palette="penguin"][data-theme="light"] {
  --ink: #f6f5f2; --ink-2: #ffffff; --ink-3: #dcdad5;
  --paper: #1d1f22; --paper-dim: #55585d;
  --gold: #ff8a1f; --gold-text: #a84d00; --gold-ink: #1a1005;
  --accent: #b55200; --on-accent: #ffffff; --fav: #c92a5f;
  --nav-a: #55585d; --nav-b: #ff8a1f;
  --shadow: 0 14px 30px -20px rgb(29 31 34 / 0.45); --glow-strength: 0.35;
  color-scheme: light;
}
[data-palette="night"][data-theme="dark"] {
  --ink: #11121c; --ink-2: #1b1c2b; --ink-3: #2c2e43;
  --paper: #ececf4; --paper-dim: #a9abc3;
  --gold: #ffd447; --gold-text: #ffd447; --gold-ink: #181a2f;
  --accent: #a3a6ff; --on-accent: #11121c; --fav: #ff7aa2;
  --nav-a: #a3a6ff; --nav-b: #ffd447;
  --shadow: 0 14px 30px -20px rgb(0 0 0 / 0.75); --glow-strength: 0.55;
  color-scheme: dark;
}
[data-palette="night"][data-theme="light"] {
  --ink: #f3f4f7; --ink-2: #ffffff; --ink-3: #d8dae4;
  --paper: #181a2f; --paper-dim: #4a4d68;
  --gold: #ffd447; --gold-text: #3b3fc4; --gold-ink: #181a2f;
  --accent: #3b3fc4; --on-accent: #ffffff; --fav: #c92a5f;
  --nav-a: #4a4d68; --nav-b: #3b3fc4;
  --shadow: 0 14px 30px -20px rgb(24 26 47 / 0.4); --glow-strength: 0.35;
  color-scheme: light;
}
[data-palette="dracula"][data-theme="dark"] {
  --ink: #282a36; --ink-2: #303241; --ink-3: #44475a;
  --paper: #f8f8f2; --paper-dim: #a9afd2;
  --gold: #ff79c6; --gold-text: #ff92d0; --gold-ink: #282a36;
  --accent: #8be9fd; --on-accent: #282a36; --fav: #ff5555;
  --nav-a: #bd93f9; --nav-b: #ff79c6;
  --shadow: 0 14px 30px -20px rgb(0 0 0 / 0.75); --glow-strength: 0.55;
  color-scheme: dark;
}
[data-palette="dracula"][data-theme="light"] { /* Dracula's own light theme, "Alucard" */
  --ink: #fffbeb; --ink-2: #ffffff; --ink-3: #cfcfde;
  --paper: #1f1f1f; --paper-dim: #6c664b;
  --gold: #a3144d; --gold-text: #a3144d; --gold-ink: #ffffff;
  --accent: #644ac9; --on-accent: #ffffff; --fav: #cb3a2a;
  --nav-a: #644ac9; --nav-b: #a3144d;
  --shadow: 0 14px 30px -20px rgb(31 31 31 / 0.4); --glow-strength: 0.35;
  color-scheme: light;
}
[data-palette="mono-green"][data-theme="dark"] { /* one green, as on an old phosphor screen */
  --ink: #07110a; --ink-2: #0d1a10; --ink-3: #1d3523;
  --paper: #c9f7d3; --paper-dim: #6fb685;
  --gold: #4cff86; --gold-text: #4cff86; --gold-ink: #04140a;
  --accent: #9cffb8; --on-accent: #04140a; --fav: #4cff86;
  --nav-a: #4cff86; --nav-b: #4cff86;
  --shadow: 0 14px 30px -20px rgb(0 0 0 / 0.8); --glow-strength: 0.5;
  color-scheme: dark;
}
[data-palette="mono-green"][data-theme="light"] {
  --ink: #eefaf0; --ink-2: #ffffff; --ink-3: #bfe0c7;
  --paper: #0b3d1c; --paper-dim: #3f6e4d;
  --gold: #0f7a34; --gold-text: #0f7a34; --gold-ink: #ffffff;
  --accent: #0b5c27; --on-accent: #ffffff; --fav: #0f7a34;
  --nav-a: #0f7a34; --nav-b: #0f7a34;
  --shadow: 0 14px 30px -20px rgb(11 61 28 / 0.4); --glow-strength: 0.3;
  color-scheme: light;
}
[data-palette="crt"][data-theme="dark"] { /* an old colour monitor: amber phosphor, scanlines */
  --ink: #0c0a08; --ink-2: #16120d; --ink-3: #2c241a;
  --paper: #ffe7c2; --paper-dim: #b8976a;
  --gold: #ffb000; --gold-text: #ffb000; --gold-ink: #140c00;
  --accent: #ffcc55; --on-accent: #140c00; --fav: #ff6a3d;
  --nav-a: #ffb000; --nav-b: #ff6a3d;
  --shadow: 0 14px 30px -20px rgb(0 0 0 / 0.85); --glow-strength: 0.5;
  --scan: rgb(0 0 0 / 0.38); --scan-page: rgb(0 0 0 / 0.16);
  color-scheme: dark;
}
[data-palette="crt"][data-theme="light"] { /* the beige computer case */
  --ink: #ece4d4; --ink-2: #f7f2e7; --ink-3: #cfc3a9;
  --paper: #2b2116; --paper-dim: #6e5c43;
  --gold: #b35c00; --gold-text: #9a4f00; --gold-ink: #fff8ec;
  --accent: #8a3d00; --on-accent: #fff8ec; --fav: #c2410c;
  --nav-a: #b35c00; --nav-b: #c2410c;
  --shadow: 0 14px 30px -20px rgb(60 40 10 / 0.45); --glow-strength: 0.3;
  --scan: rgb(0 0 0 / 0.22); --scan-page: rgb(60 40 10 / 0.06);
  color-scheme: light;
}
[data-palette="mono"][data-theme="dark"] { /* black, white and greys only */
  --ink: #0a0a0a; --ink-2: #161616; --ink-3: #2e2e2e;
  --paper: #f5f5f5; --paper-dim: #a3a3a3;
  --gold: #ffffff; --gold-text: #ffffff; --gold-ink: #0a0a0a;
  --accent: #ffffff; --on-accent: #0a0a0a; --fav: #ffffff;
  --nav-a: #ffffff; --nav-b: #ffffff;
  --shadow: 0 14px 30px -20px rgb(0 0 0 / 0.8); --glow-strength: 0.4;
  color-scheme: dark;
}
[data-palette="mono"][data-theme="light"] {
  --ink: #ffffff; --ink-2: #f4f4f4; --ink-3: #d4d4d4;
  --paper: #0a0a0a; --paper-dim: #5c5c5c;
  --gold: #0a0a0a; --gold-text: #0a0a0a; --gold-ink: #ffffff;
  --accent: #0a0a0a; --on-accent: #ffffff; --fav: #0a0a0a;
  --nav-a: #0a0a0a; --nav-b: #0a0a0a;
  --shadow: 0 14px 30px -20px rgb(0 0 0 / 0.35); --glow-strength: 0.25;
  color-scheme: light;
}
:root {
  --display: "Sofia Sans Extra Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --text: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --read: "Literata", "Iowan Old Style", "Palatino Linotype", Georgia, serif; /* long reading only */
  --gutter: 16px;
  --max: 1180px;
  --r-card: 14px;
  --r-btn: 10px;
}
@media (min-width: 900px) { :root { --gutter: 24px; } }
@media (min-width: 1400px) { :root { --max: 1320px; } }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--ink);
  color: var(--paper);
  font: 17px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 0.8em; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 56px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -9999px; top: 12px; z-index: 100;
  background: var(--gold); color: var(--gold-ink); padding: 10px 16px; border-radius: var(--r-btn); font-weight: 700;
}
.skip:focus { left: 12px; }
.js .nojs { display: none; }

/* ---------- buttons, chips, tags ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--ink-3); border-radius: var(--r-btn);
  background: var(--ink-2); color: var(--paper);
  font: 650 16px/1.1 var(--text); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--paper-dim); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-accent { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-size: 17px; }
.btn-accent:hover { border-color: var(--gold); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: color-mix(in srgb, var(--paper) 30%, transparent); }
.btn-ghost:hover { border-color: var(--paper); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-google { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-google .g { width: 18px; height: 18px; }
.btn-danger { color: var(--gold-text); }
.btn-danger.is-armed { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }

.chips {
  display: flex; gap: 8px; margin: 0; padding: 2px; padding-right: 32px; list-style: none;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; height: 40px; padding: 0 15px; white-space: nowrap;
  border: 1px solid var(--ink-3); border-radius: 999px; background: var(--ink-2);
  color: var(--paper); font-weight: 650; font-size: 15px; text-decoration: none;
}
.chip:hover { border-color: var(--paper-dim); text-decoration: none; }
.chip[aria-current] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 750; line-height: 1.6; white-space: nowrap;
}
.tag-soon, .tag-new { background: var(--gold); color: var(--gold-ink); }
.tag-plain { border: 1px solid color-mix(in srgb, var(--paper) 30%, transparent); }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--ink) 90%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-3);
}
.top-in {
  max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 10px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--paper); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark .bm-1 { fill: var(--paper-dim); }
.brand-mark .bm-2 { fill: var(--gold); }
.brand-mark .bm-3 { fill: var(--paper); }
.brand-name { font: 900 27px/1 var(--display); letter-spacing: 0.002em; }
.brand-lang { font-weight: 500; color: var(--paper-dim); }
.nav { display: none; }
.top-icons { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ibtn {
  position: relative; width: 40px; height: 40px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--ink-3); background: var(--ink-2); color: var(--paper);
  text-decoration: none; cursor: pointer;
}
.ibtn:hover, .ibtn[aria-current] { border-color: var(--paper-dim); }
.ibtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ibtn .heart { width: 19px; height: 19px; }

.favs-link[aria-current] { color: var(--fav); }
.favs-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; padding: 1px 5px;
  border-radius: 999px; background: var(--gold); color: var(--gold-ink);
  font: 800 12px/1.3 var(--text); text-align: center;
}
.back svg { stroke-width: 2.4; }

@media (min-width: 900px) {
  .top-in { padding-block: 12px; gap: 14px; }
  /* The menu in two pill groups, centred; the active item underlined in gold. */
  .nav { display: flex; gap: 8px; flex: 1 1 auto; justify-content: center; min-width: 0; }
  .nav-g {
    display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px;
    background: color-mix(in srgb, var(--nav-a) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-a) 22%, transparent);
  }
  .nav-g2 { background: color-mix(in srgb, var(--nav-b) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nav-b) 22%, transparent); }
  .nav a {
    padding: 7px 11px; border-radius: 9px; white-space: nowrap;
    color: var(--paper-dim); font-weight: 650; font-size: 16px; text-decoration: none;
  }
  .nav a:hover { color: var(--paper); background: color-mix(in srgb, var(--paper) 7%, transparent); }
  .nav a[aria-current] { color: var(--paper); border-radius: 9px 9px 0 0; box-shadow: inset 0 -3px 0 var(--gold); }
  .top-icons { margin-left: 0; }
  .reload { display: none; }
}
@media (min-width: 900px) and (max-width: 1120px) { .brand-lang { display: none; } }
@media (max-width: 899px) {
  .top-icons .favs-link { display: none; } /* in the tab bar; the search stays up here */
  .brand-name { font-size: 25px; }
}
@media (max-width: 420px) { .brand-lang { display: none; } }
@media (max-width: 899px) and (display-mode: standalone) { .reload { display: grid; } }
@media (max-width: 899px) and (not (display-mode: standalone)) { .reload { display: none; } }
.reload.spin svg { animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the tab bar (phones) ---------- */
.tabbar { display: none; }
@media (max-width: 899px) {
  :root { --tabbar-h: 62px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--ink) 92%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--ink-3);
  }
  .tabbar a {
    position: relative; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 54px; border-radius: 12px; color: var(--paper-dim); text-decoration: none;
    font-size: 11.5px; font-weight: 750; line-height: 1.1; text-align: center;
  }
  .tabbar a span:not(.favs-count) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .icon, .tabbar .heart { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current] { color: var(--paper); }
  .tabbar a[aria-current] .icon, .tabbar a[aria-current] .heart { color: var(--gold-text); }
  .tabbar .favs-count { top: 4px; right: calc(50% - 22px); }
  .toast { bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); }
}

/* ---------- page heads ---------- */
.page-head { padding: 26px 0 6px; }
.page-head h1 { font: 900 clamp(48px, 8vw, 88px)/0.88 var(--display); letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: anywhere; }
.lead { max-width: 62ch; margin: 14px 0 0; font-size: 18px; line-height: 1.45; color: var(--paper-dim); }
.crumb { margin: 0 0 8px; font-size: 15px; font-weight: 650; color: var(--paper-dim); }
.crumb a { color: inherit; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.head-actions:empty { display: none; }

.home-h { font: 900 clamp(54px, 7vw, 92px)/0.88 var(--display); letter-spacing: -0.012em; }
.home-h .hh-1, .home-h .hh-2 { white-space: nowrap; }
.home-h .hh-2 { font-weight: 500; color: var(--paper-dim); }
.tally { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 26px; margin: 18px 0 0; }
.tally a { color: var(--paper-dim); text-decoration: none; font-size: 15px; font-weight: 600; line-height: 1.2; }
.tally b { display: block; font: 900 40px/0.95 var(--display); color: var(--paper); }
.tally a:hover b { color: var(--gold-text); }
.tally .tally-rss { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-self: center; margin-left: auto; }
.tally a.btn-rss { color: var(--gold-ink); font-size: 16px; }
.i-rss { width: 14px; height: 14px; fill: currentColor; }
@media (max-width: 599px) { .home-h .hh-2 { display: block; } }

/* ---------- search and filters ---------- */
.f-search { display: flex; gap: 8px; min-width: 0; margin: 20px 0 0; max-width: 100%; }
.f-search input, .searchbar input {
  flex: 1; width: 0; min-width: 0; height: 50px; padding: 0 16px;
  border: 1.5px solid var(--ink-3); border-radius: 12px; background: var(--ink-2); color: var(--paper);
  font: 17px var(--text);
}
.f-search input:focus-visible, .searchbar input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.f-search .btn, .searchbar .btn { min-height: 50px; padding: 0 20px; }
.searchbar {
  position: sticky; top: var(--header-h, 65px); z-index: 25;
  display: flex; gap: 8px; max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter) 12px;
  background: color-mix(in srgb, var(--ink) 94%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

.f-panel { display: grid; gap: 8px; margin: 14px 0 0; }
.f-group { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; }
.f-label { font: 800 19px/1 var(--display); color: var(--paper-dim); }
@media (min-width: 900px) {
  .f-panel { gap: 0; padding: 4px 20px; border: 1px solid var(--ink-3); border-radius: 16px; background: var(--ink-2); }
  .f-group { grid-template-columns: 96px minmax(0, 1fr); gap: 18px; padding: 10px 0; }
  .f-group + .f-group { border-top: 1px solid var(--ink-3); }
  .f-label { font-size: 21px; }
  .f-group .chips { flex-wrap: wrap; overflow: visible; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .f-panel .chip:not([aria-current]) { background: var(--ink); }
}

.summary-row { display: flex; align-items: center; gap: 12px; margin: 18px 0 0; }
.summary { flex: 1 1 auto; min-width: 0; margin: 0; color: var(--paper-dim); font-size: 15px; }
.summary b { color: var(--paper); }
.viewswitch {
  flex: none; display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--ink-3); border-radius: 999px; background: var(--ink-2);
}
.vs {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 13px; border: 0;
  border-radius: 999px; background: transparent; color: var(--paper-dim); font-weight: 650; font-size: 14.5px; cursor: pointer;
}
.vs:hover { color: var(--paper); }
.vs[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.vs .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 380px) { .vs span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

/* ---------- day (or month) groups ---------- */
.group { margin-top: 18px; }
.day-head {
  position: sticky; top: var(--header-h, 65px); z-index: 20;
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 calc(-1 * var(--gutter)); padding: 12px var(--gutter) 10px;
  background: color-mix(in srgb, var(--ink) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.day-rel {
  font: 900 36px/1 var(--display); padding: 0 2px;
  background: linear-gradient(transparent 86%, var(--gold) 86%);
}
[data-theme="light"] .day-rel { background: linear-gradient(transparent 58%, var(--gold) 58%, var(--gold) 92%, transparent 92%); }
.day-date { font-size: 17px; font-weight: 600; color: var(--paper-dim); }
.day-count { margin-left: auto; font-size: 13.5px; font-weight: 650; color: var(--paper-dim); white-space: nowrap; }
@media (min-width: 900px) { .day-rel { font-size: 46px; } }

/* ---------- cards: the grid of covers ---------- */
.grid {
  list-style: none; margin: 4px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px;
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card { position: relative; isolation: isolate; min-width: 0; display: flex; flex-direction: column; }
.card-book { display: flex; flex-direction: column; gap: 6px; color: var(--paper); text-decoration: none; border-radius: var(--r-card); }
.card-book:hover { text-decoration: none; }
.cover {
  position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; isolation: isolate;
  container-type: inline-size;
  border-radius: var(--r-card); background: var(--c, var(--ink-3));
  box-shadow: var(--shadow);
}
.card .cover { border-bottom: 4px solid var(--v, var(--gold)); border-radius: var(--r-card) var(--r-card) 6px 6px; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card-book:hover .cover img { transform: scale(1.035); }
/* Coverless: a typographic tile in a colour from the ISBN. */
.cover.is-bill {
  background: hsl(var(--h, 230) 30% 17%);
  background-image: radial-gradient(120% 70% at 50% 0%, hsl(var(--h, 230) 70% 60% / 0.28), transparent 70%);
}
[data-theme="light"] .cover.is-bill {
  background: hsl(var(--h, 230) 45% 90%);
  background-image: radial-gradient(120% 70% at 50% 0%, hsl(var(--h, 230) 70% 60% / 0.25), transparent 70%);
}
.nocover {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: 46px 11cqi 13cqi; color: hsl(var(--h, 230) 25% 93%);
}
[data-theme="light"] .nocover { color: hsl(var(--h, 230) 40% 14%); }
.bill-kind {
  font: 750 max(10px, 5cqi)/1.1 var(--text); letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.75;
  padding-bottom: 3cqi; border-bottom: 2px solid currentColor;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nocover .t {
  margin: auto 0; padding: 4cqi 0;
  font: 900 13.5cqi/0.92 var(--display); text-transform: uppercase; overflow-wrap: anywhere; hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
}
.nocover .a {
  font: 700 max(11px, 5.6cqi)/1.2 var(--text); opacity: 0.8;
  padding-top: 3cqi; border-top: 2px solid currentColor;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* The cover's marks. */
.badge {
  position: absolute; z-index: 3; left: 8px; top: 8px; padding: 5px 9px 4px; border-radius: 9px;
  background: var(--ink); color: var(--paper); font: 850 18px/1 var(--display);
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.35);
}
.badge-soon, .badge-new { background: var(--gold); color: var(--gold-ink); }
.price-chip {
  position: absolute; z-index: 3; left: 8px; bottom: 8px; padding: 3px 9px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font: 750 13.5px/1.5 var(--text); font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.35);
}
.card-pub {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; min-width: 0;
  font-size: 13px; font-weight: 750; color: var(--gold-text);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.card-pub-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* The binding tells two editions of a book apart. */
.card-fmt { flex: none; font-weight: 500; color: var(--paper-dim); }
.i-book { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.card h3 {
  font: 800 21px/1.04 var(--display); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-book:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }
.card .author {
  margin: 3px 0 0; font-size: 14px; line-height: 1.3; color: var(--paper-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .author a, .book .authors a, .book-head a:not(.btn), .facts a { color: inherit; text-decoration: none; }
.card .author a:hover, .book .authors a:hover, .facts a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.row-price { display: none; }
@media (min-width: 600px) { .card h3 { font-size: 23px; } .card .author { font-size: 14.5px; } }

/* The heart, top right of a cover. */
.fav {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--paper); transition: transform 150ms;
}
.fav:hover { transform: scale(1.08); }
.heart { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.fav[aria-pressed="true"], .save[aria-pressed="true"] { color: var(--fav); }
.fav[aria-pressed="true"] .heart, .save[aria-pressed="true"] .heart { fill: currentColor; }

/* ---------- the list view: compact rows (data-view="list") ---------- */
[data-view="list"] .books .grid { display: block; margin: 0; }
[data-view="list"] .books .card {
  display: grid; grid-template-columns: 62px minmax(0, 1fr) auto;
  column-gap: 14px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--ink-3);
}
[data-view="list"] .books .card-book { display: contents; }
[data-view="list"] .books .cover { grid-column: 1; grid-row: 1 / span 4; width: 62px; border-radius: 6px; border-bottom-width: 3px; box-shadow: none; }
[data-view="list"] .books .card-pub { grid-column: 2; grid-row: 1; margin: 0; font-size: 12.5px; }
[data-view="list"] .books .card h3 { grid-column: 2; grid-row: 2; font-size: 21px; -webkit-line-clamp: 2; margin-top: 2px; }
[data-view="list"] .books .card .author { grid-column: 2; grid-row: 3; margin-top: 2px; }
[data-view="list"] .books .row-price { display: block; grid-column: 3; grid-row: 1 / span 2; margin: 0; font: 800 20px/1 var(--display); color: var(--gold-text); white-space: nowrap; }
[data-view="list"] .books .price-chip, [data-view="list"] .books .nocover .bill-kind, [data-view="list"] .books .nocover .a { display: none; }
[data-view="list"] .books .badge { left: 3px; top: 3px; padding: 2px 4px; font-size: 11px; border-radius: 5px; }
[data-view="list"] .books .nocover { padding: 6px; }
[data-view="list"] .books .nocover .t { font-size: 15cqi; -webkit-line-clamp: 5; }
[data-view="list"] .books .fav { position: static; grid-column: 3; grid-row: 3; justify-self: end; width: 36px; height: 36px; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (min-width: 900px) {
  [data-view="list"] .books .card { grid-template-columns: 76px minmax(0, 1fr) auto; }
  [data-view="list"] .books .cover { width: 76px; }
  [data-view="list"] .books .card h3 { font-size: 25px; }
}

/* ---------- pager ---------- */
.pager {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  margin: 44px 0 0; padding-top: 22px; border-top: 1px solid var(--ink-3);
}
.pager a, .pager .pg-arrow, .pager .pg-of {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 16px; border-radius: var(--r-btn);
  border: 1.5px solid var(--ink-3); background: var(--ink-2); text-decoration: none; color: var(--paper);
  font: 800 20px/1 var(--display); font-variant-numeric: tabular-nums;
}
.pager a:hover { border-color: var(--paper-dim); }
.pager .pg-arrow { font: 650 16px/1 var(--text); }
.pager .pg-arrow.off { opacity: 0.35; }
.pager .pg-nums { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pager .pg-n { padding: 0 12px; }
.pager .pg-n[aria-current] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.pager .pg-gap { min-width: 20px; text-align: center; color: var(--paper-dim); }
.pager .pg-of { display: none; background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.pager .pg-arrow:first-child { margin-right: auto; }
.pager .pg-arrow:last-child { margin-left: auto; }
@media (max-width: 760px) {
  .pager { flex-wrap: nowrap; }
  .pager .pg-nums { display: none; }
  .pager .pg-of { display: inline-flex; }
}

.empty { margin: 28px 0; padding: 22px; border-radius: 16px; background: var(--ink-2); border: 1px solid var(--ink-3); color: var(--paper-dim); max-width: 760px; }
.empty p { margin: 0 0 10px; }
.empty p:first-child { font: 800 26px/1.1 var(--display); color: var(--paper); }
.empty p:last-child { margin-bottom: 0; }

/* ---------- a book: the page takes its colours from the cover ---------- */
html:not([data-palette^="mono"])[data-theme="dark"] body.tinted {
  --ink: var(--d-bg); --ink-2: color-mix(in srgb, var(--d-bg) 86%, #fff); --ink-3: color-mix(in srgb, var(--d-bg) 72%, #fff);
  --paper: var(--d-fg); --paper-dim: var(--d-muted); --accent: var(--d-accent); --on-accent: var(--d-bg); --halo: var(--d-halo);
}
html:not([data-palette^="mono"])[data-theme="light"] body.tinted {
  --ink: var(--l-bg); --ink-2: color-mix(in srgb, var(--l-bg) 70%, #fff); --ink-3: color-mix(in srgb, var(--l-bg) 86%, #000);
  --paper: var(--l-fg); --paper-dim: var(--l-muted); --accent: var(--l-accent); --on-accent: var(--l-bg); --halo: var(--l-halo);
}
.hero {
  position: relative; margin: 0 calc(-1 * var(--gutter)); padding: 24px var(--gutter) 34px;
  background: radial-gradient(70% 90% at 15% 10%, var(--halo, color-mix(in srgb, var(--c) 30%, transparent)), transparent 70%);
}
.hero-in { display: grid; gap: 22px; }
.book-cover .cover { width: min(64vw, 300px); border-radius: 12px; }
.book-cover .cover img { border-radius: inherit; }
.hero-title {
  font: 900 clamp(46px, 8.5vw, 96px)/0.9 var(--display); letter-spacing: -0.008em;
  text-wrap: balance; overflow-wrap: anywhere; margin: 0 0 10px;
}
.subtitle { font: italic 600 20px/1.3 var(--text); color: var(--paper-dim); margin: -2px 0 10px; }
.book .authors { font: 800 28px/1.1 var(--display); margin: 0 0 14px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { min-height: 46px; }
.actions .btn-accent { font-weight: 750; }
.i-share { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.star { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.follow[aria-pressed="true"] { color: var(--gold-text); border-color: var(--gold-text); }
.follow[aria-pressed="true"] .star { fill: currentColor; }
@media (min-width: 900px) {
  .hero { padding: 40px var(--gutter) 44px; }
  .hero-in { grid-template-columns: 300px minmax(0, 1fr); gap: 48px; align-items: start; }
  .book-cover .cover { width: 300px; }
}

.book-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px; padding: 30px 0 20px; }
.book-body > * { min-width: 0; }
@media (min-width: 900px) { .book-body { grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; } }
.desc { max-width: 66ch; font: 19px/1.65 var(--read); }
.desc p { margin: 0 0 1em; }
.desc p:first-child { font-size: 21px; line-height: 1.55; }
.desc-empty { color: var(--paper-dim); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 24px; margin: 28px 0 0; max-width: 760px; }
.facts dt { font-size: 14px; font-weight: 750; color: var(--paper-dim); }
.facts dd { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; }
.num { font-variant-numeric: tabular-nums; }
.seen { margin-top: 20px; color: var(--paper-dim); font-size: 14px; }

.side-box { padding: 18px; border-radius: 16px; background: var(--ink-2); border: 1px solid var(--ink-3); margin-bottom: 16px; }
.side-box h2 { font: 850 28px/1.02 var(--display); margin-bottom: 10px; }
.offers { list-style: none; margin: 0; padding: 0; }
.offers li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding: 10px 0; border-bottom: 1px solid var(--ink-3); }
.offers li:last-child { border-bottom: 0; }
.offers a { font-weight: 750; color: var(--paper); }
.offers .price { font: 850 22px/1 var(--display); color: var(--gold-text); text-align: right; font-variant-numeric: tabular-nums; }
.offers s { margin-right: 6px; font-size: 16px; color: var(--paper-dim); font-weight: 600; }
.offers .st { grid-column: 1 / -1; font-size: 13px; color: var(--paper-dim); }
.mini { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
.mini a { display: grid; gap: 6px; color: var(--paper); text-decoration: none; }
.mini .cover { border-radius: 8px; }
.mini .nocover { padding: 8px; }
.mini .nocover .t { font-size: 15cqi; }
.mini-t { font: 800 16px/1.05 var(--display); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini a:hover .mini-t { text-decoration: underline; }

/* ---------- index pages: authors, publishers ---------- */
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 22px; }
.letters a {
  min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--ink-3); background: var(--ink-2);
  font: 800 19px/1 var(--display); color: var(--paper); text-decoration: none;
}
.letters a:hover { border-color: var(--paper-dim); }
.letters a[aria-current] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.letters a:first-child { font: 750 15px/1 var(--text); }
.letters-gap { width: 12px; flex: none; }
@media (max-width: 760px) {
  .letters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .letters a { flex: none; }
}
.index { list-style: none; padding: 0; margin: 0; columns: 300px 4; column-gap: 32px; }
.index li { break-inside: avoid; display: flex; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--ink-3); }
.index a { min-width: 0; color: var(--paper); text-decoration: none; }
.index strong { font: 800 22px/1.05 var(--display); }
.index a:hover strong { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.index .n { margin-left: auto; font-size: 14px; color: var(--paper-dim); white-space: nowrap; }
.index .n b { color: var(--gold-text); font: 900 21px/1 var(--display); }
.index .total { font-size: 13.5px; color: var(--paper-dim); white-space: nowrap; }
.index .n:empty + .total { margin-left: auto; }

/* ---------- sources, feeds, plain pages ---------- */
.sources, .feeds { list-style: none; padding: 0; margin: 0; max-width: 900px; }
.sources li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: baseline;
  padding: 14px 0 14px 16px; border-bottom: 1px solid var(--ink-3); border-left: 4px solid var(--c);
}
.sources strong { font: 800 22px/1.1 var(--display); }
.sources a { color: var(--paper); text-decoration: none; }
.sources .kind, .sources .when { color: var(--paper-dim); font-size: 14px; }
.sources .n { grid-row: 1 / span 2; grid-column: 2; text-align: right; color: var(--paper-dim); font-size: 14px; }
.sources .n b { display: block; font: 900 28px/1 var(--display); color: var(--paper); }
.sources em { color: var(--gold-text); font-style: normal; }
.feeds li { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--ink-3); }
.feeds li span { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.feeds strong { font: 850 24px/1.05 var(--display); }
.feeds small { color: var(--paper-dim); font-size: 14px; }
.sub-h { font: 850 34px/1 var(--display); margin: 40px 0 8px; }
.feeds-note { color: var(--paper-dim); max-width: 64ch; margin: 0 0 4px; }
.prose { max-width: 66ch; font: 18px/1.65 var(--text); padding: 12px 0 24px; }
.prose h2 { font: 850 32px/1.05 var(--display); margin: 30px 0 10px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 6px; }
.notfound { padding-bottom: 48px; }
.notfound .code { font: 900 clamp(96px, 20vw, 180px)/0.85 var(--display); color: var(--gold-text); margin: 0 0 8px; }
.notfound .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* ---------- "Любими" ---------- */
.me-tabs {
  display: flex; gap: 2px; margin: 18px 0 22px; padding: 3px; border-radius: 999px;
  background: var(--ink-2); border: 1px solid var(--ink-3); width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
}
.me-tabs a { padding: 10px 18px; border-radius: 999px; white-space: nowrap; font-weight: 700; font-size: 15px; text-decoration: none; color: var(--paper-dim); }
.me-tabs a:hover { color: var(--paper); }
.me-tabs a[aria-current] { background: var(--paper); color: var(--ink); }
@media (max-width: 480px) { .me-tabs a { padding: 9px 12px; font-size: 14px; } }
.me[aria-busy="true"], .saved[aria-busy="true"] { opacity: 0.55; }
.me-follow { margin: 0 0 8px; display: grid; gap: 16px; }
.me-lists { display: grid; gap: 18px 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.me-h { font: 850 30px/1 var(--display); margin: 0 0 6px; }
.me-h small { font: 650 16px var(--text); color: var(--paper-dim); margin-left: 6px; }
.me-chips { list-style: none; margin: 0; padding: 0; columns: 220px 2; column-gap: 28px; }
.me-chips li { break-inside: avoid; display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--ink-3); transition: opacity 150ms; }
.me-chips li a { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 800 20px/1.1 var(--display); color: var(--paper); text-decoration: none; }
.me-chips a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.me-chips b { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--gold); color: var(--gold-ink); font: 900 15px/1 var(--display); }
.unfollow { width: 28px; height: 28px; border: 0; border-radius: 50%; cursor: pointer; background: transparent; color: var(--paper-dim); font-size: 1.15rem; line-height: 1; transition: transform 150ms, color 150ms; }
.unfollow:hover { color: var(--paper); background: var(--ink-3); }
.me-chips li:has(.unfollow[aria-pressed="false"]) { opacity: 0.45; }
.unfollow[aria-pressed="false"] { transform: rotate(45deg); }
.me-only { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 0; }
.me-only a { display: inline-flex; align-items: center; height: 40px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--ink-3); background: var(--ink-2); text-decoration: none; font-weight: 650; font-size: 15px; color: var(--paper); }
.me-only a[aria-current] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.empty-saved { max-width: 60ch; padding: 20px 0; color: var(--paper-dim); }
.empty-saved .big { font: 850 30px/1.05 var(--display); color: var(--paper); }
.empty-saved .heart, .empty-saved .star { width: 17px; height: 17px; vertical-align: -3px; color: var(--fav); }
.saved-gone { color: var(--paper-dim); font-size: 14px; margin-top: 28px; }
.acct { max-width: 760px; margin: 0 0 18px; padding: 18px 20px; border-radius: 14px; background: var(--ink-2); border: 1px solid var(--ink-3); }
.acct p { margin: 0 0 12px; font-size: 15px; color: var(--paper-dim); }
.acct strong { color: var(--paper); }
.acct-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.save { cursor: pointer; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; visibility: hidden;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--paper); color: var(--ink); font-weight: 700; font-size: 15px;
  box-shadow: var(--shadow);
  transition: opacity 0.18s, transform 0.18s, visibility 0s 0.18s;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: opacity 0.18s, transform 0.18s; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--ink-3); margin-top: 24px; }
.foot-in { max-width: var(--max); margin: 0 auto; padding: 26px var(--gutter) 34px; color: var(--paper-dim); font-size: 15px; }
.foot-in p { max-width: 70ch; }
.foot-brand { font: 900 30px/1 var(--display); color: var(--paper); }
.foot-brand span { font-weight: 500; color: var(--paper-dim); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-weight: 650; }
.foot-charts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.foot-charts span { flex-basis: 100%; }
.foot a { color: var(--paper); }

/* ---------- covers in motion (cover.js) ---------- */
@view-transition { navigation: auto; }
.book-cover .cover img, .book-cover .cover .nocover { view-transition-name: cover; }
::view-transition-group(cover) { animation-duration: 420ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); z-index: 2; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 260ms; }
.zoomable img { cursor: zoom-in; }
dialog.zoom {
  padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100vh; display: none; place-items: center; cursor: zoom-out;
}
dialog.zoom[open] { display: grid; }
dialog.zoom::backdrop { background: rgb(10 9 22 / 0.92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.zoom img { height: 92vh; width: auto; max-width: 94vw; object-fit: contain; border-radius: 8px; box-shadow: 0 30px 80px -20px rgb(0 0 0 / .8); }

/* ---------- pull to refresh (refresh.js) ---------- */
.ptr {
  position: fixed; left: 50%; top: calc(var(--header-h, 65px) + 8px); z-index: 35;
  width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
  transform: translateY(calc(var(--pull, 0) * 1px - 60px)) rotate(calc(var(--pull, 0) * 3deg));
  opacity: calc(var(--pull, 0) / 80); pointer-events: none;
}
.ptr svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ptr.ready { background: var(--gold); color: var(--gold-ink); }
.ptr.go svg { animation: spin 700ms linear infinite; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .toast, .toast.is-on, .fav, .cover img { transition: none; }
  .card-book:hover .cover img { transform: none; }
}
@media (max-width: 380px) { .tabbar a { font-size: 10.5px; } }

/* ---- the analytics consent banner (analytics.js) ---- */
.consent {
  position: fixed; z-index: 60; left: 12px; right: 12px; bottom: 12px; max-width: 560px;
  padding: 16px 18px; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 18px 40px -16px rgb(0 0 0 / 0.55);
}
.consent[hidden] { display: none; }
.consent p { margin: 0 0 12px; font-size: 0.95rem; line-height: 1.45; }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.consent .btn:not(.btn-primary) { background: transparent; color: var(--ink); border-color: color-mix(in srgb, var(--ink) 35%, transparent); }
.consent .btn-primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
@media (max-width: 760px) {
  .consent { bottom: calc(var(--tabbar-h, 0px) + env(safe-area-inset-bottom) + 10px); }
}
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- the RSS control (templates/rss.html, rss.js) ---------- */
/* One look everywhere: a gold pill with the RSS mark; it opens the sheet
   (or, without JavaScript, the feed itself). */
.btn-rss { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 750; }
.btn-rss:hover { border-color: var(--gold); filter: brightness(1.06); text-decoration: none; }
.btn-rss .i-rss { width: 15px; height: 15px; }
.btn-rss.is-done { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.i-copy { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* The address, a copy button and a link to it: in place (/feeds, "Любими")
   and in the sheet. */
.rss-box { display: grid; gap: 10px; max-width: 760px; }
.rss-url {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 10px;
  background: var(--ink); border: 1px solid var(--ink-3); color: var(--gold-text);
  font: 600 15px/1 var(--text); text-overflow: ellipsis;
}
.rss-url:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.rss-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.rss-acts .btn { min-height: 44px; }
html:not(.js) [data-rss-copy] { display: none; }
.feeds .rss-box { margin-top: 4px; }

/* The sheet: centred on wide screens, a bottom sheet on phones. */
dialog.rss-sheet {
  width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--ink-3); border-radius: 18px;
  background: var(--ink-2); color: var(--paper); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6);
}
dialog.rss-sheet::backdrop { background: rgb(8 8 16 / 0.6); backdrop-filter: blur(3px); }
.rss-sheet-in { position: relative; padding: 22px 22px 18px; display: grid; gap: 12px; }
.rss-sheet h2 { margin: 0; padding-right: 40px; font: 900 32px/1 var(--display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.rss-kicker { margin: 0; color: var(--gold-text); font-size: 13px; font-weight: 750; letter-spacing: 0.04em; }
.rss-help { margin: 2px 0 0; color: var(--paper-dim); font-size: 14px; }
.rss-help a { color: var(--paper); }
.rss-x {
  position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--ink-3); background: transparent; color: var(--paper); font-size: 22px; line-height: 1; cursor: pointer;
}
.rss-x:hover { border-color: var(--paper-dim); }
@media (max-width: 640px) {
  dialog.rss-sheet {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .rss-acts .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.rss-sheet[open] { animation: rss-in 180ms ease-out; }
  @keyframes rss-in { from { opacity: 0; transform: translateY(16px); } }
}

/* ---- the RSS button sits on the right, everywhere ---- */
.head-actions .btn-rss { margin-left: auto; }
.rss-right { display: flex; justify-content: flex-end; }
.rss-right[hidden] { display: none; }
.me-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 14px 0 6px; }
.me-bar .rss-right { margin-left: auto; }
.me-bar:empty { display: none; }

/* ---- the colours sheet (theme.js) ---- */
.theme .pal-ico { fill: none; stroke: currentColor; stroke-width: 1.7; }
.theme .pal-ico circle { fill: currentColor; stroke: none; }
.pals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pal { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--ink-3); }
.pal-name { display: grid; }
.pal-name b { font: 800 22px/1.1 var(--display); }
.pal-name small { color: var(--paper-dim); font-size: 14px; }
.pal-modes { display: flex; gap: 8px; }
.pal-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-btn);
  border: 1px solid var(--ink-3); background: transparent; color: var(--paper); font: 650 15px var(--text); cursor: pointer;
}
.pal-btn:hover { border-color: var(--paper-dim); }
.pal-btn[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
/* A palette's swatch carries data-palette and data-theme itself (theme.js),
   so the tokens above apply to it: its page colour and its marker. */
.sw { --sw-mark: var(--gold); width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--ink) 50%, var(--sw-mark) 50%); }
.sw[data-theme="light"], .sw[data-palette="mono"] { box-shadow: inset 0 0 0 1px var(--ink-3); }
.sw[data-palette="dracula"][data-theme="light"] { --sw-mark: var(--accent); }
.sw[data-palette="crt"] { background: repeating-linear-gradient(0deg, rgb(0 0 0 / .45) 0 1px, transparent 1px 3px), linear-gradient(135deg, var(--ink) 50%, var(--sw-mark) 50%); }
.sw[data-palette="crt"][data-theme="light"] { background: repeating-linear-gradient(0deg, rgb(0 0 0 / .2) 0 1px, transparent 1px 3px), linear-gradient(135deg, var(--ink) 50%, var(--sw-mark) 50%); }

/* ---- monochrome palettes keep to their one colour: no glow from the
   cover behind a book, no cover-coloured bars and tiles ---- */
[data-palette^="mono"] .hero { background: none; }
[data-palette^="mono"] .card, [data-palette^="mono"] .cover, [data-palette^="mono"] .sources li { --c: var(--gold); }

/* ---- crt: the dark rows of a cathode-ray screen over every cover, fainter
   over the whole page, and glowing phosphor type ---- */
[data-palette="crt"] .cover::after, [data-palette="crt"] dialog.zoom::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
  background:
    repeating-linear-gradient(0deg, var(--scan) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 50%, transparent 60%, rgb(0 0 0 / 0.35));
}
[data-palette="crt"] .cover img { filter: saturate(1.25) contrast(1.08); }
[data-palette="crt"] body::after {
  content: ""; position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  background: repeating-linear-gradient(0deg, var(--scan-page) 0 1px, transparent 1px 3px);
}
[data-palette="crt"][data-theme="dark"] h1, [data-palette="crt"][data-theme="dark"] h2 {
  text-shadow: 0 0 6px rgb(255 176 0 / 0.45), 1px 0 0 rgb(255 60 60 / 0.25), -1px 0 0 rgb(60 200 255 / 0.2);
}
[data-palette="crt"] .hero { background: none; }

/* ---------- genres (internal/genres, templates/genres.html) ----------
   An icon each, and a colour in the colourful palettes. The black-and-white
   and the one-colour palettes keep their own ink: --g-* is defined only for
   penguin and dracula, and an undefined one falls back to the text colour. */
[data-palette="penguin"], [data-palette="night"], [data-palette="dracula"] {
  --g-fiction: #f5c26b; --g-crime: #ff8a7a; --g-scifi: #67e8f9; --g-fantasy: #7cb6ff; --g-romance: #ff9ec7;
  --g-erotica: #ff5c8a; --g-classics: #d9bf8c; --g-poetry: #f0abfc; --g-children: #8fe39a;
  --g-teen: #7dd3fc; --g-comics: #ffd84d; --g-history: #f4a261; --g-biography: #c4b5fd;
  --g-psychology: #bef264; --g-science: #5eead4; --g-society: #a8b4c8; --g-philosophy: #a5b4fc;
  --g-religion: #e9d5ff; --g-business: #6ee7b7; --g-cooking: #fdba74; --g-health: #86efac; --g-hobby: #e2c799; --g-home: #f4b8a0; --g-art: #f9a8d4;
  --g-education: #93c5fd;
}
[data-palette="penguin"][data-theme="light"], [data-palette="night"][data-theme="light"], [data-palette="dracula"][data-theme="light"] {
  --g-fiction: #8a5a00; --g-crime: #b42318; --g-scifi: #0e7490; --g-fantasy: #1f5fb3; --g-romance: #b0306a;
  --g-erotica: #c0134f; --g-classics: #7a5c1e; --g-poetry: #8e2c9e; --g-children: #1f7a32;
  --g-teen: #0b6e99; --g-comics: #7a5e00; --g-history: #a04a00; --g-biography: #5b3fb0;
  --g-psychology: #4d7c0f; --g-science: #0f766e; --g-society: #475569; --g-philosophy: #4338ca;
  --g-religion: #7e22ce; --g-business: #047857; --g-cooking: #b45309; --g-health: #15803d; --g-hobby: #6b5a3e; --g-home: #9a4b2e; --g-art: #a3166b;
  --g-education: #1d4ed8;
}
.g-fiction { --g: var(--g-fiction); } .g-crime { --g: var(--g-crime); } .g-scifi { --g: var(--g-scifi); } .g-fantasy { --g: var(--g-fantasy); }
.g-romance { --g: var(--g-romance); } .g-erotica { --g: var(--g-erotica); } .g-classics { --g: var(--g-classics); }
.g-poetry { --g: var(--g-poetry); } .g-children { --g: var(--g-children); } .g-teen { --g: var(--g-teen); }
.g-comics { --g: var(--g-comics); } .g-history { --g: var(--g-history); } .g-biography { --g: var(--g-biography); }
.g-psychology { --g: var(--g-psychology); } .g-science { --g: var(--g-science); } .g-society { --g: var(--g-society); }
.g-philosophy { --g: var(--g-philosophy); } .g-religion { --g: var(--g-religion); } .g-business { --g: var(--g-business); }
.g-cooking { --g: var(--g-cooking); } .g-health { --g: var(--g-health); } .g-hobby { --g: var(--g-hobby); } .g-home { --g: var(--g-home); } .g-art { --g: var(--g-art); } .g-education { --g: var(--g-education); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.gi { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gl { display: inline-flex; align-items: center; gap: 5px; color: var(--g, var(--paper)); font-weight: 750; white-space: nowrap; }
.gl .gi { position: relative; top: -0.05em; }

/* On a card: the first genre over the publisher. */
.card-genre { display: flex; margin-top: 8px; min-width: 0; font-size: 13px; line-height: 1.2; }
.card-genre + .card-pub { margin-top: 0; }
.card-genre .gl { overflow: hidden; text-overflow: ellipsis; }
[data-view="list"] .books .card-genre { grid-column: 2; grid-row: 1; margin: 0 0 2px; font-size: 12.5px; }
[data-view="list"] .books .card-genre + .card-pub { grid-row: 2; }
[data-view="list"] .books .card-genre ~ h3 { grid-row: 3; }
[data-view="list"] .books .card:has(.card-genre) .author { grid-row: 4; }

/* In the filter: the icon in the genre's colour (on the chosen chip, the chip's ink). */
.chip-g { gap: 7px; }
.chip-g .gi { color: var(--g, var(--paper-dim)); width: 17px; height: 17px; }
.chip-g[aria-current] .gi { color: currentColor; }

/* On the book page: each genre a link to its page. */
.facts .genres { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.facts .genres a:hover .gl { text-decoration: underline; }
[data-view="list"] .books .card:has(.card-genre) .cover { grid-row: 1 / span 5; }

/* Following genres: every genre a toggle chip (Любими → Жанрове). */
.chips-wrap { flex-wrap: wrap; overflow: visible; padding-right: 2px; -webkit-mask-image: none; mask-image: none; margin: 14px 0 18px; }
.chip-follow { cursor: pointer; font: inherit; font-weight: 650; font-size: 15px; }
.chip-follow[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.chip-follow[aria-pressed="true"] .gi { color: currentColor; }
.me-more { margin: 4px 0 18px; }
.me-more summary { cursor: pointer; color: var(--paper-dim); font-weight: 700; }
.me-chips .gl { font-size: inherit; }
.tag-genre { display: inline-flex; align-items: center; gap: 5px; border: 1px solid color-mix(in srgb, var(--g, var(--paper)) 45%, transparent); color: var(--g, var(--paper)); text-decoration: none; }
.tag-genre:hover { border-color: var(--g, var(--paper)); text-decoration: none; }
.facts .genres { flex-direction: column; align-items: flex-start; min-width: 0; }
.facts .genres .gl { white-space: normal; align-items: flex-start; }
.facts .genres .gl .gi { top: 0.15em; }
.side-box .used { margin: 0; }

/* The genre row, where chips wrap: "Всички" and the first ten genres, the
   chosen one, and "Още жанрове" (list.js) for the rest. */
.chip-more { display: none; }
@media (min-width: 900px) {
  .js .chips-genre:not(.is-open) > li:nth-child(n+12):not(.chip-more):not(:has([aria-current])) { display: none; }
  .js .chips-genre:not(.is-open) > .chip-more { display: list-item; }
  .chip-more .chip { cursor: pointer; font: inherit; font-weight: 650; font-size: 15px; color: var(--paper-dim); border-style: dashed; }
}

/* The book page: "Купи" leads; Любими and Сподели are icons; "Следвай"
   sits small beside the author's and the publisher's name. */
.btn-icon { width: 46px; padding: 0; justify-content: center; }
.btn-icon svg { width: 20px; height: 20px; }
.follow-mini {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 9px; vertical-align: 0.15em;
  border: 1px solid var(--ink-3); border-radius: 999px; background: transparent; color: var(--paper-dim);
  font: 700 12.5px/1.5 var(--text); cursor: pointer;
}
.follow-mini[hidden] { display: none; }
.follow-mini:hover { color: var(--paper); border-color: var(--paper-dim); }
.follow-mini .star { width: 13px; height: 13px; }
.side-more { margin: 10px 0 0; font-weight: 700; font-size: 14.5px; }
.foot-sites { color: var(--paper-dim); }
.pal-auto { display: flex; align-items: center; gap: 10px; padding: 14px 0 4px; font-weight: 600; cursor: pointer; }
.pal-auto input { width: 20px; height: 20px; accent-color: var(--gold); }
