/* Waypage: tokens first, then layout. Every color is a token here and
   only here; DESIGN.md is the rulebook for what each one is for. */

:root,
[data-theme="paper"] {
  --bg: #F7F4EE;
  --surface: #FFFFFF;
  --ink: #1C1B19;
  --muted: #5E5A53;
  --accent: #2F5D8A;
  --accent-ink: #FFFFFF;
  --line: #E4DED3;
  --preview: #D9E2EA;
  --mark: #F6E3A1;
  /* Pen colours (1.56.0): the same in every theme, as the page they're
     drawn on is white paper in every theme (reader.css has the paint). */
  --pen-ink: #1C1B19;
  --pen-red: #D0312D;
  --pen-blue: #2B61C4;
  --pen-green: #2E8B57;
  --hl-yellow: #FFD60A;
  --hl-green: #5BD66B;
  --hl-blue: #5AB0FF;
  --hl-pink: #FF7AB6;
  --hl-purple: #B58CFF;
  --mark-green: #97F0AD;
  --mark-blue: #C8DFF7;
  --mark-pink: #F9D3E0;
  --mark-purple: #E8D7F9;
  --bar: #EDE8DF;
  --ok: #1F6F5C;
  --warn: #8A4B22;
  --video: #3A4048;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.55);
  --viewer: #0B0D10;
  --shadow: rgba(0, 0, 0, 0.08);
  --press: rgba(0, 0, 0, 0.06);
  color-scheme: light;
}
[data-theme="sepia"] {
  --bg: #F1E7D3;
  --surface: #F8F0DF;
  --ink: #2B2118;
  --muted: #6B5A45;
  --accent: #8A4B22;
  --accent-ink: #FFFFFF;
  --line: #E0D2B8;
  --preview: #E3D5BC;
  --mark: #EBD594;
  --mark-green: #87EEA1;
  --mark-blue: #C1DCF6;
  --mark-pink: #F8CEDC;
  --mark-purple: #E4D1F8;
  --bar: #E7DAC0;
  --ok: #3F6B2E;
  --warn: #8A4B22;
  --video: #4A3F33;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.55);
  --viewer: #0B0D10;
  --shadow: rgba(43, 33, 24, 0.1);
  --press: rgba(0, 0, 0, 0.06);
  color-scheme: light;
}
[data-theme="night"] {
  --bg: #0F1216;
  --surface: #171B21;
  --ink: #E6E2D9;
  --muted: #9AA1AB;
  --accent: #8DB4E2;
  --accent-ink: #0F1216;
  --line: #252B33;
  --preview: #232A33;
  --mark: #3D3420;
  --mark-green: #173D20;
  --mark-blue: #1E364F;
  --mark-pink: #592234;
  --mark-purple: #452663;
  --bar: #181C22;
  --ok: #7CC4A8;
  --warn: #E0A46E;
  --video: #262C34;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.55);
  --viewer: #0B0D10;
  --shadow: rgba(0, 0, 0, 0.45);
  --press: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}
[data-theme="slate"] {
  --bg: #EEF0F3;
  --surface: #FFFFFF;
  --ink: #1A1D21;
  --muted: #555B64;
  --accent: #2B5C80;
  --accent-ink: #FFFFFF;
  --line: #D9DDE3;
  --preview: #D6DEE6;
  --mark: #F3E3A6;
  --mark-green: #8FEFA7;
  --mark-blue: #C5DEF7;
  --mark-pink: #F8D0DE;
  --mark-purple: #E6D4F9;
  --bar: #E3E6EB;
  --ok: #1F6F5C;
  --warn: #8A4B22;
  --video: #3A4048;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.55);
  --viewer: #0B0D10;
  --shadow: rgba(20, 30, 45, 0.08);
  --press: rgba(0, 0, 0, 0.06);
  color-scheme: light;
}
[data-theme="solarized"] {
  --bg: #FDF6E3;
  --surface: #FFFCF2;
  --ink: #3D4F55;
  --muted: #5A6B70;
  --accent: #1D6A9E;
  --accent-ink: #FFFFFF;
  --line: #EEE8D5;
  --preview: #EBE5D3;
  --mark: #F4E3A5;
  --mark-green: #C4F7D0;
  --mark-blue: #DDECFA;
  --mark-pink: #FBE5EC;
  --mark-purple: #F1E6FB;
  --bar: #F3EBD6;
  --ok: #5C6A00;
  --warn: #A4331A;
  --video: #3D4F55;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.55);
  --viewer: #0B0D10;
  --shadow: rgba(61, 79, 85, 0.1);
  --press: rgba(0, 0, 0, 0.06);
  color-scheme: light;
}
[data-theme="contrast"] {
  --bg: #FFFFFF;
  --surface: #F2F2F2;
  --ink: #000000;
  --muted: #333333;
  --accent: #003C99;
  --accent-ink: #FFFFFF;
  --line: #8A8A8A;
  --preview: #DADADA;
  --mark: #FFE97A;
  --mark-green: #66E987;
  --mark-blue: #AED1F3;
  --mark-pink: #F6BED1;
  --mark-purple: #DDC3F6;
  --bar: #EBEBEB;
  --ok: #0B5B3A;
  --warn: #8A2F00;
  --video: #222222;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.6);
  --viewer: #000000;
  --shadow: rgba(0, 0, 0, 0.12);
  --press: rgba(0, 0, 0, 0.06);
  color-scheme: light;
}
[data-theme="black"] {
  --bg: #000000;
  --surface: #121315;
  --ink: #E8E6E1;
  --muted: #A0A4AA;
  --accent: #8DB4E2;
  --accent-ink: #000000;
  --line: #24272C;
  --preview: #1C1F24;
  --mark: #3A3115;
  --mark-green: #15391E;
  --mark-blue: #1C334B;
  --mark-pink: #542032;
  --mark-purple: #41245E;
  --bar: #0A0A0B;
  --ok: #7CC4A8;
  --warn: #E0A46E;
  --video: #1C1F24;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.6);
  --viewer: #000000;
  --shadow: rgba(0, 0, 0, 0.6);
  --press: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}
[data-theme="dusk"] {
  --bg: #1E1A17;
  --surface: #28231F;
  --ink: #EADFCF;
  --muted: #B3A594;
  --accent: #E2A770;
  --accent-ink: #1E1A17;
  --line: #3A332D;
  --preview: #332C26;
  --mark: #4A3A22;
  --mark-green: #1A4425;
  --mark-blue: #223E5B;
  --mark-pink: #66273C;
  --mark-purple: #4E2B72;
  --bar: #241F1B;
  --ok: #A3C78F;
  --warn: #EE9F7E;
  --video: #332C26;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.55);
  --viewer: #0B0D10;
  --shadow: rgba(0, 0, 0, 0.45);
  --press: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}
[data-theme="solarized-dark"] {
  --bg: #002B36;
  --surface: #073642;
  --ink: #D3CDBA;
  --muted: #9AA8A8;
  --accent: #5AAEE6;
  --accent-ink: #002B36;
  --line: #0E4552;
  --preview: #0A3D4A;
  --mark: #3A3A1A;
  --mark-green: #184022;
  --mark-blue: #203A55;
  --mark-pink: #602438;
  --mark-purple: #49286B;
  --bar: #04313D;
  --ok: #A5B53A;
  --warn: #F08060;
  --video: #0A3D4A;
  --on-video: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.55);
  --viewer: #0B0D10;
  --shadow: rgba(0, 0, 0, 0.45);
  --press: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

:root {
  --serif: "Source Serif 4", "Frank Ruhl Libre", "New York", "Noto Serif", Georgia, serif;
  --sans: "Instrument Sans", "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* A QR code's paper, the same in every theme: scanners read black on white. */
  --code-paper: #ffffff;
  /* Highlights on a PDF's printed pages (1.56.0), the same in every
     theme: the page is its own white paper unless Dark PDF pages is on. */
  --page-mark: #F6E3A1;
  --page-mark-green: #97F0AD;
  --page-mark-blue: #C8DFF7;
  --page-mark-pink: #F9D3E0;
  --page-mark-purple: #E8D7F9;
  /* Words being selected on a printed page: a see-through blue, as on a
     computer, since it lies over the page's own type, not under it. */
  --page-select: rgba(0, 120, 215, 0.28);
  --page-select-dark: rgba(100, 170, 255, 0.35);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 40px; --s-8: 56px; --s-9: 72px;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;

  --fs-title: 32px; --lh-title: 38px;
  --fs-heading: 22px; --lh-heading: 28px;
  --fs-body: 19px; --lh-body: 30px;
  --fs-screen: 28px; --lh-screen: 34px;
  --fs-card: 18px; --lh-card: 23px;
  --fs-label: 15px; --lh-label: 20px;
  --fs-meta: 13px; --lh-meta: 18px;

  --tap: 44px;
  --gutter: 16px;
  --measure: 38rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-label)/var(--lh-label) var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A sheet puts focus on its first row; the ring shows only for keys, not after a tap. */
