/* =====================================================================
   Bookshelf styles (public site + dashboard)
   Spacing scale: 8px steps (--s1 = 8px ... ). Radius: 6px.
   ===================================================================== */

/* ---------- colour tokens ---------- */
:root {
  --page: #f6f4ef;
  --surface: #ffffff;
  --ink: #1f2328;
  --muted: #6a6f76;
  --line: #e3dfd6;
  --accent: #1d5c5c;
  --on-accent: #ffffff;
  --owned: #2f7a43;
  --buy: #9a5b00;
  --st-reading: #1f5fae; --st-read: #6b46b8; --st-want: #a8325e; --cp-hardcopy: #8a5326; --cp-ebook: #0b6e86;
  --danger: #a4262c;
  --r: 6px;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #14181b; --surface: #1d2226; --ink: #e8e6e1; --muted: #9aa1a8; --line: #2f363b;
    --accent: #5fb3b3; --on-accent: #0e1a1a; --owned: #6fcf8a; --buy: #f0b04a; --danger: #ff8a8f; --st-reading: #7fb0ff; --st-read: #c4a8ff; --st-want: #ff9fc0; --cp-hardcopy: #e6b27a; --cp-ebook: #6fd0e6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #14181b; --surface: #1d2226; --ink: #e8e6e1; --muted: #9aa1a8; --line: #2f363b;
  --accent: #5fb3b3; --on-accent: #0e1a1a; --owned: #6fcf8a; --buy: #f0b04a; --danger: #ff8a8f; --st-reading: #7fb0ff; --st-read: #c4a8ff; --st-want: #ff9fc0; --cp-hardcopy: #e6b27a; --cp-ebook: #6fd0e6;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 16px/1.6 'Literata', Georgia, 'Times New Roman', serif;
}
/* Bengali text: the page adds class "bn" whenever a book's language is Bengali */
.bn { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
h1 { font-size: 28px; line-height: 1.25; margin: 0 0 var(--s1); }
h2 { font-size: 20px; line-height: 1.3; margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: var(--s1) var(--s2); z-index: 20; }
.skip:focus { left: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: var(--s3) var(--s2) var(--s6); }
.lede { color: var(--muted); margin: 0 0 var(--s3); }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1100px; margin: 0 auto; padding: var(--s1) var(--s2); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.brand { display: inline-flex; align-items: center; color: var(--accent); text-decoration: none; padding: 2px; margin-right: var(--s1); }
.brand svg { width: 32px; height: 32px; }
.links { display: flex; gap: var(--s2); }
.links a { color: var(--ink); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; font-family: 'Literata', Georgia, 'Times New Roman', serif; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.links a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.search-wrap { display: flex; align-items: center; margin-left: auto; border: 1px solid transparent; border-radius: 999px; transition: border-color .2s, background-color .2s; }
.search-wrap.open { border-color: var(--line); background: var(--page); }
.search-wrap.open:focus-within { border-color: var(--accent); }
.icon-btn { width: 40px; height: 36px; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 999px; display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
/* light / dark toggle: sun while the site is light, moon while it is dark (pure CSS, follows the system setting too) */
.theme-btn svg { width: 20px; height: 20px; display: block; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}
.btn.theme-btn { display: inline-grid; place-items: center; padding: 8px 10px; }
/* round avatar button, last item on the right of the navbar */
.avatar-btn { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid transparent; background: transparent; color: var(--ink); text-decoration: none; transition: border-color .15s, color .15s; }
.avatar-btn svg { width: 22px; height: 22px; }
.avatar-btn:hover { border-color: var(--accent); color: var(--accent); }
/* the owner, signed in on this device, gets a clear way into the dashboard */
.avatar-btn.owner { width: auto; padding: 0 14px 0 11px; gap: 7px; grid-auto-flow: column; border-radius: 999px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font: 600 14px var(--ui); }
.avatar-btn.owner svg { width: 18px; height: 18px; }
.avatar-btn.owner:hover { color: var(--on-accent); background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
@media (max-width: 600px) { .avatar-btn.owner { width: 40px; padding: 0; } .avatar-btn.owner span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
@media (prefers-reduced-motion: reduce) { .avatar-btn { transition: none; } }
.btn svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.search {
  width: 0; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink); font: 15px var(--ui);
  outline: none; opacity: 0; visibility: hidden;
  transition: width .3s ease, padding .3s ease, opacity .2s ease, visibility 0s .3s;
}
.search-wrap.open .search { width: min(280px, 40vw); padding: 8px 14px 8px 0; opacity: 1; visibility: visible; transition-delay: 0s; }
@media (max-width: 560px) {
  .top.searching .links { display: none; }
  .top.searching .search-wrap { flex: 1; }
  .search-wrap.open .search { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .search, .search-wrap { transition: none; } }

/* ---------- buttons, chips, badges ---------- */
.btn {
  display: inline-block; font: 600 14px/1 var(--ui); padding: 10px 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.block { display: block; text-align: center; }
.btn:disabled { opacity: .6; cursor: default; }

.filters { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin: var(--s2) 0 var(--s3); }
.chipgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cg-l { font: 13px var(--ui); color: var(--muted); margin-right: 2px; }
.chip { font: 14px var(--ui); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font: 600 12.5px/1 var(--ui); padding: 7px 14px 7px 11px; border-radius: 999px;
  border: 1.5px solid currentColor; background: color-mix(in srgb, currentColor 8%, transparent);
}
.badge svg { width: 15px; height: 15px; flex: none; }
.badge.owned { color: var(--owned); }
.badge.buy { color: var(--buy); }
/* reading status: same pill, its own colour and icon */
.badge.st-reading { color: var(--st-reading); }
.badge.st-read { color: var(--st-read); }
.badge.st-want { color: var(--st-want); }
/* which copies I have */
.badge.cp-hardcopy { color: var(--cp-hardcopy); }
.badge.cp-ebook { color: var(--cp-ebook); }
.cstat { margin: 10px 0 0; }
.cstat + .ct { margin-top: 8px; }
.dtags { display: flex; flex-wrap: wrap; gap: var(--s1); margin: 0 0 var(--s2); }

/* ---------- covers and cards: cover, then title, then author ---------- */
.cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--r); overflow: hidden;
  background: var(--line); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.cover img, .nocover { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover::after { /* subtle spine shadow on the left edge */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.30) 0, rgba(0,0,0,0) 5%, rgba(255,255,255,.14) 6%, rgba(0,0,0,0) 9%);
}
.nocover { display: grid; place-items: center; color: var(--muted); font: 14px var(--ui); }

/* A cover drawn from the title and author, for titles with no picture. Sizes use "cqw" (a share of the
   cover's own width), so the same cover works on a small card, the book page and the home carousel. */
.cover, .cf-card { container-type: inline-size; }
.gencover {
  position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between;
  padding: 11cqw 9cqw 10cqw 13cqw; text-align: left; color: #f6efdf; pointer-events: none;
  background: linear-gradient(165deg, hsl(var(--h) 32% 29%), hsl(var(--h) 38% 21%));
}
.gencover[data-s="1"] { background: linear-gradient(165deg, hsl(var(--h) 26% 26%), hsl(var(--h) 34% 17%)); }
.gencover[data-s="2"] { background: linear-gradient(165deg, hsl(var(--h) 36% 31%), hsl(var(--h) 40% 23%)); }
.gencover::before { /* thin printed frame */
  content: ""; position: absolute; inset: 4.5cqw 4.5cqw 4.5cqw 8cqw; border: 1px solid rgb(255 255 255 / .3); border-radius: 2px;
}
.gc-t, .gc-a { position: relative; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.gc-t { font-size: max(13px, 10.5cqw); font-weight: 600; line-height: 1.22; -webkit-line-clamp: 5; }
.gc-t.bn { line-height: 1.4; -webkit-line-clamp: 4; }
.gc-a { font-size: max(10px, 6.4cqw); line-height: 1.3; opacity: .92; -webkit-line-clamp: 2; }
.gencover.wide { padding: 6cqw 7cqw; }
.gencover.wide::before { inset: 2.5cqw; }
.gencover.wide .gc-t { font-size: max(13px, 6.4cqw); -webkit-line-clamp: 3; }
.gencover.wide .gc-a { font-size: max(10px, 4.2cqw); -webkit-line-clamp: 1; }

/* "Show more" under a grid that has more titles to draw (the next batch also loads as you scroll) */
.more { display: flex; justify-content: center; padding: var(--s4) 0 var(--s2); }
.more .btn small { font: 13px var(--ui); opacity: .7; margin-left: 6px; }
.sec-jump { margin-left: auto; font: 14px var(--ui); text-decoration: none; }
.sec-jump:hover { text-decoration: underline; }

/* Shown under the top bar while the saved copy of the shelf is on screen */
.offline-note { margin: 0; padding: 6px var(--s2); text-align: center; font: 13px var(--ui); color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line); }
.hp {
  position: absolute; top: 6px; right: 6px; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .7); color: #fff;
}
.hp svg { width: 16px; height: 16px; }

.card { display: block; color: inherit; text-decoration: none; }
.ct { text-wrap: balance; margin: var(--s1) 0 2px; font-size: 17px; line-height: 1.35; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ca { margin: 0 0 var(--s1); color: var(--muted); font-size: 14px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
@media (hover: hover) { .card:hover .cover { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .cover { transition: none; } html { scroll-behavior: auto; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: var(--s3) var(--s2); }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); } }

/* ---------- home rows ---------- */
.shelf-row { margin-top: var(--s4); }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-bottom: var(--s2); border-bottom: 1px solid var(--line); padding-bottom: var(--s1); }
.row-head a, .row-head button {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; white-space: nowrap;
  border: 1.5px solid var(--accent); color: var(--accent); background: transparent; text-decoration: none;
  font: 600 14px var(--ui); transition: background-color .15s, color .15s;
}
.row-head a:hover, .row-head button:hover { background: var(--accent); color: var(--on-accent); }
@media (prefers-reduced-motion: reduce) { .row-head a { transition: none; } }
/* The row scrolls sideways, so it clips anything outside its box. The padding gives the hover lift and
   shadow room to show; the matching negative margin keeps the covers exactly where they were. */
.row { display: flex; gap: var(--s2); overflow-x: auto; padding: 12px 8px var(--s2); margin: -12px -8px 0; scroll-snap-type: x proximity; }
.row .card { flex: 0 0 160px; scroll-snap-align: start; }
@media (min-width: 700px) { .row .card { flex-basis: 184px; } }
/* Home rows hold six titles. A wide screen shows all six at once (audiobooks as two lines of three);
   a narrower screen swipes through them sideways. */
@media (min-width: 1000px) {
  .row.fit { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: visible; scroll-snap-type: none; }
  .row.fit.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--s3); }
  .row.fit:not(.wide) .card.wide { grid-column: span 2; }
}

/* ---------- shelf pages: a pill bar across the top (replaces the old left sidebar) ---------- */
.shelfbar { position: sticky; top: var(--nav-h, 54px); z-index: 9; background: var(--page); border-bottom: 1px solid var(--line); }
.shelfbar-in {
  position: relative; display: flex; gap: var(--s1); max-width: 1100px; margin: 0 auto; padding: 10px var(--s2);
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.shelfbar-in::-webkit-scrollbar { display: none; }
.shelf-pill {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; white-space: nowrap;
  font: 600 14px var(--ui); scroll-snap-align: center; transition: border-color .15s, background-color .15s, color .15s;
}
.shelf-pill .n { color: var(--muted); font-weight: 600; }
.shelf-pill:hover { border-color: var(--accent); }
.shelf-pill[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.shelf-pill[aria-current="page"] .n { color: var(--on-accent); opacity: .85; }
@media (max-width: 760px) { /* small fade at the edge hints that the bar scrolls */
  .shelfbar-in { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
}
@media (prefers-reduced-motion: reduce) { .shelf-pill { transition: none; } }
/* phones: each filter group is one tidy row that scrolls on its own, so nothing is cut off */
@media (max-width: 560px) {
  .filters { flex-direction: column; gap: var(--s1); }
  .chipgroup { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chipgroup::-webkit-scrollbar { display: none; }
  .cg-l, .chip { flex: none; white-space: nowrap; }
}

/* ---------- book detail ---------- */
/* Back button: a pill like "See all", with a line arrow */
.backbtn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 18px 0 10px; margin-bottom: var(--s2);
  border: 1.5px solid var(--accent); border-radius: 999px; color: var(--accent); text-decoration: none;
  font: 600 14px var(--ui); transition: background-color .15s, color .15s;
}
.backbtn svg { width: 18px; height: 18px; }
.backbtn:hover { background: var(--accent); color: var(--on-accent); }
@media (prefers-reduced-motion: reduce) { .backbtn { transition: none; } }
/* genres on the book page */
.genres { display: flex; flex-wrap: wrap; gap: var(--s1); list-style: none; margin: calc(var(--s1) * -1) 0 var(--s3); padding: 0; }
.genres li { display: contents; }              /* li becomes invisible to layout */
.gchip a,
.gchip { padding: 5px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: 13px var(--ui); text-decoration: none;}
.gchip a:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.gchip.bn, .gchip.bn a { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
.detail { display: grid; grid-template-columns: 260px 1fr; gap: var(--s4); align-items: start; }
.detail-side > * + * { margin-top: var(--s2); }
.status-pill { display: inline-block; font: 600 14px var(--ui); padding: 6px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); margin: 0; }
.author { font-size: 18px; color: var(--muted); margin: 0 0 var(--s1); }
.meta { font: 14px var(--ui); color: var(--muted); margin: 0 0 var(--s3); }
.desc { white-space: pre-line; max-width: 65ch; margin: 0 0 var(--s4); }
.facts-more { margin-top: var(--s3); max-width: 520px; border-block: 1px solid var(--line); }
.facts-more summary { cursor: pointer; padding: 12px 0; font: 600 15px var(--ui); }
.facts-more .facts tr:last-child th, .facts-more .facts tr:last-child td { border-bottom: 0; }
.facts { width: 100%; max-width: 520px; border-collapse: collapse; font-size: 15px; }
.facts th, .facts td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.facts th { color: var(--muted); font: 14px var(--ui); width: 40%; }
.h3 { font-size: 17px; margin: 0 0 var(--s1); }
@media (max-width: 700px) {
  .detail { grid-template-columns: 1fr; }
  .detail-side { max-width: 240px; margin: 0 auto; width: 100%; }
}

/* ---------- states ---------- */
.state { text-align: center; padding: var(--s6) var(--s2); color: var(--muted); }
.state .btn { margin-top: var(--s2); }
.empty { color: var(--muted); margin: var(--s2) 0; }

/* =====================================================================
   Dashboard (admin.html)
   ===================================================================== */
.login-card { max-width: 380px; margin: var(--s6) auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); }
.field { margin-bottom: var(--s2); }
.field label { display: block; font: 600 14px var(--ui); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--page); color: var(--ink); font: 16px var(--ui);
}
.field textarea { min-height: 110px; resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font: 13px var(--ui); margin: 4px 0 0; min-height: 0; }
.err:empty { display: none; }

.dash-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); margin-bottom: var(--s3); }
.dash-head h1 { margin: 0; margin-right: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s2); margin-bottom: var(--s3); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2); }
.stat b { display: block; font-size: 28px; line-height: 1.1; color: var(--accent); }
.stat span { font: 13px var(--ui); color: var(--muted); }
.stat .l-short { display: none; }
/* phones: the five counts become one slim strip (about 70px tall instead of 300px) */
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(5, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: var(--s2); }
  .stat { background: transparent; border: 0; border-radius: 0; padding: 10px 4px; text-align: center; min-width: 0; }
  .stat + .stat { border-left: 1px solid var(--line); }
  .stat b { font-size: 22px; }
  .stat span { display: block; font-size: 11px; line-height: 1.25; }
}
@media (max-width: 480px) {
  .stat .l-full { display: none; }
  .stat .l-short { display: block; }
}
.tools { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s2); }
.tools input, .tools select { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 15px var(--ui); }
.tools input { flex: 1 1 220px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.list { width: 100%; border-collapse: collapse; font: 14px var(--ui); min-width: 680px; }
.list th, .list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list th { color: var(--muted); font-weight: 600; }
.list tr:last-child td { border-bottom: 0; }
.thumb { width: 40px; aspect-ratio: 2 / 3; border-radius: 3px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acts { white-space: nowrap; }
.acts .btn { padding: 7px 10px; }

dialog { border: 0; border-radius: var(--r); padding: 0; width: calc(100% - 32px); max-width: 680px; background: var(--surface); color: var(--ink); max-height: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s2); }
.fgrid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .fgrid { grid-template-columns: 1fr; } }
.drop {
  border: 2px dashed var(--line); border-radius: var(--r); padding: var(--s2); text-align: center;
  color: var(--muted); font: 14px var(--ui); cursor: pointer; display: flex; gap: var(--s2); align-items: center; justify-content: center; flex-wrap: wrap;
}
.drop.over { border-color: var(--accent); color: var(--accent); }
.drop .thumb { width: 90px; }

