/* ---------------------------------------------------------------------------
   `/library` — the media manager. HANDOFF-20 lane 20.1, rebuilt by HANDOFF-21
   lane 21.1 (`library/SPEC-manager.md` §v2, RAW 22).

   Nick's reference for the neatness is Spotify's library
   (`_assets/2026-09-10e-spotify-reference-chrome_4q2tJ4GtSN.jpg`). v2 is his
   round 4–6 answers: a tall airy hero with the submenus in it, the controls
   as their own sticky strip, a slim left sidebar of filters on a desktop,
   Spotify squares, and WHITESPACE — "Also mind you I was considering some
   whitespace for the library page."

   The rules this sheet enforces:

     · the page is FULL SCREEN: the rail and the phone tab bar are hidden by
       `.app[data-view="library"]`, and one "Back to app" is the way out;
     · a SECTION IS TWO ROWS. `grid-template-rows` is two and the overflow is
       clipped; `fitRows` (library-page.js) hides what two rows of the real
       auto-fill column count cannot show and puts "+N more" in the last cell;
     · a tile is never wider than the "gallery" allows — auto-fill from
       `--lb-tile`, so its width stays roughly between that and 160px;
     · on a phone a section is ONE strip that scrolls sideways;
     · nothing here may scroll the PAGE sideways. Every horizontal scroller is
       its own `overflow-x: auto` box inside a `min-width: 0` grid cell.
   --------------------------------------------------------------------------- */

/* ------------------------------------------------------- full screen ------ */

/* 20 Q4: "all main menus removed except for a 'back to app' button at the top
   left". One selector does it at every width — at ≤900px `.rail` IS the
   bottom tab bar, so hiding it hides that too. */
.app[data-view="library"] { grid-template-columns: minmax(0, 1fr); }
.app[data-view="library"] > .rail,
.app[data-view="library"] .topbar { display: none; }
.app[data-view="library"] .surface { padding: 0; }
@media (max-width: 900px) {
  .app[data-view="library"] .surface { padding: 0 0 env(safe-area-inset-bottom); }
}
.surface-wide[data-view="library"] { width: 100%; max-width: none; }

/* Entering it FADES IN (20 Q4). OPACITY ONLY: a transform left behind by
   `fill-mode: both` makes this the containing block for every `position:
   fixed` inside it, and the bulk bar once pinned itself to a 4,421px page. */
.lb-page { animation: lb-in 260ms var(--soft, cubic-bezier(.22,.61,.36,1)) both; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lb-page { animation: none; } }

.lb-page {
  --lb-gut: clamp(16px, 4vw, 56px);     /* ≥32px on any desktop */
  --lb-max: 1480px;
  --lb-tile: 132px;
  min-height: 100vh; min-height: 100dvh; background: var(--white);
}

/* ------------------------------------------------------------- the hero --- */
/* Round 5 Q4 — "Title, count, platforms": big word, the line, the logos;
   taller and airy, no artwork. Round 6 Q2 — the submenus live INSIDE it. */

.lb-hero {
  padding: 22px var(--lb-gut) 0;
  background: linear-gradient(180deg, var(--paper) 0%, var(--white) 100%);
  border-bottom: 1px solid var(--line);
}
.lb-hero-in { max-width: var(--lb-max); margin: 0 auto; display: grid; justify-items: start; }
.lb-back {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 0 14px 0 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
}
.lb-back:hover { background: var(--paper); }
.lb-title {
  margin: 34px 0 0; font-size: clamp(40px, 5.2vw, 64px); line-height: 1;
  font-weight: 800; letter-spacing: -.04em; color: var(--ink);
}
.lb-hero-sub { margin: 12px 0 0; font-size: 16px; color: var(--ink-soft); font-weight: 500; }
.lb-logos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.lb-logo {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 999px; background: var(--white); border: 1px solid var(--line);
}
.lb-logo img { width: 16px; height: 16px; }

/* Underline tabs: clearly submenus of THIS page, the current one dark. */
.lb-sub { display: flex; gap: 30px; margin-top: 30px; }
.lb-subb {
  position: relative; padding: 10px 0 14px; border: 0; background: none;
  color: var(--ink-faint); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.lb-subb::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: transparent;
}
.lb-subb:hover { color: var(--ink); }
.lb-subb.is-on { color: var(--ink); }
.lb-subb.is-on::after { background: var(--ink); }