body:not(.keys) :is(#readingSheet, #menuSheet) :focus-visible { outline: none; }
button, input { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.app {
  min-height: 100dvh;
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
/* The library's bar stays while the list scrolls under it (0.28.0): the
   space over it scrolls away, the bar sticks at the top. */
#libraryView { padding-top: var(--s-5); }
/* Its parts drift right under the sidebar (1.11.0). Clipped, so the drift
   doesn't make the page wider: a phone then grew its layout viewport to
   fit and the sticky bar along the bottom went below the screen (1.45.5). */
#libraryView { overflow-x: clip; }
html.native #libraryView { padding-top: 0; }
.top-bar {
  position: sticky; top: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: var(--s-2);
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 120ms linear;
}
html.native .top-bar { padding-top: calc(var(--s-2) + env(safe-area-inset-top)); }
.top-bar.scrolled { border-bottom-color: var(--line); }
.top-bar .screen-title { flex: 1; min-width: 0; margin-inline-start: var(--s-1); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top { padding: 0 var(--gutter) var(--s-2); }
.top .meta:first-child { margin-top: 0; }
.screen-title {
  margin: 0;
  font: 700 var(--fs-screen)/var(--lh-screen) var(--serif);
}
.top-actions { display: flex; gap: var(--s-1); flex-shrink: 0; margin-inline-start: auto; }
.top-actions [hidden] { display: none; }
/* Five icons (with Sync and View) leave "Library" room on a 390 px phone
   only with the spaces between them taken out; each stays 44 px. */
@media (max-width: 419px) {
  #topBar { gap: var(--s-1); }
  #topBar .screen-title { margin-inline-start: 0; }
  .top-actions { gap: 0; }
}
.meta { margin: var(--s-1) 0 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }

.icon-btn {
  width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--ink);
  cursor: pointer;
}

.library {
  flex: 1;
  padding: var(--s-2) var(--gutter) var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-3);
}

.empty {
  margin: auto 0;
  padding: var(--s-8) var(--s-5);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
}
.empty-title { margin: 0; font: 600 var(--fs-heading)/var(--lh-heading) var(--serif); }
.empty-text { margin: 0; color: var(--muted); max-width: 22rem; }

.save-bar {
  position: sticky; bottom: 0; z-index: 2;
  padding: var(--s-3) var(--gutter) calc(var(--s-3) + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.update-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  margin-bottom: var(--s-3); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.update-bar[hidden] { display: none; }
.update-text { flex: 1; min-width: 0; font-weight: 500; }
.update-close { flex-shrink: 0; margin-inline-start: calc(-1 * var(--s-2)); color: var(--muted); }
.btn-small {
  min-width: 72px; height: var(--tap); padding: 0 var(--s-4); flex-shrink: 0;
  border: 0; border-radius: var(--r-md);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; cursor: pointer;
}
.btn-small:disabled { opacity: 0.7; cursor: default; }
a.btn-small { text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; cursor: grab; }
.save-form { display: flex; gap: var(--s-2); }
.save-link-icon { display: none; }
.save-form input {
  flex: 1; min-width: 0;
  height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  font-size: 16px;
}
.save-form input::placeholder { color: var(--muted); }
/* A placeholder too long for a narrow phone ends in …, not mid-letter. */
.save-form input:placeholder-shown { text-overflow: ellipsis; }
/* Save and its options button are one pair: same height and fill, split
   by a hairline. */
.save-form .btn-primary { border-start-end-radius: 0; border-end-end-radius: 0; }
.several-btn {
  width: 48px; height: 48px; margin-inline-start: calc(1px - var(--s-2));
  border-start-start-radius: 0; border-end-start-radius: 0;
  background: var(--accent); color: var(--accent-ink);
}
.btn-primary {
  height: 48px; padding: 0 18px;
  border: 0; border-radius: var(--r-md);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
}

.card {
  display: flex; gap: 14px; align-items: flex-start;
  width: 100%; padding: 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  text-align: start; cursor: pointer;
}
.card { position: relative; }
/* A card's own layers (Retry, the pick circle) stay inside it, under the
   save bar and anything else that floats over the list. */
.card, .tile { isolation: isolate; }
/* A long library: cards off screen skip style, layout and paint until
   they scroll near, so opening and closing things stays quick (0.30.4). */
.library > .page-card:not(.continue) { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.card-open {
  position: absolute; inset: 0; z-index: 0;
  border: 0; border-radius: inherit; background: transparent; cursor: pointer;
}
.card-open ~ .card-thumb, .card-open ~ .card-body { pointer-events: none; }
.card-retry {
  position: relative; z-index: 1; pointer-events: auto;
  min-height: var(--tap); margin: calc((var(--lh-meta) - var(--tap)) / 2) 0; padding: 0 var(--s-1);
  border: 0; background: transparent; color: var(--accent);
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
  vertical-align: middle;
}
.card-retry:disabled { color: var(--muted); cursor: default; }
/* Narrate on Continue reading (2026-11): a round button on the card's
   far side, so the card keeps its height. */
.card-narrate {
  position: relative; z-index: 1; flex: none; align-self: center;
  width: var(--tap); height: var(--tap); padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--bg); color: var(--accent); cursor: pointer;
}
.card-narrate[hidden], .selecting .card-narrate { display: none; }
.folder-go-row { display: flex; margin-bottom: var(--s-5); }
.folder-go-row > .folder-go { flex: 1; min-width: 0; margin: 0; }
.folder-go-row > .folder-go:not(:last-child) { border-start-end-radius: 0; border-end-end-radius: 0; }
.folder-narrate {
  width: 52px; height: 48px; margin-inline-start: 1px; align-self: stretch;
  border: 0; border-radius: var(--r-md); border-start-start-radius: 0; border-end-start-radius: 0;
  background: var(--accent); color: var(--accent-ink);
}
.card.saving { cursor: default; }
/* A run's card keeps one height: its status is one line whatever it says. */
.card.run .card-status { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card.run .spinner[hidden] { display: none; }
.card-actions { display: flex; gap: var(--s-2); margin-top: var(--s-1); }
.btn-quiet {
  height: var(--tap); padding: 0 var(--s-4); flex-shrink: 0;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: transparent; color: var(--ink);
  font-weight: 500; cursor: pointer;
}
.card-thumb {
  width: 64px; height: 96px; flex-shrink: 0;
  border-radius: 10px; object-fit: cover;
  background: var(--preview);
}
/* A page with no picture of its own: its site's icon, or first letter. */
.card-thumb.site-mark {
  position: relative; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font: 600 var(--fs-heading)/1 var(--serif);
}
.site-mark img { position: absolute; width: var(--s-6); height: var(--s-6); object-fit: contain; opacity: 0; }
.site-mark.has-icon img { opacity: 1; }
.site-mark.has-icon .site-letter { visibility: hidden; }
.site-letter.file-ext { font: 600 var(--fs-meta)/1 var(--sans); letter-spacing: 0.04em; }
/* A folder's card: its first picture with two sheets peeking behind it. */
.card-thumb.stack {
  position: relative; display: block; overflow: visible;
  box-shadow: 4px -4px 0 -1px var(--surface), 4px -4px 0 0 var(--line), 8px -8px 0 -1px var(--surface), 8px -8px 0 0 var(--line);
  margin: 8px 8px 0 0; width: 68px; height: 68px;
}
.card-thumb.stack img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.card-thumb.stack.blank { background: var(--preview); }
.card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.card-site, .card-status { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
.card-site { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-live { color: var(--accent); font-weight: 600; }
.card-live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-inline-end: 4px; vertical-align: 0.1em; }
.card-title {
  font: 600 var(--fs-card)/var(--lh-card) var(--serif);
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-status .ok, .card-status .warn, .card-status.accent { font-weight: 500; }
.card-status .ok { color: var(--ok); }
.card-status .warn { color: var(--warn); }
.card-status.accent { color: var(--accent); }
.progress { display: block; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress.thin { height: 3px; margin-top: 2px; }
.progress.thin .progress-fill { transition: none; }
.progress-fill {
  display: block; height: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--spring-sheet-ms, 400ms) var(--spring-sheet, ease-out);
}
/* No size known yet: a short bar sweeps across. */
.progress.busy .progress-fill { width: 30%; transform: none; transition: none; animation: sweep 1.1s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
/* Turns while a save is working, so a slow site doesn't look stuck. */
.spinner {
  display: inline-block; width: 12px; height: 12px; margin-inline-end: 6px; vertical-align: -1px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: var(--r-full);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* The library while it's read (1.7.1): in the middle, and only after a
   moment, so a quick start doesn't flash it. */
.lib-more { grid-column: 1 / -1; height: 1px; }
.lib-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-3);
  min-height: 50vh; color: var(--muted); font: 400 var(--fs-label)/var(--lh-label) var(--sans);
  animation: lib-loading-in 0s 500ms both;
}
.lib-loading .spinner { width: 28px; height: 28px; margin: 0; border-width: 3px; }
@keyframes lib-loading-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: breathe 1.6s ease-in-out infinite; border-top-color: var(--line); background: var(--accent); }
  .progress.busy .progress-fill { width: 100%; animation: breathe 1.6s ease-in-out infinite; }
}
@keyframes breathe { 50% { opacity: 0.35; } }

/* Settings' two screens; a box of their own only on a big screen. */
.settings-win { display: contents; }
.screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  background: var(--bg);
  box-shadow: -8px 0 24px var(--shadow);
  /* A scroll that runs out inside a screen stays there (1.4.1): before,
     it went on to the page underneath, which scrolled the library out of
     sight and showed a second scroll bar. */
  overflow: hidden; overscroll-behavior: contain;
}
.screen[hidden] { display: none; }
/* Screens, sheets and the sidebar move as their own layers, made before
   they move: promoting one as an animation starts, and flattening it
   back after, repaints it and drops frames on a phone (0.30.4). Hidden,
   they cost nothing. */
.screen, .sidebar, .sheet, .menu-sheet, .viewer::before { will-change: transform; }
.screen-bar {
  display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center;
  padding: var(--s-2);
  border-bottom: 1px solid var(--line);
}
html.native .screen-bar { padding-top: calc(var(--s-2) + env(safe-area-inset-top)); }
.bar-title { margin: 0; text-align: center; font: 600 var(--fs-label)/var(--lh-label) var(--sans); }
.screen-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: var(--s-4) var(--gutter) calc(var(--s-7) + env(safe-area-inset-bottom));
}
.screen-body > * { max-width: 40rem; margin-inline: auto; }

:is(.settings-section, .reading-controls.split) + .settings-section { margin-top: var(--s-6); }
/* Two cards in one section (a list and its action, say) stand apart (1.48.1). */
/* The reader's own theme sits close under Theme, with no heading. */
.settings-section + .settings-section.reader-theme-sec { margin-top: var(--s-3); }
.settings-section > .group + .group, .settings-section > :is(.footnote, textarea, .report-field) + .group { margin-top: var(--s-3); }
.overline {
  margin: 0 0 var(--s-2) var(--s-1);
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.section-lead { margin: 0 0 var(--s-2) var(--s-1); color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.footnote { margin: var(--s-2) var(--s-1) 0; color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.group {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
}
.choice, .row {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; min-height: 52px; padding: var(--s-2) var(--s-4);
  background: transparent; color: var(--ink); border: 0;
  font: inherit; text-align: start; text-decoration: none;
  cursor: pointer;
}
.choice + .choice, .row + .row { border-top: 1px solid var(--line); }
/* A hidden row stays hidden: display above would show it (Save in, 2026-11). */
.choice[hidden], .row[hidden] { display: none; }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.choice-label { font-weight: 500; }
.choice-note { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
/* The check grows in from nothing and shrinks away (1.11.0). */
.choice-check {
  display: inline-flex; color: var(--accent);
  transform: scale(0);
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out);
}
.choice input:checked ~ .choice-check { transform: none; }
.row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { flex-shrink: 0; color: var(--muted); font-size: var(--fs-meta); }
/* A row with a Stop (×) at its end: the watched folders (1.4.0). */
.watch-row { padding-inline-end: 0; }
.row-x { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-inline-start: var(--s-1); border: 0; border-radius: var(--r-full); background: none; color: var(--muted); }
.row-x:hover { color: var(--ink); background: var(--press); }
.row-refresh.looking .row-x-icon { display: inline-flex; animation: spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .row-refresh.looking .row-x-icon { animation: none; opacity: 0.5; } }
.watch-row .row-x + .row-x { margin-inline-start: 0; }
.drive-row { padding: 0; padding-inline-end: var(--s-1); gap: 0; cursor: default; }
.drive-row:active { background-image: none; }
.drive-pick { flex: 1; min-width: 0; padding-inline-end: var(--s-2); }
.drive-delete:hover, .kokoro-delete:hover { color: var(--warn); }
/* Under a watched folder, the collection its new files go into (1.28.0). */
.watch-into { gap: var(--s-3); }
.watch-into .row-label { flex: none; color: var(--muted); font-size: var(--fs-label); }
.watch-pick { position: relative; flex: 1; min-width: 0; }
.accent { color: var(--accent); font-weight: 500; }
.muted { color: var(--muted); }

.swatch {
  display: inline-flex; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: var(--r-full); overflow: hidden;
  border: 1px solid var(--line);
}
.swatch-half {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.swatch-dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--accent); }
.swatch-half + .swatch-half .swatch-dot { display: none; }
.swatch-half:first-child:not(:only-child) .swatch-dot { display: none; }

.reader-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-2);
  border-bottom: 1px solid var(--line);
}
html.native .reader-bar { padding-top: calc(var(--s-2) + env(safe-area-inset-top)); }
.reader { z-index: 11; }
/* With Settings opened over the clip (app-settings.js). */
.reader.under { z-index: 9; }
.icon-btn[hidden] { display: none; }
:root[data-clips="had"] #libraryView[data-place="library"] #viewBtn[hidden] { display: inline-flex; }
:root[data-clips="had"] #libraryView[data-place="library"] #searchBox[hidden] { display: block; }
#readerAa[aria-expanded="true"] { background: var(--line); }
.aloud-btn[aria-pressed="true"] { color: var(--accent); background: var(--line); }

/* Read aloud (0.27.0): previous, play or pause, next, in the middle of
   the bar along the bottom, which stays up while it reads. */
.aloud-player { display: flex; align-items: center; gap: var(--s-1); flex: none; pointer-events: auto; }
.aloud-player[hidden] { display: none; }
.aloud-player .icon-btn { border-radius: var(--r-full); color: var(--ink); }
.aloud-player .aloud-play { background: var(--accent); color: var(--accent-ink); }
.aloud-player { position: relative; }
/* Off to the side of the three (1.36.2), so they stay centred. */
.aloud-player .aloud-sleep { position: absolute; inset-inline-start: 100%; top: 0; width: auto; min-width: var(--tap); padding: 0 var(--s-1); gap: 2px; color: var(--ink); }
.aloud-player .aloud-sleep.on { color: var(--accent); }
.aloud-player .aloud-sleep.on svg { fill: currentColor; }
.aloud-sleep-left { font-size: var(--fs-meta); font-weight: 600; font-variant-numeric: tabular-nums; }
.aloud-sleep-left:empty { display: none; }
.aloud-play .aloud-play-icon, .aloud-play.paused .aloud-pause-icon { display: none; }
.aloud-play.paused .aloud-play-icon { display: block; }
/* Thinking: the engine is still making the piece it's on (a slow voice
   like Kokoro, at the start or after a skip). A ring turns round Pause
   until the voice starts; shown only past a quarter second. */
.aloud-player .aloud-play { position: relative; overflow: visible; }
.aloud-play.thinking::after { content: ""; position: absolute; inset: -5px; border-radius: var(--r-full); pointer-events: none;
  border: 2.5px solid color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite, think-in 0.2s ease-out; }
@keyframes think-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .aloud-play.thinking::after { animation-duration: 2.4s, 0.2s; } }
:root[data-motion="off"] .aloud-play.thinking::after { animation: none; }
/* Even room above and below the buttons (1.24.2): 2px above sat them on
   the bar's top edge, most of all over a phone's gesture area. */
.reader.aloud .read-left { align-items: center; padding-top: var(--s-2); padding-bottom: calc(var(--s-2) + env(safe-area-inset-bottom)); }
.reader.aloud .read-section, .reader.aloud .read-time { flex: 1 1 0; }
.reader.aloud .read-time { text-align: end; white-space: nowrap; }
/* Room for the moon and the percent side by side on a phone (1.37.1). */
@media (max-width: 519px) { .reader.aloud .read-left { gap: var(--s-1); padding-inline: var(--gutter); } }
/* Narrower than any current phone: the timer's minutes win over the percent. */
@media (max-width: 359px) { .reader.aloud:has(.aloud-sleep.on) .read-time { visibility: hidden; } }
.reader.aloud.bar-away .read-left { transform: none; opacity: 1; }
/* Read next (1.4.0): at the end of a clip read aloud, in place of the
   player, and on the bar along the bottom. */
.aloud-read-next {
  display: inline-flex; align-items: center; gap: var(--s-1); flex: none;
  min-height: 44px; padding: 0 var(--s-4); border: 0; border-radius: var(--r-full);
  background: var(--accent); color: var(--accent-ink);
  font: 500 var(--fs-label) var(--sans); pointer-events: auto;
}
.aloud-read-next[hidden] { display: none; }
/* The card that shows a clip being read aloud away from its page (1.4.0):
   over every screen but under sheets and the toast. Compact and movable
   (1.4.1): app.js places it (left and top), a drag takes it anywhere, and
   it snaps to a side when let go. */
.aloud-bar {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  position: fixed; left: 0; top: 0; z-index: 12;
  width: min(240px, calc(100vw - 2 * var(--gutter)));
  display: flex; align-items: center; gap: var(--s-1);
  padding: var(--s-1); padding-inline-end: var(--s-1);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 8px 24px var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
.aloud-bar.dragging { cursor: grabbing; box-shadow: 0 16px 40px var(--shadow); }
.aloud-bar.snapping { transition: left var(--spring-control-ms, 300ms) var(--spring-control, ease-out), top var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
@media (prefers-reduced-motion: reduce) { .aloud-bar.snapping { transition: none; } }
.aloud-bar[hidden] { display: none; }
/* Picture in picture (1.25.0): the app as a small window outside itself
   while reading aloud. Everything else steps aside for the paragraph being
   read, and the clip's name above it once the window is made bigger
   (1.27.0); the window's own buttons do the rest. */
.pip-view {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: var(--s-2) var(--s-3); background: var(--bg); color: var(--ink); overflow: hidden;
}
.pip-view[hidden] { display: none; }
body.pip > :not(.pip-view) { visibility: hidden; }
.pip-over, .pip-state { margin: 0; font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-title { margin: 0; font: 600 var(--fs-label)/var(--lh-label) var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-text { margin: 0; font: var(--fs-meta)/var(--lh-meta) var(--serif); color: var(--ink); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.pip-text:empty, .pip-over:empty, .pip-state:empty { display: none; }
@media (max-height: 169px) { .pip-view.has-text .pip-over, .pip-view.has-text .pip-title { display: none; } }
.aloud-bar .icon-btn { border-radius: var(--r-full); color: var(--ink); }
.aloud-bar-text {
  flex: 1; min-width: 0; display: flex; align-items: center;
  min-height: 44px; padding: 0 var(--s-1); border: 0; background: none; color: var(--ink); text-align: start; cursor: inherit;
}
.aloud-bar-title { font: 600 var(--fs-label) var(--serif); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.aloud-bar-up .library, body.aloud-bar-up .screen-body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
/* Draw (1.56.0, app-ink.js): the bar along the foot of a PDF's pages while
   Draw is on. Tools and Undo above, colours, size and Finger below. */
#readerInk[aria-pressed="true"] { color: var(--accent); background: var(--line); }
.ink-bar {
  position: fixed; z-index: 3; left: 0; right: 0; width: max-content; margin-inline: auto;
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: stretch;
  max-width: calc(100vw - 2 * var(--s-3));
  border-radius: var(--r-lg, 22px); overflow: hidden;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px var(--shadow), 0 1px 4px var(--shadow);
}
.ink-bar[hidden] { display: none; }
.ink-row { display: flex; align-items: center; justify-content: center; }
.ink-row + .ink-row { border-top: 1px solid var(--line); }
.ink-bar button {
  position: relative; flex: 0 0 auto; width: var(--tap); height: var(--tap); padding: 0; border: 0; background: none; color: inherit;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.ink-bar button:active { background-image: linear-gradient(var(--press), var(--press)); }
.ink-bar button:disabled { opacity: .35; cursor: default; }
.ink-bar button[aria-pressed="true"] { color: var(--accent); background: var(--line); }
.ink-bar .ink-gap { flex: 1 1 auto; min-width: var(--s-2); }
.ink-bar .ink-done { width: auto; padding: 0 var(--s-4); font: 600 var(--fs-label)/1 var(--sans); color: var(--accent); }
.ink-dot { display: block; width: 22px; height: 22px; border-radius: var(--r-full); background: var(--pen-ink); box-shadow: 0 0 0 1px var(--line); }
.ink-dot[data-c="red"] { background: var(--pen-red); }
.ink-dot[data-c="blue"] { background: var(--pen-blue); }
.ink-dot[data-c="green"] { background: var(--pen-green); }
.ink-dot[data-t="h"][data-c="yellow"] { background: var(--hl-yellow); }
.ink-dot[data-t="h"][data-c="green"] { background: var(--hl-green); }
.ink-dot[data-t="h"][data-c="blue"] { background: var(--hl-blue); }
.ink-dot[data-t="h"][data-c="pink"] { background: var(--hl-pink); }
.ink-dot[data-t="h"][data-c="purple"] { background: var(--hl-purple); }
.ink-bar button[aria-pressed="true"] .ink-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.ink-probe-pad {
  display: flex; align-items: center; justify-content: center; min-height: 96px; margin-top: var(--s-2);
  border: 1px dashed var(--line); border-radius: var(--r-md); color: var(--muted);
  font: 400 var(--fs-label)/var(--lh-label) var(--sans);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.ink-probe-out { margin: var(--s-2) 0 0; white-space: pre-wrap; color: var(--muted); font: 400 var(--fs-meta)/var(--lh-meta) ui-monospace, monospace; }
.ink-test-box { margin-top: var(--s-3); }
.ink-test-what { margin: 0 0 var(--s-3); font: 600 var(--fs-label)/var(--lh-label) var(--sans); }
/* Size and pen style: a small menu above their button on the Draw bar. */
.ink-pop {
  position: fixed; z-index: 4; display: flex;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 8px 24px var(--shadow), 0 1px 4px var(--shadow);
}
.ink-pop button {
  border: 0; background: none; color: inherit; cursor: pointer;
  font: 400 var(--fs-meta)/var(--lh-meta) var(--sans);
}
.ink-pop button:active { background-image: linear-gradient(var(--press), var(--press)); }
.ink-pop button[aria-pressed="true"] { color: var(--accent); background-color: var(--line); }
.ink-pop-sizes button { width: var(--tap); height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-1); padding: 0; }
.ink-pop-dot { height: 20px; display: flex; align-items: center; justify-content: center; }
.ink-pop-n { font-variant-numeric: tabular-nums; }
.ink-pop-styles { flex-direction: column; min-width: 220px; }
.ink-pop-styles button { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: 0 var(--s-3); text-align: start; font: 500 var(--fs-label)/var(--lh-label) var(--sans); }
.ink-pop-styles button + button { border-top: 1px solid var(--line); }
.ink-pop-name { flex: 1; }
.ink-pop-tick { width: 18px; text-align: center; }
.ink-bar button svg { flex-shrink: 0; }
.ink-size { display: block; border-radius: var(--r-full); background: currentColor; }
.read-here {
  position: fixed; z-index: 3; transform: translateX(-50%);
  display: inline-flex; align-items: stretch;
  height: var(--tap); overflow: hidden;
  border-radius: var(--r-full);
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 24px var(--shadow), 0 1px 4px var(--shadow);
}
.read-here[hidden] { display: none; }
.read-here button {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-4) 0 var(--s-3); border: 0; background: none; color: inherit;
  font: 600 var(--fs-label)/1 var(--sans); white-space: nowrap; cursor: pointer;
}
.read-here button[hidden] { display: none; }
.read-here button:not([hidden]) ~ button:not([hidden]) { border-inline-start: 1px solid color-mix(in srgb, var(--accent-ink) 35%, transparent); }
.read-here button:active { background-image: linear-gradient(var(--press), var(--press)); }
.read-here .sel-icon, .read-here.tight .sel-aloud, .read-here.tighter button { width: var(--tap); padding: 0; justify-content: center; }
.read-here.tight .sel-aloud .sel-label, .read-here.tighter .sel-label { display: none; }
/* Highlight colours (1.42.0): a dot for each, ringed so it shows on any
   ground. On the selection bar the dot opens the five in its place. */
.swatch-dot {
  display: block; width: 22px; height: 22px; flex-shrink: 0; border-radius: var(--r-full);
  background: var(--mark); box-shadow: 0 0 0 1px var(--line);
}
.swatch-dot[data-c="green"] { background: var(--mark-green); }
.swatch-dot[data-c="blue"] { background: var(--mark-blue); }
.swatch-dot[data-c="pink"] { background: var(--mark-pink); }
.swatch-dot[data-c="purple"] { background: var(--mark-purple); }
.read-here .swatch-dot { box-shadow: 0 0 0 2px var(--accent-ink); }
/* One Highlight button (2026-11): a hold opens the five in a row under the
   bar. A dot on its pen shows the colour a tap gives; with a mouse the
   separate dot beside it opens the row instead. */
.read-here .sel-mark { position: relative; touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.sel-mark-dot {
  position: absolute; inset-inline-start: calc(var(--s-3) + 12px); top: calc(50% + 3px);
  width: 9px; height: 9px; border-radius: var(--r-full);
  background: var(--mark); box-shadow: 0 0 0 1.5px var(--accent);
}
.sel-mark-dot[data-c="green"] { background: var(--mark-green); }
.sel-mark-dot[data-c="blue"] { background: var(--mark-blue); }
.sel-mark-dot[data-c="pink"] { background: var(--mark-pink); }
.sel-mark-dot[data-c="purple"] { background: var(--mark-purple); }
.read-here.tighter .sel-mark-dot { inset-inline-start: calc(50% + 3px); }
@media (hover: hover) and (pointer: fine) { .sel-mark-dot { display: none; } }
@media not ((hover: hover) and (pointer: fine)) { .read-here .sel-color { display: none; } }
.sel-colors {
  position: fixed; z-index: 3; display: flex; gap: var(--s-2); padding: var(--s-2);
  border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 8px 24px var(--shadow), 0 1px 4px var(--shadow);
}
.sel-colors[hidden] { display: none; }
.sel-colors .sel-swatch {
  display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0;
  border: 0; border-radius: var(--r-full); background: none; cursor: pointer;
}
.sel-colors .swatch-dot { width: 32px; height: 32px; transition: transform var(--t-quick, 120ms) ease; }
.sel-colors .sel-swatch[aria-pressed="true"] .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.sel-colors .sel-swatch.over .swatch-dot, .sel-colors .sel-swatch:hover .swatch-dot { transform: scale(1.18); }
:root[data-motion="off"] .sel-colors .swatch-dot { transition: none; }
@media (prefers-reduced-motion: reduce) { .sel-colors .swatch-dot { transition: none; } }
.chip .swatch-dot { width: 14px; height: 14px; }
.mark-filters { margin-top: var(--s-2); }
.hl-tags-row { display: flex; align-items: flex-start; gap: var(--s-2); margin-top: var(--s-2); }
.hl-tags-row .chips { flex: 1; }
.hl-match { position: relative; flex-shrink: 0; color: var(--accent); }
.hl-match:disabled { color: var(--muted); opacity: 0.5; }
.hl-match.changed::after { content: ""; position: absolute; top: 8px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-sizing: content-box; }
.pop-head { padding: var(--s-2) var(--s-4) var(--s-1); margin: 0; }
.pop-sub { display: block; color: var(--muted); font-size: var(--fs-meta); }
.mark-colors { display: flex; gap: var(--s-1); margin: 0 0 var(--s-3); }
.mark-swatch {
  width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center; background: none; cursor: pointer;
}
.mark-swatch .swatch-dot { width: 28px; height: 28px; }
.mark-swatch[aria-checked="true"] .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.mark-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.aloud-controls { display: flex; flex-direction: column; gap: var(--s-3); }
.aloud-controls > .overline { margin: var(--s-2) 0 calc(-1 * var(--s-1)) var(--s-1); }
.aloud-controls .footnote { margin: 0 var(--s-1); }
/* A dropdown as a form field (Save several's collection and tags). */
.field-pick { display: flex; }
.field-pick .dropdown-btn {
  flex: 1; justify-content: space-between; padding: 0 var(--s-3);
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font: 400 var(--fs-label)/var(--lh-label) var(--sans);
}
.field-pick .dropdown-btn { min-width: 0; }
.field-pick .dropdown-face { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.field-pick .dropdown-face.unset { color: var(--muted); }
.field-pick .dropdown-menu { inset-inline: 0; max-height: 50vh; overflow-y: auto; }
.aloud-player .icon-btn { border-radius: var(--r-full); }
.aloud-play { background: var(--accent); color: var(--accent-ink); }
.aloud-play .aloud-play-icon, .aloud-play.paused .aloud-pause-icon { display: none; }
.aloud-play.paused .aloud-play-icon { display: block; }

/* The reader's Aa sheet: rises over the bottom of the page, no scrim, so
   each change shows on the text above it as it's made. */
.sheet-catch { position: absolute; inset: 0; z-index: 1; }
/* The bar stays live over the catch, so Aa and ⋯ swap or close their sheet. */
.reader-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  background: var(--bar);
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control-edge, ease-out);
}
/* Reading on down: the bar slides up out of the way, back on a scroll up
   or when anything in it takes focus. The status bar's strip stays. */
.reader.bar-away .reader-bar:not(:focus-within) { transform: translateY(-100%); }
.reader.gliding .reader-bar:not(:focus-within) { transform: none; }
html.native .reader::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; z-index: 4;
  height: env(safe-area-inset-top); background: var(--bar);
}
/* Find in this clip (1.14.0): over the reader's bar while it's open. */
.find-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: var(--s-1);
  padding: var(--s-2); background: var(--bar); border-bottom: 1px solid var(--line);
}
html.native .find-bar { padding-top: calc(var(--s-2) + env(safe-area-inset-top)); }
.find-bar[hidden] { display: none; }
.find-input {
  flex: 1; min-width: 0; height: var(--tap); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: 400 var(--fs-label)/1 var(--sans);
}
.find-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.find-count { min-width: 4.5em; text-align: center; font-size: var(--fs-meta); color: var(--muted); font-variant-numeric: tabular-nums; }
.find-done { min-height: var(--tap); padding: 0 var(--s-2); }
/* Back to where you were (1.14.0), after following a link inside the
   clip: over the text at the bottom, until it's used or the clip closes. */
/* It rides on the bar along the bottom (1.45.2), over the skim when
   that's up, so the bar never covers it. */
.jump-back {
  position: absolute; z-index: 2; left: 50%; bottom: calc(100% + var(--s-3)); pointer-events: auto;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-4) 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--surface); color: var(--ink);
  font: 600 var(--fs-label)/1 var(--sans); white-space: nowrap;
  box-shadow: 0 8px 24px var(--shadow);
}
.jump-back[hidden] { display: none; }
/* A note, from its mark in the text (1.14.0). */
.note-text { margin: 0 0 var(--s-4); font: 400 var(--fs-label)/1.5 var(--serif); color: var(--ink); }
.link-url { margin: var(--s-1) 0 var(--s-4); font-size: var(--fs-meta); color: var(--muted); overflow-wrap: anywhere; }
/* Look up (1.45.0): each dictionary's entries under its name. */
.dict-list { margin: 0 0 var(--s-4); }
.dict-entry + .dict-entry { margin-top: var(--s-4); }
.dict-from { margin: 0 0 var(--s-2); }
.dict-word { margin: 0 0 var(--s-1); font: 600 var(--fs-label)/var(--lh-label) var(--serif); color: var(--ink); }
.dict-part { margin: 0 0 var(--s-2); font: 400 var(--fs-label)/1.5 var(--serif); color: var(--ink); overflow-wrap: anywhere; }
.dict-part.dict-t { color: var(--muted); font-family: var(--sans); }
.dict-part :is(ul, ol) { margin: var(--s-1) 0; padding-inline-start: var(--s-5); }
.dict-part :is(p, div, dd, blockquote) { margin: 0 0 var(--s-1); }
.dict-part blockquote { padding-inline-start: var(--s-3); border-inline-start: 2px solid var(--line); }

/* A tapped image, full screen: pinch or double-tap to zoom, drag to look
   around, swipe down (or ×, Escape, back) to close. */
.viewer {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column;
  color: var(--on-video);
}
.viewer::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--viewer); opacity: var(--dim, 1); }
.viewer[hidden] { display: none; }
.viewer-stage {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: zoom-in;
}
.viewer.zoomed .viewer-stage { cursor: grab; }
.viewer-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  will-change: transform;
  user-select: none; -webkit-user-drag: none;
}
.viewer-img.settle { transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.viewer-caption {
  margin: 0; padding: var(--s-3) var(--gutter) calc(var(--s-4) + env(safe-area-inset-bottom));
  max-height: 30%; overflow-y: auto;
  font-size: var(--fs-meta); line-height: var(--lh-meta);
}
.viewer-caption[hidden] { display: none; }
.viewer-close {
  position: absolute; top: calc(var(--s-2) + env(safe-area-inset-top)); inset-inline-end: var(--s-2);
  color: var(--on-video); background: var(--scrim); border-radius: var(--r-full);
}

/* How far through the page: a line along the bottom, filling in the
   page's own direction, with the section and the minutes left over it
   while the bar is up. */
.read-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none; }
.read-left {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: var(--s-7); margin: 0;
  padding: var(--s-2) calc(var(--gutter) + var(--s-2)) calc(var(--s-2) + env(safe-area-inset-bottom));
  background: var(--bar); color: var(--muted);
  font-size: var(--fs-meta); line-height: var(--lh-meta); font-variant-numeric: tabular-nums;
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control-edge, ease-out);
}
.read-section { display: flex; flex-direction: column; min-width: 0; white-space: nowrap; }
/* Pages: 4/20 over the minutes left (1.37.0). */
.read-page { color: var(--ink); font-weight: 600; }
.read-left span:last-child { flex-shrink: 0; }
.reader.bar-away .read-left { transform: translateY(100%); }
/* Brightness while reading (1.10.0): a slider on the left of the text,
   shown with the bars and while the left edge is swiped. */
.bright {
  position: absolute; z-index: 3; top: 50%;
  left: calc(var(--frame-left, 0px) + var(--s-4));
  display: flex; flex-direction: column; align-items: center; gap: var(--s-1);
  padding: var(--s-2) var(--s-1) var(--s-1);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 8px 24px var(--shadow);
  transform: translateY(-50%);
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out),
    translate var(--spring-control-ms, 300ms) var(--spring-control, ease-out),
    scale var(--spring-control-ms, 300ms) var(--spring-control, ease-out);
  color: var(--muted);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.bright[hidden] { display: none; }
/* On the right (1.16.0), held a second and swiped across. */
.bright.right { left: auto; right: calc(var(--frame-right, 0px) + var(--s-4)); }
.bright.lifted { scale: 1.06; box-shadow: 0 16px 40px var(--shadow); transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out), scale var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
/* Away, it's past the screen's left edge (1.11.0), and slides back in. */
.reader.bar-away:not(.brightening) .bright,
.reader:has(.sheet:not([hidden])) .bright { transform: translate(calc(-100% - var(--frame-left, 0px) - var(--s-4) - 16px), -50%); pointer-events: none; }
.reader.bar-away:not(.brightening) .bright.right,
.reader:has(.sheet:not([hidden])) .bright.right { transform: translate(calc(100% + var(--frame-right, 0px) + var(--s-4) + 16px), -50%); }
.bright-track {
  position: relative; width: 44px; height: min(40vh, 280px);
  border-radius: var(--r-md); overflow: hidden;
  background: var(--bar);
  touch-action: none; cursor: ns-resize;
}
.bright-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bright-fill {
  position: absolute; inset: 0; background: var(--accent);
  transform-origin: bottom; transform: scaleY(0.5);
}
/* Back to the phone's own level (1.14.0), lit while it's the phone's. */
.bright-auto {
  min-width: 44px; min-height: 44px; padding: 0 var(--s-1);
  border: 0; border-radius: var(--r-md); background: none;
  font: inherit; font-size: var(--fs-meta); font-weight: 600; color: inherit;
}
.bright-auto[aria-pressed="true"] { color: var(--accent); }
.bright { opacity: 0.55; }
.reader.brightening .bright,
.bright:focus-within { opacity: 1; color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  .bright, .bright.lifted { transition: none; scale: none; }
  .reader.bar-away:not(.brightening) .bright,
  .reader:has(.sheet:not([hidden])) .bright,
  .reader.bar-away:not(.brightening) .bright.right,
  .reader:has(.sheet:not([hidden])) .bright.right { transform: translateY(-50%); }
}
/* Over the row as it slides away under it (1.45.4): 1.45.2 lifted the
   row above it and the line went missing while the bar was away. */
.read-progress { position: relative; z-index: 2; height: 5px; background: var(--line); }
.read-progress > span:first-child {
  display: block; height: 100%;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
}
.read-progress[dir="rtl"] > span:first-child { transform-origin: right; }
/* Skim (1.45.0; in the bar since 1.45.2). A tap on the bottom row
   grows the bar upward: the chapter and where, a slider well clear of
   the phone's own swipe along the bottom edge (a drag on the row itself
   switched apps), and buttons for the chapter before and after. It
   slides up from behind the row. */