.toast { position: fixed; left: 50%; bottom: var(--s3); transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 18px; border-radius: var(--r); font: 600 14px var(--ui); z-index: 50; max-width: calc(100% - 32px); }
.toast.bad { background: var(--danger); color: #fff; }

/* ---------- audiobooks: widescreen YouTube thumbnails ---------- */
.cover.wide { aspect-ratio: 16 / 9; }
.cover.wide::after { display: none; }              /* no spine shadow on a video thumbnail */
.play { position: absolute; left: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; display: grid; place-items: center; } /* small, in the corner, so it never covers the thumbnail's own title */
.play svg { width: 14px; height: 14px; margin-left: 2px; }
.detail .play { left: 50%; top: 50%; bottom: auto; width: 56px; height: 56px; margin: -28px 0 0 -28px; }
.detail .play svg { width: 24px; height: 24px; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row .card.wide { flex-basis: 270px; }
@media (min-width: 700px) { .row .card.wide { flex-basis: 330px; } }
.sec-h { display: flex; gap: var(--s1); align-items: baseline; margin: var(--s4) 0 var(--s2); }
.sec-h small { color: var(--muted); font: 14px var(--ui); }
.sec-h:first-of-type { margin-top: 0; }
.detail.audio { grid-template-columns: minmax(280px, 440px) 1fr; }
.ytlink { display: block; }
@media (max-width: 700px) { .detail.audio { grid-template-columns: 1fr; } .detail.audio .detail-side { max-width: none; } }
.thumb.wide { width: 72px; aspect-ratio: 16 / 9; }
.yt-prev { margin-top: var(--s1); max-width: 260px; }
.yt-prev img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); display: block; }
.hint { font: 13px var(--ui); color: var(--muted); margin: 4px 0 0; }

