/* Epic Reader visual identity (Jira EP-283). Source: docs/ux/ux-epicreader-2026-11-06/DESIGN.md.
   Tokens are CSS variables so any page, and any later UI technology, can use them.
   - Theme: claro (default), sepia, escuro. With no choice the system preference decides (claro or escuro);
     <html data-theme="claro|sepia|escuro"> overrides it.
   - Area: <body data-area="livros|quadrinhos">. With no area the neutral brand (navy and gold) is used.
   - No red anywhere except --erro (error messages). */

@font-face { font-family: "Lora"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/Lora-normal-400-700.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/Lora-italic-400-700.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/assets/fonts/Nunito-normal-400-800.woff2") format("woff2"); }
@font-face { font-family: "Bangers"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/Bangers-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Comic Neue"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/ComicNeue-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Comic Neue"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/ComicNeue-normal-700.woff2") format("woff2"); }

:root {
  --creme: #ede1ca; --navy: #213756; --ouro: #f9bf32;
  --ok: #2f6b57; --aviso: #8a6422;
  --font-ui: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-title: var(--font-ui); --font-body: var(--font-ui);
  --radius: 8px; --shadow: none; --title-case: none; --title-spacing: 0;

  /* theme claro + neutral brand */
  --bg: #f8f3e6; --surface: #fffdf8; --border: #dccfb4; --text: #1d2a40; --muted: #5d6678;
  --accent: var(--navy); --accent-on: #fffdf8;
  --erro: #a8322d; --erro-bg: #fbeceb;
  color-scheme: light;
}

/* ---- areas (accent, fonts, shape). One palette from the logo (navy, blue, gold, bronze); the areas differ by tone, font and shape ---- */
:root {
  --navy-900: #14233b; --navy-700: #1e3454; --navy-500: #2e5983; --navy-300: #6fa3d6;
  --ouro-500: #f0c159; --bronze-600: #8e7042; --bronze-400: #b18e46; --bronze-200: #d9c08a;
  --fundo: url("/assets/epicreader-fundo-claro-720.webp");
}
[data-area="livros"] {
  --accent: var(--navy-700); --accent-on: #fffdf8; --second: var(--bronze-600);
  --font-title: "Lora", Georgia, "Times New Roman", serif; --font-body: var(--font-title);
  --radius: 4px; --bar: var(--navy-900); --bar-icon: #e9dfc8; --bar-active: var(--bronze-400); --bar-active-on: var(--navy-900);
}
[data-area="quadrinhos"] {
  --accent: var(--navy-500); --accent-on: #ffffff; --second: var(--ouro-500); --text: #213756;
  --font-title: "Bangers", "Comic Neue", "Trebuchet MS", sans-serif; --font-body: "Comic Neue", "Trebuchet MS", sans-serif;
  --radius: 12px; --shadow: 4px 4px 0 rgba(30, 52, 84, .85); --title-case: uppercase; --title-spacing: .04em;
  --bar: var(--navy-700); --bar-icon: #dbe8f7; --bar-active: var(--ouro-500); --bar-active-on: var(--navy-700);
}

/* ---- themes ---- */
:root[data-theme="sepia"], [data-theme="sepia"] {
  --bg: #ede1ca; --surface: #f4eadb; --border: #cdbd9b; --text: #3b2f22; --muted: #7a6a55; color-scheme: light;
  --fundo: url("/assets/epicreader-fundo-sepia-720.webp");
}
:root[data-theme="escuro"], [data-theme="escuro"] {
  --bg: #121c2e; --surface: #18243c; --border: #33466a; --text: #efe6d2; --muted: #a3adbf;
  --accent: var(--ouro-500); --accent-on: #14233b; --erro: #ffb4a8; --erro-bg: #3a1f22; color-scheme: dark;
  --fundo: url("/assets/epicreader-fundo-escuro-720.webp");
}
:root[data-theme="escuro"] [data-area="livros"], [data-theme="escuro"][data-area="livros"] { --accent: var(--bronze-200); --accent-on: #14233b; --bar: #0c1424; }
:root[data-theme="escuro"] [data-area="quadrinhos"], [data-theme="escuro"][data-area="quadrinhos"] { --text: #efe6d2; --accent: var(--navy-300); --accent-on: #0e1a30; --bar: #0a1426; --shadow: 4px 4px 0 rgba(0, 0, 0, .55); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg: #121c2e; --surface: #18243c; --border: #33466a; --text: #efe6d2; --muted: #a3adbf;
    --accent: var(--ouro-500); --accent-on: #14233b; --erro: #ffb4a8; --erro-bg: #3a1f22; color-scheme: dark;
    --fundo: url("/assets/epicreader-fundo-escuro-720.webp"); }
  :root:not([data-theme]) [data-area="livros"] { --accent: var(--bronze-200); --accent-on: #14233b; --bar: #0c1424; }
  :root:not([data-theme]) [data-area="quadrinhos"] { --text: #efe6d2; --accent: var(--navy-300); --accent-on: #0e1a30; --bar: #0a1426; --shadow: 4px 4px 0 rgba(0, 0, 0, .55); }
}

/* ---- the speech balloon (EP-369 U1a4, owner 2026-11-19): the words of a screen inside a comic balloon. One fill and one ink per kind, in each theme;
   the line is the comic's black (light) or the theme's text (dark). ---- */
:root {
  --balloon-line: #14161c;
  --balloon-info: #fffdf8; --balloon-info-ink: #1d2a40;
  --balloon-warning: #fff0c4; --balloon-warning-ink: #3d2b04;
  --balloon-error: #fde4e1; --balloon-error-ink: #7d1f19;
  --balloon-success: #e1f3e8; --balloon-success-ink: #1d4b3b;
}
:root[data-theme="sepia"], [data-theme="sepia"] { --balloon-info: #fbf4e6; --balloon-info-ink: #3b2f22; }
:root[data-theme="escuro"], [data-theme="escuro"] {
  --balloon-line: #efe6d2;
  --balloon-info: #18243c; --balloon-info-ink: #efe6d2;
  --balloon-warning: #3b3014; --balloon-warning-ink: #ffe2a0;
  --balloon-error: #3d2023; --balloon-error-ink: #ffc8bf;
  --balloon-success: #16352a; --balloon-success-ink: #bde9d2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --balloon-line: #efe6d2;
    --balloon-info: #18243c; --balloon-info-ink: #efe6d2;
    --balloon-warning: #3b3014; --balloon-warning-ink: #ffe2a0;
    --balloon-error: #3d2023; --balloon-error-ink: #ffc8bf;
    --balloon-success: #16352a; --balloon-success-ink: #bde9d2;
  }
}

/* ---- base ---- */
* { box-sizing: border-box; }
body {
  /* dvh follows the mobile browser's bars; 100vh stays as the fallback for old browsers. */
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font-body);
}
h1, h2 { font-family: var(--font-title); text-transform: var(--title-case); letter-spacing: var(--title-spacing); color: var(--accent); margin: 0 0 8px; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
[data-area="quadrinhos"] h1, [data-area="quadrinhos"] h2 { font-weight: 400; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
label { display: block; margin: 12px 0 4px; color: var(--muted); font: 700 13px var(--font-ui); }
small { color: var(--muted); }

input[type=text], input[type=file], input[type=search], input[type=email], select {
  width: 100%; padding: 10px 12px; background: var(--surface); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--radius); font: inherit;
}
input.missing { border-color: var(--erro); }
input.slider { width: 100%; min-height: 44px; margin: 0 0 4px; accent-color: var(--accent); }

button, .button {
  display: inline-block; padding: 10px 16px; min-height: 44px; border: 2px solid var(--accent); border-radius: var(--radius);
  background: transparent; color: var(--accent); font: 700 15px var(--font-ui); cursor: pointer; text-decoration: none;
  max-width: 100%; white-space: normal; overflow-wrap: anywhere;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-on); box-shadow: var(--shadow); }
[data-area="quadrinhos"] button.primary, [data-area="quadrinhos"] .button.primary { background: var(--ouro-500); color: var(--navy-700); border-color: var(--navy-700); }
button:disabled { opacity: .55; cursor: default; }

.card, .notice {
  background: color-mix(in srgb, var(--surface) 84%, transparent); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.notice strong { color: var(--accent); }
.error, .err {
  background: var(--erro-bg); color: var(--erro); border-left: 4px solid var(--erro);
  border-radius: var(--radius); padding: 8px 12px; font-size: 14px;
}

.center-page { display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.center-page main, .center-page .box { max-width: 420px; width: 100%; min-width: 0; overflow-wrap: anywhere; }
.logo { display: block; margin: 0 auto; border-radius: 28px; }

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

/* ---- app shell (EP-283): the title on top, then the areas Livros | HQ | Mangá, then the tabs (EP-348); the tab bar at the bottom on the phone,
   at the top on a wide screen ---- */
/* The mascot sits behind every screen, anchored at the bottom; the top fades into the theme color so titles and filters stay readable.
   The fade is fixed to the screen like the mascot: sized by the page, a long list would cover the mascot under its first 58%.
   EP-335: the window scrolls (keyboard, pull to refresh and the phone's address bar keep working); .app-head (title, "+", areas, tabs) sticks to
   the top over the opaque theme color, so the list passes under it. --app-top-h is the height of the tab bar row of a wide screen. */
/* Owner, 2026-11-19: the mascot is a watermark (a veil of the theme color over it) and its head is never cut: the whole drawing fits under the
   header (--fundo-top: a guess here, the header's real end from fundo.js) and is made smaller when the screen is short; only its feet may go under the bottom tab bar. 0.671 = 720 / 1073, its ratio. */
body.app { --app-top-h: 60px; --fundo-top: 150px; --fundo-veu: color-mix(in srgb, var(--bg) 45%, transparent);
  display: flex; flex-direction: column; padding-bottom: calc(76px + env(safe-area-inset-bottom));
  background: linear-gradient(var(--fundo-veu), var(--fundo-veu)) no-repeat fixed,
    var(--fundo) center bottom / min(100%, 760px, calc((100vh - var(--fundo-top)) * .671)) auto no-repeat fixed, var(--bg); }
/* An on/off switch (owner, 2026-11-18: the marks of a series in Organizar): <button role="switch" aria-checked>, its track then its label, theme colours. */
button.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 2px 4px; border: 0; background: none; box-shadow: none;
  color: var(--text); font: 600 14px var(--font-ui); cursor: pointer; }
button.switch .track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border); transition: background-color .15s; }
button.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35); transition: transform .15s; }
button.switch[aria-checked="true"] .track { background: var(--accent); }
button.switch[aria-checked="true"] .track::after { transform: translateX(16px); background: var(--accent-on); }
button.switch:disabled { opacity: .55; cursor: progress; }
.marks { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-left: auto; }
@media (prefers-reduced-motion: reduce) { button.switch .track, button.switch .track::after { transition: none; } }

