@charset "UTF-8";
/* Visualizador de livros — estilos */

@font-face { font-family: 'Open Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/OpenSans-400.woff) format('woff'); }
@font-face { font-family: 'Open Sans'; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/OpenSans-700.woff) format('woff'); }

:root {
  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --top-h: 56px;
  --bot-h: 52px;
  --side-w: 340px;
  --radius: 10px;
  --accent: #d2232a;
  --accent-contrast: #fff;
  --accent-soft: rgba(210, 35, 42, .12);
  --bg: #f4f4f6;
  --surface: #fff;
  --surface-2: #f0f0f3;
  --text: #1b1b1f;
  --muted: #62626b;
  --line: #dcdce2;
  --stage: #e6e6eb;
  --focus: #1a73e8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .10);
  --page-shadow: 0 2px 6px rgba(0, 0, 0, .18), 0 18px 44px rgba(0, 0, 0, .22);
  --mark: rgba(255, 207, 0, .55);
  --mark-now: rgba(255, 140, 0, .75);
  --rd-fs: 1.15;
}

html[data-theme="escuro"] {
  --accent: #ff6b70; --accent-contrast: #1a0a0b; --accent-soft: rgba(255, 107, 112, .16);
  --bg: #16161a; --surface: #1f1f25; --surface-2: #2a2a31; --text: #ececf1; --muted: #a2a2ae; --line: #34343c;
  --stage: #0f0f12; --focus: #8ab4f8; --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .5);
  --mark: rgba(255, 207, 0, .45); color-scheme: dark;
}
html[data-theme="sepia"] {
  --accent: #a4361c; --accent-contrast: #fff; --accent-soft: rgba(164, 54, 28, .12);
  --bg: #f3ead8; --surface: #fbf5e6; --surface-2: #efe4cb; --text: #3b2f1c; --muted: #7a6a4d; --line: #dccfb2;
  --stage: #e5d9bd; --focus: #1a5fb4;
}
html[data-theme="contraste"] {
  --accent: #ffeb3b; --accent-contrast: #000; --accent-soft: rgba(255, 235, 59, .2);
  --bg: #000; --surface: #000; --surface-2: #111; --text: #fff; --muted: #ffeb3b; --line: #fff;
  --stage: #000; --focus: #00e5ff; --shadow: none; --page-shadow: 0 0 0 2px #fff;
  --mark: rgba(255, 235, 59, .75); --mark-now: rgba(0, 229, 255, .8); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--text); background: var(--bg); overflow: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-contrast);
  padding: 10px 14px; border-radius: 8px; text-decoration: none; font-weight: 700; transition: top .15s;
}
.skip:focus { top: 8px; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) var(--bot-h); height: 100%; height: 100dvh; }
.workspace { position: relative; display: flex; min-height: 0; min-width: 0; }
.palco { position: relative; flex: 1; min-width: 0; background: var(--stage); display: flex; flex-direction: column; }
.palco:focus { outline: none; }

