/* The screens the spec drew, carried over by the platform before the first
   version was built (screen 1 is public/index.html's main screen; screen 2,
   if any, its <template data-spec-screen="2">). Colours are the design kit's
   tokens, rgb(var(--accent)), so they follow the light and the dark look. */

/* Each screen is one centred column: the phone width it was drawn at grows
   to a readable column on a wider window, never rows and buttons stretched
   across the window. Remove this only for an app that fills the window by
   design, such as a map. */
[data-spec-screen] {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
}

.app {
  background: rgb(var(--ground));
  min-height: 1360px;
  width: 390px;
  color: rgb(var(--fg));
  font-family: ui-serif,Georgia,"Times New Roman",serif;
  position: relative;
  overflow: hidden;
  padding-bottom: 96px;
}

.app * {box-sizing:border-box;margin:0;padding:0}

.sans {
  font-family: system-ui,-apple-system,"Segoe UI",sans-serif;
}

.serif {font-family:ui-serif,Georgia,serif}

.top {
  background: rgb(var(--ground));
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {font-size:28px;line-height:36px;font-weight:700;letter-spacing:-.01em}

.field {display:flex;align-items:center;gap:8px;min-height:44px;border:1px solid rgb(var(--line));background:rgb(var(--surface));border-radius:8px;padding:0 12px;font-size:16px;color:rgb(var(--muted))}

svg {width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex:none}

.sec {padding:0 16px;margin-top:20px}

.h {font-size:20px;line-height:28px;font-weight:600;margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}

.h span {font-size:14px;color:rgb(var(--accent));font-weight:500;min-height:44px;display:flex;align-items:center;font-family:system-ui,sans-serif}

.hero {display:flex;gap:16px;background:rgb(var(--surface));border:1px solid rgb(var(--line));border-radius:12px;padding:16px}

.cv {border-radius:3px 6px 6px 3px;overflow:hidden;position:relative;display:flex;flex-direction:column;box-shadow:0 1px 2px rgb(0 0 0/.15)}

.sp {height:14px;background:rgb(var(--brass));color:rgb(var(--brass-soft));display:flex;align-items:center;justify-content:center}

.sp.no {background:rgb(var(--accent));opacity:.9}

.sp svg {width:36px;height:10px;stroke-width:1.5}

.art {flex:1;padding:10px 8px;display:flex;flex-direction:column;justify-content:space-between;color:#fff;font-size:14px;line-height:18px;font-weight:600;font-family:ui-serif,Georgia,serif}

.art i {font-style:normal;font-size:11px;font-weight:400;opacity:.85}

.hero .cv {width:112px;height:168px}

.meta {display:flex;flex-direction:column;gap:4px;flex:1;font-size:14px;line-height:20px;color:rgb(var(--muted))}

.meta b {font-size:20px;line-height:26px;color:rgb(var(--fg));font-weight:600}

.btns {display:flex;gap:8px;margin-top:auto}

.btn-primary,.btn-secondary {min-height:44px;border-radius:8px;padding:0 14px;display:inline-flex;align-items:center;gap:6px;font-size:16px;font-weight:500;font-family:system-ui,sans-serif}

.btn-primary {background:rgb(var(--accent));color:rgb(var(--on-accent))}

.btn-secondary {border:1px solid rgb(var(--line));background:rgb(var(--surface));color:rgb(var(--fg))}

.chips {display:flex;gap:8px;padding:0 16px;margin-top:4px}

.chip {min-height:44px;padding:0 14px;border-radius:22px;border:1px solid rgb(var(--line));display:flex;align-items:center;font-size:14px;background:rgb(var(--surface))}

.chip.on {background:rgb(var(--fg));color:rgb(var(--ground));border-color:rgb(var(--fg))}

.grid {display:grid;grid-template-columns:repeat(3,1fr);gap:16px 12px}

.grid .cv {height:140px}

.cap {font-size:14px;line-height:20px;margin-top:6px;font-weight:600}

.cap small {display:block;font-size:12px;line-height:16px;color:rgb(var(--muted));font-weight:400}

.player {position:absolute;left:8px;right:8px;bottom:8px;background:rgb(var(--accent));color:rgb(var(--on-accent));border-radius:12px;padding:8px 8px 8px 12px;display:flex;align-items:center;gap:12px}

.player .mini {width:36px;height:48px;border-radius:2px;background:rgb(var(--brass))}

.player .t {flex:1;font-size:14px;line-height:18px}

.player .t small {display:block;opacity:.85;font-size:12px}

.bar {height:3px;background:rgb(255 255 255/.25);border-radius:2px;margin-top:6px}

.bar div {width:38%;height:3px;background:rgb(var(--brass-soft));border-radius:2px}

.pb {width:44px;height:44px;display:flex;align-items:center;justify-content:center}

/* ── The real app: behaviour and states ─────────────────────────────────────
   The drawn screen above is the phone layout; these rules let it fill the
   centred column on a wider window, pin the player, and carry the same
   tokens through the other screens and the loading, empty and error states.
   Colour still comes only from the kit's tokens. */

.app {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  min-height: 100dvh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.app a,
.sheet a { color: inherit; text-decoration: none; }

.app button,
.sheet button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

.app button:disabled { cursor: not-allowed; opacity: .55; }

.app :focus-visible,
.sheet :focus-visible,
.reader :focus-visible {
  outline: 2px solid rgb(var(--focus));
  outline-offset: 2px;
}

.top { position: sticky; top: 0; z-index: 20; }

.brandrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brandrow .brand { font-size: 28px; line-height: 36px; }

.toplink {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: rgb(var(--accent));
}
.toplink-spacer { width: 44px; }

.demo-note {
  font-size: 12px;
  line-height: 16px;
  color: rgb(var(--muted));
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--line));
  border-radius: 6px;
  padding: 6px 10px;
}

.searchfield { display: flex; align-items: center; gap: 8px; color: rgb(var(--muted)); }
.searchfield input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: rgb(var(--fg));
  font-family: inherit;
  font-size: 16px;
  min-height: 40px;
}
.searchfield input::placeholder { color: rgb(var(--muted)); }

/* Covers: the real Gutenberg image sits over a plain raised-paper fallback. */
.cv { background: rgb(var(--raised)); }
.cv img { position: absolute; top: 14px; left: 0; right: 0; bottom: 0; width: 100%; height: calc(100% - 14px); object-fit: cover; display: block; }
.art.plain { background: rgb(var(--raised)); color: rgb(var(--fg)); }
.art.plain span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.art.plain i { color: rgb(var(--muted)); }
.coverlink { display: block; }
.cardcell { min-width: 0; }
.grid .cv { height: auto; aspect-ratio: 2 / 3; }
.grid .cv .art { min-height: 0; }

.cap .req {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: rgb(var(--brass));
}
.shelf-empty { font-size: 14px; color: rgb(var(--muted)); padding: 8px 0 4px; }
.hero .playing { color: rgb(var(--brass)); font-weight: 500; }

.cv.big, .detail-hero .cv { width: 132px; height: 198px; }
.detail-hero { align-items: flex-start; }
.desc { margin-top: 16px; font-size: 16px; line-height: 26px; color: rgb(var(--fg)); }
.sources { margin-top: 12px; font-size: 13px; line-height: 20px; color: rgb(var(--muted)); }
.sources p { margin: 0 0 4px; }
.sources a { color: rgb(var(--accent)); text-decoration: underline; text-underline-offset: 2px; }
.dot { padding: 0 4px; }