/* ---------- hero: coverflow of recently finished books ---------- */
.hero { --cw: clamp(124px, 24vw, 230px); position: relative; text-align: center; padding: 0 var(--s2) var(--s4); overflow: hidden; }
.hero-head h1 { font-weight: 600; font-size: clamp(36px, 7vw, 56px); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
.hero-head .sub { color: var(--muted); margin: var(--s1) 0 var(--s4); font-size: 17px; }
.cf-cap { min-height: 84px; margin-bottom: var(--s2); }
.cf-cap small { display: block; font: 13px var(--ui); color: var(--muted); margin-bottom: 2px; }
.cf-cap h2 { font-size: clamp(20px, 3.4vw, 26px); line-height: 1.25; margin: 0; }
.cf-cap p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.cf { position: relative; height: calc(var(--cw) * 1.5 + 44px); max-width: 1100px; margin: 0 auto; perspective: 1400px; outline-offset: 4px; touch-action: pan-y; user-select: none; }
.cf-card {
  position: absolute; left: 50%; top: 50%; width: var(--cw); aspect-ratio: 2 / 3;
  margin: calc(var(--cw) * -.75) 0 0 calc(var(--cw) * -.5);
  border-radius: 18px; overflow: hidden; background: var(--line); display: block;
  box-shadow: 0 16px 36px rgba(20, 30, 40, .32);
  transform: translateX(calc(var(--cw) * var(--x))) rotateY(var(--ry, var(--ry0))) scale(var(--sc, var(--sc0)));
  transition: transform .55s cubic-bezier(.22, .9, .28, 1), opacity .35s, box-shadow .35s;
}
.cf-card img, .cf-card .nocover { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cf-card[data-o="0"]  { --x: 0;     --ry0: 0deg;   --sc0: 1;   z-index: 5; }
.cf-card[data-o="1"]  { --x: 1.02;  --ry0: -24deg; --sc0: .8;  z-index: 4; }
.cf-card[data-o="-1"] { --x: -1.02; --ry0: 24deg;  --sc0: .8;  z-index: 4; }
.cf-card[data-o="2"]  { --x: 1.78;  --ry0: -32deg; --sc0: .62; z-index: 3; }
.cf-card[data-o="-2"] { --x: -1.78; --ry0: 32deg;  --sc0: .62; z-index: 3; }
.cf-card[data-o="far"] { --x: 0; --ry0: 0deg; --sc0: .4; opacity: 0; pointer-events: none; z-index: 1; }
/* hover: the card grows, turns toward you and comes to the front */
@media (hover: hover) {
  .cf-card:hover { --sc: calc(var(--sc0) * 1.14); --ry: calc(var(--ry0) * .3); z-index: 6; box-shadow: 0 26px 52px rgba(20, 30, 40, .42); }
}
.cf-card:focus-visible { --sc: calc(var(--sc0) * 1.08); z-index: 6; }
/* Previous / next sit at the two ends of the carousel, level with the middle of the covers.
   A phone has no buttons: the carousel is swiped (tapping a side cover also brings it forward). */
.cf-btns { position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); width: min(1100px, 100% - 2 * var(--s2)); bottom: calc(var(--s4) + (var(--cw) * 1.5 + 44px) / 2 - 24px);
  display: flex; justify-content: space-between; pointer-events: none; }
.cf-btns .cf-btn { pointer-events: auto; background: var(--surface); box-shadow: 0 2px 10px rgba(0, 0, 0, .14); }
@media (max-width: 700px) { .cf-btns { display: none; } }
/* Previous and next are identical round buttons (same size, same style). */
.cf-btn {
  width: 48px; height: 48px; border-radius: 50%; padding: 0; cursor: pointer; display: grid; place-items: center;
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
  transition: background-color .15s, color .15s, transform .15s;
}
.cf-btn svg { width: 20px; height: 20px; }
.cf-btn:hover { background: var(--accent); color: var(--on-accent); }
.cf-btn:active { transform: scale(.94); }
@media (prefers-reduced-motion: reduce) { .cf-btn { transition: none; } }
@media (max-width: 560px) {
  /* five covers on a phone too: the side ones tuck in behind the centre one */
  .hero { --cw: clamp(118px, 35vw, 170px); }
  .cf-card { border-radius: 12px; }
  .cf-card[data-o="1"]  { --x: .74;  --sc0: .8; }
  .cf-card[data-o="-1"] { --x: -.74; --sc0: .8; }
  .cf-card[data-o="2"]  { --x: 1.22;  --sc0: .6; }
  .cf-card[data-o="-2"] { --x: -1.22; --sc0: .6; }
}
@media (prefers-reduced-motion: reduce) { .cf-card { transition: none; } }

/* ---------- statistics ---------- */
/* ---------- the folder tiles: the library in numbers, at the foot of the home page ---------- */
/* The container: a horizontal scroller on mobile, grid on desktop */
.pstats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 140px;
  gap: 12px;
  margin: 20px 0 28px;
  overflow-x: auto;
  padding: 8px 4px; /* space for the shadow */
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.pstats::-webkit-scrollbar { display: none; }

/* On larger screens, wrap them nicely into a grid */
@media (min-width: 600px) {
  .pstats {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    overflow-x: visible;
  }
}

/* The Folder Card */
.pstat-folder {
  scroll-snap-align: start;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 175px;
  background: var(--folder-bg, #e2e8f0); /* Soft gray/blue */
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  /* color: var(--folder-text, #1e293b); */
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pstat-folder:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

/* The folder "tab" on the top right */
.pf-tab {
  position: absolute;
  top: 0;
  right: 16px;
  width: 42px;
  height: 12px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  /* A tiny cut-out effect to look like the image */
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}

/* The text inside */
.pf-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  margin-top: 4px;
}

.pf-label {
  font-family: 'Literata', serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.03em;
  opacity: 0.8;
  max-width: 90%;
}

.pf-num {
  font-family: 'Literata', serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Dark Mode Support: once for a device that is set to dark, once for the site's own dark switch */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pstat-folder { --folder-bg: #2a2d34; --folder-text: #f1f5f9; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
  :root:not([data-theme="light"]) .pstat-folder:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.6); }
}
[data-theme="dark"] .pstat-folder {
  --folder-bg: #2a2d34;
  --folder-text: #f1f5f9;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
[data-theme="dark"] .pstat-folder:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

/* Small phone tweaks */
@media (max-width: 380px) {
  .pstats { grid-auto-columns: 125px; }
  .pstat-folder { height: 155px; padding: 12px; }
  .pf-num { font-size: 2rem; }
}
.pstat-folder { color: var(--accent); }
.pf-num { font-variant-numeric: tabular-nums; }
.pstats-sec { margin-top: var(--s5, 48px); }
/* nine tiles in one line on a wide screen, so no tile is left alone on a second row */
@media (min-width: 1000px) {
  .pstats { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 10px; }
  .pstat-folder { height: 150px; padding: 14px 12px; }
  .pf-num { font-size: 1.75rem; }
  .pf-tab { right: 12px; width: 34px; }
}
@media (max-width: 600px) { .pstat-folder { height: 120px; padding: 12px; } .pf-num { font-size: 1.8rem; } }

/* (the slimmer figures line; not in use at the moment, see ledgerHtml in public.js) */
.ledger { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 1px; background: var(--line); border-block: 1px solid var(--line); margin-bottom: var(--s4); }
.ledger a { display: block; padding: 14px 8px 12px; background: var(--page); color: var(--ink); text-decoration: none; text-align: center; }
.ledger b { display: block; font-size: 22px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; }
.ledger span { display: block; font: 13px var(--ui); color: var(--muted); }
.ledger a:hover b, .ledger a:focus-visible b { color: var(--accent); }
.ledger a:focus-visible { outline-offset: -2px; }
@media (max-width: 900px) { .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ledger a { padding: 10px 6px 9px; } .ledger b { font-size: 19px; } }

/* home page blocks, in the same order on every screen: title, carousel, shelves, numbers */
.home { display: flex; flex-direction: column; background: radial-gradient(ellipse 70% 520px at 50% 0, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%) no-repeat; }
.home > * { min-width: 0; }
.home > .wrap { width: 100%; padding-top: 0; padding-bottom: 0; }
.home > .home-rest { padding-bottom: var(--s6); }
.home .shelf-row:first-child { margin-top: 0; }
.hero-head { text-align: center; padding: var(--s6) var(--s2) 0; }
@media (max-width: 600px) {
  .hero-head { padding-top: var(--s3); }
}

/* small phones: tighter navbar so brand, 2 links, search, theme and avatar all stay on one row */
@media (max-width: 480px) {
  .top-in { gap: var(--s1); padding: var(--s1) 12px; }
  .brand { margin-right: 0; }
  .links { gap: 12px; }
  .links a { letter-spacing: .03em; }
  .icon-btn { width: 36px; }
  .avatar-btn { width: 36px; height: 36px; }
  .avatar-btn svg { width: 20px; height: 20px; }
}

/* ---------- dashboard list on phones: cards instead of a table ---------- */
.badge.fmt { color: var(--muted); }
.cards { display: none; }
@media (max-width: 760px) {
  .table-wrap { display: none; }
  .cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .bcard { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
  .bc-main { display: flex; gap: 12px; align-items: flex-start; }
  .bc-main .thumb { flex: none; width: 78px; }
  .bc-main .thumb.wide { width: 120px; }
  .bc-info { min-width: 0; flex: 1; }
  .bc-title { margin: 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
  .bc-author { margin: 2px 0 10px; color: var(--muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
  .bc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .bcard .badge { padding: 5px 10px 5px 8px; font-size: 12px; gap: 5px; }
  .bcard .badge svg { width: 13px; height: 13px; }
  .bc-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s1); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
  .bc-actions .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
}
@media (max-width: 400px) { .bc-main .thumb.wide { width: 96px; } .bc-main .thumb { width: 72px; } }

/* ---------- add / edit form: header, scrolling body, Save pinned at the bottom ---------- */
#panel[open], #import-panel[open] { display: flex; }
.dlg-in { display: flex; flex-direction: column; width: 100%; min-height: 0; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.dlg-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 8px 8px 8px var(--s3); border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 20px; }
.dlg-head .icon-btn { width: 44px; height: 44px; }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s2) var(--s3) var(--s3); }
.form-actions { flex: none; display: flex; justify-content: flex-end; gap: var(--s1); padding: 12px var(--s3); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
.form-actions .btn { min-height: 44px; }
body:has(dialog[open]) { overflow: hidden; }

/* ---------- floating add button + sticky one-row toolbar (phones) ---------- */
.fab { display: none; }
@media (max-width: 760px) {
  #dash { padding-bottom: 104px; }                 /* room so the + button never covers the last card */
  #add { display: none; }                          /* the floating + replaces it */
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 20; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .32);
  }
  .fab svg { width: 26px; height: 26px; }
  .fab:active { transform: scale(.94); }

  /* search and status filter share one row; it sticks to the top, with a solid background */
  .tools {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 8; flex-wrap: nowrap; gap: var(--s1);
    margin: 0 -16px var(--s2); padding: 8px 16px; background: var(--page); border-bottom: 1px solid var(--line);
    transition: transform .25s ease;
  }
  .tools.away { transform: translateY(-110%); }
  .tools input, .tools select { font-size: 16px; min-height: 44px; }   /* 16px stops iPhones zooming in on focus */
  .tools input { flex: 1 1 0; min-width: 0; }
  .tools select { flex: none; width: 112px; }

  /* the form fills the whole screen */
  #panel, #import-panel, #tools-panel { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border-radius: 0; }
  .dlg-in { height: 100vh; height: 100dvh; max-height: none; }
  .dlg-head { padding-left: var(--s2); padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .dlg-body { padding: var(--s2); }
  .form-actions { padding: 12px var(--s2); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .form-actions .btn { flex: 1; }
  .form-actions .btn.primary { flex: 2; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .tools { transition: none; } .fab:active { transform: none; } }

/* ---------- genre picker in the add / edit form ---------- */
.genre-picks { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.genre-picks .chip { min-height: 36px; }
.genre-picks .chip.bn { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
.genre-add { display: flex; gap: var(--s1); margin-top: var(--s1); }
.genre-add input { flex: 1; min-width: 0; }
.genre-add .btn { min-height: 44px; }

/* "Copies I have" picker in the form */
.copy-picks .chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 16px 0 12px; }
.copy-picks .chip svg { width: 17px; height: 17px; }

/* ---------- Goodreads import ---------- */
#import-panel { max-width: 760px; }
.imp-steps { margin: 0 0 var(--s2); padding-left: 22px; }
.imp-steps li { margin: 4px 0; }
.imp-sum { margin: 0 0 var(--s2); }
.imp-opts { display: grid; gap: 12px; margin-bottom: var(--s2); padding: var(--s2); background: var(--page); border: 1px solid var(--line); border-radius: var(--r); }
.imp-opts .field { margin: 0; }
.imp-opt { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; cursor: pointer; font: 15px/1.4 var(--ui); }
.imp-opt input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.imp-opt .hint { display: block; margin: 2px 0 0; }
.imp-bar { position: sticky; top: calc(var(--s2) * -1); z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: var(--s1); margin: var(--s2) 0 var(--s1); padding: 8px 0; background: var(--surface); font: 600 14px var(--ui); }
.imp-bar .btn { min-height: 36px; padding: 8px 12px; }
.imp-list { display: grid; gap: 8px; }
.imp-row { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.imp-row.off { opacity: .55; }
.imp-row input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.imp-title { font-weight: 600; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.imp-author { color: var(--muted); font-size: 14px; margin: 2px 0 8px; overflow-wrap: anywhere; }
.imp-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.imp-row .badge { padding: 4px 10px 4px 8px; font-size: 12px; gap: 5px; }
.imp-row .badge svg { width: 13px; height: 13px; }
.imp-row .chip { min-height: 30px; padding: 0 12px; font-size: 13px; }
.progress { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: var(--s2) 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.imp-center { text-align: center; padding: var(--s3) 0; }
.imp-big { font-size: 44px; line-height: 1; color: var(--accent); margin-bottom: var(--s1); }
.imp-stats { display: grid; gap: 8px; margin: var(--s2) 0; text-align: left; }
.imp-stat { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--page); font: 15px var(--ui); }
.imp-stat b { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }
.imp-steps + .hint { margin: 0 0 var(--s2); line-height: 1.5; }
#imp-drop { margin-bottom: var(--s1); }

/* ---------- import: choosing a source, and the YouTube playlist screens ---------- */
.form-actions:empty { display: none; }
.imp-sources { display: grid; gap: 12px; }
.imp-source { display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.imp-source:hover { border-color: var(--accent); }
.imp-source svg { width: 30px; height: 30px; flex: none; color: var(--accent); }
.imp-source b { display: block; font: 600 17px var(--ui); }
.imp-source small { display: block; color: var(--muted); font: 14px/1.4 var(--ui); margin-top: 2px; }
.imp-warn { padding: 12px 14px; margin: var(--s2) 0; border: 1.5px solid var(--buy); border-radius: var(--r); background: color-mix(in srgb, var(--buy) 10%, transparent); font: 14px/1.5 var(--ui); }
.imp-warn code { font-size: 13px; }
.imp-yt { cursor: default; }
.imp-yt-body { min-width: 0; }
.imp-yt-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.imp-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
.imp-yt-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font: 600 14px var(--ui); min-width: 0; }
.imp-in { width: 100%; margin-top: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--page); color: var(--ink); font: 16px var(--ui); }
.imp-in.bn { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
.progress.busy i { width: 40%; animation: imp-slide 1s ease-in-out infinite alternate; }
@keyframes imp-slide { from { margin-left: 0; } to { margin-left: 60%; } }
@media (prefers-reduced-motion: reduce) { .progress.busy i { animation: none; width: 100%; } }
.imp-yt-meta .badge { white-space: normal; line-height: 1.25; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px var(--s2); }
.two .field { margin: 0; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }

/* "Showing 100 of 2,443" + Show more (dashboard list) */
.more-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: var(--s2) 0; font: 14px var(--ui); color: var(--muted); }
.more-wrap .btn { min-height: 44px; }

/* ---------- sorting, author pages, the owner's Edit shortcut ---------- */
.sortbox { display: inline-flex; align-items: center; gap: 6px; }
.sortbox select { font: 14px var(--ui); padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.eyebrow { margin: 0 0 2px; font: 600 12px var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.author a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.author a:hover { color: var(--accent); text-decoration-color: currentColor; }
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.editbtn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.editbtn svg { width: 16px; height: 16px; }
.more-by { margin-top: var(--s6); }

/* ---------- touch screens: every control is at least 44px tall ---------- */
@media (pointer: coarse) {
  .chip, .sortbox select { min-height: 44px; padding-left: 14px; padding-right: 14px; }
  .shelf-pill, .row-head a, .row-head button, .backbtn, .editbtn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .avatar-btn { width: 44px; height: 44px; }
  .brand { min-height: 44px; min-width: 44px; justify-content: center; }
  .sec-jump { padding: 12px 0; }
  .links a { padding: 10px 0; }
}

/* ---------- phones: a shorter hero and smaller tiles, so the shelves start sooner ---------- */
@media (max-width: 600px) {
  .hero { padding-top: var(--s3); padding-bottom: var(--s2); }
  .hero-head h1 { font-size: 30px; }
  .hero-head .sub { font-size: 15px; margin: 4px 0 0; }
  .cf-cap { min-height: 72px; margin-bottom: var(--s1); }
}

/* =====================================================================
   Dashboard: clickable counts, more filters, quick status, bulk edit, tools
   ===================================================================== */
button.stat { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.stat:hover { border-color: var(--accent); }
button.stat[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 760px) { button.stat { text-align: center; } button.stat[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--accent); } }

.tools-more { display: flex; flex-wrap: wrap; gap: var(--s1); margin: calc(var(--s1) * -1) 0 var(--s2); }
.tools-more select { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 14px var(--ui); }
.tools-more .btn { padding: 7px 12px; }
@media (max-width: 760px) {
  .tools-more { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-top: 0; padding-bottom: 2px; }
  .tools-more::-webkit-scrollbar { display: none; }
  .tools-more select, .tools-more .btn { flex: none; min-height: 44px; font-size: 15px; }
}

/* tick boxes */
.pickbox, #pick-all { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.list th.pick, .list td.pick { width: 36px; padding-right: 0; }
.bc-main .pickbox { flex: none; width: 24px; height: 24px; }
.in-series { display: block; font: 12px var(--ui); color: var(--muted); margin-top: 2px; }
.bc-author .in-series { margin-top: 0; }
.acts .btn, .bc-actions .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.acts .btn svg, .bc-actions .btn svg { width: 15px; height: 15px; }
.acts .view-l { display: none; }                      /* the table shows just the eye; phone cards show "View" */

/* the reading status as a small menu, coloured like the status badge */
.qs {
  font: 600 13px var(--ui); padding: 5px 26px 5px 12px; border-radius: 999px; border: 1px solid currentColor; cursor: pointer; max-width: 100%;
  background: color-mix(in srgb, currentColor 9%, var(--surface)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23808080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 7px center / 14px;
  appearance: none; -webkit-appearance: none;
}
.qs.st-reading { color: var(--st-reading); } .qs.st-read { color: var(--st-read); } .qs.st-want { color: var(--st-want); }
.qs option { color: var(--ink); background: var(--surface); }
@media (max-width: 760px) { .qs { min-height: 32px; font-size: 12px; } }

/* bar that appears while books are ticked */
.bulkbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0, 0, 0, .14); padding-bottom: env(safe-area-inset-bottom, 0px); }
.bulk-in { max-width: 1100px; margin: 0 auto; padding: 10px var(--s2); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); font: 14px var(--ui); }
.bulk-in b { margin-right: 4px; }
.bulk-in select, .bulk-in input { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 14px var(--ui); min-height: 38px; }
.bulk-in input { width: 190px; }
.bulk-in .btn { min-height: 38px; }
#bulk-clear { margin-left: auto; }
body.bulk-on { padding-bottom: 76px; }
body.bulk-on .fab { display: none; }
@media (max-width: 760px) {
  .bulk-in select, .bulk-in input, .bulk-in .btn { min-height: 44px; font-size: 16px; }
  #bulk-value { flex: 1 1 100%; order: 5; } #bulk-value input, #bulk-value select { width: 100%; }
  #bulk-apply { order: 6; flex: 1; } #bulk-clear { order: 7; margin-left: 0; }
  body.bulk-on { padding-bottom: 170px; }
}

/* the Delete button sits at the far left of the form's buttons */
#delete-book { margin-right: auto; }
@media (max-width: 760px) { .form-actions #delete-book { flex: 0 0 auto; } }

/* ---------- Tools dialog ---------- */
#tools-btn svg { width: 15px; height: 15px; }
.tl-back { margin-right: auto; }
.tl-menu { display: grid; gap: var(--s1); }
.tl-item { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font: 15px var(--ui); }
.tl-item:hover { border-color: var(--accent); }
.tl-item b { display: block; font-size: 16px; }
.tl-item .hint { display: block; margin: 2px 0 0; }
.tl-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.tl-ic svg { width: 22px; height: 22px; }
.tl-choices, .tl-acts { display: flex; flex-wrap: wrap; gap: var(--s1); margin: var(--s2) 0; }
.tl-group { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin: var(--s2) 0; }
.tl-group .tl-acts { margin: 8px 0; }
.tl-row { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; padding: 8px 0; cursor: pointer; font: 15px/1.4 var(--ui); }
.tl-row + .tl-row { border-top: 1px solid var(--line); }
.tl-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.tl-row b { font-weight: 600; overflow-wrap: anywhere; }
.tl-row .hint, .tl-sub { display: block; margin: 1px 0 0; }
.tl-sub { font: 14px var(--ui); color: var(--muted); }
.tl-name { grid-template-columns: 24px 1fr; cursor: default; }
.tl-keep { display: grid; grid-template-columns: 24px 1fr; gap: 10px; cursor: pointer; }
.tl-head { background: var(--page); margin: -6px -12px 0; padding: 10px 12px; border-radius: 10px 10px 0 0; }
.tl-in { padding-left: 4px; }
.tl-opt { margin: var(--s2) 0; padding: 12px; background: var(--page); border: 1px solid var(--line); border-radius: var(--r); }
.tl-h { font-size: 17px; margin: var(--s4) 0 4px; }
.tl-input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 16px var(--ui); margin: 8px 0; }
.tl-inline { display: inline-flex; align-items: center; gap: 8px; font: 15px var(--ui); }
.tl-inline select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 15px var(--ui); max-width: 60vw; }
.tl-code { background: var(--page); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.tl-note { font: 600 14px var(--ui); color: var(--accent); }
.tl-ctitle { margin: 8px 0; font: 15px var(--ui); }
.tl-covers { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.tl-cover { flex: 0 0 104px; padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; color: inherit; cursor: pointer; text-align: left; }
.tl-cover img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; background: var(--line); display: block; }
.tl-cover .hint { display: block; font-size: 11px; line-height: 1.3; margin-top: 4px; }
.tl-cover:hover, .tl-cover:focus-visible { border-color: var(--accent); }

/* ---------- series on the public site; the emblem on drawn covers ---------- */
.series-line { margin: 0 0 var(--s1); font: 15px var(--ui); color: var(--muted); }
.series-line a { font-weight: 600; text-decoration: none; }
.series-line a:hover { text-decoration: underline; }
.series-line a.bn { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
.more-by + .more-by { margin-top: var(--s4); }
.gc-m { position: absolute; right: 9cqw; bottom: 9cqw; width: 17cqw; height: 17cqw; opacity: .5; }
.gc-m svg { width: 100%; height: 100%; display: block; stroke-width: 1.1; }
.gencover:has(.gc-m) .gc-a { padding-right: 20cqw; }
.gencover.wide .gc-m { width: 9cqw; height: 9cqw; right: 6cqw; bottom: 6cqw; }
body.bulk-on .toast { bottom: 84px; }
@media (max-width: 760px) { body.bulk-on .toast { bottom: 190px; } }

/* =====================================================================
   Navigation: four sections. On phones the links become a bar at the bottom.
   ===================================================================== */
.links a svg { display: none; }
@media (max-width: 600px) {
  .links {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .links a, .links a[aria-current="page"] {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 6px 0;
    border-bottom: 0; font: 600 11px var(--ui); letter-spacing: .02em; text-transform: none; color: var(--muted);
  }
  .links a[aria-current="page"] { color: var(--accent); }
  .links a svg { display: block; width: 22px; height: 22px; }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .top-in { justify-content: flex-end; }
  .brand { margin-right: auto; }
  .top.searching .brand { margin-right: 0; }
}

/* =====================================================================
   Filters: all in view on wide screens; behind one button on phones
   ===================================================================== */
.filt-btn, .filt-head, .filt-done, .filt-active, .filt-backdrop { display: none; }
.filt-sheet { display: contents; }
.chip.on { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: var(--accent); }
@media (max-width: 700px) {
  .filters { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s1); }
  .filt-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
  .filt-btn svg { width: 16px; height: 16px; }
  .filt-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 600 12px/20px var(--ui); text-align: center; }
  .filt-active { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
  .filt-active .chip { min-height: 36px; }
  .sortbox { margin-left: auto; }
  /* the panel */
  .filt-sheet {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-height: 82vh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
    padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom, 0px));
  }
  .filters.open .filt-sheet { display: block; }
  .filters.open + .filt-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5); }
  .filt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s1); font: 600 18px var(--ui); }
  .filt-sheet .chipgroup { flex-wrap: wrap; overflow: visible; padding: 10px 0; border-top: 1px solid var(--line); }
  .filt-sheet .cg-l { flex-basis: 100%; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
  .filt-done { display: block; width: 100%; min-height: 48px; margin-top: var(--s2); }
  html.sheet-open { overflow: hidden; }
}

/* ---------- "do we have it?" label, start-page switch ---------- */
.chave { margin: 4px 0 0; font: 600 12px var(--ui); display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.chave::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chave.have-shelf { color: var(--owned); } .chave.have-ebook { color: var(--cp-ebook); } .chave.have-none { color: var(--buy); }
.startsw { display: flex; align-items: center; gap: 10px; margin: var(--s4) 0 0; padding-top: var(--s2); border-top: 1px solid var(--line); font: 14px var(--ui); cursor: pointer; }
.startsw input { width: 20px; height: 20px; accent-color: var(--accent); }
.startsw small { color: var(--muted); }

/* ---------- series: number and "read" tick on the covers, progress ---------- */
.card.numbered { position: relative; }
.cno, .ctick, .cnow { position: absolute; top: 6px; z-index: 2; font: 600 12px var(--ui); border-radius: 999px; }
.cno { left: 6px; padding: 2px 8px; background: rgba(0, 0, 0, .72); color: #fff; }
.ctick { right: 6px; width: 24px; height: 24px; display: grid; place-items: center; background: var(--owned); color: #fff; }
.ctick svg { width: 14px; height: 14px; stroke-width: 2.4; }
.cnow { right: 6px; padding: 2px 8px; background: var(--st-reading); color: #fff; }
:root[data-theme="dark"] .ctick, :root[data-theme="dark"] .cnow { color: #10161a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ctick, :root:not([data-theme="light"]) .cnow { color: #10161a; } }
.pbar { display: block; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.sprog { display: grid; gap: 6px; max-width: 420px; margin: 0 0 var(--s2); font: 14px var(--ui); color: var(--muted); }
.sprog b { color: var(--ink); }

/* ---------- comics: a series is a small stack of covers ---------- */
.grid.stacks { gap: var(--s4) var(--s3); margin-top: var(--s2); }
.stack { display: block; color: inherit; text-decoration: none; }
.stack-covers { position: relative; aspect-ratio: 2 / 3; margin: 6px 10% 10px 0; }
.stack-covers .cover { position: absolute; inset: 0; transition: transform .15s; }
.stack-covers.n2 .cover:nth-child(1), .stack-covers.n3 .cover:nth-child(2) { transform: translateX(7%) rotate(3deg); filter: brightness(.82); }
.stack-covers.n3 .cover:nth-child(1) { transform: translateX(13%) rotate(6deg); filter: brightness(.66); }
@media (hover: hover) { .stack:hover .stack-covers .cover:last-child { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .stack-covers .cover { transition: none; } }
.stack .ca { margin-bottom: 6px; }
/* In a mixed list a stack's top cover is exactly the size of a book's cover, so the row stays level;
   the covers underneath lean out only a little, so the gap between cards stays clear. */
.card.stack .stack-covers { margin: 0; }
.wrap { overflow-x: clip; }   /* a leaning cover at the screen edge must not widen the page */
.card.stack .stack-covers .cover { transform-origin: 0 100%; }
.card.stack .stack-covers.n2 .cover:nth-child(1), .card.stack .stack-covers.n3 .cover:nth-child(2) { transform: rotate(1.1deg); }
.card.stack .stack-covers.n3 .cover:nth-child(1) { transform: rotate(2.2deg); }
.card.stack .ct { margin-top: var(--s1); }
.row .card .pbar { margin-top: 6px; }

/* =====================================================================
   Stats
   ===================================================================== */
.statpage, .vz-tip {
  --k-book: #0d9488; --k-comic: #de6426; --k-audio: #6250d6; --k-none: #b9b5ab;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .statpage, :root:not([data-theme="light"]) .vz-tip { --k-book: #16a3a3; --k-comic: #d95926; --k-audio: #9085e9; --k-none: #4a5157; }
}
:root[data-theme="dark"] .statpage, :root[data-theme="dark"] .vz-tip { --k-book: #16a3a3; --k-comic: #d95926; --k-audio: #9085e9; --k-none: #4a5157; }
:root[data-theme="light"] .statpage { --k-book: #0d9488; --k-comic: #de6426; --k-audio: #6250d6; --k-none: #b9b5ab; }
.k-book { background: var(--k-book); } .k-comic { background: var(--k-comic); } .k-audio { background: var(--k-audio); } .k-none { background: var(--k-none); }

.statpage section { margin-top: var(--s4); }
.statpage h2 { font-size: 20px; }
.goal, .vz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: var(--s3); }
.goal-n { margin: var(--s1) 0; font: 15px var(--ui); color: var(--muted); }
.goal-n b { font: 600 34px/1 'Literata', Georgia, serif; color: var(--ink); margin-right: 4px; }
.goal-n span { margin-left: 8px; font-weight: 600; color: var(--accent); }
.goal-bar { position: relative; height: 14px; border-radius: 999px; background: var(--line); }
.goal-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); min-width: 6px; }
.goal-bar u { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }
.goal .lede { margin: var(--s1) 0 0; }
.goal-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s1); margin-top: var(--s1); font: 14px var(--ui); }
.goal-form label { display: grid; gap: 4px; font-weight: 600; }
.goal-form input { width: 150px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 16px var(--ui); }
.goal-form .btn { min-height: 40px; }
.goal-edit { margin-top: var(--s2); font: 14px var(--ui); }
.goal-edit summary, .vz-table summary { cursor: pointer; color: var(--accent); }

.stiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s2); }
.stile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: var(--s2); color: inherit; text-decoration: none; }
a.stile:hover { border-color: var(--accent); }
.stile b { display: block; font: 600 32px/1.1 'Literata', Georgia, serif; }
.stile span { display: block; font: 600 14px var(--ui); margin-top: 2px; }
.stile small { display: block; font: 13px/1.4 var(--ui); color: var(--muted); margin-top: 4px; }

/* column charts */
.vz { margin-top: var(--s2); }
.vz-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font: 13px var(--ui); color: var(--muted); margin-bottom: var(--s1); }
.vz-legend span, .share-key li { display: inline-flex; align-items: center; gap: 6px; }
.vz-legend i, .share-key i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.vz-scroll { overflow-x: auto; padding-top: 22px; }
.vz-plot { position: relative; height: 220px; min-width: calc(var(--n) * 26px + 36px); margin-bottom: 26px; padding-left: 36px; }
.vz-grid { position: absolute; inset: 0 0 0 36px; }
.vz-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.vz-line i { position: absolute; right: 100%; top: -8px; margin-right: 8px; font: normal 11px var(--ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.vz-cols { position: relative; height: 100%; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; }
.vz-col { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
button.vz-col { cursor: pointer; }
.vz-col:hover, .vz-col:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); outline-offset: -2px; }
.vz-stack { display: flex; flex-direction: column-reverse; gap: 2px; width: min(64%, 34px); height: 100%; justify-content: flex-start; }
.vz-seg { display: block; min-height: 2px; flex: none; }
.vz-stack .vz-seg:last-child { border-radius: 4px 4px 0 0; }
.vz-col.on .vz-x { color: var(--ink); font-weight: 700; }
.vz-col.on::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: -24px; height: 2px; background: var(--ink); border-radius: 2px; }
.vz-x { position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; text-align: center; font: 11px var(--ui); color: var(--muted); white-space: nowrap; }
.vz-val { position: absolute; left: 0; right: 0; margin-bottom: 4px; text-align: center; font: 600 12px var(--ui); color: var(--ink); pointer-events: none; }
.vz-table { margin-top: var(--s1); font: 14px var(--ui); }
.vz-table table { margin-top: var(--s1); }
.vz-table td, .vz-table th { font-variant-numeric: tabular-nums; }
.vz-tip { position: absolute; z-index: 70; max-width: 260px; padding: 6px 10px; border-radius: 6px; background: var(--ink); color: var(--page); font: 13px/1.35 var(--ui); pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.vz-card .lede { margin: var(--s1) 0 0; }

/* one bar split into shares */
.share { margin-top: var(--s2); }
.share h3 { font: 600 14px var(--ui); margin: 0 0 6px; }
.share-bar { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; }
.share-bar i { min-width: 3px; }
.share-key { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font: 13px var(--ui); color: var(--muted); }
.share-key b { color: var(--ink); } .share-key span { color: var(--muted); }

/* ranked list with bars */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; font: 14px var(--ui); }
.rank a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.rank-bar { grid-column: 1 / -1; }
.rank-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s2); }
.rank-head h2 { margin: 0; }
.rank-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s3) var(--s4); margin-top: var(--s2); }
.rank-col h3 { font: 600 14px var(--ui); margin: 0 0 var(--s1); color: var(--muted); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: 600 13px var(--ui); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.vz-plot.fit { min-width: 0; }
.row-head button { cursor: pointer; }
.vz-more { margin: var(--s1) 0 0; }
.vz-more button { padding: 6px 0; border: 0; background: none; color: var(--accent); font: 14px var(--ui); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.vz-note { margin-top: var(--s1); line-height: 1.5; }
.stile small a { color: var(--accent); }
.vz-col.on { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.rank a:hover { color: var(--accent); text-decoration: underline; }
.rank-bar { height: 8px; }
.rank-bar i { display: block; height: 100%; min-width: 3px; background: var(--k-book); border-radius: 0 4px 4px 0; }
.rank b { font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .goal, .vz-card { padding: var(--s2); } .vz-plot { height: 190px; } }
/* shares that are not book / comic / audiobook use shades of the site's own teal, so the three kind colours keep one meaning */
.k-s1 { background: color-mix(in srgb, var(--accent) 88%, var(--surface)); } .k-s2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface)); } .k-s3 { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); }
.card.numbered .gencover { padding-top: 24cqw; }