.read-left { position: relative; z-index: 1; pointer-events: auto; -webkit-user-select: none; user-select: none; }
.reader.bar-away:not(.aloud) .read-left { pointer-events: none; }
.read-ticks { position: absolute; inset: 0; }
.read-ticks i, .skim-ticks i { position: absolute; top: 0; bottom: 0; width: 2px; margin-inline-start: -1px; background: var(--bg); }
.skim-bar {
  padding: var(--s-3) calc(var(--gutter) + var(--s-2)) 0;
  background: var(--bar); color: var(--ink);
  /* The second shadow fills under it: the spring overshoots by a pixel
     or so, which left a seam over the row while it grew (1.45.3). */
  box-shadow: 0 -1px 0 var(--line), 0 8px 0 var(--bar);
  font: 400 var(--fs-meta)/var(--lh-meta) var(--sans); font-variant-numeric: tabular-nums;
  pointer-events: auto; -webkit-user-select: none; user-select: none;
  animation: skim-up var(--spring-control-ms, 300ms) var(--spring-control-edge, ease-out);
}
.skim-bar > * { max-width: 34rem; margin-inline: auto; }
.skim-bar[hidden], .skim-row .icon-btn[hidden] { display: none; }
.reader.bar-away .skim-bar { display: none; }
.skim-head { display: flex; align-items: baseline; gap: var(--s-3); padding: 0 var(--s-2); }
.skim-part { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-label); font-weight: 600; }
.skim-head:has(.skim-part:empty) { visibility: hidden; }
/* One bar while it's grown: the line under the row keeps its room. */
.reader.skim-open .read-progress { background: var(--bar); }
.reader.skim-open .read-progress > * { visibility: hidden; }
.skim-row { display: flex; align-items: center; gap: var(--s-1); }
.skim-track { position: relative; flex: 1; min-width: 0; height: var(--tap); touch-action: none; cursor: pointer; }
.skim-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.skim-rail { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.skim-fill { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.skim-track[dir="rtl"] .skim-fill { transform-origin: right; }
.skim-ticks { position: absolute; inset: 0; }
/* Where Back goes: a short line through the rail (1.48.4). */
.skim-from {
  position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; margin-inline-start: -7px;
  border-radius: var(--r-full); border: 2px solid var(--ink); background: var(--surface); box-shadow: 0 0 0 2px var(--surface);
}
.skim-from[hidden] { display: none; }
.skim-knob {
  position: absolute; top: 50%; width: 22px; height: 22px; margin-top: -11px; margin-inline-start: -11px;
  border-radius: var(--r-full); background: var(--accent); box-shadow: 0 0 0 3px var(--surface);
  transition: scale var(--spring-control-ms, 300ms) var(--spring-control, ease-out);
}
.reader.skimming .skim-knob { scale: 1.2; }
@keyframes skim-up { from { transform: translateY(100%); } }
:root[data-motion="off"] .skim-bar { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .skim-bar { animation: none; }
  .skim-knob { transition: none; }
  .reader.skimming .skim-knob { scale: none; }
}
.sheet-catch[hidden], .sheet[hidden] { display: none; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  max-width: 34rem; margin: 0 auto;
  padding: var(--s-2) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -8px 24px var(--shadow);
}
/* Above the bar of Draw tools (z-index 3), which a note keeps up (2.0.0). */
#readingSheet { z-index: 4; }
.sheet-grip { display: block; width: 36px; height: 4px; margin: 0 auto var(--s-3); border-radius: var(--r-full); background: var(--line); }
.sheet-body, .reading-controls, .rc-list { display: flex; flex-direction: column; gap: var(--s-3); }
.sheet-body { max-height: min(76dvh, 40rem); overflow-y: auto; overscroll-behavior: contain; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4) var(--s-1); }
.rc-row { display: flex; align-items: center; gap: var(--s-3); }
.rc-label { width: 84px; flex-shrink: 0; color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.stepper { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-2); }
.step-btn {
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); cursor: pointer;
  font-family: var(--serif); font-weight: 600;
}
.step-btn.small { font-size: var(--fs-meta); }
.step-btn.large { font-size: var(--fs-heading); }
.step-btn:disabled { color: var(--muted); opacity: 0.5; cursor: default; }
.steps { flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s-1); }
.step { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--muted); opacity: 0.35; transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out), background-color 120ms linear; }
.step.on { background: var(--accent); opacity: 1; }
.step.now { transform: scale(1.5); }
.rc-row.tall { align-items: flex-start; }
.rc-row.tall .rc-label { padding-top: 9px; }
.page-controls { display: flex; flex-direction: column; gap: var(--s-4); }
.tag-edit { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.chip {
  position: relative; min-height: 36px; min-width: var(--tap); padding: 0 var(--s-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--bg); color: var(--ink); font: inherit; font-size: var(--fs-meta); font-weight: 500;
  cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  transition: background-color 120ms linear, color 120ms linear, border-color 120ms linear;
}
/* 36px to look at, 44px to hit. */
.chip::before { content: ""; position: absolute; inset: -4px 0; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-x { font-size: 16px; line-height: 1; opacity: 0.8; }
/* Scrolls edge to edge, so a long tag list isn't clipped at the gutter. */
.filters {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  margin: var(--s-3) calc(-1 * var(--gutter)) 0; padding: 4px var(--gutter); scroll-padding-inline: var(--gutter);
}
.filters[hidden] { display: none; }
.search { position: relative; margin-top: var(--s-3); }
.search[hidden] { display: none; }
.search input {
  width: 100%; height: var(--tap); padding-block: 0; padding-inline: 40px var(--tap);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: inherit;
  -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.search-icon { position: absolute; inset-inline-start: 12px; top: 13px; color: var(--muted); pointer-events: none; }
.search-clear { position: absolute; inset-inline-end: 0; top: 0; color: var(--muted); }
.search-clear[hidden] { display: none; }
.search-note { margin: var(--s-2) 0 0; }
.search-note[hidden] { display: none; }
.card-found {
  font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.filters::-webkit-scrollbar { display: none; }
.filters .chip { flex-shrink: 0; }
.tag-input {
  flex: 1; min-width: 120px; min-height: var(--tap); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); font: inherit;
}
.tag-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.rename-input { display: block; width: 100%; margin: var(--s-2) 0 var(--s-4); }
.sign-in-field { display: block; width: 100%; margin-top: var(--s-2); }
.sign-in-field[hidden] { display: none; }
.sheet-row {
  min-height: var(--tap); padding: 0 var(--s-3);
  display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
}
.sheet-row.danger { color: var(--warn); }
.sheet-row[aria-pressed="true"] { color: var(--accent); font-weight: 600; }
.card-tag { color: var(--accent); }
.step-rows { display: flex; gap: var(--s-2); }
.step-row {
  flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  padding: var(--s-2) var(--s-3); text-align: start;
}
.step-row:last-child { align-items: flex-end; text-align: end; }
.step-row:disabled { cursor: default; opacity: 0.5; }
.step-over { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); font-weight: 600; }
.step-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
.step-row:disabled .step-title { color: var(--muted); }
.seg {
  flex: 1; display: flex; padding: 3px; gap: 3px;
  border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line);
}
.seg-item { flex: 1; position: relative; display: flex; }
/* Three words and a name still fit one row on the narrowest phones
   (320 px), where Narrow / Normal / Wide ran past the card's edge. */
@media (max-width: 359px) {
  .rc-label { width: 64px; }
  .rc-row .seg-face { padding: 0 var(--s-1); }
}
.seg-face {
  flex: 1; min-height: 38px; padding: 0 var(--s-2);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-sm); color: var(--muted); font-weight: 500; cursor: pointer;
  transition: background-color 120ms linear, color 120ms linear;
}
.seg-item input:checked + .seg-face { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.seg-item input:focus-visible + .seg-face { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg-face .swatch { width: 20px; height: 20px; }
.seg-face .swatch-dot { width: 6px; height: 6px; }
.seg.themes .seg-face { flex-direction: column; gap: 2px; min-height: 52px; font-size: var(--fs-meta); line-height: var(--lh-meta); }
.seg.grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg.grid.five { grid-template-columns: repeat(5, 1fr); }
.seg.grid .seg-face { padding: var(--s-1); text-align: center; }
.seg.scroll { position: relative; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll .seg-item { flex: 0 0 auto; scroll-snap-align: center; }
.seg.scroll .seg-face { padding: 0 var(--s-3); white-space: nowrap; }
.seg.scroll.themes .seg-face { min-width: 72px; }
.seg.fonts .seg-face { font-size: var(--fs-label); }
.seg-sample { font-size: var(--fs-label); color: var(--ink); }
.dropdown-text .seg-sample { margin-inline-start: var(--s-2); }
.rc-row.stack { flex-direction: column; align-items: stretch; gap: var(--s-2); }
.rc-row.stack .rc-label { width: auto; }
.rc-value { display: block; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.range {
  flex: 1; min-width: 0; height: var(--tap); margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.range::-webkit-slider-runnable-track { height: 4px; border-radius: var(--r-full); background: var(--line); }
.range::-moz-range-track { height: 4px; border-radius: var(--r-full); background: var(--line); }
.range::-moz-range-progress { height: 4px; border-radius: var(--r-full); background: var(--accent); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -10px;
  border-radius: var(--r-full); background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 4px var(--shadow);
}
.range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: var(--r-full); background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 4px var(--shadow);
}
.range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.reading-controls .reset { align-self: flex-start; }
/* Reader settings (0.34.0): Layout, Text and Read aloud, each its own part. */
.rc-part { display: flex; flex-direction: column; gap: var(--s-3); }
.rc-part[hidden] { display: none; }
/* A comic's own Layout rows (1.53.0), a note under a row at its end. */
.comic-rows { display: flex; flex-direction: column; gap: var(--s-3); }
.comic-rows[hidden] { display: none; }
.rc-note { margin-top: calc(var(--s-2) * -1); text-align: end; }
/* .rc-row is display: flex, which beats the browser's [hidden] (1.49.0). */
.rc-row[hidden] { display: none; }
/* Volume under Allow mixing: normal (1×) is the middle, marked on the track. */
.volume-row[hidden] { display: none; }
.row.volume-row .stepper { flex: 0 1 58%; }
.volume-range::-webkit-slider-runnable-track { background: linear-gradient(90deg, transparent calc(50% - 1px), var(--muted) calc(50% - 1px), var(--muted) calc(50% + 1px), transparent calc(50% + 1px)), var(--line); }

/* Settings > Reading (1.48.2): the one box split into Layout and Text sections; the section heads replace the parts' own. */
.reading-controls.split { display: contents; }
.reading-controls.split .rc-part > .overline:not(.rc-sub) { display: none; }
.rc-part > .overline { margin: var(--s-2) 0 calc(-1 * var(--s-1)) var(--s-1); }
.reader-settings { display: flex; flex-direction: column; gap: var(--s-4); }
.reader-settings .rc-part > .overline { display: none; }
.reader-settings .rc-part > .overline.rc-sub { display: block; }
.rc-part > .overline.rc-sub { margin-top: var(--s-4); }
/* The parts share one cell, so the sheet keeps the tallest one's height
   and doesn't jump between tabs; the others are kept hidden in place. */
.reader-settings .reading-controls { display: grid; grid-template-columns: minmax(0, 1fr); }
.reader-settings .rc-part { grid-area: 1 / 1; align-self: start; min-width: 0; }
.reader-settings .rc-part[hidden] { display: flex; visibility: hidden; }
.font-pick { flex: 1; min-width: 0; display: flex; }
.font-pick .dropdown-btn { width: 100%; }
.switch-row { cursor: pointer; min-height: var(--tap); }
.switch-row .choice-text { flex: 1; min-width: 0; }
.switch-row .choice-text .rc-label { width: auto; color: var(--ink); font-size: var(--fs-label); }
.reading-controls .reset:disabled { opacity: 0.5; cursor: default; }
.reading-sample {
  margin: 0; padding: var(--s-3) var(--s-4);
  font: 400 var(--reader-fs, var(--fs-body))/var(--reader-lh, var(--lh-body)) var(--reader-font, var(--serif));
  border-bottom: 1px solid var(--line);
}
.group .reading-controls, .group .rc-list { padding: var(--s-3) var(--s-4) var(--s-4); }
.reader-start, .reader-actions { display: flex; align-items: center; gap: var(--s-1); }
.reader-start { flex: 1; min-width: 0; }
.reader-actions { flex: none; }
/* The Contents button: a list icon on a phone (1.42.1, the name got cut
   off there); on a computer it names the section being read (1.37.0). */
.section-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px; flex: none; min-width: var(--tap);
  min-height: var(--tap); padding: 0;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink);
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
}
.section-btn[hidden] { display: none; }
.section-btn[aria-expanded="true"] { background: var(--line); }
.section-now { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-btn svg { flex: none; }
.section-btn .section-more { color: var(--muted); }
.section-btn .section-now, .section-btn .section-more { display: none; }
.pill {
  height: 28px; padding: 0 10px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-full); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  font-size: var(--fs-meta);
}
.pill[hidden] { display: none; }
.reader-frame { flex: 1; width: 100%; border: 0; background: var(--bg); }
/* A book or PDF coming in (1.16.0): a spinner in the middle, after a
   moment so a quick one doesn't flash it, and the text once it's set. */
.reader-wait { display: none; }
.reader.waiting .reader-frame { visibility: hidden; }
.reader-frame.unready { visibility: hidden; }
.reader.waiting .reader-wait {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  animation: lib-loading-in 0s 200ms both;
}
.reader-wait .spinner { width: 28px; height: 28px; margin: 0; border-width: 3px; }
.app[hidden] { display: none; }

.toast[hidden] { display: none; }
/* A toast with one thing to do (1.3.0): "Read to 64% on your other
   device." and a Go there button, 44px tall, in the bar's colours. */
.toast:not([hidden]):has(.toast-act) { display: flex; align-items: center; gap: var(--s-3); padding-block: var(--s-2); }
.toast-act {
  flex: none; min-height: 44px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--bg); font: 600 var(--fs-label)/var(--lh-label) var(--sans);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
/* With the Aa sheet or the skim up, a toast drops from under the reader
   bar instead. */
.reader:has(.sheet:not([hidden])) ~ .toast,
.reader.skim-open ~ .toast { top: calc(72px + env(safe-area-inset-top)); bottom: auto; }
.toast {
  position: fixed; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 20;
  width: fit-content; margin: 0 auto;
  max-width: calc(100% - 2 * var(--gutter));
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--ink); color: var(--bg);
  font-size: var(--fs-label);
}

/* Presses: no grey flash on tap and no ring after a click, only for a
   keyboard. Every control answers with the small-control spring and the
   --press tint over its own fill; rows only tint, as list cells do. */
html { -webkit-tap-highlight-color: transparent; }
:focus:not(:focus-visible) { outline: none; }
.card, .tile, .tile-btn, .btn-primary, .btn-small, .btn-quiet, .icon-btn, .step-btn, .chip, .post-act, .section-btn, .sheet-row,
.seg-face, .select-act, .btn-text, .dropdown-btn, .choice, .row {
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out),
    background-color 120ms linear, color 120ms linear, border-color 120ms linear;
}
:is(.card, .tile, .tile-btn, .btn-primary, .btn-small, .btn-quiet, .icon-btn, .step-btn, .chip, .post-act, .section-btn, .sheet-row,
.seg-face, .select-act, .btn-text, .dropdown-btn, .choice, .row):active:not(:disabled) {
  background-image: linear-gradient(var(--press), var(--press));
}
:is(.card, .tile, .tile-btn, .btn-primary, .btn-small, .btn-quiet, .icon-btn, .step-btn, .chip, .post-act, .section-btn, .sheet-row,
.select-act, .btn-text, .dropdown-btn):active:not(:disabled) { transform: scale(0.97); }
.card.saving:active { transform: none; background-image: none; }
/* A mouse click gets the tint and no dip (1.11.0): the dip is for a
   finger, which covers what it presses. */
@media (prefers-reduced-motion: reduce), (hover: hover) and (pointer: fine) {
  :is(.card, .tile, .tile-btn, .btn-primary, .btn-small, .btn-quiet, .icon-btn, .step-btn, .chip, .post-act, .section-btn, .sheet-row,
  .select-act, .btn-text, .dropdown-btn):active { transform: none; }
}

/* A mouse hovering (1.50): what a click would open answers before the
   click. Boxed cards and tiles lift a little and their edge warms toward
   the accent; rows (Shelf, One list) take a rounded tint and their cover
   grows; covers (Shelf, Grid) rise on their own. Bar buttons and sidebar
   rows tint and grow a touch. Only for a mouse, so a finger never leaves
   a card stuck lifted. Transform and colour only, nothing reflows, so a
   3000-clip library stays smooth. A click settles it. Rows keep inside
   their box: content-visibility clips anything past it. */
@media (hover: hover) and (pointer: fine) {
  :is([data-layout="shelf"], [data-layout="list"]) .page-card:not(.continue),
  [data-layout="list"] .library > .tile { --lift: 1; }
  :is([data-layout="shelf"], [data-layout="grid"]) .tile { --lift: 1; --hover-fill: none; }
  .card:not(.saving):hover, .tile:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    background-image: var(--hover-fill, linear-gradient(var(--press), var(--press)));
  }
  :is([data-layout="shelf"], [data-layout="list"]) .page-card:not(.continue):not(.saving):hover,
  [data-layout="list"] .library > .tile:hover { border-radius: var(--r-md); background-image: linear-gradient(var(--press), var(--press)); }
  :is(.top-bar, .screen-bar, .reader-bar) .icon-btn:hover:not(:disabled) { background-color: var(--press); }
  .side-item:hover, .side-fold:hover { background-image: linear-gradient(var(--press), var(--press)); }
}
/* The lift moves, so reduced motion and Animations off keep only the tint. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .card-thumb, .tile-thumb, .side-icon, .side-cover { transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
  /* A row's cover grows away from its edge: past it, content-visibility clips it. */
  :is([data-layout="shelf"], [data-layout="list"]) :is(.page-card:not(.continue) .card-thumb, .library > .tile .tile-thumb) { transform-origin: 0 50%; }
  [dir="rtl"] :is([data-layout="shelf"], [data-layout="list"]) :is(.page-card:not(.continue) .card-thumb, .library > .tile .tile-thumb) { transform-origin: 100% 50%; }
  :root:not([data-motion="off"]) .card:not(.saving):hover { transform: scale(var(--lift, 1.012)); }
  :root:not([data-motion="off"]) .tile:hover { transform: scale(var(--lift, 1.03)); }
  :root:not([data-motion="off"]) :is([data-layout="shelf"], [data-layout="list"]) .page-card:not(.continue):not(.saving):hover .card-thumb,
  :root:not([data-motion="off"]) [data-layout="list"] .library > .tile:hover .tile-thumb { transform: scale(1.05); }
  :root:not([data-motion="off"]) :is([data-layout="shelf"], [data-layout="grid"]) .tile:hover .tile-thumb { transform: translateY(-3px) scale(1.03); }
  :root:not([data-motion="off"]) :is(.top-bar, .screen-bar, .reader-bar) .icon-btn:hover:not(:disabled) { transform: scale(1.06); }
  :root:not([data-motion="off"]) .side-item:hover :is(.side-icon, .side-cover) { transform: scale(1.12); }
  :root:not([data-motion="off"]) :is(.card:not(.saving), .tile, :is(.top-bar, .screen-bar, .reader-bar) .icon-btn):hover:active,
  :root:not([data-motion="off"]) :is(.card, .tile):hover:active :is(.card-thumb, .tile-thumb) { transform: none; }
}

/* The shadow of a panel growing into a screen (motion.js grow, 1.11.0):
   the screen shows through a clip the panel's size, and this draws the
   panel's edge and shadow around it. */
/* A screen zooming out of a card (1.12.1), with a copy of the card over
   it that blends away. */
.screen.zooming { will-change: transform, opacity; }

/* Animations off in Settings (1.12.0): nothing eases from one state to
   the next. Spinners keep turning; they say something is happening. */
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { transition: none !important; }
:root[data-motion="off"] :is(.card, .tile, .tile-btn, .btn-primary, .btn-small, .btn-quiet, .icon-btn, .step-btn, .chip, .post-act, .section-btn, .sheet-row,
.select-act, .btn-text, .dropdown-btn, .help-btn):active { transform: none; }
/* Nor the press stretch of a switch's knob, the ? turn or a drop-down's pop (1.48.3). */
:root[data-motion="off"] .switch:active::before { width: 20px; }
:root[data-motion="off"] .switch:checked:active::before { transform: translateX(20px); }
:root[data-motion="off"][dir="rtl"] .switch:checked:active::before, :root[data-motion="off"] [dir="rtl"] .switch:checked:active::before { transform: translateX(-20px); }
:root[data-motion="off"] .help-btn[aria-expanded="true"] { transform: none; }
:root[data-motion="off"] :is(.dropdown-face.changed, .lock-dots.shake) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  /* Except the slow breathing that stands in for a spinner: at 1 ms a
     turn it flickered on every frame. */
  :is(.spinner, .progress.busy .progress-fill, .sync-btn.looking .dl-ring) { animation-duration: 1.6s !important; }
  .listen-ch-tr.now .listen-ch-bar::after { animation-duration: 2.4s !important; }
  .aloud-play.thinking::after { animation-duration: 2.4s, 0.2s !important; }
}

/* A folder's screen: its tools, carry on, then its pages in order. */
.folder-meta { margin-top: 0; margin-bottom: var(--s-3); }
.folder-go { display: block; width: 100%; margin-bottom: var(--s-5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-list { margin-top: 0; margin-bottom: 0; padding: 0; list-style: none; }
/* A collection shown as covers: a shelf of books, three across. */
.folder-covers {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4) var(--s-3); align-content: start;
  margin: 0; padding: var(--s-1) 0 var(--s-2); list-style: none;
}
@media (min-width: 700px) { .folder-covers { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); } }
.cover-item {
  position: relative; width: 100%; display: flex; flex-direction: column; gap: var(--s-1);
  padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.cover-item .tile-thumb { height: auto; aspect-ratio: 2 / 3; box-shadow: 0 1px 2px var(--shadow), 0 4px 12px var(--shadow); }
.cover-item .tile-thumb .site-mark { width: 100%; height: 100%; border-radius: 0; }
.cover-item .tile-name { font-size: var(--fs-meta); line-height: var(--lh-meta); font-family: var(--sans); font-weight: 600; }
.cover-item .tile-meta.accent { color: var(--accent); }
.cover-item.now .tile-name { color: var(--accent); }
.selecting .folder-covers .picked .cover-item .tile-thumb { outline: 2px solid var(--accent); outline-offset: 3px; }
.folder-list li + li { border-top: 1px solid var(--line); }
.chapter { text-align: start; }
.chapter-n {
  flex-shrink: 0; min-width: 28px; text-align: center;
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); color: var(--muted); font-variant-numeric: tabular-nums;
}
.chapter.now .chapter-n { color: var(--accent); }
.chapter:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Saving several: links, folder, Save. */
.batch-links {
  display: block; width: 100%; min-height: 9rem; padding: var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font: var(--fs-meta)/1.6 var(--sans); resize: vertical; white-space: pre; overflow-x: auto;
}
.batch-links:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.batch-count { margin-top: var(--s-2); }
.batch-find { margin-top: var(--s-2); }
.batch-find[hidden] { display: none; }
/* How Find chapters stands: a bar and the stage in words under its button. */
.batch-find-bar { margin-top: var(--s-2); }
.batch-find-bar[hidden], .batch-find-note[hidden] { display: none; }
.batch-find-note { display: block; margin-top: var(--s-1); overflow-wrap: anywhere; }
.batch-form .group { margin-top: var(--s-3); }
.batch-form .group[hidden] { display: none; }
.batch-site-tags:not(:empty) { margin-bottom: var(--s-3); }
.batch-go { display: block; width: 100%; margin-top: var(--s-6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-go:disabled { opacity: 0.5; cursor: default; }
.rc-row.follow .chip { min-width: var(--tap); }
.rc-row.follow .chip:disabled { opacity: 0.5; cursor: default; }
.rc-row.follow .chip[hidden] { display: none; }
.rc-row.follow .stop { color: var(--warn); border-color: var(--warn); }
.rc-row.follow .chip[hidden] { display: none; }
.screen-body .rc-row.follow { margin-top: var(--s-4); }
.screen-body .rc-row.follow.back { margin-top: 0; margin-bottom: var(--s-4); }
.folder-list li { display: flex; align-items: center; }
.folder-list li > .row { min-width: 0; }
.folder-list.ordering li { padding-inline-end: var(--s-1); }
/* A folder's tools sit above its pages: three a row on a phone, six on a
   desktop, the same tiles as a page's sheet. */
.tile-btn.warn { color: var(--warn); }
.tile-btn.warn .tile-icon { color: var(--warn); }
.folder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); }
.folder-actions .meta { margin: 0; }
.folder-actions.order .meta { flex: 1 1 100%; }
.folder-actions.remove { flex-direction: column; align-items: stretch; }
.folder-actions.remove .meta { margin: 0 0 var(--s-1); }
.btn-quiet.danger { color: var(--warn); }
.batch-from .meta { margin: 0 0 var(--s-2); }