.chapter-list { margin-top: 4px; }
.chapter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
}
.chapter-num { flex: none; width: 26px; font-size: 12px; color: rgb(var(--muted)); font-variant-numeric: tabular-nums; }
.chapter-name { flex: 1; min-width: 0; font-size: 14px; line-height: 20px; }
.chapter-time { flex: none; font-size: 12px; color: rgb(var(--muted)); font-variant-numeric: tabular-nums; }
.chapters-block { margin-top: 24px; }

/* Reader: fills the screen, its own light or dark page, text size control. */
.reader {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgb(var(--ground));
  color: rgb(var(--fg));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.reader[data-look="light"] {
  --ground: 246 241 232; --surface: 255 252 246; --raised: 238 231 218;
  --fg: 33 29 38; --muted: 98 90 84; --line: 224 215 198;
  --accent: 35 40 74; --on-accent: 255 255 255;
  --brass: 122 90 24; --brass-soft: 236 222 190;
}
.reader[data-look="dark"] {
  --ground: 23 21 19; --surface: 33 30 27; --raised: 45 41 37;
  --fg: 240 234 222; --muted: 176 166 152; --line: 64 58 51;
  --accent: 170 180 230; --on-accent: 22 26 52;
  --brass: 214 176 96; --brass-soft: 60 46 16;
}
.reader-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgb(var(--ground));
  border-bottom: 1px solid rgb(var(--line));
}
.reader-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
}
.reader-tools { display: flex; gap: 8px; margin-left: auto; }
.reader-tools .chip { background: rgb(var(--surface)); }
.reader-body {
  max-width: 42rem;
  margin-inline: auto;
  padding: 24px 20px calc(80px + env(safe-area-inset-bottom));
  font-family: ui-serif, Georgia, serif;
  line-height: 1.65;
  color: rgb(var(--fg));
}
.reader-body p { margin: 0 0 1em; }
.reader-loading { display: flex; flex-direction: column; gap: 10px; }

/* The full player. */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(var(--ground));
  overflow-y: auto;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
.sheet-inner { width: 100%; max-width: 42rem; margin-inline: auto; padding: 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-cover { display: flex; justify-content: center; margin: 20px 0 12px; }
.sheet-cover .cv { width: 140px; height: 210px; }
.sheet-title { font-size: 22px; line-height: 28px; font-weight: 600; text-align: center; margin: 0 0 4px; }
.sheet .muted { text-align: center; color: rgb(var(--muted)); font-size: 14px; margin: 0; }
.sheet-controls { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 20px 0; }
.sheet-controls .pb {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  border: 1px solid rgb(var(--line));
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-controls .pb.big {
  width: 56px;
  height: 56px;
  background: rgb(var(--accent));
  color: rgb(var(--on-accent));
  border-color: rgb(var(--accent));
}
.sheet-controls .pb span { font-size: 12px; font-weight: 600; }
.speed { display: flex; align-items: center; gap: 12px; margin: 0 auto; max-width: 220px; }
.speed span { font-size: 14px; color: rgb(var(--muted)); }
.sheet-chapters-block { margin-top: 24px; }
.list-row.current { background: rgb(var(--raised)); }

/* Admin. */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border: 1px solid rgb(var(--line));
  background: rgb(var(--surface));
  border-radius: 12px;
}
.stat-num { font-size: 24px; line-height: 32px; font-weight: 700; }
.stat-label { font-size: 12px; line-height: 16px; color: rgb(var(--muted)); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 16px; }
.admin-lang { display: flex; flex-direction: column; flex: 1; min-width: 140px; }
.admin-lang .field { min-height: 44px; }
.import-note { margin-top: 8px; font-size: 14px; line-height: 20px; color: rgb(var(--muted)); }
.admin-log { margin-top: 24px; }
.job-row { align-items: flex-start; }
/* Pipeline strips: a cell per stage, coloured by its status. */
.pl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; font-size: 12px; line-height: 16px; color: rgb(var(--muted)); }
.pl-key { display: inline-flex; align-items: center; gap: 6px; }
.pl-strip { display: flex; gap: 3px; margin-top: 6px; }
.pl-cell { display: inline-block; width: 18px; height: 8px; border-radius: 3px; background: rgb(var(--line)); }
.pl-done { background: rgb(var(--accent)); }
.pl-running { background: rgb(var(--brass)); }
.pl-failed { background: rgb(var(--danger)); }
.pl-skipped { background: rgb(var(--raised)); box-shadow: inset 0 0 0 1px rgb(var(--line)); }
.pl-failed-h { margin-top: 16px; }
.edition-row { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 44px; justify-content: center; padding: 8px 14px; color: rgb(var(--fg)); text-decoration: none; }
.edition-row .chapter-time { font-size: 13px; color: rgb(var(--muted)); }
.job-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; width: 100%; }
.job-main b { font-size: 14px; font-weight: 600; }
.job-main small { font-size: 12px; line-height: 16px; color: rgb(var(--muted)); }
.job-log {
  margin-top: 6px;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
  line-height: 16px;
  color: rgb(var(--muted));
}

/* States and skeletons, at the content's own shape. */
.state-title { font-size: 16px; line-height: 24px; font-weight: 600; color: rgb(var(--fg)); }
.state-body { font-size: 14px; line-height: 20px; color: rgb(var(--muted)); max-width: 38ch; }
.skeleton-hero {
  display: flex;
  gap: 16px;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--line));
  border-radius: 12px;
  padding: 16px;
}
.skeleton-hero .meta { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-cover { width: 112px; height: 168px; border-radius: 4px; flex: none; }
.sk-line { display: block; height: 14px; width: 100%; margin: 4px 0; }
.sk-line.short { width: 55%; }
.sk-line.wide { width: 82%; }
.grid .art.skeleton { min-height: 0; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 20px;
  background: rgb(var(--fg));
  color: rgb(var(--ground));
}

.muted { color: rgb(var(--muted)); }

/* The player is pinned below the content: the app's bottom padding keeps the
   last shelf row clear of it. */
.player {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: min(calc(100% - 16px), 41rem);
  z-index: 30;
}

/* Shelf headings: the title is the heading; only See all takes the link style. */
.h .h-title {
  color: rgb(var(--fg));
  font-size: 20px;
  line-height: 28px;
  min-height: 0;
  font-weight: 600;
  font-family: ui-serif, Georgia, serif;
}
.h .seeall {
  font-size: 14px;
  color: rgb(var(--accent));
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-family: system-ui, sans-serif;
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none !important; }
}

/* ── Review round 1 ─────────────────────────────────────────────────────────
   Tap targets, filled-button labels, spine colours, the player's brass line
   and cover, and the reader's bar and title. */

/* Every header link is a 44 px target without changing its type. */
.toplink {
  min-width: 44px;
  padding: 0 8px;
  justify-content: center;
}

/* The reset above sets links and buttons to `color: inherit`; a filled
   button's label must stay the on-accent token in both looks. */
.app .btn-primary,
.app a.btn-primary,
.sheet .btn-primary,
.reader .btn-primary {
  color: rgb(var(--on-accent));
}
.app .btn-secondary,
.sheet .btn-secondary,
.reader .btn-secondary {
  color: rgb(var(--fg));
}

/* Loading has the content's shape, but no brass: a spine being loaded is
   neutral skeleton grey. */
.sp.skeleton {
  background: rgb(var(--line));
  color: transparent;
}