/* ---------- phones: a floating, frosted-glass bar at the bottom, like a native app ----------
   The top bar stays solid, so nothing shows through between it and the shelf bar under it. */
.links a .i-solid { display: none; }
@media (max-width: 600px) {
  .links {
    left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); padding: 4px; border-radius: 22px;
    border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .22), 0 1px 3px rgba(0, 0, 0, .12);
  }
  .links a, .links a[aria-current="page"] { min-height: 52px; border-radius: 18px; color: color-mix(in srgb, var(--ink) 72%, transparent); }
  .links a[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
  .links a[aria-current="page"] .i-line { display: none; }
  .links a[aria-current="page"] .i-solid { display: block; }
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .links {
      background: color-mix(in srgb, var(--surface) 62%, transparent);
      -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
    }
  }
}
.goal-edit a { font: 14px var(--ui); }

/* ---------- comics import (Comic Vine) ---------- */
.cv-row { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font: 15px/1.35 var(--ui); }
.cv-row:hover { border-color: var(--accent); }
.cv-row .thumb, .cv-issue .thumb { width: 48px; }
.cv-row .hint, .cv-info .hint { display: block; margin: 1px 0 0; }
.cv-issue { display: grid; grid-template-columns: 24px 48px 1fr auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font: 15px/1.35 var(--ui); }
.cv-issue.off { opacity: .55; }
.cv-issue input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.cv-issue select { padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 14px var(--ui); }
.cv-info b { overflow-wrap: anywhere; }
@media (max-width: 560px) { .cv-issue { grid-template-columns: 24px 44px 1fr; } .cv-issue select { grid-column: 2 / -1; min-height: 40px; } }
.cv-have { text-align: right; max-width: 170px; }
@media (max-width: 560px) { .cv-have { grid-column: 2 / -1; text-align: left; max-width: none; } }

