/* Lumin Reader: the Library (chips, option sheets, the facet sidebar, topic tiles), a book's page, lists, Downloads and
   storage. Owner: PB-U7. Uses the tokens in app.css :root; styles only this package's own components.
   Copyright (C) 2026 B7 Collective LLC. Licensed under AGPL-3.0-only. */

/* ---- Covers and book cards (views.js cover() and bookCard(), used across the app) --------------------------------- */
.cover { position: relative; display: block; aspect-ratio: 2 / 3; width: 100%; border-radius: 10px; overflow: hidden; flex: none; container-type: inline-size;
  background: radial-gradient(120% 90% at 30% 20%, hsl(var(--hue, 30) 38% 46%), hsl(var(--hue, 30) 42% 22%)); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 22px -14px rgba(10,14,20,.55); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover .ctext { position: absolute; left: 7%; right: 7%; bottom: 6%; padding: 7% 6% 6%; border-radius: 8px; background: rgba(250,247,240,.93); color: #18212B; display: flex; flex-direction: column; gap: 3px; text-align: center; }
.cover .ct { font-family: var(--serif); font-size: 12px; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-wrap: balance; overflow-wrap: anywhere; hyphens: auto; }
.cover .ca { font-size: 12px; line-height: 1.2; color: #3E4852; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (min-width: 150px) { .cover .ct { font-size: 14px; } }
/* author lines only on covers 96 px and wider, and never under 12 px (build-plan 6.11) */
@container (max-width: 95.98px) { .cover .ca { display: none; } }
.cover.small { width: 54px; border-radius: 7px; } .cover.small .ctext { display: none; }
.cover.big { width: min(240px, 56vw); border-radius: 14px; }
.cover .lb-dl { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--good, #1D6B55); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.lb-card { -webkit-touch-callout: none; }
.lb-card .ba, .lb-card .btags { font-size: var(--t-xs); }
/* narrow cards: the fit and the length wrap rather than the length being cut off */
.lb-card .btags { flex-wrap: wrap; white-space: normal; gap: 2px 10px; overflow: visible; }
.lb-card .btags .dot::before { content: none; }
.lb-card .tag.together { align-self: flex-start; margin-top: 4px; }

/* ---- The Library page ---------------------------------------------------------------------------------------------- */
.page.lb { max-width: calc(var(--wide) + 2 * var(--gutter)); gap: var(--s5); }
.lb .libsearch .sfield { padding-right: var(--s2); }
.lb-qx { width: 40px; height: 40px; box-shadow: none; background: transparent; }
.lb-chips { display: flex; gap: var(--s2); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: calc(-1 * var(--s2)) calc(-1 * var(--gutter)) 0; padding: 4px var(--gutter) 6px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.lb-chips::-webkit-scrollbar { display: none; }
.lb-chips > * { flex: none; }
.lb-chip { font-weight: 700; font-size: var(--t-s); }
.lb-chip .lb-caret { display: inline-flex; color: var(--muted); margin-right: -4px; }
.lb-chip[aria-pressed="true"] .lb-caret { color: inherit; }
.lb-filters { background: var(--ink); color: var(--bg); }
.lb-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--berry); color: #fff; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.lb-on { background: color-mix(in srgb, var(--accent) 30%, var(--card)); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); font-weight: 700; font-size: var(--t-s); padding-right: 6px; gap: 6px; }
.lb-on .lb-onl { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
.lb-on .lb-pin { display: inline-flex; color: var(--berry); }
.lb-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(24,33,43,.08); color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
[data-theme="dark"] .lb-x { background: rgba(255,255,255,.12); }
.lb-clear { border: 0; background: none; color: var(--link); font: inherit; font-weight: 700; padding: 0 var(--s2); cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
.lb-applied { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.lb-applied[hidden] { display: none; }
@media (max-width: 1023px) { .lb:not(.lb-kid) .lb-applied { display: none; } }
.lb-hints { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.lb-hints:empty { display: none; }
.lb-hintl { font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: var(--s1); }
.lb-hint { font-weight: 700; }
.lb-n { color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; font-weight: 700; }
.chip[aria-pressed="true"] .lb-n { color: inherit; }
.lb-layout { display: block; min-width: 0; }
.lb-main { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.lb-side { display: none; }
.lb-results { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.lb-results[hidden], .lb-browse[hidden] { display: none; }
.lb-reshead { display: flex; flex-direction: column; gap: var(--s2); }
.lb-resline { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--tap); }
.lb-count { margin: 0; font-weight: 700; }
.lb-sort { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--s2); border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; font-size: var(--t-s); cursor: pointer; border-radius: var(--r-s); }
.lb-sort:hover { background: var(--soft); }
.lb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5) var(--s3); }
@media (max-width: 340px) { .lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 600px) { .lb-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s5) var(--s4); } }
.lb-kid .lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5) var(--s4); }
@media (min-width: 600px) { .lb-kid .lb-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
.lb-kid .lb-chip { min-height: 52px; font-size: var(--t-m); padding: 0 var(--s5); }
.lb-kid .bt { font-size: var(--t-l); }
.lb-none { grid-column: 1 / -1; }
.lb-none .cluster { justify-content: center; }

/* The doors (one per group) and topic tiles */
.lb-browse { display: flex; flex-direction: column; gap: var(--s6); }
.lb-doors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); }
.lb-door { --hue: 200; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 56px; padding: var(--s2) var(--s4); border-radius: var(--r-m); color: #fff; text-decoration: none;
  background: linear-gradient(125deg, hsl(var(--hue) 42% 38%), hsl(var(--hue) 48% 24%)); box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 3px 0 hsl(var(--hue) 50% 14%); transition: transform var(--d1) var(--ease); }
.lb-door .lb-n { color: rgba(255,255,255,.9); }
.lb-door:hover { transform: translateY(-1px); }
.lb-door:active { transform: scale(.98); }
.lb-dname { font-family: var(--serif); font-size: var(--t-m); line-height: 1.2; overflow-wrap: anywhere; }
@media (max-width: 699px) {
  .lb-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* one swipeable row of tiles per group on phones */
  .lb-tiles.lb-trow { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(148px, 46%); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter) 10px; scroll-padding-inline: var(--gutter); }
  .lb-trow::-webkit-scrollbar { display: none; }
  .lb-trow > * { scroll-snap-align: start; }
}
@media (max-width: 340px) { .lb-doors { grid-template-columns: minmax(0, 1fr); } .lb-door { min-height: 48px; } }
.lb-bigtitle { margin: 0; }
.lb-gsec { gap: var(--s3); }
.lb-gsec .sec-title { font-size: var(--t-l); margin: 0; }
.lb-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
@media (min-width: 700px) { .lb-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .lb-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lb-tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 132px; padding: var(--s3) var(--s4); border-radius: var(--r-l); overflow: hidden; text-decoration: none; color: #fff;
  background: radial-gradient(130% 120% at 85% 0%, hsl(var(--hue) 45% 46%), hsl(var(--hue) 50% 26%) 55%, hsl(var(--hue) 55% 16%)); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 0 hsl(var(--hue) 50% 12%), 0 18px 26px -20px rgba(10,14,20,.6);
  transition: transform var(--d2) var(--spring, ease); }