/* Empty and error blocks breathe, and their heading matches a section. */
.state-empty,
.state-error {
  margin-top: 48px;
  padding-top: 0;
  gap: 16px;
}
.state-title {
  font-family: ui-serif, Georgia, serif;
  font-size: 20px;
  line-height: 28px;
}

/* The player's progress line is brass in both looks. */
.bar div {
  background: rgb(var(--brass-soft));
}
.dark .bar div {
  background: rgb(var(--brass));
}
.player .mini {
  background-size: cover;
  background-position: center;
}

/* The reader's top bar is solid, the title sits above the text, and the
   look control is a two-part switch with the current look selected. */
.reader-bar {
  background: rgb(var(--ground));
  position: sticky;
  top: 0;
  z-index: 2;
}
.reader-book-title {
  font-family: ui-serif, Georgia, serif;
  font-size: 26px;
  line-height: 34px;
  font-weight: 600;
  margin: 0 0 20px;
}
.reader-body {
  padding-top: 20px;
}
.look-toggle {
  display: flex;
  gap: 4px;
}
.look-toggle .chip {
  min-width: 44px;
  justify-content: center;
}

/* The look switch's selected half keeps the chip-on colours, which the
   reader's own chip background rule would otherwise override. */
.reader-tools .chip.on,
.look-toggle .chip.on {
  background: rgb(var(--fg));
  color: rgb(var(--ground));
  border-color: rgb(var(--fg));
}

/* Reader chapters: the chapter's title, then Previous / position / Next. */
.reader-chapter-title { font-size: 1.35em; line-height: 1.3; margin: 0 0 1em; }
.reader-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2em 0 1em; padding-top: 1em; border-top: 1px solid rgb(var(--line)); }
.reader-nav .btn-secondary:disabled { opacity: 0.45; }
.reader-pos { font-size: 14px; color: rgb(var(--muted)); text-align: center; }

/* ── Explore: filters, genres, collections (roadmap step 6) ─────────────── */
.chips.scroll {
  position: relative;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  margin-top: 8px;
}
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; white-space: nowrap; }
.chip-sep {
  flex: none;
  width: 1px;
  margin: 8px 2px;
  background: rgb(var(--line));
}
.chip.picked { gap: 6px; }
.chip.picked svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) {
  .genre-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.genre-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 76px;
  padding: 10px 10px 10px 14px;
  border-radius: 12px;
  border: 1px solid rgb(var(--line));
  background: rgb(var(--surface));
  overflow: hidden;
}
.genre-text { display: flex; flex-direction: column; min-width: 0; }
.genre-name {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.genre-count { font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }
.genre-tile img {
  flex: none;
  width: 38px;
  height: 56px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transform: rotate(4deg);
}

.shelf-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 24px) / 3);
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-row .cardcell { scroll-snap-align: start; }
.shelf-row .cv { height: auto; aspect-ratio: 2 / 3; }
.shelf-row .cv .art { min-height: 0; }
@media (min-width: 640px) {
  .shelf-row { grid-auto-columns: calc((100% - 48px) / 5); }
}

.more-row { display: flex; justify-content: center; margin: 20px 0 8px; }

/* Admin: collections */
.coll-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.coll-form .field { flex: 1 1 12rem; min-width: 0; }
.coll-works { margin: 8px 0 0; padding: 0; list-style: none; }
.coll-work {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}
.coll-delete { margin-top: 4px; }

/* ── Book page (roadmap step 7) ─────────────────────────────────────────── */
.book-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.book-cover { width: 180px; height: 270px; flex: none; box-shadow: 0 6px 18px rgb(0 0 0 / 0.22); }
.book-cover img { top: 0; height: 100%; }
.type-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  stroke: none;
  font-family: ui-serif, Georgia, serif;
}
.book-meta { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.book-title { font-size: 26px; line-height: 32px; font-weight: 600; margin: 0; color: rgb(var(--fg)); }
.book-author { margin: 0; font-size: 16px; line-height: 22px; color: rgb(var(--fg)); }
.book-author .years { color: rgb(var(--muted)); }
.book-facts { margin: 0; font-size: 14px; line-height: 20px; color: rgb(var(--muted)); }
/* Book ratings (request #72): a plain row under the book's details, not a
   card. Five 44 px star buttons, filled in amber up to the one tapped. */
.rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}
.rate-stars { display: flex; }
.rate-star {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}
.rate-star svg { width: 28px; height: 28px; fill: none; stroke: rgb(var(--muted)); stroke-width: 1.6; stroke-linejoin: round; }
.rate-star.on svg { fill: rgb(var(--amber)); stroke: rgb(var(--brass)); }
.dark .rate-star.on svg { fill: rgb(var(--brass)); stroke: rgb(var(--brass)); }
.rating-note { font-size: 14px; line-height: 20px; color: rgb(var(--muted)); text-align: center; }
.rating-note strong { color: rgb(var(--fg)); font-weight: 800; }
.rating-retry {
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 800;
  color: rgb(var(--accent));
  text-decoration: underline;
}
@media (hover: hover) {
  .rate-star:hover svg,
  .rate-star:has(~ .rate-star:hover) svg { fill: rgb(var(--amber)); stroke: rgb(var(--brass)); }
  .dark .rate-star:hover svg,
  .dark .rate-star:has(~ .rate-star:hover) svg { fill: rgb(var(--brass)); stroke: rgb(var(--brass)); }
}
@media (prefers-reduced-motion: no-preference) {
  .rate-star svg { transition: transform 120ms ease; }
  .rate-star:active svg { transform: scale(.9); }
}
@media (min-width: 640px) {
  .rating { flex-direction: row; align-items: center; gap: 12px; }
  .rating-note { text-align: left; }
}
.narration {
  margin: 2px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  font-size: 14px;
  line-height: 20px;
  color: rgb(var(--muted));
}
.origin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgb(var(--line));
  color: rgb(var(--fg));
  background: rgb(var(--surface));
}
.narration[data-origin="ai"] .origin-badge {
  background: rgb(var(--accent));
  color: rgb(var(--on-accent));
  border-color: transparent;
}
.book-actions { margin-top: 10px; justify-content: center; }
.h .h-note { font-size: 13px; color: rgb(var(--muted)); font-weight: 400; min-height: 0; font-family: system-ui, sans-serif; }
a.chapter-row { color: inherit; text-decoration: none; }
@media (min-width: 640px) {
  .book-head { flex-direction: row; align-items: flex-start; text-align: left; gap: 24px; }
  .book-cover { width: 200px; height: 300px; }
  .book-meta, .narration { align-items: flex-start; justify-content: flex-start; }
  .book-actions { justify-content: flex-start; }
}

/* ── Reader (roadmap step 8): sepia, typeface, settings, contents, progress ─ */
.reader[data-look="sepia"] {
  --ground: 244 236 216; --surface: 250 244 228; --raised: 236 226 200;
  --fg: 58 44 30; --muted: 104 86 64; --line: 222 206 176;
  --accent: 92 62 26; --on-accent: 255 250 240;
  --brass: 122 90 24; --brass-soft: 236 222 190;
}
/* A comfortable line: about 65 characters, whatever the text size. */
.reader-body { max-width: min(34em, 100%); }
.reader[data-family="sans"] .reader-body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.6; }
.reader[data-family="sans"] .reader-chapter-title { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

.reader-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: transparent;
}
.reader-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: rgb(var(--fg));
  opacity: 0.55;
}