.area-switch { display: inline-flex; border: 2px solid var(--accent); border-radius: 999px; overflow: hidden; background: var(--surface); }
.area-switch a { padding: 8px 22px; min-height: 44px; display: inline-flex; align-items: center; color: var(--accent); text-decoration: none; font: 700 15px var(--font-ui); }
.area-switch a[aria-current="page"] { background: var(--accent); color: var(--accent-on); }
.app-main { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px 16px; }
/* The band is painted to the window's edges (shadow + clip), so nothing of the list shows beside it in the gutters. */
/* EP-348: a grid of one row for the title and its "+", then every other part across the whole width. */
.app-head { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; column-gap: 0;
  padding: 16px 0 12px; background: var(--bg); box-shadow: 0 0 0 100vmax var(--bg); clip-path: inset(0 -100vmax); }
.app-head > * { grid-column: 1 / -1; }
.app-head > h1 { grid-column: 2; margin: 0; }
.app-head > .app-back { grid-column: 1; margin-right: 10px; }
.app-head > .app-search { grid-column: 3; margin-left: 10px; }
.app-head > .app-add { grid-column: 4; margin-left: 8px; }
.app-head > .area-switch { justify-self: start; margin: 12px 0 10px; }
.app-head > :last-child { margin-bottom: 0; }
/* "Adicionar à biblioteca" (EP-348): a round "+" in the row of the title, on every screen (owner, 2026-11-16: no word beside it). */
.app-add { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 999px;
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-on); font: 800 22px/1 var(--font-ui); text-decoration: none; box-shadow: var(--shadow); }
[data-area="quadrinhos"] .app-add { background: var(--ouro-500); color: var(--navy-700); border-color: var(--navy-700); }
/* Buscar (owner, 2026-11-16): a round magnifier before the "+", the same yellow. */
.app-search { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px;
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-on); box-shadow: var(--shadow); }
[data-area="quadrinhos"] .app-search { background: var(--ouro-500); color: var(--navy-700); border-color: var(--navy-700); }
/* EP-355: while its filter is open the lupa shows pressed, its colours swapped. */
.app-search[aria-expanded="true"] { background: var(--accent-on); color: var(--accent); box-shadow: none; }
[data-area="quadrinhos"] .app-search[aria-expanded="true"] { background: var(--navy-700); color: var(--ouro-500); }
/* Voltar (owner, 2026-11-16): a round "‹" on the left of the title, to the level above, the same yellow as Buscar and "+". */
.app-back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 2px solid var(--accent); border-radius: 999px;
  background: var(--accent); color: var(--accent-on); font: 800 26px/1 var(--font-ui); text-decoration: none; box-shadow: var(--shadow); }
[data-area="quadrinhos"] .app-back { background: var(--ouro-500); color: var(--navy-700); border-color: var(--navy-700); }
/* The views of a screen (EP-333, mock-b .tabs): plain links, the current one underlined in the accent. Only in the still head: the admin
   dialogs have tablists of their own named .tabs. */