/* Updates in Settings, and What's new. */
.update-row .row-label { white-space: normal; }
.update-row .spinner { flex-shrink: 0; margin: 0; }
/* A span styled as the button (the row is the button): centred like one. */
.update-row .btn-small { display: inline-flex; align-items: center; justify-content: center; }
/* A newer version out: the version (What's new) and Update are two buttons. */
.update-text { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: var(--s-3); margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
span.update-text { cursor: default; }
.row:disabled { cursor: default; }
.row:disabled .row-label, .row:disabled .choice-label { color: var(--muted); }
.warn { color: var(--warn); }
.news-entry + .news-entry { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.news-version { display: flex; align-items: baseline; gap: var(--s-3); margin: 0; font: 700 var(--fs-heading)/var(--lh-heading) var(--serif); }
.news-you { font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); color: var(--accent); }
.news-kind { margin: var(--s-4) 0 var(--s-1); font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.news-list { margin: 0; padding-inline-start: 1.2em; }
.news-list li { margin: var(--s-1) 0; line-height: 1.5; }
.news-list li::marker { color: var(--muted); }

/* ---- 0.19.0: the library in sections ---- */
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 32px; margin: var(--s-2) 0 calc(-1 * var(--s-1));
}
.section-head .overline { margin: 0 0 0 var(--s-1); }
.dropdown { position: relative; display: inline-flex; }
.dropdown-btn {
  display: inline-flex; align-items: center; gap: var(--s-1);
  min-height: var(--tap); padding: 0 var(--s-2);
  border: 0; border-radius: var(--r-md); background: transparent;
  color: var(--muted); font: 500 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
}
.dropdown.sort-wrap { margin: calc((32px - var(--tap)) / 2) calc(-1 * var(--s-2)) calc((32px - var(--tap)) / 2) 0; }
.dropdown-btn[aria-expanded="true"] { color: var(--ink); }
.dropdown-caret { transition: transform 160ms ease; }
.dropdown-btn[aria-expanded="true"] .dropdown-caret { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + var(--s-1)); inset-inline-end: 0; z-index: 30;
  min-width: 200px; padding: var(--s-1);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 12px 32px var(--shadow), 0 2px 6px var(--shadow);
  display: flex; flex-direction: column;
}
.dropdown-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: var(--tap); padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink); font: 400 var(--fs-label)/var(--lh-label) var(--sans); text-align: start; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus-visible, .dropdown-item:active { background: var(--bar); outline: 0; }
.dropdown-item[aria-selected="true"] { color: var(--accent); font-weight: 600; }
/* A long name (a collection's) takes two lines at most, never stretches the menu. */
.dropdown-item { flex-shrink: 0; padding-block: var(--s-1); }
.dropdown-text { min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.dropdown-check { display: inline-flex; width: 20px; height: 20px; }
@media (prefers-reduced-motion: reduce) { .dropdown-caret { transition: none; } }

.folder-strip {
  display: flex; gap: var(--s-3); overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding: var(--s-1) var(--gutter) var(--s-2); scroll-padding-inline: var(--gutter);
  scroll-snap-type: x proximity;
}
.folder-strip::-webkit-scrollbar { display: none; }
.tile {
  position: relative; flex: 0 0 136px; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: var(--s-1);
  padding: var(--s-2); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer;
}
.tile-thumb {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 88px; margin-bottom: var(--s-1); border-radius: var(--r-sm); overflow: hidden;
  background: var(--preview); color: var(--muted);
}
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-name {
  font: 600 var(--fs-label)/var(--lh-label) var(--serif);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.tile-meta { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
.tile-new {
  position: absolute; top: var(--s-2); inset-inline-end: var(--s-2);
  padding: 2px var(--s-2); border-radius: var(--r-full);
  background: var(--accent); color: var(--accent-ink);
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans);
  border: 0; cursor: pointer;
}
/* A button now (1.7.2), above the tile's own, with a 44 px reach. */
.tile .card-open ~ .tile-thumb .tile-new { pointer-events: auto; z-index: 1; }
.tile-new::after { content: ""; position: absolute; inset: -12px; }
.tile-new:active { background-image: linear-gradient(var(--press), var(--press)); }
.tile-new:disabled { opacity: 0.6; }
/* Its chapters saving (1.10.1): the badge pulses until they're in.
   Reduced motion: it stays still; Downloads shows the progress. */
.tile-new.saving, .tile-new.saving:disabled { opacity: 1; animation: badge-pulse 1.1s var(--spring-control, ease-in-out) infinite; }
@keyframes badge-pulse { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .tile-new.saving { animation: none; } }
.check-new .chips { flex-wrap: nowrap; justify-content: space-between; }
.tile .progress { margin-top: auto; }
.card-open ~ *, .tile .card-open ~ * { pointer-events: none; }
.card-open ~ .card-body .card-retry { pointer-events: auto; }
.card, .tile, .chapter { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Picking several: a circle on each card, filled once picked. */
.pick { display: none; }
.selecting .pick {
  display: flex; align-items: center; justify-content: center;
  position: absolute; z-index: 1; top: var(--s-2); inset-inline-end: var(--s-2);
  width: 24px; height: 24px; border-radius: var(--r-full);
  border: 2px solid var(--muted); background: var(--surface);
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out), background-color 120ms linear;
}
.selecting .picked .pick { background: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.selecting .picked .pick::after {
  content: ""; width: 10px; height: 5px; margin-top: -2px;
  border: solid var(--accent-ink); border-width: 0 0 2px 2px; transform: rotate(-45deg);
}
.selecting .card .card-body { padding-inline-end: var(--s-6); }
.selecting .picked.card, .selecting .picked.tile { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.selecting .chapter { position: relative; padding-inline-end: var(--s-7); }
.selecting .chapter .pick { top: 50%; margin-top: -12px; inset-inline-end: var(--s-4); }
.selecting .picked .chapter { background: var(--bg); }
.selecting .save-bar { visibility: hidden; }
.selecting .library, .selecting .screen-body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.select-head, .select-bar {
  position: fixed; left: 0; right: 0; z-index: 14;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  background: var(--surface); border-color: var(--line); border-style: solid; border-width: 0;
}
.select-head { top: 0; padding: var(--s-2) var(--s-2); padding-top: calc(var(--s-2) + env(safe-area-inset-top)); border-bottom-width: 1px; }
.select-bar { bottom: 0; padding: var(--s-1) var(--s-2) calc(var(--s-1) + env(safe-area-inset-bottom)); border-top-width: 1px; justify-content: space-around; gap: 0; }
.select-head[hidden], .select-bar[hidden] { display: none; }
.select-count { margin: 0; flex: 1; text-align: center; font-weight: 600; }
.btn-text {
  min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s-2);
  border: 0; border-radius: var(--r-md); background: transparent;
  color: var(--accent); font-weight: 600; cursor: pointer;
}
.select-act {
  flex: 1 1 auto; min-width: 0; max-width: 120px; min-height: 56px; padding: 0 2px;
  text-align: center; hyphens: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--accent);
  font: 500 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
}
.select-act.danger { color: var(--warn); }
.select-act:disabled { color: var(--muted); opacity: 0.5; cursor: default; }

/* The library's sheet: over a dimmed library, from the bottom. */
.menu-catch { position: fixed; inset: 0; z-index: 15; background: var(--scrim); }
.menu-catch[hidden] { display: none; }
.menu-sheet { position: fixed; z-index: 16; box-shadow: 0 -8px 32px var(--shadow); }
.menu-head { display: flex; flex-direction: column; gap: 2px; }
.menu-head .meta { margin: 0; }
.menu-title {
  margin: 0; font: 600 var(--fs-card)/var(--lh-card) var(--serif);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.menu-done { width: 100%; }
.tile-row { display: flex; gap: var(--s-2); }
.tile-btn {
  flex: 1; min-width: 0; min-height: 72px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-1);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); font: 500 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
}
.tile-btn:disabled { opacity: 0.5; cursor: default; }
.tile-icon { display: flex; color: var(--accent); }
.tile-btn.on .tile-icon svg { fill: currentColor; }
.page-controls > .overline { margin: var(--s-2) 0 calc(-1 * var(--s-1)) var(--s-1); }
.page-controls .group .row { min-height: 48px; }
.chip.some { border-style: dashed; border-color: var(--accent); }
.chip-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* The reader's contents: h2s, with h3s indented under them. */
.contents-list { margin: 0; padding: 0; list-style: none; }
.contents-list li + li { border-top: 1px solid var(--line); }
.contents-row { min-height: 48px; text-align: start; }
.contents-row .row-label { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.contents-row.sub { padding-inline-start: var(--s-6); font-size: var(--fs-meta); }
.contents-row[aria-current] { color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.folder-row { gap: var(--s-3); }
.folder-n { min-width: 1.5em; color: var(--muted); font: 500 var(--fs-meta)/var(--lh-meta) var(--sans); font-variant-numeric: tabular-nums; text-align: end; }
.folder-row[aria-current] .folder-n { color: var(--accent); }
.folder-row .choice-note { font-weight: 400; }
.contents-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Highlights (1.7.0): the clip's list, and one with its note. */
.marks-rows { list-style: none; margin: 0; padding: 0; }
.marks-list > .group + .group, .marks-list > .footnote + .group { margin-top: var(--s-3); }
.mark-item { display: flex; align-items: center; }
.mark-item + .mark-item { border-top: 1px solid var(--line); }
/* Drawings among the highlights (2026-11): a picture of the strokes, then
   where they are and how many. */
.mark-row.ink-row { flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--s-3); }
.ink-row-text { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.ink-thumb { flex: none; width: 88px; height: 56px; border-radius: var(--r-sm, 8px); background: var(--bg); border: 1px solid var(--line); }
.ink-thumb-page { display: block; width: 44px; background: linear-gradient(var(--line) 1px, transparent 1px) 6px 8px / calc(100% - 12px) 7px no-repeat, var(--bg); }
.ink-start { gap: var(--s-2); margin: var(--s-2) 0; border: 1px solid var(--line); border-radius: var(--r-md, 12px); color: var(--accent); justify-content: center; }
.ink-start .row-label { color: var(--accent); font-weight: 600; }
.hl-more { justify-content: center; color: var(--accent); font-weight: 600; }
.mark-row { flex: 1; min-width: 0; flex-direction: column; align-items: stretch; gap: var(--s-1); padding-block: var(--s-3); text-align: start; }
.mark-quote {
  font: 400 var(--fs-label)/1.45 var(--serif); color: var(--ink);
  padding: 2px var(--s-2); border-radius: var(--r-sm); background: var(--mark);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* In its own colour (1.42.0), as it is in the text. */
.mark-quote[data-c="green"] { background: var(--mark-green); }
.mark-quote[data-c="blue"] { background: var(--mark-blue); }
.mark-quote[data-c="pink"] { background: var(--mark-pink); }
.mark-quote[data-c="purple"] { background: var(--mark-purple); }
/* A comment bubble's row (2026-11): its words, not a quote, in its colour. */
.note-quote { font-family: var(--sans); white-space: pre-line; }
.note-quote svg { width: 15px; height: 15px; vertical-align: -2px; margin-inline-end: var(--s-1); }
.note-quote.empty { color: var(--muted); }
.mark-quote.big { display: block; margin: var(--s-2) 0 var(--s-3); padding: var(--s-2) var(--s-3); font-size: var(--fs-body); line-height: var(--lh-body); overflow: visible; }
.mark-note { color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mark-edit { flex-shrink: 0; color: var(--muted); }
.marks-copy { flex-shrink: 0; }
.mark-tags { display: flex; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.mark-tags-edit { display: flex; flex-direction: column; gap: var(--s-2); margin: var(--s-3) 0; }
.hl-tags:empty { display: none; }
.mark-note-field {
  display: block; width: 100%; min-height: 88px; margin-bottom: var(--s-4); padding: var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink);
  font: 400 var(--fs-label)/1.45 var(--sans); resize: vertical;
}
.report-field { margin-bottom: var(--s-3); }
.report-log { list-style: none; margin: 0; padding: 0; }
.report > .overline { margin-top: var(--s-5); }
.report-line { display: flex; flex-direction: column; gap: 2px; padding: var(--s-2) var(--s-4); }
.report-line + .report-line { border-top: 1px solid var(--line); }
.report-line .meta { margin: 0; }
.report-msg { font: 400 var(--fs-meta)/var(--lh-meta) var(--sans); color: var(--ink); overflow-wrap: anywhere; }
.report-clear { margin-top: var(--s-2); min-height: var(--tap); }
.mark-note-field:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Settings: a short menu of screens. */
.settings-menu { display: flex; flex-direction: column; gap: var(--s-5); }
/* Compact Settings (1.48.0): the search box under the bar, a ? on a
   section's heading that shows its explanation, and the row a search
   result lands on lit for a moment. */
.settings-search { padding: var(--s-3) var(--gutter) 0; }
.settings-search .search { margin: 0 auto; max-width: 40rem; }
.settings-search .search input { height: var(--tap); }
.found-none { margin: var(--s-4) var(--s-1); text-align: start; }
.section-top { margin-bottom: var(--s-2); }
.section-top .help-text { margin: var(--s-2) var(--s-1) var(--s-3); }
.help-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.help-wrap.open { grid-template-rows: 1fr; }
.help-inner { min-height: 0; overflow: hidden; }
.help-wrap:not(.open) .help-text { visibility: hidden; }
.settings-section .section-head { align-items: flex-end; gap: var(--s-2); min-height: 28px; margin: 0 0 var(--s-2); }
.section-top > .section-head { margin-bottom: 0; }
.help-btn {
  flex-shrink: 0; width: 28px; height: 28px; margin: 0 calc(-1 * var(--s-1)) 0 0; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); color: var(--muted);
  font: 600 13px/1 var(--sans); cursor: pointer;
}
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.help-btn { transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out), color 120ms linear, border-color 120ms linear; }
.help-btn:active { transform: scale(0.88); }
.help-btn[aria-expanded="true"] { transform: rotate(360deg); }
/* A drop-down's new choice pops into its face; a pressed switch's knob
   stretches toward where it's going (1.48.0). */
.dropdown-face.changed { animation: face-pop var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
@keyframes face-pop { from { transform: scale(0.8); } to { transform: none; } }
.switch[aria-disabled="true"] { opacity: 0.45; }
.switch:active::before { width: 26px; }
.switch:checked:active::before { transform: translateX(14px); }
[dir="rtl"] .switch:checked:active::before { transform: translateX(-14px); }
.help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.found { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-md); }
.row.found, .choice.found { background: var(--press); }
.theme-grid .seg-face { padding: var(--s-2) 2px; }
.pick-row { gap: var(--s-2); padding-inline-end: var(--s-2); }
.pick-row .row-pick { flex: 0 1 auto; max-width: 58%; }
.pick-row .row-pick .dropdown-btn { flex: 0 1 auto; max-width: 100%; border: 0; background: transparent; padding: 0 var(--s-2); color: var(--accent); font-weight: 500; }
.pick-row .row-pick .dropdown-menu { inset-inline-start: auto; inset-inline-end: 0; min-width: 240px; max-width: min(80vw, 360px); }
.storage-total { margin: 0 0 var(--s-3) var(--s-1); }
.nav-row .row-value { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chev { flex-shrink: 0; color: var(--muted); font-size: 22px; line-height: 1; margin-inline-start: calc(-1 * var(--s-1)); }
.storage-folder .row-chev { transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.storage-folder[aria-expanded="true"] .row-chev { transform: rotate(90deg); }
.storage-folder.loose .choice-label { color: var(--muted); }
.storage-pages[hidden] { display: none; }
/* Sync history: tap a version to fold out what it would change; Put back is its own button. */
.history-row { padding: 0; gap: 0; }
.history-fold, .history-put { display: flex; align-items: center; align-self: stretch; min-height: 52px; background: transparent; border: 0; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.history-fold { flex: 1; min-width: 0; gap: var(--s-3); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); }
.history-put { flex-shrink: 0; padding: var(--s-2) var(--s-4); color: var(--accent); font-size: var(--fs-meta); border-inline-start: 1px solid var(--line); }
.history-put:disabled { color: var(--muted); cursor: default; }
.history-fold .row-chev { transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.history-fold[aria-expanded="true"] .row-chev { transform: rotate(90deg); }
.history-diff[hidden] { display: none; }
.history-diff { background: var(--bg); border-top: 1px solid var(--line); }
.history-diff .row { padding-inline-start: var(--s-6); cursor: default; }
.history-head { padding: var(--s-2) var(--s-4) var(--s-1) var(--s-6); color: var(--muted); font-size: var(--fs-meta); font-weight: 500; }
.history-note { margin: 0; padding: var(--s-2) var(--s-4) var(--s-3) var(--s-6); }
@media (prefers-reduced-motion: reduce) { .history-fold .row-chev { transition: none; } }
.storage-pages .row { padding-inline-start: var(--s-6); }
.storage-pages > .row:first-child, .storage-pages + .row { border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .storage-folder .row-chev { transition: none; } }
.nav-row[aria-current] { background: var(--bg); }
.storage-total { margin: 0 0 var(--s-1) var(--s-1); font: 700 var(--fs-title)/var(--lh-title) var(--serif); }
/* Pause and Stop on Back up the library while it runs (1.47.0). */
.backup-actions { display: flex; gap: var(--s-2); align-items: center; flex: none; }
.settings-section > .section-lead { margin-bottom: var(--s-5); }
.drive-done { margin: 0; padding: var(--s-8) var(--s-5); text-align: center; color: var(--ink); font-size: var(--fs-meta); }
.update-card { border-color: var(--accent); }
.news-update { margin-bottom: var(--s-6); }


/* 0.19.1: the filters between Folders and the pages, and a switch. */
.switch {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; position: relative;
  width: 52px; height: 32px; margin: 0; border-radius: var(--r-full);
  border: 2px solid var(--muted); background: var(--bg); cursor: pointer;
  transition: background-color 120ms linear, border-color 120ms linear;
}
.switch::before {
  content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 20px; height: 20px;
  border-radius: var(--r-full); background: var(--muted);
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out), width var(--spring-control-ms, 300ms) var(--spring-control, ease-out), background-color 120ms linear;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::before { transform: translateX(20px); background: var(--accent-ink); }
[dir="rtl"] .switch:checked::before { transform: translateX(-20px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Export (0.25.2): the page sheet's kinds, then Save and Send. */
.export-top { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
.export-top .menu-title { flex: 1; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.export-rule-del { align-self: flex-start; min-height: var(--tap); }
.export-actions { display: flex; gap: var(--s-2); margin-top: var(--s-4); }
.export-actions > * { flex: 1; height: 48px; }
.export-actions [hidden] { display: none; }
/* Making the file: the pressed button turns a spinner and says what it's
   on, a bar along its foot sweeps, then fills once it can count. */
.export-actions .busy {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2); min-width: 0; padding-inline: var(--s-3); cursor: default;
}
.export-actions .busy .spinner { flex-shrink: 0; margin: 0; }
.export-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.export-bar { position: absolute; inset: auto var(--s-4) 6px; height: 3px; }
.btn-primary.busy .spinner { border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); border-top-color: var(--accent-ink); }
.btn-primary.busy .export-bar { background: color-mix(in srgb, var(--accent-ink) 30%, transparent); }
.btn-primary.busy .export-bar .progress-fill { background: var(--accent-ink); }
.export-actions button:disabled:not(.busy) { opacity: 0.5; cursor: default; }
@media (prefers-reduced-motion: reduce) { .btn-primary.busy .spinner { background: var(--accent-ink); } }

/* Folder Chapters and Export panels (0.26.0) */
.folder-actions.chapters-panel, .folder-actions.export-panel { flex-direction: column; align-items: stretch; gap: var(--s-4); }
.folder-actions.export-panel > .export { width: 100%; }
/* Website sync in Settings' groups (2026-11): one row each, nothing wider than the screen. */
.folder-actions.chapters-panel { flex-wrap: nowrap; gap: var(--s-5); }
.chapters-panel > .settings-section.settings-section { margin: 0; min-width: 0; }
.chapters-panel .choice-label.accent { color: var(--accent); font-weight: 600; }
.chapters-panel .row .chip { flex-shrink: 0; }
.chapters-panel .check-new { gap: var(--s-2); padding-inline-end: var(--s-3); }
/* Save next and Save previous: the name, then its buttons across the row. */
.chapters-panel .follow-group .rc-row.follow { margin: 0; flex-direction: column; align-items: stretch; gap: var(--s-2); padding: var(--s-3) var(--s-4); }
.chapters-panel .follow-group .rc-row.follow + .rc-row.follow { border-top: 1px solid var(--line); }
.chapters-panel .follow-group .rc-label { width: auto; color: var(--ink); font-size: inherit; font-weight: 500; }
.chapters-panel .follow-group .chips { flex-wrap: nowrap; gap: var(--s-2); }
.chapters-panel .follow-group .chip { flex: 1 1 0; min-width: 0; max-width: 8rem; padding-inline: var(--s-1); }
/* While chapters save, the row holds only Pause and Stop. */
.chapters-panel .follow-group .chip:disabled:not(.pause):not(.stop) { display: none; }
.chapters-panel .source-row { cursor: default; padding-inline-end: var(--s-3); }
.chapters-panel .source-input {
  flex: 1; min-width: 0; height: 44px; padding: 0; border: 0; background: transparent;
  color: var(--ink); font: inherit; text-overflow: ellipsis;
}
.chapters-panel .source-input:focus-visible { outline: none; }
.chapters-panel .source-row:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.folder-actions.cover-panel { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: var(--s-4); }
/* One row that scrolls sideways, so a long story's chapters stay close
   under it in Edit. */
.cover-grid {
  display: grid; grid-auto-flow: column; grid-auto-columns: 96px; gap: var(--s-3); min-width: 0;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  padding: 3px 3px var(--s-1);
}
@media (max-width: 699px) { .cover-grid { margin: 0 calc(-1 * var(--gutter)); padding-inline: var(--gutter); } }
.cover-grid::-webkit-scrollbar { display: none; }
.cover-choice {
  display: flex; flex-direction: column; gap: var(--s-2); min-width: 0;
  padding: 0; border: 0; background: none; color: var(--ink); text-align: start; cursor: pointer;
}
.cover-choice-pic {
  display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 2 / 3;
  border-radius: var(--r-sm); border: 1px solid var(--line); overflow: hidden; background: var(--preview); color: var(--muted);
}
.cover-choice-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The mosaic choice before it's picked: the pictures it will be drawn from. */
.cover-mosaic { display: grid; width: 100%; height: 100%; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.cover-mosaic img { min-width: 0; min-height: 0; }
.cover-mosaic.n2 > *, .cover-mosaic.n3 > :first-child { grid-column: 1 / -1; }
.cover-mosaic.side { grid-template-rows: 1fr; }
.cover-choice-pic .folder-icon, .cover-choice-pic .book-icon { color: var(--accent); }
.cover-choice[aria-pressed="true"] .cover-choice-pic { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.paper-row { gap: var(--s-4); }
.note-text { display: block; width: 100%; box-sizing: border-box; min-height: 7rem; margin: 0 0 var(--s-3); padding: var(--s-3); font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md, 12px); resize: vertical; }
.paper-pic { flex: none; width: 40px; height: 56px; display: grid; background: #fdfcf8; color: #c8d2e2; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.cover-choice-name { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover-choice[aria-pressed="true"] .cover-choice-name { color: var(--accent); font-weight: 600; }
.bar-title .book-icon { display: inline-flex; vertical-align: -2px; margin-inline-end: var(--s-1); color: var(--accent); }
.tile-thumb .book-icon { color: var(--accent); }
/* A favourite (1.16.0): a star on the picture's corner. */
.thumb-fav {
  position: absolute; left: var(--s-1); bottom: var(--s-1); z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 var(--s-1);
  border-radius: var(--r-sm); background: var(--surface); color: var(--accent);
  font: 600 var(--fs-meta)/1 var(--sans);
  box-shadow: 0 1px 3px var(--shadow);
}
[dir="rtl"] .thumb-fav { left: auto; right: var(--s-1); }
/* What a collection holds: a mark per kind on its cover's other corner. */
.tile-kinds {
  position: absolute; right: var(--s-1); bottom: var(--s-1); z-index: 1;
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 5px;
  border-radius: var(--r-sm); background: var(--surface); color: var(--accent);
  box-shadow: 0 1px 3px var(--shadow);
}
.tile-kinds svg { display: block; flex: none; }
[dir="rtl"] .tile-kinds { right: auto; left: var(--s-1); }
.card-thumb.has-fav { position: relative; display: block; }
.card-thumb.has-fav > img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* ---- 0.28.0: Show and Order, and the library's three layouts ---- */
.lib-tools {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  margin: var(--s-2) calc(-1 * var(--s-2)) 0;
}
.lib-tools[hidden] { display: none; }
.lib-tools .dropdown { min-width: 0; }
.lib-tools .dropdown-face { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.show-wrap.on .dropdown-btn { color: var(--accent); font-weight: 600; }
.dropdown.start .dropdown-menu { inset-inline-end: auto; inset-inline-start: 0; }
.dropdown-menu.up { top: auto; bottom: calc(100% + var(--s-1)); }
/* A group clips its rounded corners; while one of its menus is open the
   menu has to show past them (1.12.1: the Voice menu in Settings opened
   up into the group above and was cut off). */
.group.menu-open { overflow: visible; }
.dropdown-menu {
  max-height: min(60vh, 26rem); overflow-y: auto; overscroll-behavior: contain;
  scroll-margin: calc(var(--s-9) + var(--s-2)) 0 calc(var(--s-9) + var(--s-5));
}
.dropdown-menu.scrolls .dropdown-item { padding-inline-end: 14px; }
.dropdown-rail { position: sticky; bottom: calc(-1 * var(--s-1)); z-index: 2; flex: none; height: 0; pointer-events: none; }
.dropdown-track { position: absolute; bottom: 4px; inset-inline-end: -2px; width: 4px; border-radius: 2px; background: color-mix(in srgb, var(--line) 80%, transparent); }
.dropdown-thumb { position: absolute; top: 0; inset-inline: 0; border-radius: 2px; background: color-mix(in srgb, var(--muted) 70%, transparent); }
.dropdown-fade { position: absolute; inset-inline: calc(-1 * var(--s-1)); height: 40px; opacity: 0; transition: opacity 120ms linear; }
.dropdown-fade.on { opacity: 1; }
.dropdown-fade.top { background: linear-gradient(var(--surface), transparent); }
.dropdown-fade.end { bottom: 0; background: linear-gradient(transparent, var(--surface) 80%); }
.dropdown-head {
  padding: var(--s-2) var(--s-3) var(--s-1);
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.dropdown-head:not(:first-child) { margin-top: var(--s-1); border-top: 1px solid var(--line); }
.tile-kind { display: none; }
:is([data-layout="shelf"], [data-layout="grid"]) .tile-size { display: none; }
.library > .section-head:first-child { margin-top: 0; }
.top:has(.lib-tools:not([hidden])) + .library { padding-top: 0; }
/* 2026-11: the tags as a row of chips under Show and Order, scrolling
   edge to edge; a big screen has them in the sidebar instead. */
.lib-tags {
  display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  margin: var(--s-1) calc(-1 * var(--gutter)) 0; padding: var(--s-1) var(--gutter); scroll-padding-inline: var(--gutter);
}
.lib-tags::-webkit-scrollbar { display: none; }
.lib-tags[hidden] { display: none; }
.lib-tags .chip { flex: none; }
@media (min-width: 700px) { .lib-tags { display: none; } }
.chip.chip-quiet { border-color: transparent; background: transparent; color: var(--accent); }
.tag-chips { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.tag-chips .tag-input[hidden] { display: none; }
.tag-from { margin: var(--s-2) 0 0; }
.folder-tags {
  display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); margin: var(--s-1) 0 var(--s-2); padding: 0;
  border: 0; background: none; font: inherit; font-size: var(--fs-meta); text-align: start; cursor: pointer;
}
.folder-tags-sheet .tag-chips { margin: var(--s-2) 0 var(--s-4); }
.tag-detail .tag-input { width: 100%; }

/* Continue reading: its collection's cover, standing, beside the page. */
.card-thumb.cover { width: 80px; height: 120px; border-radius: var(--r-sm); }

/* Shelf and One list: pages are rows, not boxes; a picked row tints. */
:is([data-layout="shelf"], [data-layout="list"]) .page-card:not(.continue) {
  padding: var(--s-3) 0;
  background: transparent; border: 0; border-radius: 0;
  box-shadow: inset 0 -1px 0 var(--line);
}
:is([data-layout="shelf"], [data-layout="list"]) .page-card:not(.continue) .card-thumb { width: 64px; height: 96px; }
.selecting :is([data-layout="shelf"], [data-layout="list"]) .picked.page-card:not(.continue) { box-shadow: inset 0 -2px 0 var(--accent); }

/* Shelf and Grid: collections are covers, two to three wide. */
:is([data-layout="shelf"], [data-layout="grid"]) .tile {
  flex-basis: 112px; padding: 0; gap: var(--s-1);
  background: transparent; border: 0; border-radius: var(--r-sm);
}
:is([data-layout="shelf"], [data-layout="grid"]) .tile-thumb {
  height: auto; aspect-ratio: 2 / 3; margin-bottom: var(--s-1);
  box-shadow: 0 1px 2px var(--shadow), 0 4px 12px var(--shadow);
}
:is([data-layout="shelf"], [data-layout="grid"]) .tile-name { font-size: var(--fs-meta); line-height: var(--lh-meta); font-family: var(--sans); font-weight: 600; }
/* A picked cover's ring goes around its name and progress too, clear of
   them (1.23.1): hugging the tile, it ran through the progress bar. */
.selecting :is([data-layout="shelf"], [data-layout="grid"]) .picked.tile {
  box-shadow: none; outline: 2px solid var(--accent); outline-offset: 5px; border-radius: var(--r-md);
}
.selecting :is([data-layout="shelf"], [data-layout="grid"]) .folder-strip { padding-top: var(--s-2); padding-bottom: var(--s-3); }
[data-layout="grid"] .folder-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4) var(--s-3);
  overflow: visible; margin: 0; padding: var(--s-1) 0 var(--s-2);
}

/* One list: a collection is a row like a page, its cover standing. */
[data-layout="list"] .library > .tile {
  flex: none; justify-content: center; gap: 6px;
  min-height: calc(96px + 2 * var(--s-3)); padding: var(--s-3) 0 var(--s-3) calc(64px + 14px);
  background: transparent; border: 0; border-radius: 0;
  box-shadow: inset 0 -1px 0 var(--line);
}
[data-layout="list"] .library > .tile .tile-thumb { position: absolute; left: 0; top: var(--s-3); width: 64px; height: 96px; margin: 0; }
[dir="rtl"] [data-layout="list"] .library > .tile { padding: var(--s-3) calc(64px + 14px) var(--s-3) 0; }
[dir="rtl"] [data-layout="list"] .library > .tile .tile-thumb { left: auto; right: 0; }
[data-layout="list"] .tile-name { font-size: var(--fs-card); line-height: var(--lh-card); }
[data-layout="list"] .tile-kind { display: inline; }
[data-layout="list"] .tile .progress { margin-top: 0; }
[data-layout="list"] .tile-new { top: var(--s-1); inset-inline-end: var(--s-1); padding: 0 6px; }
.selecting [data-layout="list"] .picked.tile { box-shadow: inset 0 -2px 0 var(--accent); }

/* Grid: pages are cards two wide, the picture on top. Saves in progress
   and Continue reading take the whole width. */
[data-layout="grid"] .library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: var(--s-3); }
[data-layout="grid"] .library > :is(.wide, .card:not(.page-card)) { grid-column: 1 / -1; }
[data-layout="grid"] .page-card:not(.has-cover) { flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
[data-layout="grid"] .page-card:not(.has-cover) .card-thumb { width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 0; }
[data-layout="grid"] .page-card:not(.has-cover) .card-body { padding: var(--s-3); }
[data-layout="grid"] .page-card:not(.continue) .card-title { font-size: var(--fs-label); line-height: var(--lh-label); }
[data-layout="grid"] .continue:not(.has-cover) .card-thumb { aspect-ratio: 2 / 1; }
@media (min-width: 700px) { [data-layout="grid"] .continue:not(.has-cover) .card-thumb { aspect-ratio: 3 / 1; } }
[data-layout="grid"] .card-thumb.site-mark img { width: var(--s-7); height: var(--s-7); }

/* At phone width rows sit edge to edge, their hairlines between them. */
@media (max-width: 699px) {
  :is([data-layout="shelf"], [data-layout="list"]) .library > :is(.tile, .page-card:not(.continue)) + :is(.tile, .page-card) { margin-top: calc(-1 * var(--s-3)); }
}

/* ---- 0.27.9: Downloads ---- */
/* The bar's button: a ring around the icon fills with everything being
   downloaded together; a warning dot once only failures are left. */
.dl-btn { position: relative; }
.dl-ring {
  position: absolute; inset: 0; margin: auto;
  transform: rotate(-90deg); fill: none; stroke-width: 2.5;
  opacity: 0;
}
.dl-ring-track { stroke: var(--line); }
.dl-ring-fill {
  stroke: var(--accent); stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  transition: stroke-dashoffset 400ms var(--spring-control, ease-out);
}
.dl-btn.busy .dl-ring { opacity: 1; }
.dl-dot {
  position: absolute; top: var(--s-1); inset-inline-end: var(--s-1);
  width: var(--s-2); height: var(--s-2); border-radius: var(--r-full);
  background: var(--warn); box-shadow: 0 0 0 2px var(--bg);
  transform: scale(0); transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out);
}
.dl-btn.failed .dl-dot { transform: scale(1); }
/* 1.13.0: Sync's button wears the same ring and dot. With nothing to
   count yet the ring is a quarter arc that turns; held (paused, or
   waiting for Wi-Fi) the cloud is muted. */
.sync-btn.looking .dl-ring-fill { transition: none; }
.sync-btn.looking .dl-ring { animation: sync-turn 1s linear infinite; }
@keyframes sync-turn { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
.sync-btn.held { color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .dl-ring, .dl-ring-fill, .dl-dot { transition: none; }
  .sync-btn.looking .dl-ring { animation: breathe 1.6s ease-in-out infinite; }
}

/* The screen: the same cards as the library, one column. */
.downloads { display: flex; flex-direction: column; gap: var(--s-3); }
.downloads > .section-head:first-child { margin-top: 0; }
.downloads .empty { margin: var(--s-6) auto 0; }
.card.done-run { cursor: default; }
.card.done-run:active { transform: none; background-image: none; }
.card.done-page .card-thumb { width: var(--s-7); height: calc(var(--s-7) * 1.5); }

/* A run's failed pages, inside its card. */
.failed-list {
  display: flex; flex-direction: column; gap: var(--s-2);
  margin-top: var(--s-2); padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}
.failed-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  font: 500 var(--fs-meta)/var(--lh-meta) var(--sans);
}
.failed-row { display: flex; align-items: center; gap: var(--s-2); }
.failed-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.failed-url, .failed-why {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-meta); line-height: var(--lh-meta);
}
.failed-why { color: var(--muted); }
.failed-drop { flex-shrink: 0; color: var(--muted); margin-inline-start: calc(-1 * var(--s-1)); }

/* ---- 0.27.10: Select beside Order, search behind its button ---- */
.lib-tools-end { display: flex; align-items: center; gap: var(--s-1); min-width: 0; }
.lib-tools-end .dropdown.sort-wrap { margin-inline-end: 0; }

/* ---- 0.27.11: the collection as a book page ---- */
/* Favourite, Edit and ⋯ share the right; the title stays centred while
   it fits. */
#folderView .screen-bar { grid-template-columns: minmax(var(--s-9), 1fr) minmax(0, max-content) minmax(max-content, 1fr); }
#folderView .bar-tools { display: flex; align-items: center; }
#folderFav[aria-pressed="true"] { color: var(--accent); }
#folderFav[aria-pressed="true"] svg { fill: currentColor; }
#folderView .bar-left, #folderBack { grid-column: 1; justify-self: start; }
#folderView .bar-right { grid-column: 3; justify-self: end; }
#folderView .bar-left[hidden], #folderView .bar-right[hidden], #folderBack[hidden] { display: none; }
#folderTitle { grid-column: 2; grid-row: 1; }
#folderView .screen-bar > * { grid-row: 1; }
#folderView .screen-bar { border-bottom-color: transparent; transition: border-color 120ms linear; }
#folderView .screen-bar.titled { border-bottom-color: var(--line); }
#folderTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#folderView .screen-bar:not(.titled) #folderTitle { opacity: 0; }

.book-head { display: flex; align-items: flex-end; gap: var(--s-4); margin-bottom: var(--s-5); }
.book-cover {
  flex-shrink: 0; width: calc(var(--s-9) + var(--s-6)); aspect-ratio: 2 / 3;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  object-fit: cover; background: var(--surface);
  box-shadow: 0 1px 2px var(--shadow), 0 6px 16px var(--shadow);
}
.book-cover.drawn {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--preview); color: var(--muted);
}
.book-cover.drawn .book-icon, .tile-thumb .book-icon { color: var(--accent); }
.folder-icon, .book-cover.drawn .book-icon { display: inline-flex; }
.book-facts { flex: 1; min-width: 0; padding-bottom: var(--s-1); }
.book-site { margin: 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-title {
  margin: var(--s-1) 0 var(--s-2); font: 700 var(--fs-screen)/var(--lh-screen) var(--serif);
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* On the narrowest phones (320 px) a long word broke in two mid-letter. */
@media (max-width: 359px) {
  .book-title { font-size: var(--fs-heading); line-height: var(--lh-heading); -webkit-hyphens: auto; hyphens: auto; }
}
.book-title-input {
  display: block; width: 100%; margin: var(--s-1) 0 var(--s-2); padding: 0 var(--s-2); min-height: var(--tap);
  border: 2px solid var(--accent); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: 700 var(--fs-heading)/var(--lh-heading) var(--serif);
}
.book-title-input:focus { outline: none; }
.book-facts .folder-meta { margin: 0 0 var(--s-2); }
.book-progress { height: 4px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.book-progress-fill { display: block; height: 100%; background: var(--accent); }
.folder-go, .folder-go-row { margin-bottom: var(--s-2); }
.folder-starts { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: var(--s-3); }
.folder-starts > :last-child:nth-child(odd) { grid-column: span 2; }
.quick-start .chip-icon { display: flex; color: var(--accent); }
.book-new { display: flex; align-items: center; justify-content: center; gap: var(--s-2); width: 100%; margin-bottom: var(--s-2); }
.book-saved {
  display: block; width: 100%; min-height: var(--tap); margin-bottom: var(--s-3); padding: 0 var(--s-1);
  border: 0; background: transparent; color: var(--muted); text-align: start;
  font: 400 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
}
.book-saved .accent { font-weight: 600; }
.book-saved:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
/* A series' collection, under its name: still a 44px target. */
.book-saved.series-in { width: auto; margin: 0; padding: 0; }

.chapter-mark { flex-shrink: 0; width: 20px; display: flex; justify-content: center; }
.chapter-mark.done { color: var(--ok); }
.chapter-mark.ring {
  width: 16px; height: 16px; margin: 0 2px; border-radius: 50%;
  border: 2px solid var(--accent); background: conic-gradient(var(--accent) var(--at), transparent 0);
}
.chapter .choice-text .row-label { color: var(--ink); }
.selecting .chapter .chapter-mark { display: none; }
/* A star on each clip in a collection: at the row's end, or on a
   cover's top corner. */
.item-fav { flex-shrink: 0; color: var(--muted); border-radius: var(--r-full); margin-inline-end: var(--s-1); }
.item-fav:hover { color: var(--ink); background: var(--press); }
.item-fav[aria-pressed="true"] { color: var(--accent); }
.item-fav[aria-pressed="true"] svg { fill: currentColor; }
.item-fav:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.folder-list .chapter { padding-inline-end: var(--s-2); }
.folder-covers li { position: relative; }
.folder-covers .item-fav { position: absolute; top: 0; inset-inline-end: 0; margin: 0; background: none; }
.folder-covers .item-fav::before {
  content: ""; position: absolute; inset: 8px; border-radius: var(--r-full);
  background: var(--surface); box-shadow: 0 1px 3px var(--shadow);
}
.folder-covers .item-fav svg { position: relative; }
.folder-covers .item-fav:hover { background: none; }
.selecting .item-fav { display: none; }

/* Edit (2026-11): its two tabs, the facts after the cover, and Sort by
   as the top row of the chapters' card. */
.edit-tabs { margin-bottom: var(--s-4); }
.folder-edit .folder-facts { margin-top: var(--s-4); }
.sort-dir { display: inline-flex; vertical-align: -3px; margin-inline-start: var(--s-1); }
.folder-list.ordering .row { min-height: 56px; cursor: default; }
.folder-list.ordering li { background: var(--surface); }
.folder-list.dragging li { transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.folder-list.dragging li.lifted {
  position: relative; z-index: 1; transition: none;
  border-radius: var(--r-md); box-shadow: 0 8px 20px var(--shadow);
}
.drag-handle {
  flex-shrink: 0; width: var(--tap); height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: grab; touch-action: none;
  padding: 0; border: 0; border-radius: var(--r-sm); background: none; font: inherit;
}
.drag-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; color: var(--accent); }
.lifted .drag-handle { color: var(--accent); cursor: grabbing; }
@media (prefers-reduced-motion: reduce) { .folder-list.dragging li { transition: none; } }

.pop-menu {
  position: fixed; z-index: 14; width: 248px; max-width: calc(100vw - var(--s-4));
  padding: var(--s-1) 0; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: 0 8px 24px var(--shadow);
}
.pop-item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 48px; padding: 0 var(--s-4);
  border: 0; background: transparent; color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.pop-item:hover:not(:disabled), .pop-item:focus-visible { background: var(--press); outline: none; }
.pop-item:disabled { opacity: 0.5; cursor: default; }
.pop-icon { display: flex; color: var(--accent); }
.pop-item.warn, .pop-item.warn .pop-icon { color: var(--warn); }
.pop-label { flex: 1; min-width: 0; }
.pop-note { color: var(--muted); font-size: var(--fs-meta); }
.pop-note.accent { color: var(--accent); font-weight: 600; }
.pop-sep { height: 1px; margin: var(--s-1) 0; background: var(--line); }

.saved-view { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-3) var(--s-4); background: var(--surface); }
.page-controls > .saved-view { border: 1px solid var(--line); border-radius: var(--r-lg); }
.saved-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.saved-title { font-weight: 600; }
.saved-bar { display: flex; height: 8px; margin: var(--s-1) 0; border-radius: var(--r-full); overflow: hidden; background: var(--line); }
.saved-bar .pics { background: var(--accent); }
.saved-bar .text { background: var(--muted); background: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.saved-row { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.saved-key { flex-shrink: 0; width: 8px; height: 8px; border-radius: 2px; }
.saved-key.pics { background: var(--accent); }
.saved-key.text { background: var(--muted); background: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.saved-key.links { border: 1px solid var(--muted); }
.saved-key.missing { background: var(--warn); }
.saved-bar .other, .saved-key.other { background: var(--ink); opacity: .35; }
.saved-label { flex: 1; min-width: 0; }
.saved-value { flex-shrink: 0; color: var(--muted); font-size: var(--fs-meta); font-variant-numeric: tabular-nums; }
.saved-view .footnote { margin: var(--s-1) 0 0; }
.saved-sheet .refresh-go { width: 100%; }
.saved-sheet .footnote { margin-top: calc(-1 * var(--s-1)); }
.remove-sheet .sheet-row { min-height: 52px; text-align: start; }
.menu-cancel { align-self: center; }
.storage-pages > .saved-view { border-top: 1px solid var(--line); padding-inline-start: var(--s-6); }
.storage-pages > .saved-view + .row { border-top: 1px solid var(--line); }
.choice-note.warn { color: var(--warn); }
/* The Kokoro voices screen fills in once the phone answers. */
.kokoro-slot { display: contents; }
/* An audiobook chapter's transcript, written so far. */
/* Find the book (2026-11): each book found, with how it fits the
   narrator on the right. */
.listen-found-row { align-items: center; gap: var(--s-3); }
.listen-fit { flex: none; }
.listen-fit.same { color: var(--accent); border-color: var(--accent); }
.listen-heard { font-style: italic; }
/* The narrator away from the book (2026-11): over the player, in the
   toast's colours, with its two things to do. */
.listen-lost {
  position: fixed; left: var(--gutter); right: var(--gutter); z-index: 21;
  max-width: 560px; margin: 0 auto;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--ink); color: var(--bg); box-shadow: 0 6px 24px var(--shadow);
}
.listen-lost[hidden] { display: none; }
.listen-lost-title { margin: 0; font: 600 var(--fs-label)/var(--lh-label) var(--sans); }
.listen-lost-note { margin: var(--s-1) 0 0; font-size: var(--fs-meta); line-height: var(--lh-meta); opacity: 0.8; }
.listen-lost-acts { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-1); margin-inline-start: calc(-1 * var(--s-3)); }
.listen-ch-tr { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2); font: var(--fs-meta)/var(--lh-meta) var(--sans); color: var(--muted); }
.listen-ch-bar { flex: 1; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--line) 70%, transparent); overflow: hidden; }
.listen-ch-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.listen-ch-pc { min-width: 3.2em; text-align: end; font-variant-numeric: tabular-nums; }
.listen-ch-bar { position: relative; }
/* The chapter being written: a light runs along its bar. */
.listen-ch-tr.now .listen-ch-bar::after {
  content: ""; position: absolute; inset: 0; width: 30%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  animation: sweep 1.4s linear infinite;
}
.listen-ch-tr.now .listen-ch-pc { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .listen-ch-tr.now .listen-ch-bar::after { animation: breathe 2.4s ease-in-out infinite; width: 100%; } }
/* A slot's first section after one outside it: the same gap as between two. */
.settings-section + .kokoro-slot > .settings-section:first-child { margin-top: var(--s-6); }

/* ---- 0.27.12: the browser release ---- */
.empty-open { margin-top: var(--s-4); }
.install-hint { margin-top: var(--s-3); }

/* ---- 0.28.0: the sidebar and Feeds ---- */
.library[hidden], .feeds[hidden], .highlights[hidden], .reading[hidden] { display: none; }
:is([data-place="feeds"], [data-place="newsletters"], [data-place="highlights"], [data-place="reading"], [data-place="discover"], [data-place="calibre"], [data-place="catalogs"], [data-place="audiobookshelf"], [data-place="webdav"], [data-place="anki"]) .top { display: none; }

.side-catch { z-index: 17; }
.sidebar {
  position: fixed; z-index: 18; top: 0; bottom: 0; inset-inline-start: 0;
  width: min(300px, 85vw); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 2px;
  padding: calc(var(--s-8) + env(safe-area-inset-top)) 0 calc(var(--s-5) + env(safe-area-inset-bottom));
  background: var(--bg); border-inline-end: 1px solid var(--line);
  box-shadow: 8px 0 24px var(--shadow);
}
.sidebar[hidden] { display: none; }
/* Dragged to the left to close (0.30.5); its rows scroll up and down. */
.sidebar, .side-catch { touch-action: pan-y; }
.side-title { margin: 0 var(--s-5) var(--s-4); font: 700 var(--fs-heading)/var(--lh-heading) var(--serif); }
.side-item {
  display: flex; align-items: center; gap: var(--s-3); flex-shrink: 0;
  min-height: 48px; margin: 0 var(--s-2); padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink);
  font: inherit; text-align: start; cursor: pointer;
}
.side-item:active { background: var(--press); }
.side-item[aria-current] { background: var(--bar); font-weight: 600; }
.side-icon { display: inline-flex; flex-shrink: 0; color: var(--accent); }
.side-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side-n { font-size: var(--fs-meta); font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.side-pill {
  padding: 0 var(--s-2); border-radius: var(--r-full);
  background: var(--accent); color: var(--accent-ink);
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans);
}
.side-space { flex-shrink: 0; height: var(--s-5); }
.side-version { flex-shrink: 0; margin: auto var(--s-5) 0; padding-top: var(--s-5); color: var(--muted); font: var(--fs-meta)/var(--lh-meta) var(--sans); font-variant-numeric: tabular-nums; }
button.side-version { align-self: flex-start; min-height: 44px; padding-bottom: 0; padding-inline: 0; border: 0; background: none; text-align: start; cursor: pointer; }
@media (hover: hover) { button.side-version:hover { color: var(--ink); } }
.side-sub { min-height: var(--tap); margin-inline-start: calc(var(--s-2) + var(--s-4)); font-size: var(--fs-label); }
.side-sub .side-icon { color: var(--accent); }
/* A heading with its fold arrow is one item (1.45.5): the arrow sits
   inside it, in the same highlight, still its own tap. */
.side-row { display: flex; align-items: stretch; flex-shrink: 0; margin: 0 var(--s-2); border-radius: var(--r-md); }
.side-row:has(.side-item[aria-current]) { background: var(--bar); }
.side-row .side-item { flex: 1; min-width: 0; margin: 0; padding-inline-end: 0; }
.side-row .side-item[aria-current] { background: transparent; }
.side-fold {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: var(--tap);
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--muted); cursor: pointer;
}
.side-fold:active { background: var(--press); }
/* Pressing or hovering the heading lights the whole row, arrow and all
   (1.50); the arrow alone lights only itself. */
.side-row .side-item:active { background: transparent; }
.side-row:has(> .side-item:active) { background-image: linear-gradient(var(--press), var(--press)); }
@media (hover: hover) and (pointer: fine) {
  .side-row .side-item:hover { background-image: none; }
  .side-row:has(> .side-item:hover) { background-image: linear-gradient(var(--press), var(--press)); }
}
.side-fold svg { transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.side-fold[aria-expanded="false"] svg { transform: rotate(-90deg); }
.side-fold[aria-expanded="false"]:dir(rtl) svg { transform: rotate(90deg); }
.side-group { display: grid; grid-template-rows: 1fr; flex-shrink: 0; transition: grid-template-rows var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.side-group.folded { grid-template-rows: 0fr; }
.side-group-in { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .side-group, .side-fold svg { transition: none; } }
.side-cover {
  flex-shrink: 0; width: var(--s-5); height: var(--s-6); overflow: hidden;
  border-radius: var(--r-sm); background: var(--preview);
}
.side-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-cover:not(:has(img)) { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.save-form .icon-btn[hidden] { display: none; }
:is([data-place="feeds"], [data-place="newsletters"]) .save-form .btn-primary { border-radius: var(--r-md); }

/* A feed's mark: its site's icon, or first letter, on the preview tint. */
.feed-mark {
  position: relative; flex-shrink: 0; width: var(--s-6); height: var(--s-6);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: var(--r-sm); background: var(--preview);
  color: var(--muted); font: 600 var(--fs-label)/1 var(--serif);
}
.feed-mark img { width: var(--s-5); height: var(--s-5); }
.feed-mark.small { width: var(--s-5); height: var(--s-5); font-size: var(--fs-meta); }
.feed-mark.small img { width: var(--s-4); height: var(--s-4); }

/* Every highlight in one place (1.8.0): each clip's under its title. */
.highlights {
  flex: 1; padding: 0 var(--gutter) var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-3);
}
[data-place="highlights"] .save-form { display: none; }
[data-place="highlights"] .save-bar:not(:has(.update-bar:not([hidden]))) { display: none; }
[data-place="newsletters"] .save-link-icon { display: none; }
.hl-head[hidden] { display: none; }
.hl-search { margin-top: var(--s-1); }
.hl-line { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-1); }
.hl-line .meta { margin: 0; }
.hl-list { display: flex; flex-direction: column; gap: var(--s-5); }
.hl-clip { display: flex; flex-direction: column; gap: var(--s-2); }
.hl-title {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: var(--tap);
  padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.hl-name { font: 600 var(--fs-label)/var(--lh-label) var(--sans); }
.hl-title .meta { margin: 0; }
.hl-title:active .hl-name { color: var(--muted); }
.hl-none { margin: var(--s-6) auto 0; text-align: center; }

/* Reading (1.39.0): a week, month or year of reading stats. */
.reading {
  flex: 1; padding: var(--s-1) var(--gutter) var(--s-5);
  display: flex; flex-direction: column;
}
.reading > * { width: 100%; max-width: 40rem; margin-inline: auto; }
:is([data-place="reading"], [data-place="anki"]) .save-form { display: none; }
:is([data-place="reading"], [data-place="anki"]) .save-bar:not(:has(.update-bar:not([hidden]))) { display: none; }
.rs-seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--bar); }
.rs-tab {
  flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
}
.rs-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px color-mix(in srgb, var(--muted) 30%, var(--line)); }
.rs-tab:active { background: var(--press); }
.rs-range { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s-2); }
.rs-range .icon-btn { color: var(--muted); }
.rs-range .icon-btn:disabled { visibility: hidden; }
.rs-title { margin-block: 0; font: 600 var(--fs-label)/var(--lh-label) var(--sans); text-align: center; }
.rs-total { margin-block: var(--s-3) 0; font: 700 var(--fs-title)/var(--lh-title) var(--serif); font-variant-numeric: tabular-nums; }
.rs-split { margin-block: 2px 0; font-variant-numeric: tabular-nums; }
.rs-chart { position: relative; margin-top: var(--s-4); padding-top: var(--s-5); }
.rs-top { position: absolute; top: 0; inset-inline-end: 0; margin: 0; }
.rs-cols {
  display: flex; align-items: stretch; gap: var(--s-2); height: 160px;
  border-top: 1px solid var(--line); background: linear-gradient(var(--line), var(--line)) 0 69px / 100% 1px no-repeat;
}
.rs-month .rs-cols { gap: 2px; }
.rs-year .rs-cols { gap: var(--s-1); }
.rs-all .rs-cols { gap: var(--s-1); }
.rs-dense .rs-cols { gap: 2px; }
.rs-dense .rs-day { text-align: start; }
.rs-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rs-stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.rs-stack span { display: block; border-radius: 3px; }
.rs-month .rs-stack span { border-radius: 2px; }
.rs-read { background: var(--accent); }
.rs-aloud { background: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.rs-none { height: 2px; background: var(--line); }
.rs-day { height: 22px; padding-top: var(--s-1); text-align: center; overflow: visible; white-space: nowrap; font: 400 12px/18px var(--sans); color: var(--muted); }
.rs-month .rs-day { text-align: start; }
.rs-col.today .rs-day { color: var(--ink); font-weight: 700; }
.rs-legend { display: flex; gap: var(--s-4); margin-top: var(--s-2); }
.rs-legend i { display: inline-block; width: 8px; height: 8px; margin-inline-end: 6px; border-radius: 2px; vertical-align: 1px; }
.rs-key-read { background: var(--accent); }
.rs-key-aloud { background: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.rs-since { margin-block: var(--s-2) 0; }
.rs-figs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: var(--s-5); overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--line);
}
.rs-fig { display: flex; flex-direction: column; padding: var(--s-3) var(--s-4); background: var(--surface); }
.rs-fig b { font: 600 var(--fs-heading)/var(--lh-heading) var(--serif); font-variant-numeric: tabular-nums; }
.rs-fig span { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
.rs-streak {
  display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-3); padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.rs-dots { display: flex; gap: var(--s-1); flex-shrink: 0; }
.rs-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.rs-dots i.on { background: var(--ok); }
.rs-streak p { margin: 0; }
.rs-streak-n { font-weight: 600; }
.rs-over { margin: var(--s-5) auto var(--s-1); }
.rs-top-list { list-style: none; margin: 0 auto; padding: 0; }
.rs-top-list li + li { border-top: 1px solid var(--line); }
.rs-clip {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 56px; padding: var(--s-2) 0;
  border: 0; background: none; color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.rs-clip:active .rs-clip-title { color: var(--muted); }
.rs-clip .side-cover, .rs-clip .side-icon { width: var(--s-7); height: var(--s-7); }
.rs-clip .side-icon { justify-content: center; align-items: center; border-radius: var(--r-sm); background: var(--preview); color: var(--muted); }
.rs-clip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rs-clip-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 var(--fs-label)/var(--lh-label) var(--serif); }
.rs-clip-time { flex-shrink: 0; font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); font-variant-numeric: tabular-nums; }
.rs-gone .rs-clip-title, .rs-gone .rs-clip-time { color: var(--muted); }
.rs-gone .rs-clip-title { font-weight: 500; }
.rs-clip .rs-gone-mark { display: flex; justify-content: center; align-items: center; border-radius: var(--r-sm); background: var(--preview); color: var(--muted); }
.rs-note { margin-top: var(--s-5); }

/* The river: chips per feed, then the posts by day. */
.feeds {
  flex: 1; padding: 0 var(--gutter) var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.feeds .feed-chips { margin-top: var(--s-1); }
.post-search { margin-top: var(--s-1); }
.post-search:not([hidden]) + .feed-chips { margin-top: 0; }
.chip-label { overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: calc(-1 * var(--s-2)) 0 calc(-1 * var(--s-2)); }
.feed-head .meta { margin: 0 0 0 var(--s-1); min-width: 0; }
.feed-head-acts { display: flex; flex: none; }
/* Picking posts (1.20.0) shares the library's bars, with its own actions. */
.select-bar .post-only, .picking-posts .select-bar .select-act:not(.post-only) { display: none; }
.picking-posts .select-bar .post-only { display: flex; }
.picking-posts .post > .post-act, .picking-posts .post > .post-saved,
.picking-posts .feed-group + .section-head .btn-text, .picking-posts .section-head .btn-text { visibility: hidden; }
.picking-posts .post { padding-inline-end: var(--s-7); }
.picking-posts .post .pick { position: absolute; top: 50%; margin-top: -12px; inset-inline-end: var(--s-4); }
.picking-posts .post.picked { background: var(--surface); }
.picking-posts #feeds { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.feed-check { flex-shrink: 0; }
@media (hover: none) and (pointer: coarse) { .feed-check { display: none; } .feed-head { min-height: var(--tap); } }

/* Pull to check (0.28.2): a gap opens over the list with a ring that
   fills as it's pulled, and spins while checking. */
.pull { display: flex; align-items: center; justify-content: center; height: 0; overflow: hidden; }
.pull[hidden] { display: none; }
.pull.settle { transition: height var(--spring-sheet-ms, 520ms) var(--spring-sheet, ease-out); }
.pull-mark {
  width: var(--s-5); height: var(--s-5); border-radius: var(--r-full);
  border: 2px solid var(--line); border-top-color: var(--accent);
  transform: rotate(0deg); transition: border-color 120ms linear;
}
.pull.ready .pull-mark { border-color: var(--accent); }
.pull.busy .pull-mark { border-color: var(--line); border-top-color: var(--accent); animation: pull-spin 0.8s linear infinite; }
@keyframes pull-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pull.busy .pull-mark { animation: none; border-color: var(--accent); } }
.feeds > .section-head { margin-bottom: calc(-1 * var(--s-2)); }
.feeds > .section-head .btn-text { font-size: var(--fs-meta); }
.post {
  position: relative; display: flex; align-items: center; gap: var(--s-3);
  min-height: 64px; padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4);
}
.post > .post-act + .post-act, .post > .post-act + .post-saved { margin-inline-start: calc(-1 * var(--s-2)); }
.post + .post { border-top: 1px solid var(--line); }
.post-open { position: absolute; inset: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.post-open:active { background: var(--press); }
.post-open:focus-visible { outline-offset: -2px; }
.post > :not(.post-open) { position: relative; pointer-events: none; }
.post > .post-act { pointer-events: auto; }
.post-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.post-feed, .post-meta { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
.post-title {
  font: 600 var(--fs-card)/var(--lh-card) var(--serif);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-act {
  flex-shrink: 0; width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--muted); cursor: pointer;
}
.post-act .side-icon { color: inherit; }
.post-save { border: 1px solid var(--line); background: var(--surface); color: var(--accent); }
.post-save:disabled { color: var(--muted); cursor: default; }
.post-save .side-icon { color: inherit; }
.post-saved { flex-shrink: 0; padding: 0 var(--s-2); font-size: var(--fs-meta); font-weight: 600; color: var(--ok); }

/* Newsletters (1.43.0): the address in the line over the emails, and
   unread emails with a dot. */
.nl-mail { font-size: var(--fs-label); line-height: var(--lh-label); color: var(--ink); overflow-wrap: anywhere; }
.nl-unread .post-title { font-weight: 700; }
.nl-unread::before {
  content: ""; position: absolute; inset-inline-start: 6px; top: 50%;
  width: 6px; height: 6px; margin-top: -3px; border-radius: var(--r-full); background: var(--accent);
}
.post > .nl-confirm { pointer-events: auto; min-width: 0; padding: 0 var(--s-3); margin-inline-end: var(--s-2); }

/* Add a feed, and a feed's settings, in the library's sheet. */
.feed-field { display: flex; flex-direction: column; }
.feed-input {
  width: 100%; height: 48px; padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); font: inherit;
}
.feed-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.found-feed { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); }
.found-feed[hidden], .feed-mode[hidden] { display: none; }
.found-text { display: flex; flex-direction: column; min-width: 0; }
.found-text .meta { margin: 0; }
.found-name { font-weight: 600; }
.feed-mode .overline { margin-top: 0; }
.add-feed .btn-primary { width: 100%; }
/* Add a catalog: its three fields apart, its note under them. */
.add-catalog .feed-field { gap: var(--s-2); }
.add-catalog .feed-field .footnote { margin: var(--s-1) 0 0; padding-inline: var(--s-1); }
.feed-sheet .footnote { margin-top: calc(-1 * var(--s-2)); }
.feed-sheet .footnote + .sheet-row { margin-top: 0; }

/* Sync's setup (0.30.1): numbered steps in one group, and the setup code. */
.sync-step { align-items: flex-start; padding-top: var(--s-3); padding-bottom: var(--s-3); }
.sync-step .row-value { align-self: center; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: var(--r-full);
  border: 1px solid var(--accent); color: var(--accent);
  font: 600 var(--fs-meta)/1 var(--sans);
}
.sync-paste { cursor: default; }
.sync-paste .choice-text { gap: var(--s-2); }
.sync-paste .choice-note:empty { display: none; }
.sync-qr { display: flex; justify-content: center; padding: var(--s-5) var(--s-4); border-bottom: 1px solid var(--line); }
.sync-qr svg { display: block; width: 200px; height: 200px; padding: var(--s-2); background: var(--code-paper); border-radius: var(--r-sm); }

/* A library section opened alone (0.30.2). */
.section-link {
  display: inline-flex; align-items: center; gap: var(--s-1); min-height: 44px; margin: calc(-1 * var(--s-2)) 0;
  padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer;
}
.section-chev { font-size: var(--fs-label); line-height: 1; color: var(--accent); }
.part-back { border: 0; padding: 0 var(--s-1); color: var(--accent); }
.folder-strip.folder-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4) var(--s-3);
  overflow: visible; margin: 0; padding: var(--s-1) 0 var(--s-2);
}
.folder-grid .tile { flex: none; }