.reader-panel {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 4px;
}
.panel-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-label { width: 72px; flex: none; font-size: 13px; color: rgb(var(--muted)); font-family: system-ui, sans-serif; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.reader-panel .chip { min-width: 44px; justify-content: center; font-family: system-ui, sans-serif; }
.reader-panel .size-step { width: 44px; padding: 0; font-family: ui-serif, Georgia, serif; }
.reader-panel .family-serif { font-family: ui-serif, Georgia, serif; }
.reader-panel .chip.on {
  background: rgb(var(--fg));
  color: rgb(var(--ground));
  border-color: rgb(var(--fg));
}

.reader-toc {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 0.35);
}
.reader-toc[hidden] { display: none; }
.reader-toc-card {
  width: min(100%, 36rem);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: rgb(var(--ground));
  color: rgb(var(--fg));
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) {
  .reader-toc { align-items: center; }
  .reader-toc-card { border-radius: 16px; }
}
.reader-toc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.reader-toc-head h2 { margin: 0; font-size: 20px; }
.reader-toc-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.toc-row {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  text-align: left;
  border-bottom: 1px solid rgb(var(--line));
  color: rgb(var(--fg));
  font-family: system-ui, sans-serif;
}
.toc-row.here { font-weight: 600; }
.toc-row.here .chapter-num { color: rgb(var(--fg)); }

.continue-note { margin: 8px 0 0; font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }

/* ── Player (roadmap step 9) ────────────────────────────────────────────── */
/* The mini player stays above the reader while reading along, and the full
   player above both. */
.player { z-index: 75; }
.sheet { z-index: 85; }
.sheet-actions { display: flex; justify-content: center; margin: 4px 0 16px; }
.sleep-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}
.sleep-title { font-size: 14px; color: rgb(var(--muted)); }
.sleep-row .chip-row { justify-content: center; }
.sleep-row .chip { font-size: 13px; }
.sleep-row .chip.on { background: rgb(var(--fg)); color: rgb(var(--ground)); border-color: rgb(var(--fg)); }
.sleep-left { min-height: 18px; font-size: 13px; color: rgb(var(--muted)); }
.pb.buffering svg { animation: vt-pulse 1s ease-in-out infinite; }
@keyframes vt-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pb.buffering svg { animation: none; opacity: 0.5; } }

/* ── Home (roadmap step 10) ─────────────────────────────────────────────── */
/* Rows scroll sideways on a phone and become a grid on a wide screen. Every
   cover box has its shape before its image arrives, and captions keep a
   fixed two lines, so nothing moves while the page fills in. */
.home-shelf .cap { height: 56px; overflow: hidden; }
.home-shelf .cap small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.featured-row .home-shelf { grid-auto-columns: calc((100% - 12px) / 2.2); }
@media (min-width: 640px) {
  .featured-row .home-shelf { grid-auto-columns: calc((100% - 36px) / 3.4); }
}
@media (min-width: 900px) {
  .home-shelf {
    grid-auto-flow: row;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow: visible;
  }
  .featured-row .home-shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home-shelf > .cardcell:nth-child(n + 13) { display: none; }
  .featured-row .home-shelf > .cardcell:nth-child(n + 9) { display: none; }
}
button.coverlink {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: inherit;
  cursor: pointer;
}
.continue-cell .cap small { color: rgb(var(--brass)); }