.lb-tile:hover { transform: translateY(-2px); }
.lb-tile:active { transform: scale(.98); }
.lb-tile .lb-fan { position: absolute; top: 10px; right: 10px; width: 92px; height: 66px; }
.lb-tile .lb-fan .cover.small { width: 40px; }
.lb-tname { position: relative; font-family: var(--serif); font-size: calc(19px * var(--scale, 1)); line-height: 1.15; max-width: calc(100% - 4px); text-shadow: 0 1px 2px rgba(0,0,0,.35); padding-top: 64px; overflow-wrap: break-word; hyphens: manual; }
.lb-tn { position: relative; font-size: 13px; font-weight: 700; opacity: .92; }
.lb-kid .lb-tile { min-height: 148px; }
.lb-kid .lb-tname { font-size: calc(21px * var(--scale, 1)); }
.lb-sacred { --hue: 42; }
.lb-wrapchips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.lb-wrapchips .chip { font-weight: 700; }
.lb-allbtn { padding-top: var(--s2); }

/* Fanned covers (lists, tiles) */
.lb-fan { position: relative; display: block; width: 104px; height: 78px; flex: none; }
.lb-fan .cover.small { position: absolute; top: 0; width: 46px; box-shadow: 0 8px 16px -10px rgba(10,14,20,.7); }
.lb-fan .cover.small:nth-child(1) { left: 0; transform: rotate(-9deg) translateY(6px); }
.lb-fan .cover.small:nth-child(2) { left: 50%; transform: translateX(-50%); z-index: 2; }
.lb-fan .cover.small:nth-child(3) { right: 0; transform: rotate(9deg) translateY(6px); }
.lb-fan:empty { background: color-mix(in srgb, var(--soft) 70%, transparent); border-radius: 12px; }
.lb-fan.big { width: 190px; height: 140px; margin: 0 auto; }
.lb-fan.big .cover.small { width: 82px; }