/* ---- 1.5.0: big screens ----
   Phone under 700 px is as above. A tablet (700 px and up) gets the save
   field in the bar at the top, two columns of clips, and dialogs and
   panels for sheets. From 1024 px the sidebar is pinned beside the
   library. Row heights follow the pointer, not the width: 44 px for a
   finger, 40 px for a mouse. DESIGN.md §5 has the rules. */
:root { --side-w: 272px; --rail-w: 272px; --content-max: 76rem; }

@media (min-width: 700px) {
  :root { --gutter: var(--s-5); }
  .app { max-width: none; margin: 0; }
  #libraryView { padding-top: 0; }
  /* Everything in the library lines up on one column, as wide as the
     window allows. */
  :root { --lib-left: 0px; --lib-pad: max(var(--gutter), calc((100vw - var(--lib-left) - var(--content-max)) / 2)); }
  #libraryView > :is(.top-bar, .top, .library, .feeds, .highlights, .reading, .save-bar) {
    padding-inline: max(var(--gutter), calc((100% - var(--content-max)) / 2));
  }
  .top-bar { padding-block: var(--s-4) var(--s-3); gap: var(--s-3); }
  html.native .top-bar { padding-top: calc(var(--s-4) + env(safe-area-inset-top)); }
  .top-bar .save-form { flex: 1; min-width: 0; }
  .top-bar .menu-btn { margin-inline-start: calc(-1 * var(--s-2)); }
  .save-form input { padding-inline-start: calc(var(--s-4) + 20px + var(--s-3)); }
  .save-link-icon { display: flex; position: absolute; inset-inline-start: var(--s-4); top: 14px; color: var(--muted); pointer-events: none; }
  [data-place="newsletters"] .save-form input { padding-inline-start: 14px; }
  .save-form { position: relative; }
  /* The bottom bar is left with the update notice alone. */
  .save-bar { border-top: 0; padding-block: 0 var(--s-3); }
  .save-bar:not(:has(.update-bar:not([hidden]))) { display: none; }
  .update-bar { margin-bottom: 0; }

  .lib-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s-1) var(--s-3); padding-top: var(--s-2); }
  .lib-head .screen-title { margin: 0; }
  .lib-head .meta { margin: 0; flex: 1; min-width: 0; }
  .lib-head .lib-tools { margin: 0 calc(-1 * var(--s-2)) 0 0; align-self: center; gap: var(--s-4); }
  .top { padding-bottom: var(--s-3); }
  /* Stats and Anki were left out, so a big screen showed them with no name. */
  :is([data-place="feeds"], [data-place="newsletters"], [data-place="highlights"], [data-place="reading"], [data-place="discover"], [data-place="calibre"], [data-place="catalogs"], [data-place="audiobookshelf"], [data-place="webdav"], [data-place="anki"]) .top { display: block; }
  :is([data-place="feeds"], [data-place="newsletters"], [data-place="highlights"], [data-place="reading"], [data-place="discover"], [data-place="calibre"], [data-place="catalogs"], [data-place="audiobookshelf"], [data-place="webdav"], [data-place="anki"]) :is(.top > :not(.lib-head), .lib-head > :not(.screen-title)) { display: none; }

  /* Two columns of clips; Continue reading, collections and section
     heads take the whole width. */
  .library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; column-gap: var(--s-6); }
  .library > :is(.wide, .section-head, .continue, .folder-strip, .card:not(.page-card), .empty) { grid-column: 1 / -1; }
  [data-layout="grid"] .library { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--s-3); }
  :is([data-layout="shelf"], [data-layout="grid"]) .tile { flex-basis: 152px; }
  .folder-strip { margin-inline: 0; padding-inline: 0; }
  /* Room at the sides for a picked cover's ring, which the strip's
     scrolling would cut. */
  .selecting [data-layout="shelf"] .folder-strip { margin-inline: calc(-1 * var(--s-2)); padding-inline: var(--s-2); }
  [data-layout="grid"] .folder-strip, .folder-strip.folder-grid { grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); }
  .continue { padding: var(--s-4); }

  /* The sidebar over the page (tablet) and pinned (wide) share a look. */
  .sidebar { width: min(var(--side-w), 85vw); padding: calc(var(--s-5) + env(safe-area-inset-top)) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom)); }
  .side-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 var(--s-4) var(--s-3); }
  .side-head .side-title { margin: 0; }
  .side-item { margin: 0; }
  .side-row { margin: 0; }
  .side-sub { margin-inline-start: var(--s-4); }
  .side-over { margin: 0 var(--s-3) var(--s-2); font: 600 var(--fs-meta)/var(--lh-meta) var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
  .side-tags { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: 0 var(--s-3); }
  .side-over-row { display: flex; align-items: center; justify-content: space-between; padding-inline-end: var(--s-1); }
  .side-over-row .side-over { margin-bottom: 0; }
  .side-edit { min-height: var(--tap); font-size: var(--fs-meta); }
  .side-tag { min-height: 32px; }
  .side-gap { flex: 1; min-height: var(--s-4); }
  .side-version { margin: 0 var(--s-3); padding-top: 0; }
}
@media (min-width: 700px) and (pointer: fine) {
  .side-item { min-height: 40px; }
  .side-sub { min-height: 40px; }
}