/* ── Admin: imports (roadmap step 11) ───────────────────────────────────── */
.import-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 12px; margin: 8px 0 16px; }
.import-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: rgb(var(--muted)); border: 0; padding: 0; margin: 0; }
.import-langs { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
.import-langs legend { width: 100%; padding: 0; margin-bottom: 4px; }
.import-langs label { display: flex; align-items: center; gap: 6px; min-height: 44px; color: rgb(var(--fg)); font-size: 15px; }
.import-buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.import-schedule { display: flex; gap: 8px; }
.admin-sub { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
.run-counts { color: rgb(var(--fg)); }
.run-items { margin-top: 8px; }
.run-item-list { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 20px; max-height: 18rem; overflow-y: auto; }
.run-item-list small { color: rgb(var(--muted)); }
.run-outcome { display: inline-block; min-width: 6.5em; font-weight: 600; }
.run-item-list [data-outcome="failed"] .run-outcome { color: #b42318; }
@media (prefers-color-scheme: dark) { .run-item-list [data-outcome="failed"] .run-outcome { color: #f97066; } }

/* ── My Library and bookmarks (roadmap step 12) ─────────────────────────── */
.toplinks { display: flex; gap: 4px; align-items: center; }
.lib-actions { margin-top: 4px; }
.lib-actions .chip { min-height: 36px; font-size: 13px; padding: 0 10px; }
#reader-bookmark-btn svg { width: 18px; height: 18px; }
.bm-form { display: flex; gap: 8px; flex-wrap: wrap; }
.bm-form .field { flex: 1 1 12rem; min-width: 0; }
.bm-list { list-style: none; margin: 8px 0 0; padding: 0; }
.bm-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgb(var(--line)); }
.bm-go {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  color: inherit;
  text-decoration: none;
  font-family: system-ui, sans-serif;
  font-size: 14px;
}
.bm-go small { color: rgb(var(--muted)); font-size: 12px; }
.panel-empty { margin: 8px 0 0; font-size: 13px; color: rgb(var(--muted)); font-family: system-ui, sans-serif; }

/* ── Wikisource credit (roadmap step 19) ────────────────────────────────── */
.reader-credit { margin: 2em 0 0; font-size: 0.75em; line-height: 1.5; color: rgb(var(--muted)); font-family: system-ui, sans-serif; }
.reader-credit a { color: inherit; text-decoration: underline; }
.wikisource-form { border-top: 1px solid rgb(var(--line)); padding-top: 12px; }

/* ── Offline downloads (roadmap step 20) ────────────────────────────────── */
.download-panel { margin-top: 12px; padding: 12px; border: 1px solid rgb(var(--line)); border-radius: 12px; background: rgb(var(--surface)); }
.dl-size { margin: 0 0 8px; font-size: 14px; line-height: 20px; color: rgb(var(--muted)); }
.dl-warn { margin: 0 0 8px; font-size: 14px; line-height: 20px; color: #b42318; }
.dl-progress { height: 6px; border-radius: 3px; background: rgb(var(--raised)); overflow: hidden; margin-bottom: 8px; }
.dl-progress i { display: block; height: 100%; background: rgb(var(--accent)); transition: width 0.2s; }
.dl-btn.is-done { color: rgb(var(--muted)); }
@media (prefers-color-scheme: dark) { .dl-warn { color: #f97066; } }

/* ── Admin dashboard (roadmap step 22) ──────────────────────────────────── */
.admin-tabs { padding: 0; margin-top: 8px; }
/* The selected tab keeps .chip.on's colours (same specificity, so this
   rule must not reach it: it once left the selected label invisible). */
.admin-tabs .chip { text-decoration: none; }
.admin-tabs .chip:not(.on) { color: inherit; }
.overview-stats { flex-wrap: wrap; }
.overview-stats a.stat { text-decoration: none; color: inherit; }
.pager { justify-content: center; margin: 16px 0; }
.job-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.job-table th, .job-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid rgb(var(--line)); }
.job-table td:not(:first-child), .job-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.rights-bulk { margin: 8px 0 12px; }

/* Text and audio in step (roadmap steps 16 to 18). While the chapter's
   recording plays, the sentence being read is tinted with the look's
   brass-soft and, with karaoke on, the word under it is underlined in
   brass. Tokens only, so the light, sepia and dark looks all follow. */
.has-sync .sync-s { border-radius: 3px; transition: background-color .15s ease; }
.has-sync.is-listening .sync-s[data-act] { cursor: pointer; }
.sync-s.is-now { background: rgb(var(--brass-soft) / .55); box-shadow: 0 0 0 2px rgb(var(--brass-soft) / .55); }
.sync-w.is-now { text-decoration: underline; text-decoration-color: rgb(var(--brass)); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.reader[data-look="dark"] .sync-s.is-now { background: rgb(var(--brass) / .35); box-shadow: 0 0 0 2px rgb(var(--brass) / .35); }
@media (prefers-reduced-motion: reduce) { .has-sync .sync-s { transition: none; } }
.sync-unsure { color: rgb(var(--brass)); }
.sync-transcript { max-height: 8rem; overflow: hidden; }
.sync-text { min-height: 12rem; font-family: ui-serif, Georgia, serif; line-height: 1.5; resize: vertical; }

/* AI narration (roadmap steps 14, 15): said on the spine, on cards, and on
   the book page with its voice, engine and progress. */
.sp.ai { gap: 4px; }
.sp .sp-ai {
  font: 700 9px/10px ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .04em;
  color: rgb(var(--surface));
  background: rgb(var(--brass-soft));
  border-radius: 2px;
  padding: 0 3px;
}
.cap .ai-tag {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: rgb(var(--muted));
}
.narration-detail {
  margin-top: 4px;
  font-size: 13px;
  line-height: 18px;
  color: rgb(var(--muted));
}
.narration-detail small { display: block; font-size: 12px; }
.narration-bar {
  display: block;
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: rgb(var(--line));
  overflow: hidden;
}
.narration-bar i { display: block; height: 100%; background: rgb(var(--brass)); }
.narration-paused { color: rgb(var(--accent)); }
.book-narration-admin { margin-top: 12px; }

/* ── The ViaTales look (request #46) ────────────────────────────────────────
   One layout and one set of components in two looks: only the tokens in
   styles/tailwind-input.css change between light and dark. Lora for titles,
   Nunito for everything else, both served from /fonts. Rounded cards (20 to
   28 px), soft shadows, 44 px targets. These rules come last and win over
   the starter's rules above. */

@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url('/fonts/lora.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 500 600;
  font-display: swap;
  src: url('/fonts/lora-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
  src: url('/fonts/nunito.woff2') format('woff2');
}

body { background: rgb(var(--ground)); }

.app,
.sheet,
.reader,
.toast,
.sans,
.btn-primary,
.btn-secondary,
.h span,
.h .seeall,
.h .h-note,
.panel-label,
.toc-row,
.bm-go,
.reader-credit,
.reader-panel .chip,
.panel-empty {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.serif,
.h .h-title,
.art,
.state-title,
.reader-body,
.reader-book-title,
.reader-chapter-title,
.type-cover,
.genre-name,
.sync-text,
.reader-panel .family-serif,
.reader-panel .size-step {
  font-family: 'Lora', ui-serif, Georgia, serif;
}
.reader[data-family="sans"] .reader-body,
.reader[data-family="sans"] .reader-chapter-title {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The page fills the window; each screen's content sits in one 1280 px
   column, with 20 px sides on a phone and 48 px on a wide window. */
[data-spec-screen],
.app {
  max-width: none;
}
.app {
  overflow: visible;
  padding-bottom: calc(152px + env(safe-area-inset-bottom));
}
#view { max-width: 80rem; margin-inline: auto; }
.sec { padding: 0 20px; margin-top: 28px; }
.top { padding: 16px 20px 8px; }
.chips { padding: 0 20px; }
.top .chips { padding: 0; }
@media (min-width: 768px) {
  .app { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  .sec { padding: 0 48px; margin-top: 36px; }
  .top { padding: 8px 48px 4px; position: static; }
  .chips { padding: 0 48px; }
  .brand-dup { visibility: hidden; }
}

/* ── The top bar (wide windows) and the tab bar (phones) ── */
.appbar { display: none; }
@media (min-width: 768px) {
  .appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 80rem;
    margin-inline: auto;
    padding: 16px 48px;
    background: rgb(var(--ground));
  }
}
.appbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgb(var(--accent));
  color: rgb(var(--on-accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-mark svg { width: 18px; height: 18px; stroke-width: 2.4; }
.appbar-links { display: flex; gap: 4px; }
.appbar-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  color: rgb(var(--muted));
}
.appbar-link svg { width: 18px; height: 18px; stroke-width: 2.2; }
.appbar-link:hover { color: rgb(var(--fg)); }
.appbar-link[aria-current="page"] { background: rgb(var(--raised)); color: rgb(var(--fg)); }
.appbar-search {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  width: min(280px, 30vw);
  padding: 0 16px;
  border-radius: 999px;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  color: rgb(var(--muted));
}
.appbar-search svg { width: 16px; height: 16px; stroke-width: 2.4; }
.appbar-search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 65;
  display: flex;
  align-items: stretch;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  background: rgb(var(--surface));
  border-top: 1px solid rgb(var(--line));
}
.tab {
  flex: 1;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgb(var(--muted));
}
.tab svg { width: 22px; height: 22px; stroke-width: 2.2; }
.tab[aria-current="page"] { color: rgb(var(--accent)); }
@media (min-width: 768px) {
  .tabbar { display: none; }
}

/* ── Home: greeting, language control, hero, tiles ── */
.home-top { gap: 14px; }
.greet { display: flex; flex-direction: column; gap: 2px; }
.greet-hi { font-size: 13px; font-weight: 800; color: rgb(var(--muted)); }
.greet-title { font-size: 26px; line-height: 1.1; font-weight: 600; color: rgb(var(--fg)); }
/* The language control and With audio share one line: on a phone the row
   scrolls sideways instead of dropping the audio chip to a second line
   (request #68). The padding keeps a focused button's outline off the edge. */
.home-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin: -5px 0;
  padding: 5px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.home-tools::-webkit-scrollbar { display: none; }
.home-tools > * { flex: none; }
.home-tools .seg button { white-space: nowrap; }
/* Tighter on a phone so all four filters fit one line at 390 px; a narrower
   window scrolls the row instead (the chips cut at the edge show it does). */
@media (max-width: 480px) {
  .home-tools { gap: 8px; }
  .home-tools .seg button { padding: 0 12px; font-size: 13px; }
  .home-tools .chip { padding: 0 12px; }
}
@media (max-width: 380px) {
  .home-tools .seg button,
  .home-tools .chip { padding: 0 8px; }
}
@media (min-width: 768px) {
  .home-top { flex-direction: row; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
  .home-top .demo-note { flex-basis: 100%; }
  .greet-title { font-size: 34px; }
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgb(var(--raised));
}
.seg button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: rgb(var(--muted));
}
.app .seg button { color: rgb(var(--muted)); }
.app .seg button.on { background: rgb(var(--fg)); color: rgb(var(--ground)); }

.chip {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgb(var(--raised));
  font-size: 13px;
  font-weight: 700;
  color: rgb(var(--fg));
}
.chip.on,
.reader-tools .chip.on,
.look-toggle .chip.on,
.reader-panel .chip.on,
.sleep-row .chip.on {
  background: rgb(var(--fg));
  color: rgb(var(--ground));
  border-color: transparent;
}
.mood-chips { padding: 0; margin-top: 0; }

.home-hero-row { display: grid; gap: 16px; margin-top: 20px; }
@media (min-width: 900px) {
  .home-hero-row:has(.side-col > *) { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
}
.hero-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  background: rgb(var(--hero-bg));
  color: rgb(var(--hero-fg));
  box-shadow: var(--shadow);
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(70% 90% at 15% 50%, var(--hero-glow), transparent 70%);
}
.hero-card.skeleton-hero { background: rgb(var(--surface)); border: 0; }
.hero-cover { flex: none; }
.hero-cover .cv { width: 96px; height: 144px; border-radius: 12px; box-shadow: 0 14px 24px -14px rgb(0 0 0 / 0.6); }
.hero-meta { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.hero-eyebrow { font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.hero-title { font-size: 22px; line-height: 1.08; font-weight: 600; }
.hero-line { font-size: 13px; line-height: 1.45; }
.hero-card .wave { height: 30px; max-width: 420px; }
.hero-card .wave span { background: var(--hero-wave-off); }
.hero-card .wave span.on { background: rgb(var(--hero-wave)); }
.hero-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.app .hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: rgb(var(--hero-btn));
  color: rgb(var(--hero-btn-fg));
  font-size: 14px;
  font-weight: 900;
}
.hero-btn svg { width: 14px; height: 14px; fill: currentColor; }
.app .hero-btn.ghost { background: transparent; color: rgb(var(--hero-fg)); box-shadow: inset 0 0 0 2px var(--hero-dim); }
.hero-pct { margin-left: auto; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 559px) {
  .hero-card { flex-wrap: wrap; }
  .hero-meta { flex-basis: calc(100% - 112px); }
  .hero-card .wave,
  .hero-btns { flex-basis: 100%; }
  .hero-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
  .hero-meta { display: contents; }
  .hero-cover { grid-row: 1 / span 3; }
  .hero-eyebrow, .hero-title, .hero-line { grid-column: 2; }
  .hero-card .wave, .hero-btns { grid-column: 1 / -1; }
  .hero-btns .hero-btn { flex: 1; }
}
@media (min-width: 768px) {
  .hero-card { gap: 32px; padding: 36px 40px; border-radius: 28px; }
  .hero-cover .cv { width: 150px; height: 222px; border-radius: 16px; }
  .hero-title { font-size: 40px; }
  .hero-line { font-size: 15px; }
  .hero-card .wave { height: 40px; }
  .app .hero-btn { min-height: 48px; padding: 0 22px; font-size: 15px; }
}

.wave { display: flex; align-items: flex-end; gap: 3px; width: 100%; }
.wave span { flex: 1; border-radius: 2px; background: rgb(var(--line)); }
.wave span.on { background: rgb(var(--accent)); }

.side-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 22px;
  border: 0;
  border-radius: 24px;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
  text-align: left;
}
.side-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgb(var(--raised));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.side-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-title { font-size: 14px; font-weight: 900; }
.side-sub { font-size: 12px; font-weight: 600; color: rgb(var(--muted)); }

/* Section headings: Lora, with the link in the accent. */
.h { margin-bottom: 14px; align-items: baseline; }
.h .h-title { font-size: 20px; line-height: 1.2; font-weight: 600; }
.h .seeall { font-size: 14px; font-weight: 700; color: rgb(var(--accent)); }
@media (min-width: 768px) {
  .h .h-title { font-size: 24px; }
}

/* Book tiles: a white (light) or navy (dark) card around the cover. */
.cardcell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
}
.cv { border-radius: 12px; box-shadow: none; }
.cardcell .cap { margin-top: 0; font-size: 14px; line-height: 1.3; font-weight: 700; color: rgb(var(--fg)); }
/* A long title stops at two lines (#53): the card, and the row it sits in,
   stay as tall as its neighbours. The full name is in the span's title. */
.cardcell .cap-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.cardcell .cap small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap small { margin-top: 2px; font-size: 12px; line-height: 16px; font-weight: 600; color: rgb(var(--muted)); }
.cap .cap-facts { font-weight: 700; }
.home-shelf .cap { height: auto; min-height: 70px; }
.continue-cell .cap small { color: rgb(var(--muted)); }
.continue-cell .cap { min-height: 52px; }
/* A Continue card's X: a 44px tap area around a 28px chip on the cover. */
.continue-cell { position: relative; }
.continue-remove {
  position: absolute; top: 22px; right: 8px;
  width: 44px; height: 44px; padding: 0;
  border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.continue-remove span {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgb(var(--surface)); box-shadow: var(--shadow);
}
.continue-remove svg { width: 14px; height: 14px; stroke: rgb(var(--fg)); stroke-width: 2.4; fill: none; stroke-linecap: round; }
.tile-bar { display: block; height: 5px; border-radius: 3px; background: rgb(var(--raised)); overflow: hidden; }
.tile-bar i { display: block; height: 100%; border-radius: 3px; background: rgb(var(--accent)); }
.shelf-row { grid-auto-columns: 140px; gap: 14px; padding: 4px 2px 12px; scroll-padding-inline: 2px; }
.featured-row .home-shelf { grid-auto-columns: 180px; }
@media (min-width: 640px) {
  .shelf-row { grid-auto-columns: 168px; gap: 16px; }
  .featured-row .home-shelf { grid-auto-columns: 210px; }
}
@media (min-width: 900px) {
  .home-shelf { grid-auto-columns: auto; }
}
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }

/* Lists, cards, fields and buttons follow the same rounded language. */
.list { border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.card,
.stat,
.genre-tile,
.download-panel { border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.demo-note { border: 0; border-radius: 12px; }
.app .btn-primary,
.app .btn-secondary,
.sheet .btn-primary,
.sheet .btn-secondary,
.reader .btn-primary,
.reader .btn-secondary {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
}
.btn-secondary { border-color: rgb(var(--line)); }
.field,
.searchfield { border: 0; border-radius: 999px; background: rgb(var(--surface)); box-shadow: var(--shadow); padding: 0 16px; }
select.field { border-radius: 14px; }

/* The book page. */
.book-cover { border-radius: 16px; box-shadow: 0 20px 30px -18px rgb(0 0 0 / 0.55); }
.book-title { font-size: 30px; line-height: 1.1; }
.origin-badge { border-radius: 999px; min-height: 26px; font-weight: 800; }
/* The AI summary, under the description (request #58). */
.summary {
  margin-top: 24px;
  max-width: 760px;
  padding: 20px 24px;
  border-radius: 20px;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
}
.summary-label {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(var(--muted));
}
.summary-title {
  font-family: 'Lora', ui-serif, Georgia, serif;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  margin-top: 2px;
  color: rgb(var(--fg));
}
.summary-text {
  font-family: 'Lora', ui-serif, Georgia, serif;
  font-size: 17px;
  line-height: 28px;
  margin-top: 8px;
  color: rgb(var(--fg));
}
.summary-none { font-size: 15px; line-height: 24px; margin-top: 6px; color: rgb(var(--muted)); }
.summary-listen { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.summary-credit { font-size: 13px; color: rgb(var(--muted)); }
.summary .skeleton { display: block; margin-top: 8px; }
.summary .btn-secondary:disabled { opacity: 0.55; }
/* The reader's own private note (request #50), under the AI summary. */
.note-hint { font-size: 14px; line-height: 20px; color: rgb(var(--muted)); margin-top: 2px; }
.note-field-label {
  display: block;
  margin-top: 12px;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: rgb(var(--fg));
}
.note-field {
  display: block;
  width: 100%;
  min-height: 112px;
  margin-top: 6px;
  border-radius: 16px;
  background: rgb(var(--ground));
  padding: 12px 16px;
  font-family: 'Lora', ui-serif, Georgia, serif;
  font-size: 16px;
  line-height: 26px;
  color: rgb(var(--fg));
  resize: vertical;
}
.note-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.note-spacer { flex: 1; }
.note-count, .note-when { font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }
.note-remove, .note-retry {
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 800;
  color: rgb(var(--accent));
  text-decoration: underline;
}
.note-snip {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-family: 'Lora', ui-serif, Georgia, serif;
  font-size: 14px;
  line-height: 20px;
  color: rgb(var(--fg));
}
@media (min-width: 640px) {
  .book-title { font-size: 40px; }
}

/* ── The mini player: a rounded card docked at the bottom, above the tab
   bar on a phone. ── */
.player {
  bottom: calc(64px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 74rem);
  padding: 8px 8px 8px 8px;
  gap: 10px;
  border-radius: 16px;
  background: rgb(var(--surface));
  color: rgb(var(--fg));
  box-shadow: 0 16px 32px -14px rgb(0 0 0 / 0.4), 0 0 0 1px rgb(var(--line));
}
body:has(.reader) .player { bottom: calc(8px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) {
  .player { bottom: calc(16px + env(safe-area-inset-bottom)); padding: 10px 14px 10px 10px; gap: 14px; border-radius: 20px; }
}
.player .mini { flex: none; width: 38px; height: 50px; border-radius: 9px; background-color: rgb(var(--raised)); }
.player .t { flex: 1 1 140px; min-width: 0; font-size: 13px; line-height: 1.3; }
#p-title { display: block; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .t small { display: block; font-size: 11px; font-weight: 600; color: rgb(var(--muted)); opacity: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .bar { display: none; height: 6px; margin: 0; border-radius: 3px; background: rgb(var(--raised)); overflow: hidden; }
.player .bar div,
.dark .player .bar div { width: 0; height: 100%; border-radius: 3px; background: rgb(var(--accent)); }
@media (min-width: 768px) {
  .player .t { font-size: 14px; }
  .player .t small { font-size: 12px; }
  .player .bar { display: block; flex: 3 1 200px; }
}
.player .pb { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: rgb(var(--muted)); }
/* A skip button stays a 44 px tap target with its 15 unchanged in size. */
.player .pb.soft { width: 44px; height: 44px; background: rgb(var(--raised)); color: rgb(var(--fg)); font-size: 11px; font-weight: 900; }
.player #p-toggle { background: rgb(var(--accent)); color: rgb(var(--on-accent)); }
/* The hero's Listen is the dark look's one filled amber pill, so the mini
   player's play button is the outlined secondary there. */
.dark .player #p-toggle { background: transparent; color: rgb(var(--fg)); box-shadow: inset 0 0 0 1px rgb(var(--line)); }
#p-toggle svg,
.sheet-controls .pb.big svg { fill: currentColor; stroke-width: 2.4; }
@media (max-width: 420px) {
  .player #p-forward { display: none; }
}

.toast { bottom: calc(142px + env(safe-area-inset-bottom)); border-radius: 12px; font-weight: 700; }
@media (min-width: 768px) {
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
}

/* ── The full player ── */
.sheet {
  background:
    radial-gradient(90% 40% at 50% 0%, rgb(var(--accent) / 0.12), transparent 70%),
    rgb(var(--ground));
  color: rgb(var(--fg));
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}
.sheet-inner { max-width: 32rem; padding: calc(12px + env(safe-area-inset-top)) 20px 0; }
.sheet-head { align-items: center; }
.ico-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ico-spacer { width: 44px; }
.sheet-label { font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(var(--muted)); }
.sheet-cover { margin: 18px 0 14px; }
.sheet-cover .cv { width: 170px; height: 252px; border-radius: 18px; box-shadow: 0 30px 44px -22px rgb(0 0 0 / 0.6); }
@media (min-height: 800px) {
  .sheet-cover .cv { width: 196px; height: 290px; }
}
.sheet-titles { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.sheet-eyebrow { font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(var(--accent)); }
.sheet-title { font-size: 26px; line-height: 1.12; font-weight: 600; margin: 0; }
.sheet .sheet-titles .muted { font-size: 13px; font-weight: 600; }
.scrub { position: relative; margin-top: 20px; border-radius: 8px; }
.scrub .wave { height: 56px; }
.scrub input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.scrub input:disabled { cursor: default; }
.scrub:has(input:focus-visible) { outline: 2px solid rgb(var(--focus)); outline-offset: 4px; }
.scrub-times { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; font-weight: 700; color: rgb(var(--muted)); font-variant-numeric: tabular-nums; }
.sheet-controls { gap: 14px; margin: 16px 0 18px; }
.sheet-controls .pb {
  width: 48px;
  height: 48px;
  border: 0;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
}
.sheet-controls .pb span { font-size: 12px; font-weight: 900; }
.sheet-controls .pb.flat { background: transparent; box-shadow: none; }
.sheet-controls .pb.flat svg { fill: currentColor; }
.sheet-controls .pb.big {
  width: 72px;
  height: 72px;
  background: rgb(var(--accent));
  color: rgb(var(--on-accent));
  box-shadow: 0 16px 28px -12px rgb(var(--accent) / 0.6);
}
.sheet-controls .pb.big svg { width: 26px; height: 26px; }
.sheet-actions { flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgb(var(--raised));
  color: rgb(var(--fg));
  font-size: 13px;
  font-weight: 800;
}
.pill svg { width: 16px; height: 16px; stroke-width: 2.2; }
.pill-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  min-height: 44px;
  padding: 0 4px;
  cursor: pointer;
}
.sleep-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.sleep-title svg { width: 16px; height: 16px; }
.sleep-row .chip { min-height: 40px; font-size: 12px; }
.sheet-chapters-block {
  margin-top: 20px;
  padding: 14px 18px 4px;
  border-radius: 22px 22px 0 0;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
}
.sheet-chapters-block .h { margin-bottom: 4px; }
.sheet-chapters-block .h .h-title { font-size: 17px; }
.sheet-chapters { position: relative; max-height: min(50vh, 26rem); overflow-y: auto; border-radius: 0; box-shadow: none; background: transparent; }
.sheet-chapters .list-row { padding: 0; border-top: 1px solid rgb(var(--line)); }
.sheet-chapters .chapter-row { font-weight: 700; }
.list-row.current { background: transparent; }
.list-row.current .chapter-row,
.list-row.current .chapter-num,
.list-row.current .chapter-time { color: rgb(var(--accent)); }

/* ── The reader: the same tokens; Light, Dark and Sepia stay its own
   choice and win over the platform theme once picked. ── */
.reader[data-look="light"] {
  --ground: 251 247 240; --surface: 255 255 255; --raised: 240 233 221;
  --fg: 43 37 32; --muted: 111 100 92; --line: 229 222 210;
  --accent: 31 111 139; --on-accent: 251 247 240;
  --brass: 138 89 14; --brass-soft: 248 231 200;
}
.reader[data-look="dark"] {
  --ground: 14 15 20; --surface: 21 25 42; --raised: 34 39 56;
  --fg: 242 239 232; --muted: 163 160 154; --line: 46 51 72;
  --accent: 240 179 91; --on-accent: 14 15 20;
  --brass: 240 179 91; --brass-soft: 60 46 16;
}
.reader-bar { border-bottom-color: rgb(var(--line)); }
.reader-tools .chip { background: rgb(var(--raised)); }
.reader-toc-card { border-radius: 24px 24px 0 0; }
@media (min-width: 640px) {
  .reader-toc-card { border-radius: 24px; }
}

/* Beside the hero: "This week" and the sleep timer. Side by side on a
   phone, stacked beside the hero on a wide window. */
.side-col { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.side-col:empty { display: none; }
@media (min-width: 900px) {
  .side-col { grid-template-columns: 1fr; gap: 16px; }
}
.side-label { font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(var(--muted)); }
.week-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 24px;
  background: rgb(var(--surface));
  box-shadow: var(--shadow);
}
.wk-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.wk-time { font-size: 28px; line-height: 1; font-weight: 600; }
.wk-days { font-size: 12px; font-weight: 700; color: rgb(var(--muted)); }
.wk-bars { display: flex; gap: 6px; align-items: flex-end; height: 64px; }
.wk-day { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px; height: 100%; }
.wk-bar { display: block; border-radius: 5px; background: rgb(var(--accent)); }
.wk-bar.today { background: rgb(var(--amber)); }
.wk-bar.none { background: rgb(var(--raised)); }
.wk-letter { font-size: 11px; font-weight: 700; text-align: center; color: rgb(var(--muted)); }
@media (min-width: 900px) {
  .week-card { padding: 22px; }
  .wk-time { font-size: 40px; }
}
.side-card { padding: 16px 18px; }
/* On a phone the two side cards share a narrow row: give the sleep timer's
   text the whole card width instead of squeezing it beside the icon. */
@media (max-width: 899px) {
  .side-card { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* Requests (request #46). */
.req-list .req-row { gap: 12px; padding: 10px 14px; }
.req-cover { flex: none; }
.req-cover .cv { width: 48px; height: 72px; border-radius: 8px; }
.req-cover .sp { height: 8px; }
.req-cover .sp svg { display: none; }
.req-cover .art { font-size: 9px; line-height: 11px; padding: 4px; }
.req-cover .cv img { top: 8px; height: calc(100% - 8px); }
.req-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.req-text b { font-size: 15px; font-weight: 800; }
.req-text small { font-size: 12px; font-weight: 600; color: rgb(var(--muted)); }
.req-status.ready { color: rgb(var(--accent)); font-weight: 800; }
.req-row .btn-primary svg { width: 14px; height: 14px; fill: currentColor; }
#requests-wanted .cardcell > .chip { min-height: 40px; justify-content: center; margin-top: auto; }
#requests-wanted .cardcell > .chip.on { background: rgb(var(--raised)); color: rgb(var(--muted)); }

/* Asking for a book or an author (request #62). */
#requests-ask .card { padding: 16px; }
.ask-form { display: flex; flex-direction: column; gap: 12px; }
.ask-form .chips { padding: 0; margin: 0; }
.ask-label { font-size: 13px; font-weight: 800; color: rgb(var(--fg)); }
.ask-form .field { width: 100%; box-sizing: border-box; color: rgb(var(--fg)); }
.ask-form .field::placeholder { color: rgb(var(--muted)); }
.ask-form .btn-primary { align-self: flex-start; margin-top: 2px; }
.catalog-row .req-status.dismissed { color: rgb(var(--muted)); }
[data-screen="admin"] #admin-catalog-requests .job-row { align-items: center; }

/* Bookmarks in the full player. */
.sheet-bookmarks { margin-top: 8px; }
.sheet-bookmarks .h .h-title { font-size: 17px; }
.list .bm-row { padding: 8px 10px 8px 16px; }
.bm-go b { font-size: 14px; font-weight: 800; }
.pill:disabled { opacity: 0.5; cursor: default; }
.pill svg { fill: none; }

/* Admin (#48). Its rows, tiles and forms are drawn from the shared pieces,
   so the fixes live here, scoped to the admin screens (data-screen="admin"). */
/* .app * zeroes padding, which took the Tailwind .list-row padding with it:
   admin rows sat on the card's edge and its rounded corners clipped them. */
.list .job-row { padding: 12px 16px; gap: 12px; }
.list .job-row .btn-primary,
.list .job-row .btn-secondary { flex: none; }
/* Chips inside a tab line up with the content, not Home's edge-to-edge rows. */
[data-screen="admin"] .sec .chips { padding: 0; margin: 4px 0 12px; }
/* Compact tiles: as many as fit (two on a phone, a row on a wide screen),
   with room before whatever follows them. */
[data-screen="admin"] .stats { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: 16px; }
[data-screen="admin"] .stat { padding: 12px 14px; }
[data-screen="admin"] .stat-label { font-size: 13px; }
[data-screen="admin"] a.stat:hover { box-shadow: 0 0 0 2px rgb(var(--accent)), var(--shadow); }
/* A section heading's button is a button, not part of the serif heading. */
[data-screen="admin"] .h .btn-secondary { font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; }
/* Schedule kept its label but lost its padding to the select beside it. */
.import-schedule .btn-secondary,
.import-buttons .btn-primary,
.import-buttons .btn-secondary { flex: none; }
/* Logs' five filters: two to a row on a phone instead of a screenful. */
[data-screen="admin"] [data-form="log-filter"] { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.admin-sub { margin-top: 20px; }
/* Show all, at the foot of a long list. */
.list .more-row { padding: 0; }
.link-btn {
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: rgb(var(--accent));
  background: none;
  border: 0;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
/* The import log is long and rarely read: folded, with its count. */
.admin-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.admin-fold > summary::-webkit-details-marker { display: none; }
.admin-fold > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid rgb(var(--muted));
  border-bottom: 2px solid rgb(var(--muted));
  transform: rotate(45deg);
  transition: transform 0.15s;
}
.admin-fold[open] > summary::after { transform: rotate(225deg); }
.admin-fold .fold-count {
  min-height: 0;
  display: inline-flex;
  align-items: center;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: rgb(var(--muted));
  background: rgb(var(--raised));
  border-radius: 999px;
  padding: 2px 10px;
}
/* Featured's works are a card, like every other admin list. */
#admin-featured .coll-works { background: rgb(var(--surface)); border-radius: 20px; box-shadow: var(--shadow); padding: 4px 16px; }

/* Right to left (request #60): the app in Arabic. Only what a mirrored
   layout breaks is flipped; media controls stay left to right, as they are
   everywhere else in the world. */
[dir=rtl] .appbar,
[dir=rtl] .appbar-links,
[dir=rtl] .tabbar { direction: rtl; }
[dir=rtl] .chapter-row { text-align: right; }
[dir=rtl] .toplink.back::before { transform: scaleX(-1); }
[dir=rtl] .scrub,
[dir=rtl] .scrub-times,
[dir=rtl] .player .times { direction: ltr; }

/* The language sheet: the endonym in the reader's own language beside it. */
.lang-list .list-row { padding: 0 16px; border-top: 1px solid rgb(var(--line)); }
.lang-list .check { flex: none; display: inline-flex; color: rgb(var(--accent)); }
.lang-list .check svg { width: 18px; height: 18px; stroke-width: 2.2; }
.lang-list .chapter-time { margin-inline-start: auto; }
/* Each language's number of books, and a language with none cannot be
   picked (request #91). */
.lang-list .lang-count { display: block; font-size: 12px; line-height: 16px; color: rgb(var(--muted)); }
.lang-list .chapter-row:disabled { opacity: .55; cursor: not-allowed; }