/* Your lists row */
.lb-lrow { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 180px); gap: var(--s3); overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter) 8px; }
.lb-lrow::-webkit-scrollbar { display: none; }
.lb-lcard, .lv-card { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); border-radius: var(--r-l); background: var(--card); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); min-width: 0; }
.lb-lcard .lb-fan, .lv-card .lb-fan { align-self: center; margin-bottom: var(--s1); }
.lb-lname, .lv-cname { font-weight: 700; display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }

/* Option sheets and the facet sidebar */
.lb-sheet { gap: var(--s4); }
.lb-sbody { display: flex; flex-direction: column; gap: var(--s4); }
.lb-sfoot { position: sticky; bottom: calc(-1 * var(--s6)); display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0 var(--s4); margin-top: auto; background: inherit; border-top: 1px solid var(--line); z-index: 1; }
.lb-sfoot .btn.primary { flex: 1; max-width: 320px; margin-left: auto; }
.lb-check { display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: 2px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.lb-check:last-child { border-bottom: 0; }
.lb-check input { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin: 0; border-radius: 7px; border: 2px solid var(--lip); background: var(--card); flex: none; display: grid; place-items: center; cursor: pointer; }
.lb-check input:checked { background: var(--ink); border-color: var(--ink); }
.lb-check input:checked::after { content: ""; width: 12px; height: 7px; border: solid var(--bg); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }
.lb-check input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.lb-check.zero { color: var(--muted); }
.lb-check:has(input:checked) .lb-cl { font-weight: 700; }
.lb-cl { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.lb-check.lb-all .lb-cl { font-weight: 700; }
.lb-topics { display: flex; flex-direction: column; gap: var(--s4); }
.lb-grp h3 { margin: 0 0 var(--s1); font-size: var(--t-xs); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
details.lb-grp { border-bottom: 1px solid var(--line); }
details.lb-grp > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 48px; cursor: pointer; font-weight: 700; list-style: none; }
details.lb-grp > summary::-webkit-details-marker { display: none; }
details.lb-grp > summary::after { content: ""; width: 9px; height: 9px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); margin: 0 4px 4px var(--s2); transition: transform var(--d2) var(--ease); }
details.lb-grp[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
details.lb-grp > summary span:first-child { flex: 1; }
details.lb-grp .lb-check { padding-left: var(--s2); }
.lb-topics details.lb-grp { gap: 0; }
.lb-fsec { display: flex; flex-direction: column; }
.lb-fsec h3 { margin: 0 0 var(--s1); font-size: var(--t-xs); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.lb-fhead { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.lb-pinbtn { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 var(--s2); border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font: inherit; font-size: var(--t-xs); font-weight: 700; cursor: pointer; }
.lb-pinbtn[aria-pressed="true"] { color: var(--berry); background: color-mix(in srgb, var(--berry) 12%, transparent); }
.lb-pinsw { border-top: 1px solid var(--line); }
.lb-menu { display: flex; flex-direction: column; margin: calc(-1 * var(--s2)); }
.lb-menu > button, .lb-menu > a { display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s3); border: 0; border-radius: var(--r-s); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.lb-menu > :hover, .lb-menu > :focus-visible { background: var(--soft); }
.lb-menu [aria-checked="true"] { font-weight: 700; }
.lb-mi { width: 16px; flex: none; }
.lv-flip { display: inline-flex; transform: rotate(180deg); }

@media (min-width: 1024px) {
  .lb:not(.lb-kid) .lb-chips { display: none; }
  .lb-layout.has-side { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: var(--s6); align-items: start; }
  .lb-side { display: flex; flex-direction: column; gap: var(--s5); position: sticky; top: var(--s4); max-height: calc(100dvh - var(--s6)); overflow-y: auto; overscroll-behavior: contain;
    padding: var(--s4) var(--s4) var(--s5); border-radius: var(--r-l); background: var(--card); box-shadow: var(--shadow); scrollbar-width: thin; }
  .lb-side .lb-check { min-height: 40px; font-size: var(--t-s); border-bottom: 0; }
  .lb-side details.lb-grp > summary { min-height: 40px; font-size: var(--t-s); }
  .lb-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .lb-layout.has-side .shelf-row, .lb-layout.has-side .lb-lrow { margin-inline: 0; padding-inline: 0; }
  .lb-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) { .lb-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---- A book's page -------------------------------------------------------------------------------------------------- */
.page.lb-book { max-width: calc(var(--wide) + 2 * var(--gutter)); gap: var(--s5); }
.lb-hero { position: relative; display: grid; grid-template-columns: 1fr; justify-items: center; text-align: center; gap: var(--s5); }
.lb-hero::before { content: ""; position: absolute; left: 50%; top: -40px; width: min(560px, 120%); height: 420px; transform: translateX(-50%); z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, hsl(var(--hue) 55% 55% / .28), transparent); }
.lb-hcover .cover.big { width: min(196px, 52vw); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 28px 40px -24px rgba(10,14,20,.7); }
.lb-hinfo { display: flex; flex-direction: column; align-items: center; gap: var(--s3); min-width: 0; width: 100%; }
.lb-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: calc(clamp(30px, 7.5vw, 52px) * var(--scale, 1)); line-height: 1.08; overflow-wrap: anywhere; text-wrap: balance; }
.lb-sub { margin: -4px 0 0; color: var(--muted); font-family: var(--serif); font-style: italic; }
.lb-author { margin: 0; font-size: var(--t-l); }
.lb-author a { color: var(--ink); text-decoration-color: var(--line); }
.lb-hinfo > .muted.small { margin: 0; }
.lb-tags { justify-content: center; gap: var(--s2); }
.lb-topic { background: var(--card); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 0 var(--lip); min-height: 36px; }
.lb-prog { width: 100%; max-width: 420px; }
.lb-prog .bprog { height: 6px; }
.lb-progt { margin: var(--s2) 0 0; color: var(--muted); }
.lb-ptitle { font-weight: 700; color: var(--ink); }
.lb-actions { display: flex; align-items: center; gap: var(--s3); width: 100%; max-width: 420px; }
.lb-read { flex: 1; min-height: 56px; min-width: 0; }
.lb-actions .iconbtn { width: 56px; height: 56px; border-radius: var(--r-m); margin-bottom: 4px; }
.lb-actions .lb-dlbtn[aria-pressed="true"] { color: var(--good, #1D6B55); }
.lb-facts { margin: 0; color: var(--muted); font-size: var(--t-s); }
.lb-scrnote { margin: 0; font-family: var(--serif); font-style: italic; color: var(--muted); max-width: 46ch; }
.lb-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
.lb-col { display: flex; flex-direction: column; gap: var(--s6); min-width: 0; }
.lb-col:empty { display: none; }
.lb-about p, .lb-edition p { margin: 0; max-width: var(--measure); }
.lb-about, .lb-edition { gap: var(--s3); }
.lb-nbcard { display: flex; align-items: center; gap: var(--s4); padding: var(--s4); border-radius: var(--r-l); background: var(--card); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.lb-nbic { width: 48px; height: 48px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 28%, var(--card)); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.lb-four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 340px) { .lb-four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lb-four .bt { font-size: var(--t-s); }
.lb-four .btags { display: none; }
.lb-series { margin: 0; }
.lb-colls { display: flex; flex-direction: column; gap: var(--s2); }
.lb-coll { --cc: var(--teal); display: flex; justify-content: space-between; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s3) var(--s4); border-radius: var(--r-m); text-decoration: none; color: #fff;
  background: linear-gradient(120deg, var(--cc), color-mix(in srgb, var(--cc) 70%, #000)); box-shadow: 0 3px 0 color-mix(in srgb, var(--cc) 55%, #000); }
.lb-coll strong { font-family: var(--serif); font-weight: 400; font-size: var(--t-m); }
.lb-quiet { display: flex; }
.lb-tocq { width: 100%; min-height: 48px; padding: 0 var(--s4); border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
/* the book page's own contents list (the reader's Contents panel is .rd-toc in search.css) */
.lb-toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-ch a { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); min-height: 48px; padding: var(--s3) var(--s4); border-radius: var(--r-m); text-decoration: none; color: var(--ink); transition: background-color var(--d1) var(--ease); }
.lb-ch a:hover { background: var(--soft); }
.lb-ch .tt { font-family: var(--serif); }
.lb-ch .tt { min-width: 0; overflow-wrap: anywhere; }
.lb-ch.done .tt { color: var(--muted); }
.lb-chk { color: var(--good, #1D6B55); display: inline-flex; flex: none; }
.lb-ch.here a { background: var(--card); box-shadow: inset 4px 0 0 var(--accent), var(--shadow); }
.lb-chbar { width: 60px; flex: none; margin: 0; height: 6px; }
.lb-ch .muted.small { flex: none; }
.lb-ch.lb-fold { display: none; }
.lb-part > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 var(--s4); cursor: pointer; font-family: var(--serif); font-size: var(--t-l); list-style: none; }
.lb-part > summary::-webkit-details-marker { display: none; }
.lb-part > summary::after { content: ""; width: 9px; height: 9px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); margin-bottom: 4px; }
.lb-part[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
.lb-partli { list-style: none; }
@media (min-width: 900px) {
  .lb-hero { grid-template-columns: 260px minmax(0, 1fr); justify-items: start; text-align: left; align-items: center; gap: var(--s7); }
  .lb-hero::before { left: 130px; top: -60px; }
  .lb-hcover .cover.big { width: 260px; }
  .lb-hinfo { align-items: flex-start; }
  .lb-tags { justify-content: flex-start; }
  .lb-cols { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s7); }
}

/* ---- Lists --------------------------------------------------------------------------------------------------------- */
.page.lv { max-width: calc(var(--page) + 2 * var(--gutter)); }
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
@media (max-width: 340px) { .lv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lv-card { padding: var(--s3); } .lv-card .lb-fan { transform: scale(.85); } }
.lv-card { --lc: var(--teal); border-top: 4px solid var(--lc); }
.lv-cmeta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lv-kick { color: var(--muted); }
.lv-kick.berry { color: var(--berry); }
.lv-empty { margin: 0; }
.lv-hero { --lc: var(--teal); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s5) var(--s4) var(--s5); border-radius: var(--r-l);
  background: linear-gradient(180deg, color-mix(in srgb, var(--lc) 20%, var(--card)), var(--card) 70%); box-shadow: var(--shadow); }
.lv-hero .kicker { margin: var(--s2) 0 0; }
.lv-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: calc(clamp(26px, 6vw, 36px) * var(--scale, 1)); line-height: 1.15; overflow-wrap: anywhere; }
.lv-desc { margin: 0; color: var(--muted); max-width: 52ch; }
.lv-meta { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px var(--s3); color: var(--muted); font-size: var(--t-s); }
.lv-avs { display: inline-flex; }
.lv-avs .avatar + .avatar { margin-left: -6px; }
.lv-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); margin-top: var(--s2); }
.lv .avatar.sm, .lv-edit .avatar.sm, .lv-addsheet .avatar.sm { width: 28px; height: 28px; font-size: 14px; box-shadow: 0 0 0 2px var(--card); }
.lv .avatar.xs { width: 22px; height: 22px; font-size: 12px; }
.lv-sugs { display: flex; flex-direction: column; gap: var(--s2); }
.lv-sug { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4); border-radius: var(--r-l); background: color-mix(in srgb, var(--accent) 20%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); }
.lv-sug .grow { flex: 1 1 160px; min-width: 0; }
.lv-sug p { margin: 0; }
.lv-msg { font-style: italic; color: var(--muted); font-size: var(--t-s); }
.lv-sugact { display: flex; gap: var(--s2); }
.lv-wait { margin: 0; }
.lv-rows { list-style: none; margin: 0; padding: 0 var(--s2); border-radius: var(--r-l); background: var(--card); box-shadow: var(--shadow); }
.lv-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); background: var(--card); position: relative; transition: transform var(--d2) var(--ease); }
.lv-row:last-child { border-bottom: 0; }
.lv-row.dragging { z-index: 3; transition: none; box-shadow: 0 16px 30px -16px rgba(10,14,20,.5); border-radius: var(--r-m); }
.lv-grip { width: 36px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); cursor: grab; touch-action: none; border-radius: 10px; }
.lv-grip:active { cursor: grabbing; }
.lv-rcover { flex: none; }
.lv-rcover .cover.small { width: 48px; }
.lv-rmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lv-rt { font-family: var(--serif); font-size: calc(17px * var(--scale, 1)); color: var(--ink); text-decoration: none; line-height: 1.25; overflow-wrap: anywhere; }
.lv-ra { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.lv-st { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 700; color: var(--muted); }
.lv-st.done { color: var(--good, #1D6B55); }
.lv-st.reading { color: var(--ink); }
.lv-bar { width: 60px; height: 5px; margin: 0; }
.lv-kids { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.lv-kid { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lv-kn { font-size: var(--t-xs); font-weight: 700; }
.lv-kidhead { display: none; }
.lv-ok { align-self: flex-start; margin-top: 4px; }
.lv-more { width: 44px; height: 44px; box-shadow: none; background: transparent; }
@media (min-width: 720px) {
  .lv-rows.many .lv-kids { display: grid; grid-template-columns: repeat(var(--kids), minmax(0, 1fr)); gap: var(--s3); }
  .lv-rows.many .lv-kid .avatar, .lv-rows.many .lv-kn { display: none; }
  .lv-kidhead { display: grid; grid-template-columns: repeat(var(--kids, 2), minmax(0, 1fr)); gap: var(--s3); padding-left: calc(36px + 48px + 2 * var(--s3) + var(--s2)); padding-right: 52px; font-size: var(--t-xs); font-weight: 700; color: var(--muted); }
  .lv-kidhead span { display: inline-flex; align-items: center; gap: 6px; }
}
.lv-edit .lv-swatches { display: flex; flex-wrap: wrap; gap: var(--s2); }
.lv-edit .swatch .icon { color: #fff; opacity: 0; }
.lv-edit .swatch[aria-checked="true"] .icon { opacity: 1; }
.lv-edit textarea, .lv-edit input:not([type]) { width: 100%; min-height: 48px; padding: var(--s3) var(--s4); border-radius: var(--r-s); border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
.lv-who { display: flex; flex-direction: column; gap: var(--s2); }
.lv-who .segctl { flex-wrap: wrap; }
.lv-who .segctl button { display: inline-flex; align-items: center; gap: 6px; }
.lv-truth { margin: 0; }
.lv-err { margin: 0; color: var(--bad); font-weight: 700; }
.lv-err:empty { display: none; }
.lv-checks { display: flex; flex-direction: column; }
.lv-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.lv-for { margin: -12px 0 0; font-family: var(--serif); font-size: var(--t-m); color: var(--ink); }
.lv-addbooks .sfield { box-shadow: inset 0 0 0 1px var(--line); }
.lv-pick { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lv-prow { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.lv-prow .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lv-prow strong { font-weight: 400; overflow-wrap: anywhere; }
.lv-prow .cover.small { width: 40px; }

/* ---- Downloads and storage ----------------------------------------------------------------------------------------- */
.st-meter { gap: var(--s4); }
.st-big { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); }
.st-num { font-family: var(--serif); font-size: calc(clamp(30px, 9vw, 40px) * var(--scale, 1)); line-height: 1.1; }
.st-on { color: var(--muted); }
.st-bar { display: flex; height: 14px; border-radius: var(--r-pill); overflow: hidden; background: var(--soft); gap: 2px; }
.st-bar i { display: block; min-width: 4px; }
.st-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.st-legend li { display: flex; align-items: center; gap: var(--s3); }
.st-legend li i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.st-legend .grow { flex: 1; min-width: 0; }
.st-legend strong { font-variant-numeric: tabular-nums; }
.st-keep { gap: var(--s2); }
.st-keep .switch { border-bottom: 0; }
.st-answer { margin: 0; }
.st-answer:empty { display: none; }
.st-safe { margin: var(--s2) 0 0; padding-top: var(--s3); border-top: 1px solid var(--line); display: flex; gap: var(--s3); align-items: flex-start; color: var(--muted); font-size: var(--t-s); }
.st-safe .icon { color: var(--good, #1D6B55); flex: none; margin-top: 2px; }
.st-radios { padding-block: var(--s1); }
.st-radio { display: flex; align-items: center; gap: var(--s4); width: 100%; min-height: 64px; padding: var(--s3) 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.st-radio:last-child { border-bottom: 0; }
.st-radio .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-radio small { color: var(--muted); font-size: var(--t-s); }
.st-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--lip); flex: none; display: grid; place-items: center; }
.st-radio[aria-checked="true"] .st-dot { border-color: var(--link); }
.st-radio[aria-checked="true"] .st-dot::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--link); }
.st-books .shelf-head { flex-wrap: wrap; align-items: center; }
.st-list { list-style: none; margin: 0; }
.st-row { gap: var(--s3); flex-wrap: nowrap; }
.st-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-t { color: var(--ink); text-decoration: none; font-size: var(--t-m); overflow-wrap: anywhere; }
.st-row .cover.small { width: 44px; }
.st-sel { width: 24px; height: 24px; flex: none; accent-color: var(--ink); }
.st-selbar { justify-content: flex-end; }
.st-old { white-space: normal; text-align: left; }
.st-words progress { width: 100%; accent-color: var(--accent); }
.st-empty { padding: var(--s5) var(--s4); }

/* Reduced motion and the calm setting: nothing in the library moves on its own; taps don't spring */
@media (prefers-reduced-motion: reduce) { .lb-tile, .lb-door, .lv-row, .lb-card .cover { transition: none !important; } }
html.calm .lb-tile, html.calm .lb-door, html.calm .lv-row { transition: none !important; }

/* Named works inside a book, above the search results (FE-03) */
.lb-parts { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.lb-parts-h { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lb-parts-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.lb-part { display: inline-flex; flex-direction: column; gap: 2px; min-height: 48px; padding: 8px 14px; border-radius: var(--r-m, 14px); background: var(--card); box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.12)); color: var(--ink); text-decoration: none; max-width: 100%; }
.lb-part strong { font-family: var(--serif); font-size: var(--t-m, 17px); font-weight: 500; }
.lb-part span { font-size: 13px; color: var(--muted); }
.lb-part:hover { transform: translateY(-1px); }