@media (min-width: 1280px) {
  /* Picking several: one bar at the top, the actions at its end. Only where
     it all fits on one line (1.53.0): a tablet keeps the phone's two bars. */
  .select-head {
    top: calc(var(--s-4) + env(safe-area-inset-top)); inset-inline: calc(var(--lib-left) + var(--lib-pad)) var(--lib-pad);
    height: 52px; padding: 0 var(--s-2); justify-content: flex-start; gap: var(--s-2);
    background: var(--bar); border: 0; border-radius: var(--r-md);
  }
  .select-count { flex: none; }
  .select-bar {
    top: calc(var(--s-4) + 4px + env(safe-area-inset-top)); bottom: auto; inset-inline: auto calc(var(--lib-pad) + 4px);
    height: 44px; padding: 0; gap: var(--s-2); background: transparent; border: 0; justify-content: flex-end;
  }
  .select-act {
    flex: none; max-width: none; min-height: 44px; flex-direction: row; gap: var(--s-2); padding: 0 var(--s-4);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    font-size: var(--fs-label); line-height: var(--lh-label); font-weight: 600;
  }
  .select-act svg { width: 18px; height: 18px; }
  .selecting .library, .selecting .screen-body { padding-bottom: var(--s-5); }
  .selecting .top-bar { visibility: hidden; }
}