/* ---------- barra superior ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; min-height: var(--top-h); padding: 6px 12px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.tb-left, .tb-center, .tb-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.tb-left { flex: 0 1 auto; }
.tb-center { flex: none; margin: 0 auto; }
.tb-right { flex: 0 0 auto; justify-content: flex-end; }

.btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text); transition: background .12s, color .12s, transform .08s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.94); }
.btn[aria-pressed="true"], .btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.btn[disabled] { opacity: .4; cursor: default; pointer-events: none; }
.btn-sm { width: 32px; height: 32px; border-radius: 8px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-left: 4px; }
.brand-logo { width: 32px; height: 32px; color: var(--accent); stroke: none; }
.brand-text { min-width: 0; }
.brand-title { margin: 0; font-size: 15px; line-height: 1.2; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { margin: 0; font-size: 12px; line-height: 1.2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pg-input { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 40px; border-radius: var(--radius); background: var(--surface-2); }
.pg-input input {
  width: 3.2ch; min-width: 3.2ch; border: 0; background: transparent; text-align: right; font-weight: 700; padding: 0;
  -moz-appearance: textfield; appearance: textfield; width: calc(var(--digits, 2) * 1ch + 1.2ch);
}
.pg-input input::-webkit-outer-spin-button, .pg-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pg-input input:focus-visible { outline: none; }
.pg-input:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
#pg-total { color: var(--muted); font-size: 13px; white-space: nowrap; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 12px; margin-right: 6px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-checked="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
html[data-theme="contraste"] .seg-btn[aria-checked="true"] { background: var(--accent); color: var(--accent-contrast); }

.zoom { display: inline-flex; align-items: center; gap: 0; margin-right: 4px; }
.zoom-val {
  min-width: 104px; height: 34px; padding: 0 6px; border: 0; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.zoom-val:hover { background: var(--surface-2); }

/* ---------- painel lateral ---------- */
.sidebar {
  position: relative; flex: none; width: 0; overflow: hidden; background: var(--surface); border-right: 0 solid var(--line);
  visibility: hidden; transition: width .22s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .22s; display: flex; flex-direction: column; z-index: 15;
}
body.panel-open .sidebar { width: var(--side-w); border-right-width: 1px; visibility: visible; transition-delay: 0s; }
.sidebar > * { width: var(--side-w); max-width: 100vw; }
.tabs { display: flex; align-items: stretch; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.tab {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: 1; padding: 6px 2px 8px; border: 0; background: transparent;
  color: var(--muted); font-size: 11.5px; font-weight: 600; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.side-close { display: none; align-self: center; margin-left: 4px; }
.panel { flex: 1; overflow: auto; padding: 12px; overscroll-behavior: contain; }

.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); z-index: 14; }