/* ------------------------------------------------------------ the strip --- */
/* Round 6 Q1 — search · count · Sort · View toggle · Add. Its own bar, sticky. */

.lb-bar {
  position: sticky; top: 0; z-index: 20;
  padding: 12px var(--lb-gut);
  background: color-mix(in srgb, var(--white) 92%, transparent);
  backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.lb-bar-in { max-width: var(--lb-max); margin: 0 auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lb-search {
  flex: 0 1 380px; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--paper); color: var(--ink-faint);
}
.lb-search:focus-within { box-shadow: 0 0 0 2px var(--ink); color: var(--ink); }
.lb-f-q {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  color: var(--ink); font: inherit; font-size: 14px;
}
.lb-count { color: var(--ink-faint); font-size: 13px; font-weight: 600; white-space: nowrap; }
.lb-bar-gap { flex: 1; }
.lb-sort {
  min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lb-view { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; }
.lb-viewb {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 999px; background: none; color: var(--ink-faint); cursor: pointer;
}
.lb-viewb:hover { color: var(--ink); }
.lb-viewb.is-on { background: var(--ink); color: var(--white); }
.lb-add {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--white);
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.lb-add:hover { opacity: .9; }

/* -------------------------------------------------------- the filters ---- */
/* Round 5 Q1 — desktop: a slim LEFT sidebar of checklists; narrow: a row of
   chips that open sheets. Both are drawn; the width decides. */

.lb-main {
  max-width: var(--lb-max); margin: 0 auto;
  padding: 36px var(--lb-gut) 140px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px;
}
.lb-main.has-side { grid-template-columns: 196px minmax(0, 1fr); }
.lb-side {
  position: sticky; top: 88px; align-self: start;
  max-height: calc(100vh - 110px); overflow-y: auto; scrollbar-width: thin;
}
.lb-side-in { display: grid; gap: 10px; }
/* 23.2 — each section is a collapsible header. */
.lb-side-b {
  display: flex; align-items: center; gap: 6px; width: 100%;
  margin: 0 0 4px; padding: 4px 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; font: inherit; cursor: pointer;
}
.lb-side-b:hover { background: var(--paper); }
.lb-side-b svg { flex: none; color: var(--ink-faint); transition: transform 140ms ease; }
.lb-side-g.is-open .lb-side-b svg { transform: rotate(180deg); }
.lb-side-h {
  flex: 1; min-width: 0;
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint);
}
.lb-side-g.is-open .lb-side-h { color: var(--ink-soft); }
/* A CLASS BEATS THE UA'S [hidden], so say it here or a closed section still draws. */
.lb-opts[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .lb-side-b svg { transition: none; } }
.lb-opts { display: grid; gap: 1px; }
.lb-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink-soft); text-align: left;
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.lb-opt:hover { background: var(--paper); color: var(--ink); }
.lb-opt.is-on { background: var(--ink); color: var(--white); font-weight: 700; }
.lb-opt-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-opt-n { font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.lb-opt.is-on .lb-opt-n { color: rgba(255, 255, 255, .7); }

.lb-chips { display: none; }
.lb-fchip {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lb-fchip.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); }
.pop-panel.lb-pop.lb-sheet { width: min(420px, 94vw); grid-template-rows: auto minmax(0, 1fr); }
.lb-sheet .lb-opts { padding: 6px 14px 20px; overflow: auto; }
.lb-sheet .lb-opt { min-height: 44px; font-size: 14px; }

/* Active filters: dark chips with an x. */
.lb-active { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lb-achip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 10px 0 12px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--white); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.lb-aclear { border: 0; background: none; color: var(--ink-faint); font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; }

/* ------------------------------------------------------------ the body ---- */

.lb-body { display: grid; gap: 48px; min-width: 0; align-content: start; }
.lb-sec { display: grid; gap: 14px; min-width: 0; }