@media (min-width: 1024px) {
  :root { --gutter: var(--s-7); }
  /* The pinned sidebar: under every screen, beside the library. */
  body.pinned .sidebar {
    z-index: 9; width: var(--side-w);
    box-shadow: none; touch-action: auto;
  }
  body.pinned { --lib-left: var(--side-w); --lib-pad: max(var(--gutter), calc((100vw - var(--side-w) - var(--content-max)) / 2)); }
  body.pinned #libraryView { margin-inline-start: var(--side-w); }
  body.pinned .menu-btn { display: none; }
  body.pinned .side-catch { display: none; }
  /* A collection opens beside the sidebar; the reader and Settings cover
     everything. */
  body.pinned #folderView { inset-inline-start: var(--side-w); box-shadow: none; }
  :is([data-layout="shelf"], [data-layout="grid"]) .folder-strip .tile { flex-basis: calc((100% - 5 * var(--s-5)) / 6); }
  .folder-strip { gap: var(--s-5); }
  [data-layout="grid"] .library { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  :is([data-layout="shelf"], [data-layout="list"]) .library { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Phone: none of the big-screen parts show. */
.reader-rail, .read-keys, .back-label, .close-icon, .pane-note { display: none; }
/* The clip's name shows on a phone too (2.0.0), a button that renames it in
   place; the site waits for a bigger screen. */
.reader-name { display: flex; align-items: baseline; gap: var(--s-2); flex: 0 1 auto; min-width: 0; margin: 0 0 0 var(--s-1); overflow: hidden; white-space: nowrap; }
.reader-name:has(.reader-title-input) { flex: 1 1 auto; }
button.reader-title {
  appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600;
  min-width: 0; margin: 0; padding: var(--s-2) var(--s-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: start; border-radius: var(--r-sm, 8px); cursor: pointer;
}
.reader-title-input {
  flex: 1; min-width: 0; font: inherit; font-weight: 600; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm, 8px); padding: var(--s-1) var(--s-2);
}
.reader-part { display: none; }
@media (max-width: 699px) {
  .reader-site { display: none; }
  /* The clip's name in a bubble under the bar (Daniel's ask), the chapter
     under it; it goes with the bar. A tap on the name renames it. */
  .reader-bar .reader-name {
    position: absolute; top: calc(100% + var(--s-2)); left: 50%; transform: translateX(-50%);
    flex-direction: column; align-items: center; justify-content: center; gap: 0;
    max-width: calc(100% - 2 * var(--s-6)); min-height: var(--tap); margin: 0; padding: var(--s-1) var(--s-4);
    border: 1px solid var(--line); border-radius: var(--r-full);
    background: var(--surface); color: var(--ink); box-shadow: 0 6px 18px var(--shadow);
    transition: opacity var(--spring-control-ms, 300ms) ease;
  }
  .reader-bar .reader-name:empty { display: none; }
  .reader-bar .reader-name:has(.reader-title-input) { width: calc(100% - 2 * var(--s-4)); max-width: none; border-radius: var(--r-lg); padding: var(--s-2); }
  .reader-bar .reader-name .reader-title { max-width: 100%; padding: var(--s-1) 0 0; font-size: var(--fs-label); line-height: 1.2; }
  .reader-bar .reader-name .reader-title:only-child,
  .reader-bar .reader-name .reader-title:has(+ .reader-part[hidden]) { padding: var(--s-1) 0; }
  .reader-bar .reader-name .reader-title-input { width: 100%; }
  .reader-bar .reader-name:has(.reader-title-input) .reader-part { display: none; }
  .reader-part { display: block; max-width: 100%; padding-bottom: var(--s-1); overflow: hidden; text-overflow: ellipsis; font: 400 var(--fs-meta)/1.2 var(--sans); color: var(--muted); }
  .reader-part[hidden] { display: none; }
  .reader.bar-away:not(.gliding) .reader-bar:not(:focus-within) .reader-name { opacity: 0; pointer-events: none; }
  /* A smaller reader bar on a phone (Daniel's ask, 2.0.0): 18 px icons in 38 px
     buttons, so the clip's name has room. */
  .reader-bar .icon-btn { width: 38px; height: 38px; flex: none; }
  .reader-bar .icon-btn svg, .reader-bar .section-icon { width: 18px; height: 18px; }
  .reader-bar .section-btn { min-width: 38px; min-height: 38px; }
}
.screen-catch { position: fixed; inset: 0; z-index: 12; background: var(--scrim); }
.screen-catch.clear { background: transparent; }
.screen-catch[hidden] { display: none; }
.drop-zone {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  display: flex; align-items: center; justify-content: center; padding: var(--s-5);
  background: var(--scrim);
}
.drop-zone[hidden] { display: none; }
.drop-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  width: min(28rem, 100%); padding: var(--s-7) var(--s-5);
  border: 2px dashed var(--accent); border-radius: var(--r-lg);
  background: var(--surface); color: var(--accent); text-align: center;
}
.drop-title { margin: 0; font: 700 var(--fs-heading)/var(--lh-heading) var(--serif); color: var(--ink); }
.drop-note { margin: 0; color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); color: var(--ink); font: 600 12px/1 var(--sans);
}
.pop-key { margin-inline-start: auto; color: var(--muted); }
.clip-pop { position: fixed; z-index: 16; width: 264px; }
.card.menu-on, .tile.menu-on { outline: 2px solid var(--accent); outline-offset: var(--s-1); border-radius: var(--r-md); }

/* The shortcuts list. */
.keys-sheet { display: flex; flex-direction: column; gap: var(--s-4); }
.keys-groups { display: grid; gap: var(--s-5); }
.keys-list { display: grid; grid-template-columns: auto 1fr; gap: var(--s-2) var(--s-4); align-items: center; margin: 0; }
.keys-list dt { display: flex; align-items: center; gap: var(--s-1); white-space: nowrap; }
.keys-list dd { margin: 0; }
.keys-then { color: var(--muted); font-size: var(--fs-meta); }

@media (min-width: 700px) {
  /* Sheets over the library are dialogs in the middle. */
  .menu-sheet {
    inset: 0; margin: auto; width: min(30rem, calc(100vw - 2 * var(--s-5))); max-width: none;
    height: fit-content; max-height: calc(100dvh - 2 * var(--s-7));
    padding: var(--s-5); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: 0 24px 64px var(--shadow);
  }
  .menu-sheet .sheet-grip, .reader .sheet .sheet-grip { display: none; }
  .menu-sheet .sheet-body { max-height: calc(100dvh - 2 * var(--s-7) - 2 * var(--s-5)); margin: 0 calc(-1 * var(--s-5)); padding: 0 var(--s-5) var(--s-1); }
  .menu-sheet[data-kind="keys"] { width: min(52rem, calc(100vw - 2 * var(--s-5))); }
  .keys-groups { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }

  /* The reader's sheets are panels under their buttons. */
  .reader .sheet {
    left: auto; right: auto; bottom: auto; width: min(23.5rem, calc(100% - 2 * var(--s-3))); max-width: none; margin: 0;
    padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: 0 12px 40px var(--shadow);
  }
  .reader .sheet-body { max-height: calc(100dvh - 140px); margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4) var(--s-1); }
  /* A link, note or look-up opens from the text, with no button to hang under: the middle (1.53.0). */
  .reader .sheet[data-pop="center"] { inset: 0; margin: auto; height: fit-content; max-height: calc(100% - 2 * var(--s-5)); }
  .reader-name {
    display: flex; align-items: baseline; gap: var(--s-2); min-width: 0; margin: 0 0 0 var(--s-2);
    overflow: hidden; white-space: nowrap;
  }
  .reader-site { flex-shrink: 0; color: var(--muted); font-size: var(--fs-meta); }
  .reader-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
  /* Beside the clip's name, after it. */
  .reader-name { order: 1; flex: 0 1 auto; }
  .section-btn { order: 2; flex: 0 1 auto; max-width: 40%; min-width: 0; padding: 0 var(--s-2); margin-inline-start: var(--s-1); }
  .section-btn .section-icon { display: none; }
  .section-btn .section-now, .section-btn .section-more { display: revert; }

  /* Save with options: a dialog. Downloads: a panel under its button. */
  .screen[data-dialog] { z-index: 13; box-shadow: 0 24px 64px var(--shadow); border: 1px solid var(--line); border-radius: var(--r-lg); }
  .screen[data-dialog="dialog"] { inset: 0; margin: auto; width: min(40rem, calc(100vw - 2 * var(--s-5))); height: min(46rem, calc(100dvh - 2 * var(--s-7))); }
  .screen[data-dialog="panel"] {
    inset: auto; top: calc(var(--s-4) + 48px + var(--s-2)); inset-inline-end: var(--lib-pad);
    width: min(26rem, calc(100vw - 2 * var(--s-5))); height: auto; max-height: min(36rem, calc(100dvh - 120px));
  }
  .screen[data-dialog] .back-icon { display: none; }
  .screen[data-dialog] .close-icon { display: block; }
  .screen[data-dialog] .screen-bar { grid-template-columns: var(--tap) 1fr var(--tap); }
  .screen[data-dialog] #downloadsBack, .screen[data-dialog] #batchBack { grid-column: 3; grid-row: 1; }
  .screen[data-dialog] .bar-title { grid-column: 1 / 3; grid-row: 1; text-align: start; padding-inline-start: var(--s-2); font-size: var(--fs-card); }
  .screen[data-dialog] .bar-spacer { display: none; }
  .screen[data-dialog="panel"] .screen-body { padding-bottom: var(--s-4); }

  /* Settings: the menu as its own sidebar, the section beside it. */
  :root { --settings-w: 300px; }
  #settingsView .screen-bar {
    width: var(--settings-w); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2);
    padding: var(--s-4) var(--s-4) 0; border: 0;
  }
  #settingsBack { width: auto; padding: 0 var(--s-3) 0 var(--s-1); gap: var(--s-1); color: var(--ink); }
  #settingsBack .back-label { display: inline; font-weight: 500; }
  #settingsBack svg { width: 18px; height: 18px; }
  #settingsView .bar-title { padding: 0 var(--s-3); text-align: start; font: 700 var(--fs-screen)/var(--lh-screen) var(--serif); }
  #settingsView .bar-spacer { display: none; }
  #settingsView .settings-search { width: var(--settings-w); padding: var(--s-3) var(--s-4) 0; }
  #settingsView .screen-body { width: var(--settings-w); padding: var(--s-4) var(--s-4) var(--s-5); }
  #settingsView .found-list .group { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  #settingsView .screen-body > * { margin: 0; max-width: none; }
  #settingsView { border-inline-end: 0; }
  #settingsView .settings-menu { gap: 0; }
  #settingsView .settings-menu > .group:not(.update-card) { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  #settingsView .settings-menu > .group:not(.update-card) + .group { margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--line); border-radius: 0; }
  #settingsView .update-card { margin-bottom: var(--s-4); }
  #settingsView .nav-row { min-height: 46px; border-radius: var(--r-md); padding-inline: var(--s-3); }
  #settingsView .nav-row + .nav-row { border-top: 0; }
  #settingsView .nav-row .row-chev { display: none; }
  #settingsView .nav-row[aria-current] { background: var(--bar); font-weight: 600; }
  #sectionView { inset-inline-start: var(--settings-w); z-index: 11; box-shadow: none; border-inline-start: 1px solid var(--line); }
  #sectionView .screen-bar { display: block; padding: var(--s-6) var(--s-7) 0; border: 0; }
  #sectionBack, #sectionView .bar-spacer { display: none; }
  #sectionView .bar-title { text-align: start; font: 700 var(--fs-screen)/var(--lh-screen) var(--serif); }
  #sectionView .screen-body { padding: var(--s-5) var(--s-7) var(--s-8); }
  #sectionView .screen-body > * { margin-inline-start: 0; max-width: 42rem; }

  /* Settings' window (1.49.0): the menu and section inside a box over the
     library, grown from the gear (openWin in app-reader.js). The box
     contains them, so their inset: 0 fills it. */
  .settings-win {
    display: block; position: fixed; inset: 0; z-index: 13; margin: auto;
    width: min(65rem, calc(100vw - 2 * var(--s-5))); height: min(46rem, calc(100dvh - 2 * var(--s-6)));
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: 0 24px 64px var(--shadow); overflow: hidden; contain: layout paint;
  }
  .settings-win:not([data-open]) { display: none; }
  .settings-win > .screen { box-shadow: none; }
  #newsView { z-index: 14; }
}
@media (min-width: 700px) and (max-width: 1023px) {
  .settings-win { --settings-w: 240px; }
  #sectionView .screen-bar { padding: var(--s-5) var(--s-5) 0; }
  #sectionView .screen-body { padding: var(--s-4) var(--s-5) var(--s-7); }
}
@media (min-width: 700px) and (pointer: fine) {
  .menu-sheet .sheet-row, .reader .sheet .row { min-height: 40px; }
}

@media (min-width: 1024px) {
  /* The reader: the contents rail beside the text. */
  .reader.railed .reader-rail {
    position: absolute; top: 0; bottom: 0; inset-inline-start: 0; z-index: 4; width: var(--rail-w);
    display: flex; flex-direction: column; gap: var(--s-1);
    padding: var(--s-4) var(--s-4) var(--s-4); padding-top: calc(var(--s-4) + env(safe-area-inset-top));
    background: var(--bg); border-inline-end: 1px solid var(--line);
  }
  .reader.railed .reader-rail[hidden] { display: none; }
  .reader.railed :is(.reader-bar, .read-foot) { inset-inline-start: var(--rail-w); }
  .reader.railed .reader-frame { margin-inline-start: var(--rail-w); width: calc(100% - var(--rail-w)); }
  .reader.railed .sheet[data-pop="start"] { margin-inline-start: 0; }
  .reader.railed #readerBack, .reader.railed #readerContents { display: none; }
  .reader.railed .reader-name { margin-inline-start: var(--s-4); }
  .rail-back {
    display: inline-flex; align-items: center; gap: var(--s-2); align-self: flex-start; min-height: var(--tap); padding: 0 var(--s-3);
    border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink); font: 500 var(--fs-label)/var(--lh-label) var(--sans); cursor: pointer;
  }
  .rail-over { margin: var(--s-3) var(--s-3) var(--s-1); }
  .rail-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0; list-style: none; overscroll-behavior: contain; }
  .rail-row {
    display: block; width: 100%; min-height: 40px; padding: var(--s-2) var(--s-3); margin-bottom: 2px;
    border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink); text-align: start;
    font: 500 var(--fs-label)/var(--lh-label) var(--sans); cursor: pointer;
  }
  .rail-row.sub { padding-inline-start: var(--s-6); color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: 400; }
  .rail-row:hover { background: var(--press); }
  .rail-row[aria-current] { background: var(--bar); font-weight: 600; color: var(--ink); }
  .paged .rail-list { padding-top: var(--s-1); }
  .rail-page {
    display: flex; flex-direction: column; align-items: center; gap: var(--s-1); width: 100%; padding: var(--s-2) 0;
    border: 0; border-radius: var(--r-md); background: transparent; color: var(--muted);
    font: 500 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
  }
  .rail-page:hover { background: var(--press); }
  .rail-thumb {
    display: block; width: calc(var(--s-9) + var(--s-7)); aspect-ratio: 3 / 4; object-fit: contain;
    background: var(--preview); box-shadow: 0 0 0 1px var(--line);
  }
  .rail-thumb.in { aspect-ratio: auto; background: transparent; }
  /* Dark PDF pages (1.49.0): the rail's small pages follow the big ones. */
  html[data-pdf-dark] .rail-thumb[src] { filter: url(#pdf-dark); }
  .rail-page[aria-current] { color: var(--ink); font-weight: 600; }
  .rail-page[aria-current] .rail-thumb { box-shadow: 0 0 0 2px var(--accent); }
  .rail-foot { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-4) var(--s-3) 0; border-top: 1px solid var(--line); }
  .rail-foot:empty { display: none; }
  .rail-licence { margin: 0; color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
  .rail-original {
    display: inline-flex; align-items: center; gap: var(--s-2); align-self: flex-start; min-height: var(--tap); padding: 0;
    border: 0; background: none; color: var(--accent); font: 500 var(--fs-meta)/var(--lh-meta) var(--sans); cursor: pointer;
  }
  .reader .reader-bar { padding-inline: var(--s-4); }

  /* Feeds at 1280 px: the river in a column, the post beside it. */
  .aloud-bar.docked { width: calc(var(--side-w) - 2 * var(--s-4)); cursor: default; }
  body.aloud-docked .side-version { margin-bottom: calc(var(--s-9) + var(--s-2)); }

}
@media (min-width: 1024px) and (pointer: fine) {
  .read-keys {
    display: inline-flex; align-items: center; gap: var(--s-2); flex: none; min-height: 32px; margin: -6px 0; padding: 0;
    border: 0; background: none; color: var(--muted); font: inherit; pointer-events: auto; cursor: pointer;
  }
  .reader.aloud .read-keys { display: none; }
}
.pane-grip { display: none; }
@media (min-width: 1280px) {
  /* The list and the post beside it share the room half and half, and
     the line between them can be dragged (1.49.0, Daniel's ask; it was a
     500 px list). --list-w is set from the saved share in app-places.js. */
  :root { --list-w: calc((100vw - var(--side-w)) / 2); }
  body.pinned #libraryView:is([data-place="feeds"], [data-place="newsletters"], [data-place="highlights"]) { width: var(--list-w); border-inline-end: 1px solid var(--line); }
  body.pinned:has(#libraryView:is([data-place="feeds"], [data-place="newsletters"], [data-place="highlights"])):not(:has(#readerView:not([hidden]):not([data-pane]))) .pane-grip {
    display: block; position: fixed; top: 0; bottom: 0; inset-inline-start: calc(var(--side-w) + var(--list-w) - 5px); z-index: 11; width: 10px;
    cursor: col-resize; touch-action: none;
  }
  .pane-grip::after { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 4px; width: 2px; background: transparent; transition: background-color 120ms linear; }
  .pane-grip:hover::after, .pane-grip.dragging::after, .pane-grip:focus-visible::after { background: var(--accent); }
  .pane-grip:focus-visible { outline: none; }
  body.resizing { cursor: col-resize; user-select: none; }
  body.resizing iframe { pointer-events: none; }
  body.pinned #libraryView:is([data-place="feeds"], [data-place="newsletters"], [data-place="highlights"]) > * { padding-inline: var(--s-5); }
  body.pinned:has(#libraryView:is([data-place="feeds"], [data-place="newsletters"], [data-place="highlights"])):has(#readerView[hidden]) .pane-note {
    display: flex; position: fixed; inset: 0; inset-inline-start: calc(var(--side-w) + var(--list-w)); align-items: center; justify-content: center; margin: 0;
    color: var(--muted);
  }
  #readerView[data-pane] { inset-inline-start: calc(var(--side-w) + var(--list-w)); box-shadow: none; }
}
@media (min-width: 1024px) and (pointer: fine) {
  .read-left .read-time { margin-inline-start: auto; }
}
.book-side { display: contents; }
@media (min-width: 1024px) {
  #folderBody:has(> .book-side) {
    display: grid; grid-template-columns: minmax(16rem, 20rem) minmax(0, 44rem); grid-template-rows: auto 1fr;
    column-gap: var(--s-7); justify-content: center; align-content: start; padding-top: var(--s-5);
  }
  #folderBody:has(> .book-side) > * { max-width: none; margin: 0; }
  #folderBody > .book-side { display: block; grid-row: 1 / span 2; }
  #folderBody > .book-side .book-head { flex-direction: column; align-items: flex-start; }
  #folderBody > .book-side .book-cover { width: 13.75rem; }
  #folderBody > .book-side .book-facts { width: 100%; }
  #folderBody:has(> .book-side) > .section-head { grid-column: 2; grid-row: 1; margin-top: 0; }
  #folderBody:has(> .book-side) > .folder-list { grid-column: 2; grid-row: 2; align-self: start; }
}

/* The image viewer's arrows and zoom (1.5.0), from 700 px. */
.viewer-step, .viewer-zoom { display: none; }
@media (min-width: 700px) {
  .viewer-step:not([hidden]) {
    display: inline-flex; position: absolute; top: 50%; margin-top: calc(-1 * var(--tap) / 2);
    color: var(--on-video); background: var(--scrim); border-radius: var(--r-full);
  }
  .viewer-step:disabled { opacity: 0.35; cursor: default; }
  .viewer-prev { inset-inline-start: var(--s-4); }
  .viewer-next { inset-inline-end: var(--s-4); }
  .viewer-zoom {
    display: flex; position: absolute; top: calc(var(--s-2) + env(safe-area-inset-top)); inset-inline-end: calc(var(--s-2) + var(--tap) + var(--s-2));
    background: var(--scrim); border-radius: var(--r-full);
  }
  .viewer-zoom .icon-btn { color: var(--on-video); border-radius: var(--r-full); }
}

/* Edit clips (1.22.0): a few of what Find found, struck through and
   with what goes in their place. */
.edit-sec .group + .group, .edit-sec .group + .edit-samples, .edit-sec .edit-samples + .group { margin-top: var(--s-3); }
.edit-samples { list-style: none; margin: 0; padding: 0; }
.edit-sample { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-3) var(--s-4); }
.edit-sample + .edit-sample { border-top: 1px solid var(--line); }
.edit-text { font-size: var(--fs-label); line-height: var(--lh-label); overflow-wrap: anywhere; }
.edit-text del { color: var(--warn); text-decoration-thickness: 2px; }
.edit-text ins { color: var(--accent); text-decoration: none; font-weight: 600; }
.edit-result .row:disabled .choice-label { color: var(--muted); }
.drive-actions { display: flex; gap: var(--s-2); align-items: center; }

/* Linked pages (1.38.0): a list of the clip's links to tick, with the
   Save button kept in reach at the bottom of the sheet. */
.links-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.links-bar .meta { margin: 0; }
.links-list .choice { min-height: 52px; }
.links-list .choice-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links-list .choice-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links-list .choice.done { cursor: default; }
.links-list .choice.done .choice-label { color: var(--muted); }
.links-list .choice.done .choice-check { color: var(--muted); }
.links-filter { width: 100%; }
.links-foot { position: sticky; bottom: calc(-1 * var(--s-1)); margin: 0 calc(-1 * var(--s-4)); padding: var(--s-2) var(--s-4) var(--s-3); background: var(--surface); border-top: 1px solid var(--line); }
.links-foot .btn-primary { width: 100%; }

/* App lock (1.38.0): one screen over everything, the library hidden
   from the first paint while it's up. */