/* ---------- story arcs (comics) ---------- */
.field label .opt { font-weight: 400; color: var(--muted); }
.arc-head { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; margin: var(--s4) 0 var(--s2); }
.arc-head:first-of-type { margin-top: var(--s1); }
.arc-head h2 { font-size: 20px; }
.arc-head h2 a { color: inherit; text-decoration: none; }
.arc-head h2 a:hover { color: var(--accent); text-decoration: underline; }
.arc-head > span { font: 13px var(--ui); color: var(--muted); }
.arc-head .pbar { grid-column: 1 / -1; max-width: 320px; margin-top: 4px; }
.eyebrow a { color: inherit; }
.tl-opt b { display: block; font: 600 15px var(--ui); }
.field .imp-opt input { width: 20px; height: 20px; padding: 0; }
.cv-kind { margin: 10px 0 0; }
.cv-more { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0 0; }

/* ---------- add a series by hand ---------- */
.sa-row { display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.sa-row.off { opacity: .55; }
.sa-row.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.sa-cover { width: 60px; aspect-ratio: 2 / 3; padding: 0; border: 1.5px dashed var(--line); border-radius: 4px; background: var(--page); color: var(--muted); font: 12px var(--ui); cursor: pointer; overflow: hidden; }
.sa-cover:hover, .sa-cover:focus-visible { border-color: var(--accent); color: var(--accent); }
.sa-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sa-fields { display: grid; gap: 8px; min-width: 0; }
.sa-line { display: grid; grid-template-columns: 76px 1fr 72px 80px; gap: 8px; align-items: center; }
.sa-row [aria-invalid="true"] { border-color: var(--danger); }
.sa-line + .sa-line { grid-template-columns: 1fr 150px; }
.sa-line label { display: flex; align-items: center; gap: 4px; font: 600 14px var(--ui); color: var(--muted); }
.sa-row input, .sa-row select { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 14px var(--ui); }
.sa-pick { grid-template-columns: 0 1fr; }
@media (max-width: 560px) {
  .sa-line { grid-template-columns: 70px 1fr; }
  .sa-line + .sa-line { grid-template-columns: 1fr; }
  .sa-row input, .sa-row select { font-size: 16px; min-height: 40px; }
}
.sa-tip { margin: 0 0 var(--s1); }
.imp-bar #sa-covers { min-height: 36px; }

/* ---------- dashboard header on phones: title with three small buttons, then Import | Tools side by side ---------- */
.hd-ic { display: none; }
@media (max-width: 760px) {
  .dash-head { gap: var(--s1); margin-bottom: var(--s2); }
  .dash-head h1 { font-size: 26px; flex: 1 1 auto; min-width: 0; }
  .dash-head .hd-util, .dash-head .theme-btn { order: 1; width: 44px; height: 44px; padding: 0; display: inline-grid; place-items: center; flex: none; }
  .dash-head .hd-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .dash-head .hd-ic { display: block; width: 20px; height: 20px; }
  /* buttons with a label put a small space after their picture; a picture-only button must not, or it sits left of centre */
  .dash-head .hd-util svg, .dash-head .theme-btn svg { width: 20px; height: 20px; margin: 0; }
  #import-btn svg, #tools-btn svg { margin: 0; }
  #import-btn, #tools-btn { order: 2; flex: 1 1 calc(50% - var(--s1)); min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; }
  #import-btn svg, #tools-btn svg { width: 17px; height: 17px; }
}
.btn.theme-btn svg { margin: 0; }   /* the light/dark button has no label, on any screen size */

/* =====================================================================
   Dashboard, second pass: the public site's top bar, attention counters,
   a tighter table, compact rows and a floating bar on phones
   ===================================================================== */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.adm-top .top-in { flex-wrap: nowrap; }
.adm-title { margin: 0 auto 0 0; font-size: 20px; line-height: 1.2; white-space: nowrap; }
.adm-main, .adm-util { display: flex; align-items: center; gap: var(--s1); }
.adm-util { padding-left: var(--s2); margin-left: var(--s1); border-left: 1px solid var(--line); }
.adm-top .btn { white-space: nowrap; }
.adm-wrap { padding-top: var(--s3); }
.adm-bar { display: none; }
.fab { display: none !important; }

/* counters for books that lack something */
.attn { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: calc(var(--s1) * -1) 0 var(--s3); }
.attn:empty { display: none; }
.attn-l { font: 600 12px var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.attn-chip { font-size: 13px; padding: 5px 12px; color: var(--muted); }
.attn-chip b { color: var(--ink); font-weight: 700; }
.attn-chip[aria-pressed="true"] b { color: inherit; }
.attn-chip[aria-pressed="true"] { color: var(--on-accent); }

/* the table: more rows on screen, headings that stay in view, a click on a row opens it */
@media (min-width: 761px) {
  .table-wrap { overflow: visible; }
  .list th { position: sticky; top: var(--nav-h, 57px); z-index: 5; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
  .list thead tr:first-child th:first-child { border-top-left-radius: var(--r); }
  .list thead tr:first-child th:last-child { border-top-right-radius: var(--r); }
}
.list th, .list td { padding: 5px 10px; }
.list th { padding-top: 8px; padding-bottom: 8px; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.list tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.list .thumb { width: 26px; }
.list .thumb.wide { width: 46px; }
.t-title { max-width: 380px; } .t-author { max-width: 260px; }
.t-main { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; overflow-wrap: anywhere; }
.t-title .t-main { font-weight: 600; }
.list .in-series { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-sort { font: inherit; color: inherit; background: none; border: 0; padding: 4px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-sort::after { content: "\2195"; font-size: 11px; opacity: .45; }
.th-sort:hover { color: var(--ink); }
.th-sort[aria-pressed="true"] { color: var(--accent); }
.th-sort[aria-pressed="true"]::after { content: "\2191"; opacity: 1; }
.list .acts { text-align: right; }
.list .acts .btn { padding: 6px 8px; margin-left: 4px; }
.list .acts .btn svg { margin: 0; }
.list .qs { font-size: 12px; padding-top: 4px; padding-bottom: 4px; }
.list .badge { font-size: 12px; }
.dlg-head #panel-view { margin-left: auto; padding: 8px 12px; text-decoration: none; }

@media (max-width: 760px) {
  /* top bar: brand, title, and three small buttons; the main actions are in the bar at the bottom */
  .adm-top { position: static; }
  .adm-top .top-in { gap: var(--s1); padding: var(--s1) 12px; }
  .adm-main { display: none; }
  .adm-util { border-left: 0; padding-left: 0; margin-left: 0; gap: 6px; }
  .adm-util .btn { width: 44px; height: 44px; padding: 0; display: inline-grid; place-items: center; flex: none; }
  .adm-util .hd-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .adm-util .hd-ic { display: block; }
  .adm-util .btn svg { width: 20px; height: 20px; margin: 0; }
  .adm-wrap { padding-top: var(--s2); padding-bottom: 96px; }
  .attn { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px var(--s2); padding: 0 16px; }
  .attn::-webkit-scrollbar { display: none; }
  .attn-chip { flex: none; min-height: 36px; }
  .attn-l { flex: none; }

  /* one compact row per book */
  .cards { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .brow { display: grid; grid-template-columns: 24px 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; min-height: 68px; }
  .brow + .brow { border-top: 1px solid var(--line); }
  .brow .pickbox { width: 22px; height: 22px; }
  .brow .thumb { width: 40px; cursor: pointer; }
  .brow .thumb.wide { width: 40px; aspect-ratio: 1; }
  .br-info { display: grid; gap: 1px; min-width: 0; padding: 4px 0; text-align: left; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
  /* up to two lines, so an issue number at the end of a long title is not cut off */
  .br-title { font: 600 15px/1.3 'Literata', Georgia, serif; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
  .br-title.bn, .br-author.bn { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
  .br-author, .br-meta { font: 13px/1.35 var(--ui); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .br-meta { font-size: 12px; }
  .brow .qs { font-size: 12px; min-height: 34px; padding: 4px 22px 4px 10px; background-position: right 5px center; }

  /* floating bar, like the public site's */
  .adm-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 20;
    padding: 4px; border-radius: 22px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .22), 0 1px 3px rgba(0, 0, 0, .12);
  }
  .adm-bar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border: 0; border-radius: 18px; background: none; cursor: pointer; font: 600 11px var(--ui); letter-spacing: .02em; color: color-mix(in srgb, var(--ink) 72%, transparent); }
  .adm-bar button svg { width: 22px; height: 22px; }
  .adm-bar button[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
  .adm-bar button[data-bar="add"] { color: var(--on-accent); background: var(--accent); }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .adm-bar { background: color-mix(in srgb, var(--surface) 62%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8); }
  }
  body.bulk-on .adm-bar { display: none; }
  body:has(dialog[open]) .adm-bar { display: none; }
}
.form-actions:empty { display: none; }   /* a screen with no buttons should not leave an empty strip */

/* row headings: the count sits with the title, and "See all" is a plain link with an arrow */
.row-head h2 small { font: 500 15px var(--ui); color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-head a, .row-head button { min-height: 40px; padding: 0; border: 0; border-radius: 0; gap: 6px; font: 600 15px var(--ui); flex: none; }
.row-head a:hover, .row-head button:hover { background: none; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.row-head a svg, .row-head button svg { width: 16px; height: 16px; }
/* the last thing in a swiped row: a card that opens the whole shelf */
.row .card.endcard { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 2 / 3; align-self: flex-start; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--r); color: var(--accent); text-align: center; padding: 12px; }
.endcard b { font: 600 26px/1.1 'Literata', Georgia, serif; font-variant-numeric: tabular-nums; }
.endcard span { font: 600 14px var(--ui); }
.endcard svg { width: 20px; height: 20px; margin-top: 4px; }
.row.wide .card.endcard { aspect-ratio: auto; flex-basis: 150px; align-self: stretch; margin-bottom: 52px; }
@media (min-width: 1000px) { .row.fit .endcard { display: none; } }

/* ---------- audiobook page: the player leads, the title sits under it, Listen + details stand beside it ---------- */
.detail.listen { grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "side aside" "head aside" "body aside"; grid-template-rows: auto auto 1fr; gap: var(--s2) var(--s4); }
.detail.listen .detail-side { grid-area: side; max-width: none; } .detail.listen .detail-head { grid-area: head; } .detail.listen .detail-body { grid-area: body; } .detail.listen .detail-aside { grid-area: aside; }
.detail.listen h1 { font-size: 26px; margin: var(--s1) 0 4px; text-wrap: balance; }
.detail.listen .detail-head .meta { margin-bottom: 0; }
.detail.listen .dtags { margin-bottom: var(--s2); }
.detail.listen .genres { margin: 0; }
.ytplay { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; }
.ytplay .cover, .ytframe { border-radius: 10px; overflow: hidden; }
.ytframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.yt-hint { margin: 8px 0 var(--s3); line-height: 1.45; }
.twin { margin: 0 0 var(--s2); font: 15px var(--ui); color: var(--muted); } .twin a { font-weight: 600; }
.detail.listen .facts-more { margin-top: 0; max-width: none; }
.detail.listen .facts { font-size: 14px; max-width: none; }
.steps { display: grid; gap: 12px; margin-top: var(--s3); }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.step.wide { grid-template-columns: 84px 1fr; }
.step-c .cover { border-radius: 4px; } .step-c .hp, .step-c .play { display: none; }
.step-t small { display: block; font: 12px var(--ui); color: var(--muted); }
.step-t b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.3; font-weight: 600; }
.step:hover b { color: var(--accent); }
@media (min-width: 901px) { .detail.listen .facts-more { border-top: 0; } .detail.listen .facts-more summary { list-style: none; cursor: default; pointer-events: none; padding-top: 0; } .detail.listen .facts-more summary::-webkit-details-marker { display: none; } }
@media (max-width: 900px) { .detail.listen { grid-template-columns: 1fr; grid-template-areas: "side" "head" "body" "aside"; } .detail.listen .detail-aside { max-width: 560px; } .yt-hint { margin-bottom: var(--s2); } }

/* figures inside a card on the Stats page: no boxes of their own */
.stiles.in-card { margin-top: var(--s2); gap: var(--s3); }
.stiles.in-card .stile { background: none; border: 0; border-radius: 0; padding: 0; }

/* ================= Stats page: this year first, then all time ================= */
.st-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.st-top h1 { margin: 0; }
.yearnav { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.yearnav b { min-width: 64px; text-align: center; font: 600 17px var(--ui); font-variant-numeric: tabular-nums; }
.yearnav button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: var(--accent); cursor: pointer; display: grid; place-items: center; }
.yearnav button:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.yearnav button:disabled { color: var(--line); cursor: default; }
.yearnav svg { width: 18px; height: 18px; }
.statpage.v2 > * + *, .statpage.v2 > * + section { margin-top: var(--s3); }   /* one even gap between the blocks */
.statpage.v2 .st-two > section, .statpage.v2 .st-hero section { margin-top: 0; }
.st-hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s4); align-items: center; padding: var(--s3) var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.st-hero.solo { grid-template-columns: 1fr; }
.st-big { display: flex; align-items: center; gap: var(--s3); }
.st-big > b { font: 600 clamp(64px, 9vw, 96px)/.9 'Literata', Georgia, serif; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--accent); }
.st-big h2 { margin: 0 0 4px; font-size: 22px; }
.st-big p { margin: 0; font: 14px/1.5 var(--ui); color: var(--muted); }
.st-big p.vs { color: var(--ink); }
.st-hero .goal { border: 0; padding: 0 0 0 var(--s4); border-left: 1px solid var(--line); border-radius: 0; background: none; }
.st-hero .goal h2 { font-size: 16px; font-family: var(--ui); margin: 0; }
.st-hero .goal .lede { font-size: 15px; }
.figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.fig { background: var(--page); padding: 14px 16px 12px; }
.fig b { display: block; font: 600 26px/1.15 'Literata', Georgia, serif; font-variant-numeric: tabular-nums; }
.fig span { display: block; font: 600 13px var(--ui); margin-top: 2px; }
.fig small { display: block; font: 13px/1.4 var(--ui); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fig small a { color: var(--accent); }
.st-two { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s3); align-items: stretch; }
.st-two.even { grid-template-columns: 1fr 1fr; }
.statpage.v2 > h2.st-div { margin: 44px 0 0; padding-bottom: var(--s1); border-bottom: 1px solid var(--line); font-size: 22px; }
.lead b { font: 600 40px/1 'Literata', Georgia, serif; font-variant-numeric: tabular-nums; margin-right: 10px; }
.lead span { font: 600 16px var(--ui); }
.lead small { display: block; margin-top: 6px; font: 13px var(--ui); color: var(--muted); }
.st-two.even .stiles.in-card { grid-template-columns: 1fr; gap: var(--s2); }
.st-two.even .stiles.in-card .stile { padding: 0 0 var(--s2); border-bottom: 1px solid var(--line); }
.st-two.even .stiles.in-card .stile:last-child { border-bottom: 0; padding-bottom: 0; }
.statpage.v2 > .vz-note { margin-top: var(--s1); }
@media (max-width: 860px) {
  .st-hero, .st-two, .st-two.even { grid-template-columns: 1fr; }
  .st-hero { gap: var(--s3); padding: var(--s2); }
  .st-hero .goal { padding: var(--s3) 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-big > b { font-size: 64px; }
}

/* ================= book page: cover | the book | its series and details ================= */
.detail.bookpage { grid-template-columns: 250px minmax(0, 1fr) 300px; grid-template-areas: "side head aside" "side body aside"; grid-template-rows: auto 1fr; gap: 0 var(--s4); align-items: start; }
.bookpage .detail-side { grid-area: side; } .bookpage .detail-head { grid-area: head; } .bookpage .detail-body { grid-area: body; } .bookpage .detail-aside { grid-area: aside; }
.bookpage h1 { margin-top: 0; text-wrap: balance; }
.bookpage .detail-head .meta { margin-bottom: var(--s2); }
.bookpage .dtags { margin: 0 0 var(--s3); }
.bookpage .meta.fin { margin-bottom: var(--s2); color: var(--ink); }
.bookpage .desc { margin: 0 0 var(--s3); }
.bookpage .genres { margin: 0; }
.bookpage .facts-more { margin-top: 0; max-width: none; }
.bookpage .facts { font-size: 14px; max-width: none; }
.inseries { padding-bottom: var(--s3); margin-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.inseries h2 { margin: 0 0 2px; font: 600 15px var(--ui); } .inseries h2 a { text-decoration: none; } .inseries h2 a.bn { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
.inseries-n { margin: 0 0 8px; font: 13px var(--ui); color: var(--muted); }
.inseries .steps { margin-top: var(--s2); }
@media (min-width: 1001px) { .bookpage .facts-more { border-top: 0; } .bookpage .facts-more summary { list-style: none; cursor: default; pointer-events: none; padding-top: 0; } .bookpage .facts-more summary::-webkit-details-marker { display: none; } }
@media (max-width: 1000px) and (min-width: 701px) { .detail.bookpage { grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "side head" "side body" "side aside"; grid-template-rows: auto auto 1fr; } .bookpage .detail-aside { margin-top: var(--s3); max-width: 520px; } }
@media (max-width: 700px) {
  .detail.bookpage { grid-template-columns: min(42%, 170px) minmax(0, 1fr); grid-template-areas: "side head" "body body" "aside aside"; grid-template-rows: auto; gap: var(--s2); }
  .bookpage .detail-side { max-width: none; margin: 0; }
  .bookpage h1 { font-size: 20px; line-height: 1.25; }
  .bookpage .author { font-size: 16px; }
  .bookpage .dtags { margin-bottom: 0; } .bookpage .dtags .badge { font-size: 12px; }
  .bookpage .inseries .steps { grid-template-columns: 1fr 1fr; }
}

.bookpage .desc.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; }
.desc-more { padding: 6px 0; margin: 0 0 var(--s3); border: 0; background: none; color: var(--accent); font: 600 14px var(--ui); cursor: pointer; display: block; }

.inseries h2 { font-weight: 500; color: var(--muted); } .inseries h2 a { display: block; font: 600 17px/1.3 'Literata', Georgia, serif; color: var(--ink); margin-top: 2px; } .inseries h2 a:hover { color: var(--accent); }
.inseries-also { margin: var(--s2) 0 0; padding-top: var(--s2); border-top: 1px solid var(--line); font: 14px/1.45 var(--ui); color: var(--muted); }
.inseries-also a { font-weight: 600; } .inseries-also small { display: block; font-size: 13px; }

/* the cover opens full screen when tapped */
.coverzoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--r); }
.coverbox { border: 0; padding: 0; margin: auto; background: none; max-width: 100vw; max-height: 100dvh; overflow: visible; cursor: zoom-out; }
.coverbox::backdrop { background: rgba(10, 14, 18, .88); }
.coverbox img { display: block; width: min(94vw, 60dvh); max-height: 92dvh; height: auto; object-fit: contain; border-radius: 8px; box-shadow: 0 24px 70px rgba(0, 0, 0, .6); }
.coverbox-gen { width: min(90vw, 58dvh); aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; box-shadow: 0 24px 70px rgba(0, 0, 0, .6); }
.coverbox-x { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font: 28px/1 var(--ui); cursor: pointer; }

/* ===== Books page: shelves as tabs under the title, and one line of filter menus on a wide screen ===== */
/* the tabs stay in reach while the page scrolls, as the old pills did */
.stabs { position: sticky; top: var(--nav-h, 54px); z-index: 9; background: var(--page); display: flex; gap: 4px 26px; margin: 6px 0 var(--s3); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.stabs::-webkit-scrollbar { display: none; }
.stab { position: relative; flex: none; padding: 10px 0 12px; color: color-mix(in srgb, var(--ink) 70%, transparent); text-decoration: none; font: 600 15px var(--ui); white-space: nowrap; }
.stab .n { margin-left: 7px; font-weight: 500; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stab:hover { color: var(--ink); }
.stab[aria-current="page"] { color: var(--accent); }
.stab[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--accent); }
.stab[aria-current="page"] .n { color: var(--accent); }
.fbar { display: none; }
@media (min-width: 701px) {
  .filters { align-items: center; flex-wrap: nowrap; gap: 10px; margin: 0 0 var(--s3); }
  .filters .filt-sheet, .filters .filt-btn, .filters .filt-active { display: none !important; }
  .fbar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .fbar-n { margin-right: 6px; font: 600 14px var(--ui); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .fsel, .sortbox { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 4px 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: 14px var(--ui); }
  .fsel span, .sortbox .cg-l { color: var(--muted); font-size: 13px; margin: 0; }
  .fsel select, .sortbox select { border: 0; background: none; color: var(--ink); font: 600 14px var(--ui); padding: 0 4px 0 0; height: 36px; cursor: pointer; }
  .fsel.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
  .fsel.on select { color: var(--accent); }
  .fbar-clear { border: 0; background: none; color: var(--accent); font: 600 14px var(--ui); cursor: pointer; padding: 8px 4px; }
  .sortbox { margin-left: auto; }
}
/* ===== Stats page: line icons, and the shelf mark faintly behind the headline ===== */
.si { width: 20px; height: 20px; flex: none; color: var(--accent); }
.statpage h2 .si { vertical-align: -3px; margin-right: 9px; }
.figs .fig { position: relative; padding-left: 52px; }
.fig .si { position: absolute; left: 16px; top: 17px; width: 24px; height: 24px; }
.lead .si { width: 30px; height: 30px; vertical-align: -3px; margin-right: 10px; }
.st-hero { position: relative; overflow: hidden; }
.st-mark { position: absolute; right: 18px; top: -30px; width: 150px; fill: var(--accent); opacity: .06; pointer-events: none; }   /* sits in the empty corner above the goal bar, clear of the text */
.st-hero > :not(.st-mark) { position: relative; }
@media (max-width: 860px) { .st-mark { display: none; } .figs .fig { padding-left: 46px; } .fig .si { left: 12px; width: 22px; height: 22px; } }

/* an icon before a section heading */
.hi { display: inline-grid; vertical-align: -3px; margin-right: 10px; color: var(--accent); }
.hi svg { width: 21px; height: 21px; }

/* ===== one face for numbers: every count is set in the book face, with even-width figures.
   (Numbers inside a sentence or a menu, and the chart's axis ticks, stay with their surrounding text.) ===== */
.stab .n, .row-head h2 small, .sec-h small, .sec-jump small, .fbar-n, .rank b, .share-key b, .share-key span, .goal-n span,
.yearnav b, .sprog b, .more .btn small, .cno, .vz-val, .filt-n, .stat b {
  font-family: 'Literata', Georgia, serif; font-variant-numeric: lining-nums tabular-nums;
}
.stab .n { font-size: 14px; }
.row-head h2 small, .sec-h small { font-size: 16px; font-weight: 500; }
.rank b, .share-key b { font-size: 14.5px; }

/* ---------- one title: my progress and its reads (added 18 November 2026) ---------- */
/* They sit in the middle column of the book page, under the badges, styled like the series block. */
.myprog, .myreads { max-width: 520px; }
.myprog .num { font: 600 15px 'Literata', Georgia, serif; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.myprog .pbar { height: 8px; }
.myprog-sub { margin: 8px 0 0; font: 13px var(--ui); color: var(--muted); }
.myprog-only { margin: 0 0 var(--s2); }
.readlist { list-style: none; margin: 6px 0 0; padding: 0; font: 14px var(--ui); color: var(--ink); }
.readlist li { display: grid; grid-template-columns: 76px 1fr; padding: 7px 0; border-top: 1px solid var(--line); }
.readlist li span { font-family: 'Literata', Georgia, serif; font-variant-numeric: lining-nums tabular-nums; color: var(--muted); }
/* the home page's Currently Reading row: a slim bar and the percentage under the cover */
.cprog { display: block; margin: 6px 0 2px; }
.row .card .cprog .pbar { height: 5px; margin-top: 0; }
.cprog small { display: block; margin-top: 3px; font: 12px var(--ui); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- dashboard form: progress and reads (added 18 November 2026) ---------- */
.prog-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s2); }
.prog-inputs .mini { display: grid; gap: 4px; font: 13px var(--ui); color: var(--muted); }
.prog-inputs .mini[hidden] { display: none; }
.read-rows { list-style: none; margin: var(--s1) 0; padding: 0; }
.read-rows li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 76px 40px; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.read-rows li:last-child { border-bottom: 1px solid var(--line); }
.read-rows li.none { display: block; font: 14px var(--ui); color: var(--muted); }
.read-rows .rn { font-family: 'Literata', Georgia, serif; font-variant-numeric: lining-nums tabular-nums; color: var(--muted); }
.read-rows .or { font: 13px var(--ui); color: var(--muted); }
.read-rows .icon-x { padding: 6px 0; width: 40px; font-size: 18px; line-height: 1; }
.read-btns { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }
.read-btns [hidden] { display: none; }
@media (max-width: 480px) {
  .read-rows li { grid-template-columns: 36px minmax(0, 1fr) 64px 40px; }
  .read-rows .or { display: none; }
}

/* ---------- Tools: Series from a list (added 19 November 2026) ---------- */
.sl-paste { width: 100%; min-height: 190px; font: 13px/1.45 var(--ui); padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); resize: vertical; }
.sl-name { margin-top: var(--s2); }
.sl-title { margin: 0 0 4px; }
.sl-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 12px; font: 14px var(--ui); color: var(--muted); }
.sl-sum b { color: var(--ink); font-family: 'Literata', Georgia, serif; font-variant-numeric: lining-nums tabular-nums; }
.sl-no { font-family: 'Literata', Georgia, serif; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; margin-right: 6px; }
.sl-head2 { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin: 16px 0 0; }
.sl-head2 h3 { margin: 0; font: 600 15px var(--ui); }
.sl-head2 h3 small { display: inline; font-weight: 400; }
.sl-headrow { grid-template-columns: 1fr; }
.sl-pill { display: inline-block; font: 600 11px var(--ui); padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.sl-ok { background: color-mix(in srgb, var(--owned) 14%, transparent); color: var(--owned); }
.sl-warn { background: color-mix(in srgb, var(--buy) 16%, transparent); color: var(--buy); }
.sl-done { background: var(--line); color: var(--muted); }
.sl-same { cursor: default; opacity: .75; }
.sl-tick-done { width: 20px; text-align: center; color: var(--owned); font-weight: 700; }
.sl-miss { list-style: none; margin: 6px 0 0; padding: 0; columns: 2; column-gap: 24px; font: 14px/1.9 var(--ui); color: var(--muted); }
@media (max-width: 600px) { .sl-miss { columns: 1; } }
.sl-rename-text { margin: 0 0 8px; font: 15px/1.5 var(--ui); }
.sl-rename-text strong { font-weight: 600; }

/* ---------- book form: Fill from a saved Goodreads page (added 19 November 2026) ---------- */
.gp-drop { display: flex; gap: 12px; align-items: center; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font: 14px/1.45 var(--ui); color: var(--muted); cursor: pointer; }
.gp-drop b { color: var(--ink); font-weight: 600; }
.gp-drop.over, .gp-drop:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.gp-drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gp-ic { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.gp-card { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 18px; overflow: hidden; background: var(--surface); }
.gp-top { display: flex; gap: 12px; padding: 12px 14px; background: var(--page); border-bottom: 1px solid var(--line); font: 14px/1.45 var(--ui); color: var(--muted); }
.gp-top b { display: block; color: var(--ink); font: 600 16px/1.3 'Literata', Georgia, serif; }
.gp-top b.bn { font-family: 'Noto Serif Bengali', 'Literata', Georgia, serif; }
.gp-cov img { width: 38px; border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.gp-cov-top img { width: 46px; margin: 0; display: block; }
.gp-cov-top:empty { display: none; }
.gp-row { display: grid; grid-template-columns: 22px 92px 1fr; gap: 10px; align-items: start; padding: 10px 14px; border-top: 1px solid var(--line); font: 14px/1.45 var(--ui); cursor: pointer; }
.gp-top + .gp-row, .gp-dup + .gp-row { border-top: 0; }
.gp-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.gp-k { color: var(--muted); }
.gp-v { color: var(--ink); overflow-wrap: anywhere; }
.gp-v small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.gp-chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; margin: 0 4px 4px 0; font-size: 13px; }
.gp-same { padding: 10px 14px; border-top: 1px solid var(--line); font: 13px var(--ui); color: var(--muted); }
.gp-dup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--buy) 10%, transparent); font: 14px/1.45 var(--ui); }
.gp-act { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--page); }
.gp-filled { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
@media (max-width: 600px) { .gp-row { grid-template-columns: 22px 1fr; } .gp-k, .gp-v { grid-column: 2; } }

/* ---------- book form: Fill from a web page, the paste box and the arc name (added 20 November 2026) ---------- */
.gp-drop { margin-bottom: 8px; }
.gp-paste { display: flex; gap: 8px; align-items: stretch; margin: 0 0 16px; }
.gp-paste textarea { flex: 1; min-height: 44px; resize: vertical; font: 14px/1.4 var(--ui); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.gp-paste .btn { align-self: flex-start; }
.gp-arcname { font: 600 14px var(--ui); padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); width: min(100%, 320px); margin-top: 4px; }
.gp-row input.gp-arcname { width: min(100%, 320px); height: auto; margin: 4px 0 0; accent-color: auto; }

/* ---------- book form: Get its issues (added 21 November 2026) ---------- */
.gp-act .gp-issues { margin-right: auto; }
.gi-wrap { padding: 12px 14px; font: 14px/1.45 var(--ui); }
.gi-wrap .progress { margin: 8px 0; }
.gi-title { margin: 0 0 8px; }
.gi-maps { margin: 0 0 10px; }
.gi-maps .hint { margin: 0 0 4px; }
.gi-map { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 4px 0; }
.gi-map span { color: var(--muted); }
.gi-map input { flex: 1; min-width: 180px; font: 600 14px var(--ui); padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.gi-opts .imp-opt { margin: 6px 0; }
.gi-sel { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 8px 0 4px; color: var(--muted); }
.gi-sel select { font: 14px var(--ui); padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.gi-head { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 4px; color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.gi-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); max-height: 460px; overflow: auto; }
.gi-row { border-bottom: 1px solid var(--line); }
.gi-row label { display: grid; grid-template-columns: 22px 40px 1fr; gap: 10px; align-items: start; padding: 8px 2px; cursor: pointer; }
.gi-row.off label { cursor: default; opacity: .65; }
.gi-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.gi-cov { width: 40px; aspect-ratio: 2 / 3; background: var(--line); border-radius: 3px; overflow: hidden; }
.gi-cov img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gi-info b { display: block; font-weight: 600; }
.gi-info .hint { display: block; }
.gi-st { font-style: italic; }
.gi-state { display: inline-block; margin-top: 3px; font-size: 12px; font-weight: 600; }
.gi-new { color: var(--owned); } .gi-fill { color: var(--accent); } .gi-have, .gi-missing { color: var(--muted); }
.gi-prog { margin-top: 10px; }