/* Round 5 Q3 — the WHOLE title row is the button; "Show all ›" bold at right. */
.lb-sec-head {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  margin: 0 -10px; padding: 6px 10px; box-sizing: content-box;
  border: 0; border-radius: 10px; background: none; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.lb-sec-head:hover { background: var(--paper); }
.lb-sec-h { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.lb-sec-n { font-size: 13px; font-weight: 600; color: var(--ink-faint); }
.lb-sec-of { font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-showall {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 2px;
  font-size: 14px; font-weight: 800; color: var(--ink);
}
.lb-sec-head:hover .lb-showall { text-decoration: underline; }

/* TWO ROWS, AND ONLY TWO (19 Q1). Auto-fill makes the column count the
   screen's; `fitRows` hides what two rows of it cannot show. */
.lb-rows {
  display: grid; column-gap: 20px; row-gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(var(--lb-tile), 1fr));
  grid-template-rows: repeat(2, auto);
  grid-auto-rows: 0; overflow: hidden;
  min-width: 0; padding: 4px 4px 6px; margin: -4px -4px -6px;   /* room for the hover lift */
}
/* Round 5 Q2 — "less items get bigger": a short kind uses the larger end. */
.lb-rows.is-few { grid-template-columns: repeat(auto-fill, 164px); }
.lb-rows > [hidden], .lb-strip > [hidden] { display: none; }
@media (min-width: 1700px) { .lb-page { --lb-tile: 150px; } }

/* 21 Q1 — the phone is ONE strip per kind, scrolling sideways. It is its own
   overflow box, so the PAGE never scrolls sideways. */
.lb-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 112px; gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; padding-bottom: 4px;
  min-width: 0; scrollbar-width: none;
}
.lb-strip::-webkit-scrollbar { display: none; }
.lb-strip > * { scroll-snap-align: start; }

/* ------------------------------------------------------------- one tile --- */
/* Round 4 Q2 — "Spotify square": square cover, title below, one grey subline,
   8px radius, hover lifts. */

.lb-tile { display: grid; gap: 3px; min-width: 0; align-content: start; }
.lb-art {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 1; width: 100%; margin-bottom: 6px;
  border: 0; padding: 0; border-radius: 8px;
  background: var(--paper); overflow: hidden; cursor: pointer; color: var(--ink-faint);
  box-shadow: 0 1px 2px rgba(36, 20, 46, .08);
  transition: transform 160ms var(--soft, ease), box-shadow 160ms var(--soft, ease);
}
.lb-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-tile:hover .lb-art { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(36, 20, 46, .16); }
@media (prefers-reduced-motion: reduce) { .lb-art, .lb-tile:hover .lb-art { transition: none; transform: none; } }
/* Round 4 Q3 — no artwork anyone can attribute: a tile tinted in the
   platform's own colour, carrying its mark. Never a broken image. */
.lb-art.is-blank, .lb-sthumb.is-blank {
  background: color-mix(in srgb, var(--lb-tint, #8a7f96) 15%, var(--white));
}
.lb-ph { display: grid; place-items: center; width: 100%; height: 100%; }
.lb-art .lb-ph img { width: 34%; height: auto; opacity: .92; object-fit: contain; }
.lb-pin {
  position: absolute; top: 6px; right: 6px;
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 999px; background: var(--ink); color: var(--white);
}
.lb-tick {
  position: absolute; top: 6px; left: 6px;
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 999px; border: 2px solid var(--white);
  background: rgba(36, 20, 46, .35); color: var(--white);
}
.lb-tick.is-on { background: var(--violet); border-color: var(--white); }
.lb-tick.is-inline { position: static; width: 16px; height: 16px; border-width: 1px; }
.lb-tile.is-on .lb-art { outline: 2px solid var(--violet); outline-offset: 2px; }
/* Round 6 Q4 — title one line with an ellipsis; one grey subline; nothing else. */
.lb-name, .lb-sub1 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name { font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.lb-sub1 { font-size: 12px; line-height: 1.3; color: var(--ink-faint); }

/* "+N more" — the last cell of the second row (round 5 Q3). */
.lb-moretile {
  grid-row: 2; grid-column: -2 / -1;
  display: grid; place-content: center; justify-items: center; gap: 2px;
  aspect-ratio: 1; width: 100%; align-self: start;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font: inherit; cursor: pointer;
  transition: background 160ms ease;
}
.lb-moretile b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.lb-moretile span { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.lb-moretile:hover { background: color-mix(in srgb, var(--ink) 7%, var(--paper)); }
.lb-strip .lb-moretile { grid-row: auto; grid-column: auto; }

/* ------------------------------------------------- songs: a FLAT list ----- */
/* 20 Q3: "Flat list, sortable" — never grouped. v2: each row has its cover. */

.lb-songs { display: grid; min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lb-srow {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 36px minmax(0, 2.2fr) minmax(0, 1.4fr) 100px 96px 64px;
  padding: 7px 14px; border-bottom: 1px solid var(--line-soft); min-width: 0;
}
.lb-srow:last-child { border-bottom: 0; }
.lb-srow.is-head { background: var(--paper); font-size: 11px; font-weight: 700; color: var(--ink-faint); padding-block: 9px; }
.lb-srow.is-on { background: var(--violet-wash); }
.lb-sthumb {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 5px; overflow: hidden; background: var(--paper);
}
.lb-sthumb.is-head { height: 0; background: none; }
.lb-sthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-sthumb .lb-ph img { width: 16px; height: 16px; }
.lb-scell { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stitle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; padding: 0; text-align: left;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.lb-stitle:hover { text-decoration: underline; }
.lb-screator, .lb-splatform, .lb-sadded, .lb-srating { color: var(--ink-soft); }
.lb-srating { text-align: right; }
.lb-listmore {
  display: block; width: 100%; min-height: 42px; border: 0; border-top: 1px solid var(--line-soft);
  background: var(--white); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.lb-listmore:hover { background: var(--paper); }
@media (max-width: 700px) {
  .lb-srow { grid-template-columns: 36px minmax(0, 1.6fr) minmax(0, 1fr) 52px; }
  .lb-splatform, .lb-sadded { display: none; }
}

/* --------------------------------------------------------- the bulk bar --- */
/* 21 Q3 — long-press a tile, then a bar at the bottom with the bulk actions. */

.lb-bulk {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  max-width: calc(100vw - 24px);
  padding: 8px 10px; border-radius: 999px;
  background: var(--ink); color: var(--white); box-shadow: var(--shadow);
}
.lb-bulk-n { padding: 0 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.lb-bulk-b, .lb-bulk-x {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 12px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .12); color: var(--white);
  font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer;
}
.lb-bulk-b:hover:not([disabled]), .lb-bulk-x:hover { background: rgba(255, 255, 255, .22); }
.lb-bulk-b[disabled] { opacity: .4; cursor: default; }
.lb-bulk-x { background: transparent; text-decoration: underline; }
@media (max-width: 560px) { .lb-bulk-b span, .lb-bulk-n { font-size: 11.5px; } }

/* ------------------------------------------------------- "open more" ------ */
/* 20 Q1 — Spotify's grid with its own search, scrolling INSIDE the popup. */

.pop-panel.lb-pop {
  width: min(1100px, 94vw); max-height: min(88vh, 940px);
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  gap: 0; padding: 0; overflow: hidden; position: relative;
}
.lb-pop-x {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); cursor: pointer;
}
.lb-pop-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 18px 60px 14px 20px; border-bottom: 1px solid var(--line);
}
.lb-pop-h { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: .06em; }
.lb-pop-dot { margin: 0 6px; color: var(--ink-faint); }
.lb-pop-n { color: var(--ink-faint); font-weight: 700; }
.lb-pop-q {
  flex: 1 1 200px; min-width: 0; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 13px;
}
.lb-pop-sort {
  min-height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 12.5px; cursor: pointer;
}
.lb-popbody { overflow: auto; padding: 18px 22px 28px; min-width: 0; }
.lb-popbody.is-list { padding: 0; }
.lb-grid {
  display: grid; column-gap: 18px; row-gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  min-width: 0;
}
.lb-pop-more {
  display: block; margin: 18px auto 0; min-height: 38px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-weight: 600; font-size: 12.5px;
  cursor: pointer;
}

/* ------------------------------------------- the manage block + dialogs --- */

.lb-manage { display: grid; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.lb-manage-h { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.lb-manage-rate, .lb-manage-verdict { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lb-manage-l { font-size: 12px; color: var(--ink-soft); min-width: 78px; }
.lb-manage-clear { border: 0; background: none; color: var(--ink-faint); font: inherit; font-size: 11.5px; text-decoration: underline; cursor: pointer; }
.lb-manage-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-manage-in { margin: 0; font-size: 11.5px; color: var(--ink-faint); }
.lb-chip {
  min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.lb-chip.is-on { background: var(--ink); color: var(--white); border-color: var(--ink); }
.lb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer;
}
.lb-btn:hover { background: var(--paper); }
.lb-btn.is-bad { color: var(--coral); border-color: var(--coral-wash); }

.lb-pop .lb-pop-h { padding: 18px 60px 6px 20px; }
.lb-listrows { display: grid; gap: 4px; padding: 8px 20px; overflow: auto; }
.lb-listrow {
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
}
.lb-listrow:hover { background: var(--paper); }
.lb-listrow-n { margin-left: auto; color: var(--ink-faint); font-size: 11.5px; }
.lb-listnew, .lb-fix-acts, .lb-ratebox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 20px 20px; }
.lb-listname, .lb-fix-i {
  flex: 1 1 160px; min-width: 0; min-height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); color: var(--ink); font: inherit; font-size: 13px;
}
.lb-fix-l { display: grid; gap: 4px; padding: 6px 20px; font-size: 11.5px; font-weight: 700; color: var(--ink-faint); }
.lb-fix-p { margin: 0; padding: 0 20px 6px; font-size: 12px; color: var(--ink-soft); }

/* ------------------------------------------------------------- the rest --- */

.lb-warn, .lb-wait, .lb-none, .lb-more-note { margin: 0; font-size: 13px; color: var(--ink-soft); }
.lb-warn { color: var(--coral-dark); display: flex; align-items: center; gap: 6px; }
.lb-none, .lb-more-note { padding: 14px 0; color: var(--ink-faint); }
.lb-empty { display: grid; gap: 10px; justify-items: start; padding: 28px 0; max-width: 460px; }
.lb-empty h2 { margin: 0; font-size: 17px; font-weight: 800; }
.lb-empty p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }

/* The Dashboard and Scan panes have no sidebar; their content keeps the
   page's gutter and width. */
.lb-body[data-pane="dashboard"], .lb-body[data-pane="scan"] { gap: 0; }

/* 21.1 — the dashboard's graph box (brain.css owns `.blib-prev`). */
.db-graphbox { margin: 0 0 8px; }
.db-graphbox .blib-prev { margin: 0; height: 180px; }
.blib-prev.is-wait { display: grid; place-items: center; }
.blib-prev.is-wait .blib-prev-btn { position: static; }

/* A SHORT WINDOW KEEPS THE HERO, SMALLER. On the 13" laptop (1440×620) the
   full hero and strip were 380px before a single tile; the hero stays a hero
   (round 5 Q4) but gives the rows most of the window back. */
@media (min-width: 701px) and (max-height: 760px) {
  .lb-hero { padding-top: 14px; }
  /* Title, line and logos on ONE row; the way out above, the submenus below. */
  .lb-hero-in { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 18px; }
  .lb-back, .lb-sub { flex: 0 0 100%; }
  .lb-back { max-width: max-content; }
  .lb-title { margin-top: 14px; font-size: 44px; }
  .lb-hero-sub { margin: 0; }
  .lb-logos { margin: 0 0 0 auto; align-self: center; }
  .lb-sub { margin-top: 12px; }
  .lb-subb { padding-top: 6px; padding-bottom: 10px; }
  .lb-bar { padding-block: 8px; }
  .lb-main { padding-top: 24px; }
}

/* ------------------------------------------------ narrow: chips, not a side --- */

@media (max-width: 1000px) {
  .lb-main.has-side { grid-template-columns: minmax(0, 1fr); }
  .lb-side { display: none; }
  .lb-chips {
    display: block; position: sticky; top: 64px; z-index: 19;
    padding: 10px 0 10px var(--lb-gut);
    background: var(--white); border-bottom: 1px solid var(--line-soft);
  }
  .lb-chips-in {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-right: var(--lb-gut);
    max-width: var(--lb-max); margin: 0 auto;
  }
  .lb-chips-in::-webkit-scrollbar { display: none; }
}

/* --------------------------------------------------------- the phone ------ */

@media (max-width: 700px) {
  .lb-hero { padding-top: 14px; }
  .lb-title { margin-top: 22px; font-size: 40px; }
  .lb-hero-sub { font-size: 14px; }
  .lb-sub { gap: 24px; margin-top: 20px; }
  .lb-bar { padding: 10px var(--lb-gut); }
  .lb-bar-in { gap: 8px; }
  .lb-search { flex: 1 1 100%; min-height: 40px; }
  .lb-bar-gap { display: none; }
  .lb-count { margin-right: auto; }
  .lb-add span { display: none; }
  .lb-add { padding: 0 12px; }
  .lb-chips { top: 110px; }
  .lb-main { padding-top: 22px; gap: 0; }
  .lb-body { gap: 34px; }
  .lb-sec-h { font-size: 18px; }
  .lb-back span { display: none; }
  .lb-back { padding: 0 10px; }
  /* A SHEET FROM THE BOTTOM, and the scrim's 20px padding goes with it —
     `width: 100vw` inside a padded grid overflowed by 40px. */
  .lb-scrim.pop-scrim { padding: 0; align-items: end; }
  .pop-panel.lb-pop, .pop-panel.lb-pop.lb-sheet { width: 100%; max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .lb-pop-head { padding: 16px 56px 12px 14px; }
  .lb-popbody { padding: 12px 14px 24px; }
  .lb-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); column-gap: 12px; row-gap: 16px; }
}

/* 20.1 — the profile tab's hand-over to the manager. */
.th-manage {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--ink); border-radius: 999px;
  background: var(--white); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.th-manage:hover { background: var(--ink); color: var(--white); }
.th-manage-n { color: var(--ink-faint); font-weight: 600; font-size: 11.5px; }
.th-manage:hover .th-manage-n { color: rgba(255, 255, 255, .7); }

/* ------------------------------ the manage block ON THE MEDIA CARD -------- */
/* 20 Q2: the detail popup is a DARK full-bleed sheet over the blurred artwork,
   so the block uses the card's own values (`styles/mediacard.css`). */
.mc-panel .lb-manage { border-top-color: rgba(255, 255, 255, .2); gap: 12px; margin-top: 18px; padding-top: 18px; }
.mc-panel .lb-manage-h { color: rgba(255, 255, 255, .55); }
.mc-panel .lb-manage-l { color: rgba(255, 255, 255, .8); font-size: 14px; min-width: 92px; }
.mc-panel .lb-manage-in { color: rgba(255, 255, 255, .6); font-size: 13px; }
.mc-panel .lb-manage-clear { color: rgba(255, 255, 255, .6); }
.mc-panel .lb-manage .st-input { color: #fff; }
.mc-panel .lb-manage .st-bg { color: rgba(255, 255, 255, .32); }
.mc-panel .lb-chip, .mc-panel .lb-manage .lb-btn {
  border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .06); color: #fff;
  min-height: 42px; border-radius: 4px; font-size: 14px;
}
.mc-panel .lb-chip:hover, .mc-panel .lb-manage .lb-btn:hover {
  border-color: #fff; background: rgba(255, 255, 255, .14);
}
.mc-panel .lb-chip.is-on { background: #fff; color: #1a1020; border-color: #fff; }
.mc-panel .lb-manage .lb-btn.is-bad { color: #ffb4a6; border-color: rgba(255, 180, 166, .45); }

/* 24.2 (media-card/SPEC.md 10) — your name for it, beside the original; and
   the In-your-library toggle that every media popup carries. */
.lb-alias, .mc-alias { font-weight: 700; color: var(--accent, #7c3aed); }
.mc-alias { font-size: .7em; vertical-align: middle; }
.lb-orig { color: var(--ink-faint); font-weight: 400; }
.lb-manage-alias { margin: 0; font-size: 12px; color: var(--ink-faint); }
.mc-panel .lb-manage-alias { color: rgba(255, 255, 255, .6); font-size: 13px; }
.lb-btn.lb-inlib.is-on { background: var(--accent, #7c3aed); border-color: var(--accent, #7c3aed); color: #fff; }

/* 26.8 — a write that failed after the popup already showed it: the old state
   is back, and this line says why. */
.lb-manage-err { margin: 0; font-size: 12.5px; color: var(--coral-dark); }
.mc-panel .lb-manage-err { color: #ffb4a8; font-size: 13px; }

/* 2026-09-14 — the Add pill on a phone: labelled and prominent in its bar
   (a fixed pill landed mid-page under a transformed ancestor). */
@media (max-width: 900px) {
  .lb-add { min-height: 42px; padding: 0 16px; box-shadow: 0 4px 14px rgba(20, 12, 34, .18); }
  .lb-add span { display: inline; }
}

.lb-fab { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 18px;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--white);
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: 0 8px 24px rgba(20, 12, 34, .28); }
@media (max-width: 900px) { .lb-add { display: none; } }
.lb-gate { max-width: 420px; margin: 48px auto; padding: 0 20px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.lb-gate h1 { margin: 0; font-size: 28px; }
.lb-gate p { margin: 0; color: var(--ink-soft); }

/* 2026-09-15 — icons dead-centre in their pills; sections paint only when
   they scroll into view (a long library no longer lays out all at once) */
.lb-viewb { padding: 0; line-height: 0; }
.lb-viewb svg, .lb-add svg { display: block; }
.lb-add { line-height: 1; }
.lb-sec { content-visibility: auto; contain-intrinsic-size: auto 260px; }