.app-head .tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--border); font: 700 14px var(--font-ui); overflow-x: auto; }
.app-head .tabs a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; white-space: nowrap; }
.app-head .tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.app-head .tabs small { font-weight: 400; }
/* The search field of Buscar (EP-212): the field and its button on one row, in the still head; the results scroll under it. */
.app-head form.search { display: flex; gap: 8px; align-items: stretch; margin: 0 0 4px; }
.app-head form.search input[type=search] { flex: 1 1 auto; min-width: 0; min-height: 44px; }
.app-head form.search button { flex: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  background: var(--bar, #213756); padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; min-height: 52px; border-radius: var(--radius);
  color: var(--bar-icon, #eee); text-decoration: none; font: 700 11px var(--font-ui); }
.tabbar a[aria-current="page"] { background: var(--bar-active, var(--accent)); color: var(--bar-active-on, #fff); }
[data-area="quadrinhos"] .tabbar { border-top: 3px solid var(--ouro-500); }
/* Computer (and scaled screens or browser zoom, which can be under 900 CSS px): one compact header row, smaller type, content capped,
   the mascot centered behind the content, big, with translucent cards over it.
   EP-335: a wrapping flex row, not a grid: a grid item sticks only inside its own row, so the header row could not stay at the top. The tab bar
   comes after the main in the page, so order puts it in the header row; the main takes the next row whole and centers its content at 860px. */
@media (min-width: 720px) {
  body.app { --fundo-top: 260px; display: flex; flex-flow: row wrap; align-content: flex-start; padding-bottom: 0; font-size: 15px;
    background: linear-gradient(var(--fundo-veu), var(--fundo-veu)) no-repeat fixed,
      var(--fundo) center bottom / auto min(calc(100vh - var(--fundo-top)), 1100px) no-repeat fixed, var(--bg); }
  .tabbar { order: 1; flex: 1 1 0; min-width: 0; position: sticky; top: 0; height: var(--app-top-h); justify-content: flex-end; gap: 4px; padding: 10px 24px; background: var(--bg); border-bottom: 2px solid var(--border); align-items: center; }
  [data-area="quadrinhos"] .tabbar { border-top: 0; }
  [data-area="quadrinhos"] .tabbar { border-bottom-color: var(--ouro-500); }
  .tabbar a { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 4px 14px; min-height: 36px; font-size: 14px; color: var(--accent); }
  .tabbar a[aria-current="page"] { background: var(--accent); color: var(--accent-on); }
  .tabbar svg { width: 18px; height: 18px; }
  .area-switch a { min-height: 34px; padding: 4px 18px; font-size: 14px; }
  .app-main { order: 2; flex: none; max-width: none; padding: 0 max(24px, calc(50% - 406px)) 20px; }
  .app-head { top: var(--app-top-h); padding-top: 20px; }
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
  button, .button { min-height: 36px; padding: 6px 14px; font-size: 14px; }
}
/* EP-357 (owner, 2026-11-17): from 1024 px the screens of covers (Biblioteca and Buscar, body.app-wide) take a wider column, about
   min(1100px, 100% - 32px), so 7 or 8 covers per row are not tiny (and the Início, EP-382, its two columns); the still head is inside it and follows. Perfil and the reader keep theirs. */
@media (min-width: 1024px) {
  body.app-wide .app-main { padding: 0 max(16px, calc((100% - 1100px) / 2)) 20px; }
}
/* A short screen (a phone on its side): a still top would leave almost nothing for the list, so there it scrolls away with it. */
@media (max-height: 500px) { .app-head { position: static; } }
@media (min-width: 720px) and (max-height: 500px) { .tabbar { position: static; } }
details.series { background: color-mix(in srgb, var(--surface) 82%, transparent); border: 2px solid var(--border); border-radius: var(--radius); margin: 0 0 10px; box-shadow: var(--shadow); }
details.series summary { padding: 12px 14px; cursor: pointer; font-weight: 700; }
ul.volumes { list-style: none; margin: 0; padding: 0 14px 10px; }
/* A series opens into a shelf of covers (2:3), a few across; a volume without a cover keeps its place. */
ul.shelf { list-style: none; margin: 0; padding: 4px 14px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-title { font-weight: 700; font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile small { font-size: 12px; }
.cover { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 4px; text-align: center; background: rgb(18 12 40 / .88); color: #fff; font-weight: 800; font-size: 15px; line-height: 1.1; white-space: nowrap; }
.cover-empty { background: repeating-linear-gradient(135deg, var(--surface) 0 8px, var(--border) 8px 9px); }
@media (min-width: 720px) { ul.shelf { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); } }
/* ---- Biblioteca by levels (EP-61, B3b slice 2; mock-b frames 3a to 3c): sections HQ and Mangá with their estantes, the prateleiras of an
   estante, the volumes of a prateleira. The path sits in the still head under the areas, from the estante (the switch already says the area), and
   breaks into lines, so the whole name of a series shows (owner, 2026-11-16); Voltar is the round "‹" on the left of the title. ---- */
.app-head .crumbs { display: flex; align-items: flex-start; gap: 10px; min-width: 0; margin: 0 0 6px; font: 600 13px var(--font-ui); color: var(--muted); }
.crumbs-path { flex: 1; min-width: 0; line-height: 1.4; overflow-wrap: anywhere; }
.crumbs-path a { color: var(--muted); }
.crumbs-path b { color: var(--accent); }
/* Legibility over the mascot (owner, 2026-11-16, mock-j option B): every prateleira and volume is a translucent
   card like the estante cards, so its title, year, count and progress never sit on the drawing; the cover stays whole and the mascot shows between cards. The name of the
   estante or prateleira is only read by screen readers (owner: the breadcrumb above already shows it). */
ul.prateleiras > .tile, ul.volumes-grid > .tile { padding: 6px 6px 8px; border: 2px solid var(--border); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent); }
.library-section { margin: 0 0 16px; }
.library-section h2 { margin: 4px 0 8px; }
.library-section h2 small { font-weight: 400; }
ul.shelves { list-style: none; margin: 0; padding: 0; background: color-mix(in srgb, var(--surface) 84%, transparent); border: 2px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
ul.shelves li + li { border-top: 1px solid var(--border); }
.shelf-card { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; color: inherit; text-decoration: none; }
.shelf-card:focus-visible { outline-offset: -3px; }
.shelf-logo { flex: none; display: flex; align-items: center; justify-content: center; width: 60px; aspect-ratio: 3 / 2; overflow: hidden;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.shelf-logo img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 4px; box-sizing: border-box; }
/* A logo the owner framed (EP-347, A5): the reader's 3:2 rectangle the framing was made in, the img placed by its inline style (the formula of
   logo-frame.js, computed by the server) and cut by the frame; what the logo does not cover shows the frame's colour. */
.shelf-logo-framed { position: relative; display: block; width: 60px; aspect-ratio: 3 / 2; }
.shelf-logo-framed img { position: absolute; transform: translate(-50%, -50%); max-width: none; max-height: none; padding: 0; object-fit: contain; }
.shelf-initial { background: var(--accent); border-color: var(--accent); color: var(--accent-on); font: 800 24px/1 var(--font-title); }
.shelf-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font: 15px/1.3 var(--font-ui); }
.shelf-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 800; }
.shelf-text small { margin-top: 2px; font-size: 12px; }
.shelf-go { flex: none; color: var(--muted); font: 700 22px/1 var(--font-ui); }
/* The prateleiras: the series, the year it began and how many volumes under the cover, in the columns of the Perfil (below, with the volumes). */
.tile-year { font-weight: 400; }
.tile-count { font-size: 12px; line-height: 1.25; }
/* Where the reading is, in the middle of the cover (EP-356; owner, 2026-11-17: in the middle and bigger, not in a corner), for a volume and for a
   whole series: the seal of read (a round yellow button with a dark check, the yellow of the lupa and the "+"; it opens the menu of the card, so it
   sits outside the link, in .tile-over, a frame of the cover's size laid over it that lets every other touch through) with the cover dimmed under
   it; a ring on a dark translucent disk, in the same yellow, full as far as the reading went, with "5/25" (pages of a volume) or, for a series, the
   volume being read ("#5") over "de 21" in small letters (smaller for long numbers); nothing when never opened. The words are in the link's name only. */
.tile { position: relative; --status-size: 64px; --status-on: var(--ouro-500); --status-ink: var(--navy-700); --status-disk: rgb(12 20 36 / .74); }
.tile-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center;
  width: var(--status-size); height: var(--status-size); border-radius: 999px; background: var(--status-disk); color: #fff; pointer-events: none; }
.tile-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tile-ring circle { fill: none; stroke-width: 3.5; }
.tile-ring-track { stroke: rgb(255 255 255 / .22); }
.tile-ring-fill { stroke: var(--status-on); }
.tile-ring b { position: relative; font: 800 16px/1 var(--font-ui); letter-spacing: -.02em; white-space: nowrap; color: #fff; }
.tile-ring-s b { font-size: 13px; }
.tile-ring-xs b { font-size: 11px; letter-spacing: -.04em; }
.tile-ring b small { display: block; margin-top: 1px; font: 700 10px/1.1 var(--font-ui); letter-spacing: 0; text-align: center; color: #fff; }
.tile-ring-s b small, .tile-ring-xs b small { font-size: 9px; }
/* The li is the card (2px border, 6px padding): the frame starts where the cover does and has its 2:3 shape, so its middle is the cover's. */
.tile-over { position: absolute; top: 6px; left: 6px; right: 6px; aspect-ratio: 2 / 3; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.tile .tile-status { pointer-events: auto; z-index: 1; display: inline-flex; align-items: center; justify-content: center;
  width: var(--status-size); height: var(--status-size); min-height: 0; padding: 0; border: 3px solid var(--status-ink); border-radius: 999px;
  background: var(--status-on); color: var(--status-ink); box-shadow: 0 2px 8px rgb(0 0 0 / .35); }
.tile .tile-status svg { width: 56%; height: 56%; }
.tile-done .cover img { opacity: .55; }
/* A phone with 4 or 5 columns, or a computer with 7 or 8 (EP-357), has narrow covers: a smaller disk and smaller numbers. */
@media (max-width: 719.98px) {
  ul.shelf[data-cols="4"] .tile, ul.shelf[data-cols="5"] .tile { --status-size: 48px; }
  ul.shelf[data-cols="4"] .tile-ring b, ul.shelf[data-cols="5"] .tile-ring b { font-size: 12px; }
  ul.shelf[data-cols="4"] .tile-ring-s b, ul.shelf[data-cols="5"] .tile-ring-s b { font-size: 10px; }
  ul.shelf[data-cols="4"] .tile-ring-xs b, ul.shelf[data-cols="5"] .tile-ring-xs b { font-size: 8.5px; }
  ul.shelf[data-cols="4"] .tile-ring b small, ul.shelf[data-cols="5"] .tile-ring b small { font-size: 8px; }
  ul.shelf[data-cols="4"] .tile-ring circle, ul.shelf[data-cols="5"] .tile-ring circle { stroke-width: 4.5; }
}
@media (min-width: 720px) {
  ul.shelf[data-cols-desktop="7"] .tile, ul.shelf[data-cols-desktop="8"] .tile { --status-size: 48px; }
  ul.shelf[data-cols-desktop="7"] .tile-ring b, ul.shelf[data-cols-desktop="8"] .tile-ring b { font-size: 12px; }
  ul.shelf[data-cols-desktop="7"] .tile-ring-s b, ul.shelf[data-cols-desktop="8"] .tile-ring-s b { font-size: 10px; }
  ul.shelf[data-cols-desktop="7"] .tile-ring-xs b, ul.shelf[data-cols-desktop="8"] .tile-ring-xs b { font-size: 8.5px; }
  ul.shelf[data-cols-desktop="7"] .tile-ring b small, ul.shelf[data-cols-desktop="8"] .tile-ring b small { font-size: 8px; }
  ul.shelf[data-cols-desktop="7"] .tile-ring circle, ul.shelf[data-cols-desktop="8"] .tile-ring circle { stroke-width: 4.5; }
}
/* The lupa (EP-355; owner, 2026-11-17: it searches the whole area): its field under the row of the title, in the still head, with its own "×" (not
   the browser's); while there is a search the level gives way to its results, in groups with a title each and "Ver todos os N" to Buscar. */
.app-head > .library-filter { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.app-head > .library-filter[hidden] { display: none; }
.library-filter input[type=search] { flex: 1 1 auto; min-width: 0; min-height: 44px; }
.library-filter input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.library-filter .library-filter-clear { flex: none; width: 44px; min-height: 44px; padding: 0; font: 800 22px/1 var(--font-ui); }
.library-list[hidden], .library-results[hidden] { display: none; }
.search-group { margin: 0 0 18px; }
.search-group-title { margin: 4px 0 8px; }
.search-group-title small { font: 400 14px var(--font-ui); }
.search-more { margin: -6px 0 0; font: 700 14px var(--font-ui); }
/* Every grid of covers of the Biblioteca (the prateleiras of an estante, the volumes of a prateleira, the results of the lupa and of Buscar): the
   columns the person chose in the Perfil for each device (EP-357, owner 2026-11-17): data-cols (2 to 5) under 720 px, data-cols-desktop (4 to 8)
   from 720 px. */
ul.volumes-grid, ul.prateleiras { padding: 0 0 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; }
@media (max-width: 719.98px) {
  ul.shelf[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  ul.shelf[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  ul.shelf[data-cols="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  ul.shelf[data-cols="4"] .badge, ul.shelf[data-cols="5"] .badge { font-size: 12px; padding: 3px 2px; }
}
@media (min-width: 720px) {
  ul.volumes-grid, ul.prateleiras { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  ul.shelf[data-cols-desktop="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  ul.shelf[data-cols-desktop="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  ul.shelf[data-cols-desktop="7"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  ul.shelf[data-cols-desktop="8"] { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  ul.shelf[data-cols-desktop="7"] .badge, ul.shelf[data-cols-desktop="8"] .badge { font-size: 12px; padding: 3px 2px; }
}
/* Marcar como lido by holding (owner, 2026-11-16): a card that can be held never selects its text or cover, nor shows the phone's own menu; the menu
   opens by the card, names it at its top, and its lines are as tall as a finger. EP-358 (owner, 2026-11-17): while it is open the card held stands
   out (a yellow outline, a little in front) and the other cards dim; its top has the cover and the kind ("Série", "Volume") over the name, an arrow
   points at the card, and the two marks look apart: a yellow check for read, an undo arrow in the colour of an alert for not read. */
li[data-hold] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
li[data-hold] img { -webkit-user-drag: none; }
body.hold-open .tile:not(.hold-held), body.hold-open ul.shelves > li { opacity: .4; transition: opacity .15s; }
body.hold-open .tile.hold-held { z-index: 3; outline: 3px solid var(--ouro-500); outline-offset: 1px; box-shadow: 0 10px 24px rgb(0 0 0 / .4); }
.hold-menu { --arrow-x: 24px; position: fixed; z-index: 40; display: flex; flex-direction: column; width: min(260px, calc(100vw - 16px)); padding: 6px;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / .28); }
/* The arrow: a square turned on its corner, half of it out of the menu on the side of the card, with the menu's border on its two outer edges. */
.hold-menu::before { content: ""; position: absolute; left: calc(var(--arrow-x) - 8px); width: 14px; height: 14px; background: var(--surface);
  border: 2px solid var(--border); transform: rotate(45deg); }
.hold-menu[data-side="below"]::before { top: -9px; border-right: 0; border-bottom: 0; }
.hold-menu[data-side="above"]::before { bottom: -9px; border-left: 0; border-top: 0; }
.hold-menu-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); }
.hold-menu-cover { flex: none; width: 36px; height: 54px; object-fit: cover; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.hold-menu-names { min-width: 0; display: flex; flex-direction: column; }
.hold-menu-kind { color: var(--muted); font: 700 11px/1.2 var(--font-ui); text-transform: uppercase; letter-spacing: .06em; }
.hold-menu-title { display: block; color: var(--text); font: 800 14px/1.3 var(--font-ui); overflow-wrap: anywhere; }
.hold-menu button { display: flex; align-items: center; gap: 10px; min-height: 48px; border: 0; text-align: left; color: var(--text); }
.hold-menu button::before { content: ""; flex: none; width: 24px; height: 24px; border-radius: 999px; }
.hold-menu .hold-menu-read::before { border: 2px solid var(--navy-700); background: var(--ouro-500) center / 14px no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e3454' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.hold-menu .hold-menu-unread { color: var(--erro); }
.hold-menu .hold-menu-unread::before { border-radius: 0; background: currentColor;
  -webkit-mask: center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4v6h6'/%3E%3Cpath d='M5.6 15a7.5 7.5 0 1 0 1.4-8.1L4 10'/%3E%3C/svg%3E");
  mask: center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4v6h6'/%3E%3Cpath d='M5.6 15a7.5 7.5 0 1 0 1.4-8.1L4 10'/%3E%3C/svg%3E"); }
.hold-menu-sep { height: 1px; margin: 2px 8px; background: var(--border); }
.hold-menu button:disabled { opacity: .55; }
ul.volumes li { padding: 8px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; color: var(--text); font: 600 16px var(--font-ui); }
.choice input { width: 20px; height: 20px; accent-color: var(--accent); }
.card { margin-bottom: 12px; }
/* The Perfil saves itself (EP-357): a quiet "Salvo" under the line of the control changed, or the error with "Tentar de novo". */
.profile-saved { display: block; margin: -4px 0 6px 30px; color: var(--muted); font: 700 13px var(--font-ui); }
.profile-error { margin: 6px 0; }
.profile-error button { margin-left: 6px; min-height: 36px; padding: 4px 12px; }
/* The columns of the covers (EP-357, owner 2026-11-17): each device keeps its own, so the Perfil shows only the group of the screen in use, the phone's
   under 720 px and the computer's from 720 px; the other is only hidden, so the form still sends both. */
.columns-desktop { display: none; }
@media (min-width: 720px) {
  .columns-phone { display: none; }
  .columns-desktop { display: block; }
}
.card h2 { margin-top: 18px; }
.card h2:first-child { margin-top: 0; }
/* The preferences assistant (EP-360): the groups of the Perfil, one step at a time with the script (Voltar, "Passo N de M", Próximo or Começar under
   the card), every step together without it. */
.welcome-intro { margin: 0 0 12px; }
.welcome-step + .welcome-step { margin-top: 22px; }
.welcome-step h2:focus { outline: none; }
.welcome-step[hidden], .welcome-nav[hidden], .welcome-nav [hidden] { display: none; }
.welcome-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.welcome-count { flex: 1; text-align: center; color: var(--muted); font: 700 14px var(--font-ui); }
.welcome-finish { margin: 0; }
/* ---- The blocks of the preferences (EP-360 round 2, owner 2026-11-18), the same in the Perfil and the assistant: the buttons of the reader's sheet
   (.reader-tile), here a radio of the form inside a label, hidden but focusable (its focus and :checked draw the tile, like aria-pressed in the
   sheet); under them a short sentence and a small scene drawn in CSS of the option marked (.pref-scene, data-show), in the colours of the theme.
   With reduced motion the scenes stay still (the rule at the top stops every animation), each on a frame that shows its option. ---- */
.card .pref-block h2 { margin: 0 0 8px; }
.pref-block + .pref-block, .welcome-step .pref-block + .pref-block { margin-top: 14px; }
.pref-tiles { margin: 0 0 8px; }
.pref-tile { position: relative; flex: 1 1 0; min-width: 0; display: flex; margin: 0; color: var(--text); font: inherit; cursor: pointer; }
.pref-tile input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.pref-tiles .reader-tile { flex: 1 1 0; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 6px 4px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: 700 12px/1.15 var(--font-ui); text-align: center; }
.pref-tiles .reader-tile svg { color: var(--accent); }
.pref-tiles .reader-tile span { white-space: normal; overflow-wrap: anywhere; }
.pref-tiles .reader-tile small { color: var(--muted); }
.pref-tile input:checked + .reader-tile { background: var(--ouro-500); border-color: var(--navy-700); color: var(--navy-700); }
.pref-tile input:checked + .reader-tile svg, .pref-tile input:checked + .reader-tile small { color: var(--navy-700); }
.pref-tile input:focus-visible + .reader-tile { outline: 3px solid var(--accent); outline-offset: 2px; }
.pref-tile input:disabled + .reader-tile { opacity: .55; }
.pref-tile:has(input:disabled) { cursor: default; }
/* Direção is no choice here (it is chosen in the reader, for each series): a plain row of icon and words, no tile, nothing to press. */
.pref-direction { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; }
.pref-dir { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font: 700 14px var(--font-ui); }
.pref-dir svg { flex: none; width: 20px; height: 20px; color: var(--accent); }
.pref-dir small { font-weight: 600; }
.pref-explain { display: flex; align-items: center; gap: 12px; }
.pref-says { flex: 1; min-width: 0; font: 600 14px/1.35 var(--font-ui); color: var(--text); }
.pref-says p { margin: 0; }
.pref-says p + p { margin-top: 2px; }
.pref-says [hidden] { display: none; }
.pref-scene { --s-page: var(--surface); --s-ink: var(--accent); flex: none; position: relative; display: block; width: 88px; height: 56px; overflow: hidden;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.pref-scene i, .pref-scene b, .pref-scene .s-strip, .pref-scene .s-grid { position: absolute; display: block; }
/* Tema: a small screen in the theme marked; Automático is half light, half dark. */
.pref-scene[data-scene="theme"] { --s-bg: #f8f3e6; --s-text: #1d2a40; --s-bar: #213756; background: var(--s-bg); transition: background .3s; }
.pref-scene[data-scene="theme"][data-show="sepia"] { --s-bg: #ede1ca; --s-text: #3b2f22; --s-bar: #8e7042; }
.pref-scene[data-scene="theme"][data-show="escuro"] { --s-bg: #121c2e; --s-text: #efe6d2; --s-bar: #f0c159; }
.pref-scene[data-scene="theme"][data-show="auto"] { --s-text: #8a93a6; --s-bar: #6fa3d6; background: linear-gradient(135deg, #f8f3e6 50%, #121c2e 50%); }
.pref-scene[data-scene="theme"] i { left: 8px; height: 4px; border-radius: 2px; background: var(--s-text); opacity: .7; transition: background .3s; }
.pref-scene[data-scene="theme"] i:nth-child(1) { top: 8px; right: 8px; height: 9px; background: var(--s-bar); opacity: 1; }
.pref-scene[data-scene="theme"] i:nth-child(2) { top: 26px; right: 18px; }
.pref-scene[data-scene="theme"] i:nth-child(3) { top: 36px; right: 34px; }
/* Abrir o app em: the name of the area in the look of the area. */
.pref-scene[data-scene="area"] b { inset: 0; display: flex; align-items: center; justify-content: center; background: var(--ouro-500); color: var(--navy-700);
  font: 400 22px/1 "Bangers", "Comic Neue", sans-serif; letter-spacing: .04em; animation: pref-pop 2.4s ease-in-out infinite; }
.pref-scene[data-scene="area"][data-show="hq"] b::after { content: "HQ"; }
.pref-scene[data-scene="area"][data-show="manga"] b::after { content: "Mangá"; }
.pref-scene[data-scene="area"][data-show="livros"] b { background: var(--navy-700); color: #e9dfc8; font: 700 17px/1 "Lora", Georgia, serif; letter-spacing: 0; }
.pref-scene[data-scene="area"][data-show="livros"] b::after { content: "Livros"; }
@keyframes pref-pop { 0%, 100% { transform: none; } 50% { transform: scale(1.08); } }
/* Modo: one whole page with its panels, framed at once (Paginado). */
.pref-scene[data-scene="mode"] i { background: var(--s-ink); opacity: .45; border-radius: 2px; }
.pref-scene[data-scene="mode"] i:nth-child(1) { left: 28px; top: 8px; width: 32px; height: 16px; }
.pref-scene[data-scene="mode"] i:nth-child(2) { left: 28px; top: 28px; width: 14px; height: 18px; }
.pref-scene[data-scene="mode"] i:nth-child(3) { left: 46px; top: 28px; width: 14px; height: 18px; }
.pref-scene[data-scene="mode"]::after { content: ""; position: absolute; left: 23px; top: 3px; width: 42px; height: 48px; border: 2px solid var(--ouro-500);
  border-radius: 3px; animation: pref-frame 2.4s ease-in-out infinite; }
@keyframes pref-frame { 0%, 100% { transform: none; } 50% { transform: scale(.92); } }
/* Direção: the reading goes left to right (HQ) on top, right to left (Mangá) below. */
.pref-scene[data-scene="direction"]::before, .pref-scene[data-scene="direction"]::after { content: ""; position: absolute; left: 10px; right: 10px; height: 2px;
  background: var(--border); }
.pref-scene[data-scene="direction"]::before { top: 18px; }
.pref-scene[data-scene="direction"]::after { top: 36px; }
.pref-scene[data-scene="direction"] i { width: 12px; height: 12px; border-radius: 50%; background: var(--s-ink); }
.pref-scene[data-scene="direction"] i:nth-child(1) { top: 13px; left: 8px; animation: pref-ltr 2.4s ease-in-out infinite; }
.pref-scene[data-scene="direction"] i:nth-child(2) { top: 31px; left: 64px; background: var(--ouro-500); animation: pref-ltr 2.4s ease-in-out infinite reverse; }
@keyframes pref-ltr { 0%, 15% { left: 8px; } 85%, 100% { left: 64px; } }
/* Paginação: the pages pass sideways (Horizontal), upwards (Vertical) or both ways (Livre); still, the next page shows where it comes from. */
.pref-scene[data-scene="pagination"] .s-strip { top: 6px; left: 6px; display: flex; gap: 8px; }
.pref-scene[data-scene="pagination"] .s-strip i { position: static; flex: none; width: 36px; height: 44px; border: 2px solid var(--s-ink); border-radius: 3px; background: var(--s-page); }
.pref-scene[data-scene="pagination"] .s-strip i:nth-child(even) { border-color: var(--ouro-500); }
.pref-scene[data-scene="pagination"][data-show="horizontal"] .s-strip { animation: pref-x 3s ease-in-out infinite alternate; }
.pref-scene[data-scene="pagination"][data-show="vertical"] .s-strip { left: 22px; flex-direction: column; animation: pref-y 3s ease-in-out infinite alternate; }
.pref-scene[data-scene="pagination"][data-show="vertical"] .s-strip i { width: 40px; height: 36px; }
.pref-scene[data-scene="pagination"][data-show="multidirectional"] .s-strip { display: grid; grid-template-columns: 36px 36px; animation: pref-free 4s ease-in-out infinite alternate; }
.pref-scene[data-scene="pagination"][data-show="multidirectional"] .s-strip i { height: 36px; }
.pref-scene[data-scene="pagination"][data-show="multidirectional"] .s-strip i:nth-child(n) { border-color: var(--s-ink); }
.pref-scene[data-scene="pagination"][data-show="multidirectional"] .s-strip i:nth-child(2), .pref-scene[data-scene="pagination"][data-show="multidirectional"] .s-strip i:nth-child(3) { border-color: var(--ouro-500); }
@keyframes pref-x { 0%, 30% { transform: none; } 70%, 100% { transform: translateX(-44px); } }
@keyframes pref-y { 0%, 30% { transform: none; } 70%, 100% { transform: translateY(-44px); } }
@keyframes pref-free { 0%, 15% { transform: none; } 40%, 55% { transform: translateX(-44px); } 85%, 100% { transform: translate(-44px, -44px); } }
/* Animação ao virar: over the page below, the page turns by its corner, on its spine (the left edge) or swaps at once. */
.pref-scene[data-scene="turn"] { perspective: 160px; }
.pref-scene[data-scene="turn"] i { left: 26px; top: 4px; width: 36px; height: 44px; border: 2px solid var(--s-ink); border-radius: 3px; }
.pref-scene[data-scene="turn"] .s-under { background: var(--s-page); border-color: var(--ouro-500); }
.pref-scene[data-scene="turn"] .s-leaf { background: var(--s-page); transform-origin: 0 50%; }
.pref-scene[data-scene="turn"][data-show="curl"] .s-leaf::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px;
  background: linear-gradient(315deg, var(--bg) 50%, var(--ouro-500) 50%); animation: pref-curl 2.4s ease-in-out infinite alternate; }
.pref-scene[data-scene="turn"][data-show="hinge"] .s-leaf { transform: rotateY(-50deg); animation: pref-hinge 2.4s ease-in-out infinite; }
.pref-scene[data-scene="turn"][data-show="none"] .s-leaf { animation: pref-swap 2.4s steps(1) infinite; }
@keyframes pref-curl { 0%, 20% { width: 6px; height: 6px; } 80%, 100% { width: 30px; height: 30px; } }
@keyframes pref-hinge { 0%, 15% { transform: none; opacity: 1; } 75% { transform: rotateY(-165deg); opacity: 1; } 76%, 100% { transform: rotateY(-165deg); opacity: 0; } }
@keyframes pref-swap { 0% { opacity: 1; } 50% { opacity: 0; } }
/* Colunas: the grid of covers with as many columns as the option. */
.pref-scene[data-scene="columns"] .s-grid { inset: 5px; display: grid; grid-template-columns: repeat(var(--s-cols, 2), minmax(0, 1fr)); grid-auto-rows: 20px; gap: 3px; overflow: hidden; }
.pref-scene[data-scene="columns"] .s-grid i { position: static; border-radius: 2px; background: var(--s-ink); opacity: .5; animation: pref-cover 2.4s ease-in-out infinite; }
.pref-scene[data-scene="columns"] .s-grid i:nth-child(odd) { animation-delay: .6s; }
.pref-scene[data-scene="columns"][data-show="3"] { --s-cols: 3; }
.pref-scene[data-scene="columns"][data-show="4"] { --s-cols: 4; }
.pref-scene[data-scene="columns"][data-show="5"] { --s-cols: 5; }
.pref-scene[data-scene="columns"][data-show="6"] { --s-cols: 6; }
.pref-scene[data-scene="columns"][data-show="7"] { --s-cols: 7; }
.pref-scene[data-scene="columns"][data-show="8"] { --s-cols: 8; }
@keyframes pref-cover { 0%, 100% { opacity: .5; } 50% { opacity: .8; } }
/* The rule for the whole app (top of this file) does not reach the pseudo-elements, which draw the frame of Modo and the corner of Canto dobrando. */
@media (prefers-reduced-motion: reduce) {
  .pref-scene::before, .pref-scene::after, .pref-scene *::before, .pref-scene *::after { animation: none !important; transition: none !important; }
}
/* Conforto: a coloured page under the reader's three layers (dim, warm, amber), as opaque as the choice; profile.js follows the sliders. */
.pref-scene[data-scene="comfort"] { background: linear-gradient(160deg, #6fa3d6 0 40%, #f0c159 40% 70%, #e9dfc8 70%); }
.pref-scene[data-scene="comfort"] i { inset: 0; transition: opacity .15s; }
.pref-scene[data-scene="comfort"] .s-dim { background: #000; opacity: var(--dim, 0); }
.pref-scene[data-scene="comfort"] .s-warm { background: #ff8a2a; mix-blend-mode: multiply; opacity: var(--warm, 0); }
.pref-scene[data-scene="comfort"] .s-amber { background: #ffb000; mix-blend-mode: multiply; opacity: var(--amber, 0); }
/* The tabs of the Perfil (Leitura, Aparência, Conta) are the .tabs of the still head, a little apart from the switch of the areas. */
.app-head .profile-tabs { margin-top: 2px; }

/* ---- fan edition (EP-321): the "Edição de fã" seal on a volume of the shelf and beside the title in the reader ---- */
.fan-badge { display: inline-block; padding: 2px 7px; border-radius: 999px; background: var(--ouro); color: var(--navy); font: 800 11px/1.3 var(--font-ui); letter-spacing: .02em; white-space: nowrap; }
.cover .fan-badge { position: absolute; top: 4px; left: 4px; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; }
.reader-heading .fan-badge { margin-top: 2px; font: 800 11px/1.3 var(--font-ui); color: var(--navy); }

/* ---- shelf → reader (EP-182): every cover is a link; the notice shows while the reader opens ---- */
.tile-link { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: inherit; text-decoration: none; border-radius: var(--radius); }
.opening { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); color: var(--text); font: 700 18px var(--font-ui); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- reader (EP-182): full screen, Paginado. No tab bar; a dark menu over the page shows on a touch in the middle and hides by itself.
   The page is never cropped (contain); the hairline at the foot is the only thing over it. ---- */
body.reader-body { min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none; background: var(--bg); }
.reader { position: relative; width: 100%; height: 100%; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* A tap turns the page: the browser's tap highlight would leave a bluish veil over it (seen on Android, 2026-11-08). */
.reader, .reader * { -webkit-tap-highlight-color: transparent; }
.reader-page::selection, .reader-stage::selection { background: transparent; }
/* touch-action none: the swipe is the reader's, not the browser's (no back gesture, no scroll). Pinch zoom comes with EP-196. */
.reader-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: pointer;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(4px + env(safe-area-inset-bottom)) env(safe-area-inset-left); }
.reader-page { display: block; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.reader-page.waiting { visibility: hidden; }
/* Pinch zoom (EP-196): the page is scaled and shifted from its centre; zoomed, the cursor says it can be dragged. */
.reader-page { transform-origin: 50% 50%; }
.reader.zoomed .reader-page { will-change: transform; }
.reader.zoomed .reader-stage { cursor: grab; }
.reader.zoomed .reader-hair, .reader.zoomed .reader-pill { opacity: .35; }
.reader-state { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 24px 16px; text-align: center; pointer-events: none; }
.reader-state[hidden] { display: none; }
/* EP-369 U1a4 (owner 2026-11-19): while a page is not shown yet the whole screen dims and the balloon waits in the middle. The touches go through to the
   page, where a turn is refused and a touch in the middle still opens the menu (the top bar and Voltar sit above). Only the balloon's button takes them. */
.reader-state.blocking { background: rgb(6 10 18 / .58); }
.reader-state button, .reader-state a { pointer-events: auto; }
/* No flash for a page from the cache: the dim and the balloon appear only after about 300 ms. */
.reader-state.reader-state-delayed { animation: reader-wait-in .18s ease-out .3s both; }
@keyframes reader-wait-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .reader-state.reader-state-delayed { animation-duration: 0s; } }
.reader-hair { position: absolute; left: 0; right: 0; bottom: env(safe-area-inset-bottom); z-index: 3; height: 3px; pointer-events: none;
  background: color-mix(in srgb, var(--border) 55%, transparent); }
.reader-hair i { position: absolute; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width .2s ease-out; }
[data-direction="ltr"] .reader-hair i { left: 0; }
[data-direction="rtl"] .reader-hair i { right: 0; }
/* The menu (round 5; mockup C, frame 2): the dark top bar with back, title and the gear, opened together with the quick sheet by a touch in
   the middle. The frame around it lets the touches through to the reader. */
.reader-menu { position: absolute; inset: 0; z-index: 5; pointer-events: none;
  visibility: hidden; opacity: 0; transition: opacity .2s, visibility 0s .2s; }
.reader-menu.open { visibility: visible; opacity: 1; transition: opacity .2s; }
.reader-bar { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 8px; pointer-events: auto;
  background: rgb(14 22 38 / .92); color: #efe6d2; transition: transform .2s; }
.reader-bar-top { top: 0; padding: calc(6px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 6px calc(8px + env(safe-area-inset-left));
  border-bottom: 3px solid var(--ouro-500); transform: translateY(-8px); }
.reader-menu.open .reader-bar { transform: none; }
.reader-menu a, .reader-menu button { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; min-height: 48px;
  padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: inherit; box-shadow: none; }
/* Where the reading is, always there in a pill at the top of the page (owner, 2026-11-09), the same pill as the Painel, Balão and Épico modes
   of mockup C: "Página 5 de 28" here, "Página 5 · Painel 3" and so on in the others. The sheet says it while the menu is open. */
.reader-pill { position: absolute; z-index: 3; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 96px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 5px 14px; border: 2px solid #efe6d2; border-radius: 999px; background: rgb(14 22 38 / .88); color: #efe6d2;
  font: 700 12px var(--font-ui); box-shadow: 2px 2px 0 #000; pointer-events: none; }
.reader-pill[hidden] { display: none; }
.reader.menu-open .reader-pill { visibility: hidden; }
.reader-menu a:focus-visible, .reader-menu button:focus-visible { outline: 3px solid var(--ouro-500); outline-offset: -3px; }
.reader-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.25; }
.reader-heading b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ouro-500);
  font: 400 19px var(--font-title); text-transform: var(--title-case); letter-spacing: var(--title-spacing); }
.reader-heading span { font: 700 13px var(--font-ui); color: #dbe8f7; }
/* The quick sheet (EP-182, rounds 4 and 5; mockup C, frame 2): dark like the menu, rising from the foot under the top bar; the page and its
   progress first, then three sections of tiles (Modo de leitura, Direção de leitura, Paginação) and Conforto with two sliders and two
   switches. One tile chosen at a time, filled in gold. */
.reader-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; width: 100%; max-width: 480px; margin: 0 auto;
  max-height: calc(100% - 72px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 14px calc(14px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  background: #0e1626; color: #efe6d2; border-top: 3px solid var(--ouro-500); border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -6px 24px rgb(0 0 0 / .35); }
.reader-sheet[hidden] { display: none; }
.reader-sheet-where { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.reader-where { margin: 0; white-space: nowrap; font: 700 15px var(--font-ui); color: var(--ouro-500); }
.reader-sheet-progress { flex: 1; display: flex; height: 5px; border-radius: 5px; background: rgb(239 230 210 / .2); overflow: hidden; }
.reader-sheet-progress em { display: block; width: 0; height: 100%; border-radius: 5px; background: var(--ouro-500); transition: width .2s ease-out; }
/* The summary (round 6; mockup C, frames 2 to 2c): what is chosen now, one tile per kind; the open one is filled in gold and only its options
   show below, after a thin line. */
.reader-summary { margin: 0 0 12px; }
.reader-sheet .reader-sum { min-height: 64px; gap: 3px; }
.reader-sum b { font: 800 9px var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: rgb(239 230 210 / .72); }
.reader-sheet .reader-sum[aria-expanded="true"] { background: var(--ouro-500); border-color: var(--ouro-500); color: var(--navy-700); }
.reader-sum[aria-expanded="true"] b, .reader-sum[aria-expanded="true"] svg { color: var(--navy-700); }
.reader-panel { padding-top: 12px; border-top: 1px solid rgb(239 230 210 / .15); }
.reader-panel[hidden] { display: none; }
.reader-section { margin: 0 0 12px; }
.reader-section h3 { margin: 0 0 6px; font: 800 11px var(--font-ui); text-transform: uppercase; letter-spacing: .07em; color: rgb(239 230 210 / .72); }
.reader-section h3 small { font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: rgb(239 230 210 / .55); }
.reader-tiles { display: flex; gap: 6px; }
.reader-sheet .reader-tile { flex: 1 1 0; min-width: min-content; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 6px 4px; border: 2px solid #4b5d80; border-radius: var(--radius); background: transparent; color: #dbe8f7; box-shadow: none;
  font: 700 12px var(--font-ui); line-height: 1.15; text-align: center; overflow-wrap: normal; }
.reader-tiles .reader-tile span { font-size: clamp(11px, 3vw, 12px); letter-spacing: -.01em; }
.reader-tile svg { width: 22px; height: 22px; color: var(--navy-300); }
.reader-tile span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-tile small { color: #a3adbf; font-size: 10px; font-weight: 600; }
.reader-sheet .reader-tile[aria-pressed="true"] { background: var(--ouro-500); border-color: var(--ouro-500); color: var(--navy-700); }
.reader-tile[aria-pressed="true"] svg { color: var(--navy-700); }
.reader-sheet .reader-tile:disabled { opacity: .55; }
.reader-slider { display: grid; grid-template-columns: auto 1fr 52px; align-items: center; gap: 8px; min-height: 44px; }
.reader-slider label, .reader-switch { display: flex; align-items: center; gap: 8px; margin: 0; color: #efe6d2; font: 600 14px var(--font-ui); }
.reader-slider label { min-width: 0; max-width: 46vw; }
.reader-slider svg, .reader-switch svg { flex: none; width: 20px; height: 20px; color: var(--navy-300); }
.reader-slider input { width: 100%; min-width: 0; margin: 0; accent-color: var(--ouro-500); }
.reader-slider output { text-align: right; font: 700 13px var(--font-ui); color: #dbe8f7; }
.reader-switch { min-height: 48px; cursor: pointer; }
.reader-switch span { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.reader-switch b { font-weight: 700; }
.reader-switch small { color: #a3adbf; font-size: 12px; }
.reader-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.reader-switch i { flex: none; position: relative; width: 40px; height: 22px; border-radius: 999px; background: #4b5d80; transition: background .15s; }
.reader-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #efe6d2; transition: left .15s; }
.reader-switch input:checked + i { background: var(--ouro-500); }
.reader-switch input:checked + i::after { left: 21px; background: var(--navy-700); }
.reader-switch input:focus-visible + i { outline: 3px solid var(--ouro-500); outline-offset: 2px; }
.reader-sheet .reader-tile:focus-visible, .reader-slider input:focus-visible { outline: 3px solid var(--ouro-500); outline-offset: 2px; }
.reader-sheet .error { margin: 0 0 10px; }
/* No "Fechar" on screen (owner, 2026-11-09): a touch on the page, a swipe down or Escape close the menu. The button stays for the keyboard and
   screen readers (TalkBack cannot swipe the sheet away), out of sight until it has the focus. */
.reader-sheet-foot { margin: 0; text-align: right; }
.reader-sheet #sheet-close { min-height: 40px; padding: 6px 16px; border-color: #4b5d80; color: #efe6d2; box-shadow: none; }
.reader-sheet #sheet-close:not(:focus) { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.reader-show-menu { position: absolute; top: 8px; left: 8px; z-index: 6; }
.reader-show-menu:not(:focus) { width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.reader-noscript { position: absolute; left: 16px; right: 16px; bottom: 24px; z-index: 4; text-align: center; }
/* The page turn (EP-331, B2.1; the prototype the owner approved): a layer over the page, laid by reader.js only while a turn runs, so the
   page itself swaps at once. The page below fills the box like the page does; the sheet is the moving page where it is drawn, with the shade on
   the page below, the leaf (clipped for the curl, turned for the hinge) and the SVG of the fold's shadows and the back of the paper. Under the
   comfort layers, like the page. No animation with reduced motion: reader.js does not lay it then. */
.reader-turn { position: absolute; overflow: hidden; pointer-events: none; background: var(--bg); }
.reader-turn[hidden] { display: none; }
.reader-turn.hinge { overflow: visible; }
.reader-turn-under { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.reader-turn-sheet { position: absolute; perspective: 1700px; }
.reader-turn.curl .reader-turn-sheet { overflow: hidden; }
.reader-turn-shade, .reader-turn-leaf, .reader-turn-leaf-shade, .reader-turn-fx { position: absolute; inset: 0; }
.reader-turn-shade, .reader-turn-leaf-shade { opacity: 0; }
.reader-turn-leaf { transform-style: preserve-3d; will-change: transform; }
.reader-turn-face { display: block; width: 100%; height: 100%; }
.reader-turn-fx { width: 100%; height: 100%; overflow: visible; }
.reader-turn.hinge .reader-turn-fx { display: none; }
/* The second group of Paginação (Animação ao virar) and the foot of the sheet: "Marcar como lido" or "Marcar como não lido" (EP-332). */
.reader-section h3.reader-subhead { margin-top: 12px; }
.reader-sheet .reader-mark { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px;
  border: 2px solid #4b5d80; border-radius: var(--radius); background: transparent; color: #efe6d2; box-shadow: none; font: 700 14px var(--font-ui); }
.reader-mark svg { flex: none; width: 20px; height: 20px; color: var(--ouro-500); }
.reader-mark[data-done="on"] svg { color: var(--navy-300); }
.reader-sheet .reader-mark:focus-visible { outline: 3px solid var(--ouro-500); outline-offset: 2px; }
/* Comfort (EP-284): layers over the page inside the app (the browser cannot touch the system brightness or filter). They sit over the page
   image only: under the loading and error state, the hairline, the counter, the menu and the sheet, which stay readable. Off by default. */
.reader-comfort { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.reader-comfort i { position: absolute; inset: 0; opacity: 0; transition: opacity .15s; }
.reader-dim { background: #000; }
.reader-warm { background: #ff8a2a; mix-blend-mode: multiply; }
.reader-amber { background: #ffb000; mix-blend-mode: multiply; }
/* The strip of a reading that goes on (EP-161; mockup C, frame 10): dark like the menu, at the foot over the hairline, with a thin bar that runs
   out while it waits to hide by itself (reader.js, about 4 s). Under the menu, which covers it when open. */
.reader-resume { position: absolute; z-index: 4; left: calc(14px + env(safe-area-inset-left)); right: calc(14px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom)); max-width: 452px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; overflow: hidden; border: 2px solid #efe6d2; border-radius: var(--radius); background: rgb(14 22 38 / .94); color: #efe6d2;
  box-shadow: 4px 4px 0 #000; }
.reader-resume[hidden] { display: none; }
.reader-resume svg { flex: none; width: 20px; height: 20px; color: var(--ouro-500); }
.reader-resume b { display: block; font: 700 14px/1.3 var(--font-ui); }
.reader-resume button { min-height: 44px; margin: 2px 0 -10px -6px; padding: 0 6px; border: 0; background: transparent; box-shadow: none;
  color: var(--ouro-500); font: 700 13px var(--font-ui); text-decoration: underline; }
.reader-resume button:focus-visible { outline: 3px solid var(--ouro-500); outline-offset: 0; }
.reader-resume-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--ouro-500); transform-origin: 0 50%;
  animation: reader-resume-time 4s linear forwards; }
@keyframes reader-resume-time { to { transform: scaleX(0); } }
/* A volume already read (owner, 2026-11-13): the same strip with two choices side by side, wrapping on a narrow screen; it never hides by itself. */
.reader-finished-actions { display: flex; flex-wrap: wrap; gap: 0 18px; }
.reader-finished .reader-finished-actions button { margin: 2px 0 -6px -6px; }
/* The end of the volume (EP-170; mockup C, frame 9): over the last page, which stays under it so a step back shows it at once. The touches go
   through to the page (its edges and swipes still step; a new step forward opens the next volume); only the buttons take them. */
.reader-end { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; overflow-y: auto;
  padding: calc(20px + env(safe-area-inset-top)) calc(28px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(28px + env(safe-area-inset-left));
  background: var(--bg); pointer-events: none; }
.reader-end[hidden] { display: none; }
.reader-end-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.reader-end-cover { width: 128px; height: 178px; object-fit: cover; border: 3px solid var(--navy-700); border-radius: var(--radius); box-shadow: var(--shadow);
  background: var(--surface); }
.reader-end-ok { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-top: 14px; border-radius: 50%;
  background: var(--ok); color: #fff; }
.reader-end-ok svg { width: 22px; height: 22px; }
.reader-end h2 { margin: 6px 0 0; font-size: 22px; color: var(--text); }
.reader-end p { margin: 0 0 10px; color: var(--muted); font: 600 13px/1.5 var(--font-ui); }
.reader-end .button { width: 100%; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; pointer-events: auto; }
.reader-end-next { margin-bottom: 8px; font: 600 13px var(--font-ui); }
.reader.ended .reader-pill, .reader.ended .reader-hair { visibility: hidden; }
/* A short screen (a phone lying down): the box cannot scroll (it lets the touches through), so it drops the cover and tightens, keeping both buttons. */
@media (max-height: 520px) {
  .reader-end { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .reader-end-box { gap: 4px; }
  .reader-end-cover { display: none; }
  .reader-end-ok { width: 28px; height: 28px; margin-top: 0; }
  .reader-end-ok svg { width: 18px; height: 18px; }
  .reader-end h2 { margin: 0; font-size: 18px; }
  .reader-end p { margin: 0 0 4px; line-height: 1.35; }
  .reader-end .button { min-height: 44px; }
  .reader-end-next { margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-bar, .reader-menu.open .reader-bar { transform: none; }
  .reader-resume-bar { animation: none; }
}

/* ---- Recentes (EP-211; mockup B, frame 6a): the volumes read, one row each with the cover, the name, the page, a bar and when. The theme and
   the area come from the tokens, so the rows follow claro, sépia and escuro like the rest of the shell. ---- */
ul.recent { list-style: none; margin: 0; padding: 0; background: color-mix(in srgb, var(--surface) 84%, transparent); border: 2px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.recent-item + .recent-item { border-top: 1px solid var(--border); }
.recent-link { flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 0; min-height: 44px; }
.recent-link:focus-visible { outline-offset: -3px; }
.recent-cover { flex: none; width: 56px; }
.recent-cover .cover { border-width: 2px; }
[data-area="quadrinhos"] .recent-cover .cover { border-color: var(--text); box-shadow: 3px 3px 0 var(--text); }
.recent-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font: 14px/1.3 var(--font-ui); }
.recent-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 800; }
.recent-text small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.recent-text .recent-next { color: var(--accent); font-weight: 700; }
.recent-bar { display: block; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.recent-bar em { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
/* ---- Adicionar à biblioteca (EP-336, #108): the form inside the app frame, the file button like the app's buttons ---- */
.upload { max-width: 560px; }
.upload > p { color: var(--muted); font-size: 14px; margin-top: 0; }
input[type=file]::file-selector-button { margin-right: 12px; padding: 6px 14px; min-height: 36px; border: 2px solid var(--accent); border-radius: var(--radius);
  background: transparent; color: var(--accent); font: 700 14px var(--font-ui); cursor: pointer; }
[data-area="quadrinhos"] input[type=file]::file-selector-button { background: var(--ouro-500); color: var(--navy-700); border-color: var(--navy-700); }
.upload .actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
.upload button.pick { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 6px; text-align: left; color: var(--text); border-color: var(--border); }
.upload button.pick.on { border-color: var(--accent); }
#status { min-height: 1.4em; margin-top: 14px; font-size: 15px; }
#bar { width: 100%; margin-top: 8px; accent-color: var(--accent); }
/* EP-369 (owner, 2026-11-18): the questions open over the page, never below the form, so nothing scrolls; only the dialog scrolls on a small screen */
#ask { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 18px; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
#ask::backdrop { background: rgb(0 0 0 / 45%); }
#ask h2 { margin-top: 0; }
#ask .error[hidden] { display: none; }
.upload img.cover { display: block; width: 72px; height: 108px; object-fit: cover; border: 2px solid var(--border); border-radius: 6px; background: var(--surface); flex: none; }
.upload button.pick img.cover { width: 40px; height: 60px; border-width: 1px; }
.upload .compare { display: flex; gap: 12px; margin: 0 0 14px; }
.upload .compare figure { flex: 1 1 0; min-width: 0; margin: 0; text-align: center; }
.upload .compare img.cover { width: 100%; height: auto; aspect-ratio: 2/3; }
.upload .compare .none { aspect-ratio: 2/3; display: flex; align-items: center; justify-content: center; padding: 8px; border: 2px dashed var(--border); border-radius: 6px; color: var(--muted); font-size: 13px; }
.upload .compare figcaption { color: var(--muted); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
/* EP-369: the kind is the one choice of the form; the file's cover alone (asking its name) is as wide as one of the two side by side */
.upload fieldset.kind { border: 0; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.upload fieldset.kind legend { padding: 0; margin-bottom: 6px; font-weight: 700; }
.upload fieldset.kind label { display: inline-flex; gap: 6px; align-items: center; }
.upload fieldset.kind small { color: var(--muted); }
.upload .compare.single figure { flex: 0 1 50%; }
#ask label { display: block; margin-top: 10px; }
#ask label input { display: block; width: 100%; margin-top: 4px; }
#ask label small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
#status a { font-weight: 700; }

/* ---- the speech balloon (EP-369 U1a4; balloon.js): black line, a tail at the foot, the comic font of the area, the words inside. The kind changes only its
   colours (tokens at the top). Livros (balloon-plain): the same words and colours in a plain centred card, no tail, the regular text font. ---- */
.balloon { --balloon-fill: var(--balloon-info); --balloon-ink: var(--balloon-info-ink);
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; box-sizing: border-box;
  width: max-content; max-width: min(340px, 100%); margin: 0 auto 26px; padding: 18px 26px 20px;
  border: 3px solid var(--balloon-line); border-radius: 44px; background: var(--balloon-fill); color: var(--balloon-ink);
  box-shadow: 4px 4px 0 rgb(0 0 0 / .4); text-align: center; }
.balloon-warning { --balloon-fill: var(--balloon-warning); --balloon-ink: var(--balloon-warning-ink); }
.balloon-error { --balloon-fill: var(--balloon-error); --balloon-ink: var(--balloon-error-ink); }
.balloon-success { --balloon-fill: var(--balloon-success); --balloon-ink: var(--balloon-success-ink); }
/* The tail: the line's triangle, and the fill's a little smaller over it. */
.balloon::before, .balloon::after { content: ""; position: absolute; width: 0; height: 0; border-style: solid; pointer-events: none; }
.balloon::before { left: 26%; bottom: -24px; border-width: 24px 6px 0 20px; border-color: var(--balloon-line) transparent transparent transparent; }
.balloon::after { left: calc(26% + 5px); bottom: -17px; border-width: 18px 3px 0 13px; border-color: var(--balloon-fill) transparent transparent transparent; }
.balloon-text { margin: 0; max-width: 100%; color: inherit; font: 700 18px/1.3 var(--font-body); overflow-wrap: anywhere; }
[data-area="quadrinhos"] .balloon-text { font-family: "Comic Neue", var(--font-body); letter-spacing: .01em; }
.balloon-dots { display: inline-flex; gap: 6px; }
.balloon-dots i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .35; animation: balloon-dot 1.1s ease-in-out infinite; }
.balloon-dots i:nth-child(2) { animation-delay: .18s; }
.balloon-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes balloon-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .balloon-dots i { animation: none; opacity: .7; } }
.balloon .balloon-action { margin: 2px 0 0; }
.balloon.balloon-plain { margin-bottom: 0; padding: 18px 22px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 18px rgb(0 0 0 / .22); }
.balloon.balloon-plain::before, .balloon.balloon-plain::after { content: none; }
.balloon.balloon-plain .balloon-text { font: 400 17px/1.45 var(--font-body); letter-spacing: 0; }

/* ---- Início (EP-382; mock-k-home-leitor, proposal A of EP-278; owner, 2026-11-24): rows of covers that scroll sideways ("Continuar lendo", "Na fila",
   "Chegou na biblioteca", or "Comece por aqui") and "Suas estantes"; with nothing to read, the mascot and the way to add a comic. The
   rows go one under the other on every screen (owner, 2026-11-25); from 720 px, with nothing to go on with, "Comece por aqui" and the arrivals go
   side by side and "Suas estantes" under them. ---- */
.tabbar .tabbar-brand { display: none; }
.home-section { min-width: 0; margin: 0 0 16px; }
/* EP-382 (owner's test, 2026-11-24): the mascot shows between the cards, as in the Biblioteca, and only what is text has a ground of its own: the name
   of each section, its link and the text of each cover are tight labels, nearly opaque (--home-ground). */
.home { --home-ground: color-mix(in srgb, var(--surface) 95%, transparent); }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 8px; }
.home-head h2, .home-head a { padding: 1px 8px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--home-ground); }
.home-head h2 { margin: 0; font-size: 20px; }
.home-head a { flex: none; font: 800 13px var(--font-ui); text-decoration: none; }
.home ul.shelves { background: var(--home-ground); }
.home-row { list-style: none; margin: 0; padding: 2px 2px 8px; display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
/* The cover stands by itself; only its name and what goes with it have a frame (legibility over the mascot, owner 2026-11-16 and 2026-11-24). */
.home-item { flex: none; width: 96px; scroll-snap-align: start; }
/* The play of "Continuar lendo" and "Comece por aqui" (owner, 2026-11-24). */
.home-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 2px solid var(--navy-700); border-radius: 999px; background: var(--ouro-500); color: var(--navy-700); box-shadow: 0 2px 6px rgb(0 0 0 / .4); }
.home-item-info { display: block; margin-top: 3px; padding: 2px 5px 4px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--home-ground); }
.home-item-line { display: block; color: var(--muted); font: 600 11px/1.25 var(--font-ui); }
.home-item-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; color: var(--text); font: 700 12px/1.25 var(--font-body); }
.home-item-number { display: block; color: var(--text); font: 700 12px/1.25 var(--font-body); }
.home-item .recent-bar { margin-top: 3px; }
/* Nothing to read: a translucent card (legible over the mascot of the background), the mascot of the prototype framed in it. */
.home-empty { display: flex; flex-direction: column; align-items: center; max-width: 420px; margin: 8px auto 0; padding: 16px 14px 18px; text-align: center;
  border: 2px solid var(--border); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); }
.home-mascot { width: auto; height: 200px; max-width: 100%; border-radius: var(--radius); }
.home-empty h2 { margin: 6px 0 0; font-size: 24px; }
.home-empty p { max-width: 340px; margin: 6px 0 14px; color: var(--muted); font-weight: 700; }
.home-empty .home-add { display: inline-flex; align-items: center; min-height: 44px; }
.home-link { margin-top: 12px; font: 800 14px var(--font-ui); }
@media (min-width: 720px) {
  .tabbar .tabbar-brand { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; padding: 0; background: none; color: var(--text); font: 800 17px var(--font-ui); }
  .tabbar .tabbar-brand img { width: 28px; height: 28px; }
  .home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; align-items: start; }
  .home-grid > :nth-child(3) { grid-column: 1 / -1; }
  /* "Suas estantes" under the first two: in two columns. */
  .home-grid > :nth-child(3) ul.shelves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid > :nth-child(3) ul.shelves li:nth-child(2) { border-top: 0; }
  .home-grid > .home-section { margin-bottom: 8px; }
  .home-grid > :last-child { margin-bottom: 0; }
  .home-grid .home-row { padding-bottom: 5px; }
}