html.locked body > :not(.lock-view):not(script) { visibility: hidden !important; }
.lock-view {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--s-5) + env(safe-area-inset-top)) var(--gutter) calc(var(--s-5) + env(safe-area-inset-bottom));
  background: var(--bg); color: var(--ink); overflow-y: auto;
}
.lock-view[hidden] { display: none; }
/* safe: taller than the screen, it scrolls from its top instead of losing it. */
.lock-view { align-items: safe center; }
.lock-box { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); width: 100%; max-width: 20rem; text-align: center; }
.lock-box > div { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); width: 100%; }
.lock-box > div[hidden] { display: none; }
.lock-icon { width: 56px; height: 56px; border-radius: var(--r-md); }
.lock-title { margin: 0; font: 700 var(--fs-heading)/var(--lh-heading) var(--serif); }
.lock-note { min-height: var(--lh-meta); margin: 0; color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
.lock-note.warn { color: var(--warn); }
.lock-erase .lock-note { text-align: start; font-size: var(--fs-label); line-height: var(--lh-label); color: var(--ink); }
.lock-dots { display: flex; justify-content: center; gap: var(--s-3); min-height: 14px; margin-top: var(--s-2); }
.lock-dot { width: 14px; height: 14px; border-radius: var(--r-full); border: 1.5px solid var(--ink); transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out); }
.lock-dot.on { background: var(--ink); transform: scale(1.1); }
.lock-dots.shake { animation: lock-shake 360ms ease-out; }
@keyframes lock-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(3px); } }
.lock-keys { display: grid; grid-template-columns: repeat(3, 72px); gap: var(--s-4) var(--s-5); justify-content: center; margin-top: var(--s-3); }
.lock-key {
  width: 72px; height: 72px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 28px/1 var(--sans); font-variant-numeric: tabular-nums; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform var(--spring-control-ms, 300ms) var(--spring-control, ease-out);
}
.lock-key:active { background-image: linear-gradient(var(--press), var(--press)); transform: scale(0.94); }
.lock-key:disabled { color: var(--muted); cursor: default; }
.lock-key-icon { border-color: transparent; background: transparent; }
.lock-key-icon[hidden] { display: none; }
.lock-key-gap { display: inline-flex; width: 72px; height: 72px; }
.lock-next, .lock-erase-go { width: 100%; }
.lock-foot { display: flex; justify-content: center; gap: var(--s-2); flex-wrap: wrap; }
.lock-foot .btn-quiet, .lock-erase .btn-quiet { border-color: transparent; color: var(--accent); }
.lock-erase-go { background: var(--warn); border-color: var(--warn); color: var(--accent-ink); }
/* A phone on its side: the title, dots and Forgot beside the keys, which
   didn't fit under them (the title was off the top). */
@media (max-height: 500px) and (orientation: landscape) {
  .lock-box { display: grid; max-width: 40rem; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 1fr repeat(5, auto) 1fr; column-gap: var(--s-7); justify-items: center; }
  .lock-box > #lockPad { display: contents; }
  .lock-title { grid-area: 2 / 1; }
  .lock-dots { grid-area: 3 / 1; }
  .lock-note { grid-area: 4 / 1; }
  .lock-next { grid-area: 5 / 1; }
  .lock-foot { grid-area: 6 / 1; }
  .lock-keys { grid-area: 1 / 2 / -1; margin-top: 0; }
}
@media (max-height: 640px) { .lock-keys { grid-template-columns: repeat(3, 60px); gap: var(--s-3) var(--s-4); } .lock-key, .lock-key-gap { width: 60px; height: 60px; } .lock-icon { display: none; } }
@media (prefers-reduced-motion: reduce) { .lock-dots.shake { animation: none; } .lock-key, .lock-dot { transition: none; } }
.lock-view:focus { outline: none; }
.lock-next:disabled { background: var(--line); color: var(--muted); cursor: default; }

/* ---- Discover ---- */
:is([data-place="discover"], [data-place="calibre"], [data-place="catalogs"], [data-place="audiobookshelf"], [data-place="webdav"]) .save-form { display: none; }
:is([data-place="discover"], [data-place="calibre"], [data-place="catalogs"], [data-place="audiobookshelf"], [data-place="webdav"]) .save-bar:not(:has(.update-bar:not([hidden]))) { display: none; }
.dz-head, .dz-body { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.dz-search { margin-top: var(--s-1); }
.dz-ask { align-self: flex-start; margin-top: var(--s-2); }
.dz-none { margin-top: var(--s-4); }
.discover .section-head .dropdown { margin-inline-end: calc(-1 * var(--s-2)); }
.discover .section-head .dropdown-btn { border: 0; background: transparent; color: var(--accent); font-weight: 600; min-height: var(--tap); padding: 0 var(--s-2); }
.dz-covers {
  display: flex; gap: var(--s-3); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4) var(--s-1); scroll-padding-inline: var(--s-4);
}
.dz-covers::-webkit-scrollbar { display: none; }
.dz-book {
  flex: none; width: 112px; display: flex; flex-direction: column; gap: 2px; padding: 0; text-align: start;
  border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer;
}
.dz-art { position: relative; display: block; }
.dz-cover {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; overflow: hidden;
  width: 112px; height: 160px; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--preview) 76%, hsl(var(--dz-hue, 210) 55% 50%)); color: var(--ink); font: 700 15px/1.15 var(--serif);
  box-shadow: inset 0 4px 0 hsl(var(--dz-hue, 210) 45% 45%);
}
.dz-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dz-cover.has-img > span { visibility: hidden; }
.dz-cover-s { margin-bottom: auto; padding-top: 2px; padding-inline-end: 36px; font: 600 11px/14px var(--sans); letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-cover-by { font: 400 12px/15px var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-cover-t { position: relative; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.dz-book:active .dz-cover { filter: brightness(0.94); }
.dz-mark {
  position: absolute; top: 6px; inset-inline-end: 6px; width: 32px; height: 32px; border-radius: var(--r-full);
  display: grid; place-items: center; background: var(--surface); color: var(--accent); border: 1px solid var(--line);
}
.dz-mark.on { color: var(--ok); }
/* Audiobookshelf: how much of a book is heard, along the cover's foot. */
.abs-bar { position: absolute; inset-inline: 0; bottom: 0; height: 4px; border-radius: 0 0 var(--r-sm) var(--r-sm); background: var(--line); overflow: hidden; }
.abs-bar > span { display: block; height: 100%; background: var(--accent); }
.dz-mark .side-icon { color: inherit; }
.dz-bt { margin-top: var(--s-1); font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dz-bm { font-size: 12px; line-height: 16px; color: var(--muted); }
.dz-src { margin-top: var(--s-2); }
.dz-about { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--ink); }
.post-saved.dz-on { display: inline-flex; align-items: center; gap: 4px; }
.post-saved.dz-on .side-icon { color: inherit; }
.dz-foot { margin-top: var(--s-5); }
.dz-suggest { font-size: inherit; min-height: 0; padding: 0; }
.dz-sheethead { display: flex; gap: var(--s-4); align-items: flex-start; }
.dz-sheethead .feed-mark { flex: none; }
.dz-sheet-cover { flex: none; width: 88px; height: 126px; font-size: 13px; }
.dz-sheet-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dz-sheet-text .meta { margin: 0; }
.dz-sheet-title { margin: 0 0 var(--s-1); text-align: start; }
.dz-blurb { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.dz-story .btn-quiet { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--accent); }
.dz-story .footnote, .dz-signup .footnote { margin-top: 0; }
.dz-ok { color: var(--ok); }
.dz-addr {
  margin: 0; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg);
  font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--ink); word-break: break-all;
}
.dz-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--s-4) var(--s-3);
  overflow: visible; margin: var(--s-3) 0 0; padding: 0;
}
.dz-grid .dz-book { width: auto; min-width: 0; }
.dz-grid .dz-cover { width: 100%; height: auto; aspect-ratio: 2 / 3; }
.dz-tools { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.dz-tools .dropdown { flex: 1 1 140px; min-width: 0; }
.dz-more { display: block; width: 100%; margin-top: var(--s-4); color: var(--accent); font-weight: 600; }
/* Sites (2026-11): every site as a tile, grouped by kind; a tile opens
   the site's own page. */
.dz-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-2); margin-top: var(--s-2); }
.dz-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0;
  padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.dz-tile:active { background: var(--bar); }
.dz-tile-name { font-weight: 600; line-height: var(--lh-label); max-width: 100%; overflow-wrap: anywhere; }
.dz-tile-about { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
.dz-mono {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: hsl(var(--dz-hue, 210) 45% 36%); color: #fff; font: 700 13px/1 var(--sans);
}
.dz-site-head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); margin-top: var(--s-1); }
.dz-back {
  display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); padding: 0 var(--s-2) 0 0;
  border: 0; background: none; color: var(--accent); font: 600 var(--fs-label)/1 var(--sans); cursor: pointer;
}
[dir="rtl"] .dz-back { padding: 0 0 0 var(--s-2); }
[dir="rtl"] .dz-back svg { transform: scaleX(-1); }
.dz-site-title { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.dz-site-title .dz-mono { width: 40px; height: 40px; border-radius: 11px; font-size: 15px; }
.dz-site-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dz-site-text h2 { margin: 0; font: 700 22px/1.2 var(--serif); }
.dz-lists { margin-top: var(--s-3); }
.dz-lists .chip { flex: none; }
.dz-lists + .dz-tools { margin-top: 0; }
.dz-lists .chip.on { background: var(--surface); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.dz-genre .dropdown-btn { color: var(--ink); font-size: var(--fs-label); margin-inline-start: calc(-1 * var(--s-2)); }
.dz-genre .dropdown-menu { inset-inline-end: auto; inset-inline-start: 0; }
/* One site's grid: its name on every cover says nothing. */
.dz-grid .dz-cover-s { visibility: hidden; }

/* Select, Add and your own colours on the Draw bar (app-ink.js). */
.ink-bar button { flex: 0 1 var(--tap); min-width: 36px; }
.ink-bar .ink-done { flex: 0 0 auto; padding: 0 var(--s-3); }
/* At 320 px the tools row was 14 px too wide and lost the pen and Done off
   its two ends; safe keeps the start in view if a language makes it longer. */
.ink-row { justify-content: safe center; }
@media (max-width: 359px) {
  .ink-bar { max-width: calc(100vw - 2 * var(--s-2)); }
  .ink-bar .ink-gap { min-width: 0; }
  .ink-bar .ink-done { padding: 0 var(--s-1); }
}
.ink-dot[data-c=""] { background: var(--pen-ink); }
.ink-pop-styles button .ink-pop-name { text-align: start; }
.ink-color {
  position: fixed; z-index: 5; left: 0; right: 0; margin-inline: auto; width: min(420px, calc(100vw - 2 * var(--s-3)));
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); max-height: calc(100vh - 2 * var(--s-4));
  overflow: auto; padding: var(--s-3);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg, 22px);
  box-shadow: 0 8px 24px var(--shadow), 0 1px 4px var(--shadow);
}
.ink-color[hidden] { display: none; }
.ic-spec { position: relative; touch-action: none; border-radius: var(--r-md); overflow: hidden; cursor: crosshair; outline-offset: 2px; }
.ic-spectrum { display: block; width: 100%; height: 150px; }
.ic-ring { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: var(--r-full); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); pointer-events: none; }
.ic-slide { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-3); }
.ic-slider { --ic-to: #fff; flex: 1; height: 28px; margin: 0; -webkit-appearance: none; appearance: none; border-radius: var(--r-full); background: linear-gradient(90deg, #000, var(--ic-to)); }
.ic-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: var(--r-full); background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.ic-slider::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: var(--r-full); background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.ic-pct { min-width: 44px; text-align: end; font: 500 var(--fs-label)/1 var(--sans); font-variant-numeric: tabular-nums; }
.ic-values { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-3); }
.ic-pair { display: flex; flex: 0 0 auto; width: 64px; height: 44px; border-radius: var(--r-md); overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.ic-old, .ic-new { flex: 1; }
.ic-col { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; min-width: 0; color: var(--muted); font: 500 var(--fs-meta)/var(--lh-meta) var(--sans); }
.ic-values .ic-col:nth-child(2) { flex: 1.6; }
.ic-field { width: 100%; min-width: 0; height: 32px; padding: 0; border: 0; background: none; color: var(--ink); text-align: center; font: 500 var(--fs-label)/1 var(--sans); font-variant-numeric: tabular-nums; }
.ic-field:focus-visible { outline: 2px solid var(--accent); border-radius: var(--r-sm); }
.ic-rule { margin: var(--s-3) 0; border: 0; border-top: 1px dotted var(--line); }
.ic-slots { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); }
.ic-slots button { flex: 0 0 auto; width: var(--tap); height: var(--tap); padding: 0; border: 0; background: none; color: inherit; border-radius: var(--r-full); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ic-slots .ic-slot .ink-dot { width: 34px; height: 34px; }
.ic-slots .ic-slot[aria-pressed="true"] .ink-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.ic-actions { display: flex; margin-top: var(--s-2); border-top: 1px solid var(--line); }
.ic-btn { flex: 1; height: var(--tap); border: 0; background: none; color: var(--ink); font: 600 var(--fs-label)/1 var(--sans); cursor: pointer; }
.ic-btn:last-child { color: var(--accent); }
.ic-btn:active, .ic-slots button:active { background-image: linear-gradient(var(--press), var(--press)); }

/* ---- Audiobooks (2026-11, app-listen.js) ---- */
/* The player under the text: the chapter, a track through it, and the
   controls. The reader's foot sits above it while it shows. */
.listen-player {
  flex: none; display: flex; flex-direction: column; gap: 2px;
  padding: var(--s-2) calc(var(--gutter) + var(--s-1)) calc(var(--s-2) + env(safe-area-inset-bottom));
  background: var(--bar); border-top: 1px solid var(--line); color: var(--ink);
}
.listen-player[hidden] { display: none; }
.reader.listening .read-left { display: none; }
.listen-track { position: relative; height: var(--tap); margin: -8px 0; touch-action: none; cursor: pointer; }
.listen-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.listen-rail { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.listen-fill { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
[dir="rtl"] .listen-fill { transform-origin: right; }
.listen-knob { position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; margin-inline-start: -7px; border-radius: var(--r-full); background: var(--accent); box-shadow: 0 0 0 3px var(--bar); transition: transform 120ms ease-out; }
.listen-track.dragging .listen-knob { transform: scale(1.4); }
@media (prefers-reduced-motion: reduce) { .listen-knob { transition: none; } }
:root[data-motion="off"] .listen-knob { transition: none; }
.listen-times { display: flex; justify-content: space-between; font: var(--fs-meta)/1 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.listen-ctl { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-1); margin-top: var(--s-1); }
.listen-side { display: flex; align-items: center; justify-content: space-around; }
.listen-ctl .icon-btn { border-radius: var(--r-full); color: var(--ink); }
.listen-ctl .listen-play { width: 52px; height: 52px; background: var(--accent); color: var(--accent-ink); }
.listen-speed {
  min-width: var(--tap); height: var(--tap); padding: 0 var(--s-1); border: 0; border-radius: var(--r-full); background: none;
  color: var(--ink); font: 600 var(--fs-meta)/1 var(--sans); font-variant-numeric: tabular-nums; cursor: pointer;
}
.listen-skip { position: relative; }
.listen-skip > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 9px/1 var(--sans); padding-top: 1px; }
.listen-sleep.on { color: var(--accent); }
.listen-sleep.on svg { fill: currentColor; }
.listen-mark.on { color: var(--accent); }
.listen-mark.on svg { fill: currentColor; }
/* Bookmarks under the chapters: the moment to play from, and its note's button. */
.listen-marks-head { margin-top: var(--s-4); }
.listen-marks li { display: flex; align-items: center; }
.listen-marks li > .row { flex: 1; min-width: 0; }
.listen-marks .icon-btn { flex: none; color: var(--muted); }
/* Search the transcript: each time it was heard, the words around it. */
.listen-hits .choice-label { font-weight: 400; }
.listen-hits mark { background: var(--preview); color: inherit; border-radius: 2px; }
/* The bar along the bottom while it plays from elsewhere: Narrate's card,
   with the chapter and what's left under the name. */
.listen-bar { width: min(320px, calc(100vw - 2 * var(--gutter))); cursor: default; touch-action: auto; }
.listen-bar .aloud-bar-text { flex-direction: column; align-items: flex-start; justify-content: center; }
.listen-bar-note { max-width: 100%; font: var(--fs-meta)/var(--lh-meta) var(--sans); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listen-bar .listen-skip { color: var(--ink); }
body.listen-bar-up .library, body.listen-bar-up .screen-body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
/* Headphones on an audiobook's cover. */
.card-thumb.has-listen { position: relative; display: block; }
.card-thumb.has-listen > img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.listen-badge {
  position: absolute; right: var(--s-1); bottom: var(--s-1); z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: var(--r-full); background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px var(--shadow);
}
[dir="rtl"] .listen-badge { right: auto; left: var(--s-1); }
.listen-sleeps { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.reader.listening .read-progress { display: none; }
.listen-pack { flex: none; accent-color: var(--accent); width: 20px; height: 20px; margin: 0; }
.sel-fix[hidden] { display: none; }

/* Recover Notes and Highlights (2026-11): what was found, the words across
   the row and its buttons under them, so a phone keeps readable lines. */
.recover-item { flex-wrap: wrap; align-items: center; gap: 2px 18px; }
.recover-item .choice-text { flex: 1 1 100%; }
/* Anki (2026-11): the extension's place, card sheet and selection button. */
.anki { display: flex; flex-direction: column; gap: var(--s-4); padding-bottom: var(--s-6); }
.anki-title { margin: 0; font: 600 var(--fs-heading)/var(--lh-heading) var(--serif); }
.anki-counts { margin: 0; }
.anki-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.anki-top .anki-counts { text-align: end; }
.anki-study { width: 100%; height: 48px; }
.anki-face {
  display: flex; flex-direction: column; gap: var(--s-3); align-items: center; justify-content: center;
  min-height: 12rem; padding: var(--s-6) var(--s-5); text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.anki-front { margin: 0; font: 600 1.75rem/1.25 var(--serif); overflow-wrap: anywhere; }
.anki-rule { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--line); }
.anki-back { margin: 0; font-size: 1.125rem; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.anki-context { margin: 0; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.anki-show { width: 100%; height: 48px; }
.anki-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.anki-grade {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
}
.anki-grade:active { background: var(--bar); }
.anki-grade:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.anki-grade-name { font-weight: 600; }
.anki-grade-wait { color: var(--muted); font-size: 0.8125rem; }
.anki-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s-2); }
.anki-tools .btn-text:disabled { color: var(--muted); cursor: default; }
.anki-field { display: flex; flex-direction: column; gap: var(--s-1); }
.anki-field .tag-input, .anki-field .mark-note-field { width: 100%; }
.anki-sheet { display: flex; flex-direction: column; gap: var(--s-3); }
.sel-anki[hidden] { display: none; }

.anki-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.anki-fill { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.anki-fill .field-pick { min-width: 0; }
.anki-pack { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anki-found { margin: 0; }

/* Right to left (2026-11): Hebrew turns the page's direction; arrows that
   mean back, forward, previous or next turn with it. The sidebar, the
   desktop panes and the reader's rail sit on the right, and keel's motion
   engine slides them from there (keel 0.10.0); a pushed screen comes in
   from the left. Shadows fall the other way. Inside the reader the
   saved page keeps its own direction. */
:root[dir="rtl"] .screen { box-shadow: 8px 0 24px var(--shadow); }
:root[dir="rtl"] .sidebar { box-shadow: -8px 0 24px var(--shadow); }
:root[dir="rtl"] body.pinned .sidebar { box-shadow: none; }
@keyframes sweep-rtl { from { transform: translateX(100%); } to { transform: translateX(-340%); } }
:root[dir="rtl"] .progress-fill { transform-origin: right; }
:root[dir="rtl"] .progress.busy .progress-fill, :root[dir="rtl"] .listen-ch-tr.now .listen-ch-bar::after { animation-name: sweep-rtl; }
:root[dir="rtl"] svg:has(> path:is([d="M15 5l-7 7 7 7"], [d="M9 5l7 7-7 7"], [d="M6 5v14M18 5l-8 7 8 7"], [d="M6 5h2v14H6zM20 5v14L9.5 12z"])) { transform: scaleX(-1); }
/* Hebrew has no capitals, and spaced letters read as separate words. */
:root:lang(he) .overline { letter-spacing: 0; }
#matchPop .pop-icon { width: 20px; height: 20px; }

/* Page view of a note (2026-11): the open note's sheets in one column, full screen. */
#readingSheet[data-kind="pageview"], .reader #readingSheet[data-kind="pageview"] {
  position: absolute; inset: 0; width: auto; max-width: none; height: auto; max-height: none; margin: 0; padding: 0;
  border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; background: var(--bg);
}
#readingSheet[data-kind="pageview"] .sheet-grip { display: none; }
#readingSheet[data-kind="pageview"] .sheet-body, .reader #readingSheet[data-kind="pageview"] .sheet-body { flex: 1; min-height: 0; max-height: none; margin: 0; padding: 0; overflow: hidden; gap: 0; }
.pageview { height: 100%; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; background: var(--bg); }
.pv-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: var(--s-2);
  padding: calc(var(--s-2) + env(safe-area-inset-top)) var(--s-3) var(--s-2); background: var(--bg);
}
.pv-count { flex: 1; margin: 0; font: 400 var(--fs-title, 1.5rem)/1.2 var(--sans); color: var(--ink); text-align: start; }
.pv-count strong { font-weight: 700; }
.pv-of { color: var(--muted); }
.pv-menu { position: absolute; inset-inline-end: var(--s-3); top: 100%; min-width: 12rem; z-index: 3; box-shadow: 0 8px 24px var(--shadow); background: var(--surface); }
.pv-list { list-style: none; margin: 0; padding: var(--s-2) var(--s-4) var(--s-5); display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--s-4); justify-items: center; }
.pv-item { width: min(100%, 22rem); }
.pv-sheet { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); width: 100%; padding: 0; background: none; border: 0; color: var(--ink); touch-action: pan-y; -webkit-touch-callout: none; user-select: none; }
.pv-page { position: relative; display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm, 4px); background: #fdfcf8; overflow: hidden; box-shadow: 0 1px 4px var(--shadow); }
.pv-thumb { display: block; width: 100%; height: auto; opacity: 0; }
.pv-thumb.in { opacity: 1; }
.pv-item.on .pv-page { outline: 3px solid var(--accent); outline-offset: 1px; }
.pv-sheet[aria-current="true"] .pv-num { color: var(--accent); font-weight: 600; }
.pv-tick { position: absolute; inset-block-start: var(--s-2); inset-inline-end: var(--s-2); width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); display: none; }
.pv-item.on .pv-tick { display: block; background: var(--accent); }
.pv-num { font: 400 var(--fs-meta) / var(--lh-meta) var(--sans); color: var(--muted); }
.pv-bar { position: sticky; bottom: 0; z-index: 2; margin-top: auto; padding: var(--s-2) var(--s-3) calc(var(--s-2) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.pv-bar[hidden] { display: none; }
.pv-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-1); }
.pv-tools .tile-btn { min-width: 0; }
@media (min-width: 560px) { .pv-tools { grid-template-columns: repeat(6, 1fr); } }
.pv-tools .tile-btn:disabled { opacity: .4; }
.pv-ask { margin: 0 0 var(--s-2); font-weight: 600; }
.pv-choices { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pv-choice { min-height: 44px; padding: 0 var(--s-4); border: 1px solid var(--line); border-radius: var(--r-full); background: var(--bg); color: var(--ink); font: inherit; }
.pv-choice.quiet { border-color: transparent; color: var(--muted); }
#readingSheet[data-kind="pageview"][hidden], .reader #readingSheet[data-kind="pageview"][hidden] { display: none; }

/* A story's status on its site (2026-11): a tag on the cover's top,
   across from the new-chapters badge. In one list the cover is too
   narrow for both, so the word joins the line under the name instead. */
.tile-status {
  position: absolute; top: var(--s-1); inset-inline-start: var(--s-1); z-index: 1;
  max-width: calc(100% - 2 * var(--s-1));
  padding: 1px 6px; border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font: 600 var(--fs-meta)/var(--lh-meta) var(--sans);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 3px var(--shadow);
}
.tile-thumb:has(.tile-new) .tile-status { max-width: calc(100% - 2 * var(--s-1) - 40px); }
.tile-status[data-status="ongoing"] { color: var(--accent); }
.tile-status[data-status="hiatus"], .tile-status[data-status="stubbed"], .tile-status[data-status="dropped"], .tile-status[data-status="inactive"] { color: var(--muted); }
.tile-status-word { display: none; }
[data-layout="list"] .library > .tile .tile-status { display: none; }
[data-layout="list"] .library > .tile .tile-status-word { display: inline; }