/* sumário */
.toc { list-style: none; margin: 0; padding: 0; }
.toc-group { margin: 14px 8px 6px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.toc-group:first-child { margin-top: 2px; }
.toc-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; text-align: left;
  border-radius: 10px; color: var(--text);
}
.toc-item:hover { background: var(--surface-2); }
.toc-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.toc-num {
  display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--surface-2);
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.toc-item[aria-current="true"] .toc-num { background: var(--accent); color: var(--accent-contrast); }
.toc-t { flex: 1; min-width: 0; line-height: 1.25; }
.toc-p { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* miniaturas */
.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.thumb { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 2px solid transparent; border-radius: 10px; background: transparent; text-align: center; }
.thumb:hover { background: var(--surface-2); }
.thumb[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
.thumb img { width: 100%; height: auto; display: block; border-radius: 4px; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); background: var(--surface-2); }
.thumb .thumb-n { font-size: 12px; font-weight: 600; color: var(--muted); }
.thumb[aria-current="true"] .thumb-n { color: var(--accent); }
.thumb .thumb-bm { position: absolute; top: 2px; right: 4px; color: var(--accent); width: 22px; height: 22px; fill: currentColor; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
.thumb-wide { grid-column: span 2; }

/* busca */
.search-form { position: sticky; top: -12px; margin: -12px -12px 8px; padding: 12px; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--line); }
.search-box { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.search-box:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; background: var(--surface); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; height: 100%; }
.search-box input:focus-visible { outline: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-nav { display: flex; align-items: center; gap: 4px; margin-top: 8px; min-height: 32px; font-size: 13px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.result {
  display: grid; grid-template-columns: 54px 1fr; gap: 10px; width: 100%; padding: 8px; text-align: left; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface);
}
.result:hover { background: var(--surface-2); }
.result[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
.result img { width: 54px; height: auto; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.result .r-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.result .r-s { font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.result mark, .rd-article mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty svg { width: 36px; height: 36px; opacity: .5; margin-bottom: 8px; }

/* marcadores */
.marks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mark-item { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.mark-item .m-go { display: contents; }
.mark-item img { width: 54px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.mark-item .m-t { font-size: 13.5px; font-weight: 600; }
.mark-item .m-s { font-size: 12px; color: var(--muted); }
.mark-add { width: 100%; margin-bottom: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border: 1px dashed var(--line); background: transparent; border-radius: 12px; font-weight: 600; color: var(--accent); }
.mark-add:hover { background: var(--accent-soft); }

/* ---------- palco: modo livro ---------- */
.stage { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; scrollbar-gutter: stable both-edges; }
.stage.grab { cursor: grab; }
.stage.grabbing { cursor: grabbing; user-select: none; }
.stage-inner { display: grid; min-width: 100%; min-height: 100%; padding: 16px; overflow-x: clip; }
/* ---------- livro aberto: duas páginas lado a lado, com a folha girando ---------- */
.book { position: relative; grid-area: 1 / 1; margin: auto; flex: none; }
.book-shift { position: absolute; inset: 0; perspective: 2800px; perspective-origin: 50% 50%; }
.slot { position: absolute; top: 0; width: 50%; height: 100%; background: var(--bg-page, #fff); }
.slot.l { left: 0; border-radius: 3px 0 0 3px; } .slot.r { left: 50%; border-radius: 0 3px 3px 0; }
/* sombras ficam numa camada atrás das duas páginas: nunca vazam de uma página para a outra */
.under { position: absolute; top: 0; width: 50%; height: 100%; pointer-events: none; border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18), 0 18px 44px rgba(0, 0, 0, .22); }
.under.l { left: 0; } .under.r { left: 50%; }
.slot.empty { background: transparent; box-shadow: none; }
.slot.empty .slot-shade { display: none; }
.face { position: absolute; inset: 0; overflow: hidden; background: var(--bg-page, #fff); user-select: none; -webkit-user-select: none; }
.face-img { position: absolute; top: 0; display: block; height: 100%; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.spine { position: absolute; top: 0; left: 50%; width: 5%; height: 100%; margin-left: -2.5%; pointer-events: none; z-index: 7;
  background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, .035) 46%, rgba(0, 0, 0, .06) 50%, rgba(0, 0, 0, .03) 54%, rgba(0, 0, 0, 0)); }
.leaf { position: absolute; top: 0; width: 50%; height: 100%; z-index: 6; transform-style: preserve-3d; will-change: transform; }
.leaf.fwd { left: 50%; transform-origin: left center; }
.leaf.back { left: 0; transform-origin: right center; }
.leaf-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--bg-page, #fff); }
.leaf-face.back { transform: rotateY(180deg); }
.shade, .slot-shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 4; }
.leaf.fwd .front .shade { background: linear-gradient(to right, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0) 75%); }
.leaf.fwd .back .shade { background: linear-gradient(to left, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0) 75%); }
.leaf.back .front .shade { background: linear-gradient(to left, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0) 75%); }
.leaf.back .back .shade { background: linear-gradient(to right, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0) 75%); }
.slot.r .slot-shade { background: linear-gradient(to right, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0) 55%); }
.slot.l .slot-shade { background: linear-gradient(to left, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0) 55%); }
/* cantos para clicar: viram a página */
.hot { position: absolute; top: 0; bottom: 0; width: 9%; z-index: 8; padding: 0; border: 0; background: transparent; cursor: pointer; }
.hot.l { left: 0; } .hot.r { right: 0; }
.hot::after { content: ""; position: absolute; bottom: 0; width: 0; height: 0; transition: width .18s, height .18s; }
.hot.r::after { right: 0; border-radius: 100% 0 0 0; background: linear-gradient(225deg, var(--stage) 45%, rgba(0, 0, 0, .28) 50%, rgba(255, 255, 255, .9) 56%); }
.hot.l::after { left: 0; border-radius: 0 100% 0 0; background: linear-gradient(135deg, var(--stage) 45%, rgba(0, 0, 0, .28) 50%, rgba(255, 255, 255, .9) 56%); }
.hot:hover::after, .hot:focus-visible::after { width: 7.5%; height: 9%; min-width: 34px; min-height: 34px; }
@media (hover: none) { .hot::after { display: none; } }
.stage { touch-action: pan-y pinch-zoom; }

.textlayer, .hllayer { position: absolute; inset: 0; overflow: hidden; border-radius: 3px; }
.textlayer { user-select: text; -webkit-user-select: text; cursor: text; }
.textlayer span { position: absolute; color: transparent; line-height: 1; white-space: pre; transform-origin: 0 0; }
.textlayer span::selection { background: rgba(26, 115, 232, .35); }
.hllayer { pointer-events: none; mix-blend-mode: multiply; }
html[data-theme="contraste"] .hllayer { mix-blend-mode: normal; }
.hl { position: absolute; background: var(--mark); border-radius: 3px; outline: 1px solid rgba(255, 150, 0, .6); }
.hl.now { background: var(--mark-now); }
.no-textlayer .textlayer { display: none; }

.nav-arrow {
  position: absolute; top: 50%; z-index: 5; display: grid; place-items: center; width: 48px; height: 48px; margin-top: -24px; border: 0; border-radius: 50%;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); opacity: 0; transition: opacity .18s, transform .1s;
}
.nav-arrow.prev { left: 14px; } .nav-arrow.next { right: 14px; }
.palco:hover .nav-arrow, .nav-arrow:focus-visible { opacity: .92; }
.nav-arrow:hover { opacity: 1; transform: scale(1.06); }
.nav-arrow[disabled] { display: none; }
body[data-mode="rolagem"] .nav-arrow, body[data-mode="leitura"] .nav-arrow { display: none; }
@media (hover: none) { .nav-arrow { display: none; } }

/* ---------- modo rolagem ---------- */
.scroll-view { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 20px 16px 60px; scroll-behavior: auto; }
.sc-item { position: relative; margin: 0 auto 22px; background: var(--bg-page, #fff); border-radius: 3px; box-shadow: var(--page-shadow); }
.sc-item img { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .25s; border-radius: 3px; pointer-events: none; }
.sc-item img.ok { opacity: 1; }
.sc-item .sc-n { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); }
.sc-item .textlayer, .sc-item .hllayer { inset: 0; }

/* ---------- modo leitura ---------- */
.reader-view { position: relative; flex: 1; min-height: 0; overflow: auto; background: var(--bg); padding: 28px 16px 90px; }
.rd-head { max-width: 40rem; margin: 0 auto 34px; text-align: center; }
.rd-head h2 { font-size: calc(1.9rem * var(--rd-fs) / 1.15); margin: 0 0 6px; color: var(--accent); }
.rd-head p { margin: 4px 0; color: var(--muted); font-size: .95rem; }
.rd-article { max-width: 40rem; margin: 0 auto 56px; font-size: calc(1rem * var(--rd-fs)); }
.rd-kicker { margin: 0 0 4px; font-size: .75em; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.rd-article h3 { margin: 0 0 14px; font-size: 1.9em; line-height: 1.15; }
.rd-intro { padding: 14px 16px; margin: 0 0 22px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; font-size: .95em; line-height: 1.6; }
.rd-pg {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 26px 0 12px; padding: 0; border: 0; background: transparent; color: var(--muted);
  font-size: .72em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.rd-pg::before, .rd-pg::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.rd-pg:hover { color: var(--accent); }
.rd-stanza { margin: 0 0 1.1em; line-height: 1.7; }
.rd-end { max-width: 40rem; margin: 0 auto; text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- barra inferior ---------- */
.bottombar {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 46%) minmax(0, 1fr); align-items: center; gap: 16px; padding: 0 16px;
  background: var(--surface); border-top: 1px solid var(--line); font-size: 12.5px; z-index: 20;
}
.bb-info { display: flex; gap: 12px; min-width: 0; align-items: center; }
.bb-info.right { justify-content: flex-end; }
.bb-section { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slider-wrap { position: relative; height: 36px; display: flex; align-items: center; }
.ticks { position: absolute; left: 8px; right: 8px; top: 50%; height: 0; pointer-events: none; }
.tick { position: absolute; top: -7px; width: 2px; height: 14px; margin-left: -1px; border-radius: 1px; background: var(--muted); opacity: .55; }
.tick.cordel { background: var(--accent); opacity: .9; }
#slider { position: relative; width: 100%; margin: 0; height: 36px; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
#slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--line) var(--pct, 0%)); }
#slider::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
#slider::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
#slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
#slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
#slider:focus-visible { outline-offset: 0; }
.slider-tip {
  position: absolute; bottom: 42px; left: 0; transform: translateX(-50%); display: grid; gap: 4px; justify-items: center; padding: 6px; border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); pointer-events: none; font-size: 12px; font-weight: 600; z-index: 30;
}
.slider-tip img { width: 120px; height: auto; border-radius: 4px; display: block; }

/* ---------- menus / diálogos / toast ---------- */
.popover {
  position: fixed; z-index: 60; min-width: 250px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.pop-title { margin: 6px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pop-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text);
  text-align: left; text-decoration: none; font-size: 14px;
}
.pop-item:hover { background: var(--surface-2); }
.pop-item .ck { margin-left: auto; opacity: 0; color: var(--accent); }
.pop-item[aria-checked="true"] .ck { opacity: 1; }
.sw { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.sw-claro { background: linear-gradient(135deg, #fff 50%, #f4f4f6 50%); } .sw-escuro { background: linear-gradient(135deg, #1f1f25 50%, #0f0f12 50%); }
.sw-sepia { background: linear-gradient(135deg, #fbf5e6 50%, #e5d9bd 50%); } .sw-contraste { background: linear-gradient(135deg, #000 50%, #ffeb3b 50%); }

.dlg { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 24px 70px rgba(0, 0, 0, .45); }
.dlg::backdrop { background: rgba(10, 10, 14, .55); backdrop-filter: blur(2px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; border-bottom: 1px solid var(--line); margin: 0; }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg-body { padding: 18px 22px 22px; overflow: auto; max-height: calc(100dvh - 130px); }
.info-grid { display: grid; grid-template-columns: 150px 1fr; gap: 20px; }
.info-cover { width: 100%; border-radius: 6px; box-shadow: var(--page-shadow); }
.info-title { margin: 0 0 4px; font-size: 22px; line-height: 1.2; color: var(--accent); }
.info-dl { margin: 12px 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.info-dl dt { color: var(--muted); } .info-dl dd { margin: 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.btn-primary { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-contrast); font-weight: 700; text-decoration: none; }
.btn-primary:hover { filter: brightness(1.08); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; align-items: center; }
.keys dt { white-space: nowrap; } .keys dd { margin: 0; color: var(--muted); }
kbd { display: inline-block; min-width: 24px; padding: 2px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); font: 600 12px var(--font); text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bot-h) + 18px); transform: translateX(-50%); z-index: 80; padding: 10px 16px; border-radius: 12px;
  background: #222; color: #fff; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
html[data-theme="contraste"] .toast { background: #ffeb3b; color: #000; }

#print-area { display: none; }

/* ---------- responsivo ---------- */
@media (max-width: 1400px) {
  .seg-btn span { display: none; }
  .seg-btn { padding: 0 9px; }
  .brand-sub { display: none; }
  .zoom-val { display: none; }
}
@media (max-width: 1100px) {
  .zoom-val { display: none; }
}
@media (max-width: 980px) {
  #btn-full { display: none; }
}
/* ---------- uma página por vez ---------- */
.slot.one { left: 0; width: 100%; border-radius: 3px; }
.under.one { left: 0; width: 100%; }
.leaf.one { left: 0; width: 100%; transform-origin: left center; }
.leaf-face.back.paper { background: #f3efe6; }
.leaf.one .front .shade { background: linear-gradient(to right, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0) 75%); }
.leaf.one .back .shade { background: linear-gradient(to left, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0) 75%); }
.slot.one .slot-shade { background: linear-gradient(to right, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0) 55%); }
.mob-only { display: none; }
.bb-tools { display: none; }

/* ---------- celular e tablet (classe body.mob, definida pelo JavaScript) ---------- */
body.mob { --top-h: 48px; --side-w: min(360px, 90vw); }
body.mob .app { grid-template-rows: auto minmax(0, 1fr) auto; }
body.mob .topbar {
  flex-wrap: nowrap; gap: 2px; min-height: 48px;
  padding: calc(4px + env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left));
}
body.mob .tb-left { flex: 1 1 auto; min-width: 0; }
body.mob .tb-right { flex: 0 0 auto; }
body.mob .brand { gap: 8px; }
body.mob .brand-logo { display: block; width: 28px; height: 28px; }
body.mob .brand-sub, body.mob .zoom, body.mob #btn-theme, body.mob #btn-full { display: none; }
body.mob .brand-title { font-size: 14.5px; }
body.mob .btn { width: 44px; height: 44px; }
body.mob .btn-sm { width: 36px; height: 36px; }
body.mob .aud { margin-right: 2px; }
body.mob .aud-seek, body.mob .aud-time { display: none; }
body.mob .sidebar { position: absolute; top: 0; bottom: 0; left: 0; box-shadow: var(--shadow); }
body.mob.panel-open .sidebar { width: var(--side-w); }
body.mob .side-close { display: inline-grid; }
body.mob .tab { padding: 8px 2px 10px; }
body.mob .mob-only { display: block; }
body.mob .stage-inner { padding: 6px; }
body.mob .nav-arrow, body.mob .hot { display: none; }
@media (hover: none) { .hot { display: none; } }
body.mob .scroll-view { padding: 10px 8px 40px; }
body.mob .reader-view { padding: 20px 14px 70px; }
body.mob .toast { bottom: calc(110px + env(safe-area-inset-bottom)); }

/* barra inferior: progresso + (modos, páginas, marcador) */
body.mob .bottombar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 6px; height: auto;
  padding: 2px max(10px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
body.mob .bottombar > .bb-info { display: none; }
body.mob .slider-wrap { flex: 1 1 100%; order: 1; height: 30px; }
body.mob .bb-tools { display: flex; order: 2; flex: 1 1 100%; align-items: center; justify-content: space-between; gap: 4px; padding-bottom: 2px; }
body.mob .bb-tools .tb-center { display: flex; margin: 0; gap: 0; align-items: center; }
body.mob .bb-tools #btn-first, body.mob .bb-tools #btn-last { display: none; }
body.mob .bb-tools .seg { margin: 0; }
body.mob .bb-tools .seg-btn { height: 40px; padding: 0 12px; }
body.mob .bb-tools .seg-btn span { display: none; }
body.mob .bb-tools .pg-input { height: 44px; padding: 0 10px; }
body.mob .bb-tools .pg-input input { font-size: 16px; }

/* celular deitado: tudo numa faixa só, para sobrar altura para o livro */
body.mob-land { --top-h: 40px; }
body.mob-land .topbar { min-height: 40px; padding-top: 2px; padding-bottom: 2px; }
body.mob-land .btn { width: 38px; height: 38px; }
body.mob-land .brand-logo { width: 24px; height: 24px; }
body.mob-land .bottombar { flex-wrap: nowrap; padding-top: 0; padding-bottom: calc(2px + env(safe-area-inset-bottom)); gap: 10px; }
body.mob-land .bb-tools { order: 1; flex: 0 0 auto; }
body.mob-land .slider-wrap { order: 2; flex: 1 1 auto; }
body.mob-land .bb-tools .btn, body.mob-land .bb-tools .pg-input { height: 38px; }
body.mob-land .bb-tools .btn { width: 38px; }
body.mob-land .bb-tools .seg-btn { height: 34px; }
body.mob-land .toast { bottom: 60px; }

@media (max-width: 400px) {
  body.mob .bb-tools .seg-btn { padding: 0 8px; }
  body.mob .bb-tools .btn { width: 40px; }
  body.mob .bb-tools .pg-input { padding: 0 8px; gap: 3px; }
  body.mob .bb-tools .pg-input input { --digits: 3; }
  body.mob .bb-tools #pg-total { display: none; }
  body.mob .brand-title { font-size: 13.5px; }
}
@media (max-width: 520px) {
  .brand-logo { display: block; }
  .info-grid { grid-template-columns: 1fr; } .info-cover { max-width: 160px; }
  .lb-top { padding-top: calc(8px + env(safe-area-inset-top)); }
}

/* ---------- movimento reduzido ---------- */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { * { transition-duration: .001ms !important; animation-duration: .001ms !important; } }

/* ---------- impressão: só a página atual ---------- */
@media print {
  @page { margin: 8mm; }
  html, body { height: auto; overflow: visible; background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area img { display: block; width: 100%; height: auto; page-break-inside: avoid; }
}

/* ---------- ilustrações clicáveis ---------- */
.ilus-hit {
  position: absolute; z-index: 7; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: zoom-in;
  transition: background .15s, box-shadow .15s;
}
.ilus-hit::after {
  content: ""; position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%; opacity: 0; transform: scale(.8);
  background: rgba(20, 20, 24, .78) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3M11 8v6M8 11h6'/%3E%3C/svg%3E") center / 20px no-repeat;
  transition: opacity .15s, transform .15s; box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.ilus-hit:hover, .ilus-hit:focus-visible { background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .85), inset 0 0 0 5px rgba(210, 35, 42, .75); }
.ilus-hit:hover::after, .ilus-hit:focus-visible::after { opacity: 1; transform: none; }
@media (hover: none) { .ilus-hit::after { opacity: .85; transform: none; } }
.sc-item .ilus-hit { z-index: 5; }

/* ---------- janela de ampliação ---------- */
.lb { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #0b0b0e; color: #fff; animation: lb-in .2s ease-out; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, 0)); position: relative; z-index: 3; }
.lb-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.lb-title strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-title span { font-size: 12.5px; opacity: .7; }
.lb-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.lb-btn { color: #fff; text-decoration: none; }
.lb-btn:hover { background: rgba(255, 255, 255, .16); }
.lb-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .22); color: #fff; }
.lb-zoom { min-width: 84px; height: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.lb-zoom:hover { background: rgba(255, 255, 255, .16); }
.lb-sep { width: 1px; height: 22px; margin: 0 6px; background: rgba(255, 255, 255, .25); }
.lb-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.lb-stage.moving { cursor: grabbing; }
.lb-stage img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; border-radius: 4px; box-shadow: 0 10px 50px rgba(0, 0, 0, .6); background: #fff; -webkit-user-drag: none; }
.lb-stage img.anim { transition: transform .22s cubic-bezier(.2, .7, .2, 1); }
.lb-nav { position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 48px; height: 48px; margin-top: -24px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; backdrop-filter: blur(4px); }
.lb-nav.prev { left: 14px; } .lb-nav.next { right: 14px; }
.lb-nav:hover { background: rgba(255, 255, 255, .28); }
.lb-nav[disabled] { opacity: .25; pointer-events: none; }
.lb-cap { margin: 0; padding: 12px 70px 16px; text-align: center; font-size: 14px; line-height: 1.45; color: rgba(255, 255, 255, .9); background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .65)); position: relative; z-index: 3; min-height: 48px; }
.lb :focus-visible { outline-color: #8ab4f8; }
@media (max-width: 700px) {
  .lb-title { display: none; }
  .lb-top { justify-content: flex-end; }
  .lb-zoom { min-width: 60px; }
  .lb-cap { padding: 10px 14px 14px; font-size: 13px; }
  .lb-nav { width: 40px; height: 40px; margin-top: -20px; }
  .lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; }
}
@media (prefers-reduced-motion: reduce) { .lb { animation: none; } .lb-stage img.anim { transition: none; } }
@media print { .lb { display: none !important; } }

/* ---------- audiolivro: player discreto no topo ---------- */
.aud { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; padding: 2px 2px 2px 3px; border-radius: 999px; background: var(--surface-2); }
.aud-play, .au-big {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-contrast); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .08s, filter .15s;
}
.aud-play:hover, .au-big:hover { filter: brightness(1.1); } .aud-play:active, .au-big:active { transform: scale(.93); }
.aud-play .ic { width: 18px; height: 18px; }
.aud-time { min-width: 34px; padding: 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.aud-seek, .au-range { -webkit-appearance: none; appearance: none; height: 18px; margin: 0; background: transparent; cursor: pointer; }
.aud-seek { width: 88px; }
.aud-seek::-webkit-slider-runnable-track, .au-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line) var(--p, 0%)); }
.aud-seek::-moz-range-track, .au-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.aud-seek::-moz-range-progress, .au-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.aud-seek::-webkit-slider-thumb, .au-range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: var(--accent); border: 0; }
.aud-seek::-moz-range-thumb, .au-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 0; }
.aud-more { position: relative; width: 34px; height: 34px; border-radius: 50%; }
.eq { position: absolute; right: 4px; bottom: 5px; display: none; gap: 1.5px; align-items: flex-end; height: 9px; }
.eq b { display: block; width: 2px; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq b:nth-child(2) { animation-delay: -.3s; } .eq b:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 2px; } 50% { height: 9px; } }
.aud.playing .eq { display: inline-flex; }
.aud-panel { width: 300px; padding: 10px 12px 12px; }
.aud-panel .pop-title { margin-left: 0; }
.au-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.au-range { flex: 1; min-width: 0; }
.au-t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 38px; text-align: center; }
.au-ctrl { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 10px; }
.au-big { width: 46px; height: 46px; } .au-big .ic { width: 22px; height: 22px; }
.au-speeds { display: flex; gap: 4px; margin: 4px 0 8px; }
.au-speeds button { flex: 1; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 12.5px; font-weight: 600; }
.au-speeds button:hover { background: var(--surface-2); }
.au-speeds button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
@media (max-width: 1500px) { .aud-seek, .aud-time { display: none; } }
@media (max-width: 520px) { .aud { margin-right: 0; } .aud-panel { width: min(300px, calc(100vw - 16px)); } }

@media (max-width: 520px) { body.has-audio .zoom { display: none; } }
