/* RockBooks — “sala de leitura”: tecido verde de biblioteca, filetes dourados, estantes de nogueira. */

@font-face { font-family: "Literata RB"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("../fonts/literata-latin-opsz-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata RB"; font-style: italic; font-weight: 200 900; font-display: swap; src: url("../fonts/literata-latin-opsz-italic.woff2") format("woff2"); }
@font-face { font-family: "Figtree RB"; font-weight: 300 900; font-display: swap; src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson RB"; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson RB"; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }

:root {
  --accent: #D4AF61;
  --bg: #0F2424;
  --bg-2: #0B1D1D;
  --surface: #163331;
  --surface-2: #1C3E3B;
  --line: rgba(239, 231, 211, .11);
  --line-2: rgba(239, 231, 211, .2);
  --text: #EFE7D3;
  --muted: #9FB0A7;
  --danger: #E3808A;
  --ok: #7FC9A4;
  --ink-on-accent: #1A1406;
  --walnut-1: #5B4330;
  --walnut-2: #33241A;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .65);
  --display: "Literata RB", "Iowan Old Style", Georgia, serif;
  --ui: "Figtree RB", -apple-system, system-ui, "Segoe UI", sans-serif;
  --r: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

[data-app-theme="dia"] {
  --bg: #E6EAE2;
  --bg-2: #D9DFD6;
  --surface: #F6F7F2;
  --surface-2: #ECEFE8;
  --line: rgba(23, 48, 46, .12);
  --line-2: rgba(23, 48, 46, .22);
  --text: #16302D;
  --muted: #5A6C66;
  --danger: #B33A48;
  --walnut-1: #8A6644;
  --walnut-2: #5C4129;
  --shadow: 0 18px 36px -20px rgba(20, 40, 35, .45);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
}
body.reading { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ic { width: 22px; height: 22px; display: block; }
.ic-wrap { display: inline-flex; flex: none; }
.ic-inline .ic { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.display { font-family: var(--display); font-weight: 500; font-variation-settings: "opsz" 72; letter-spacing: -.012em; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--text); }
.boot svg { width: 56px; height: 56px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; transform: scale(.94); } }

/* ---------------------------------------------------------------- botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; font-weight: 600; font-size: 15px;
  transition: background .15s, transform .1s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--ink-on-accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 0; width: 38px; }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn .ic { width: 19px; height: 19px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: inherit; flex: none;
  transition: background .15s;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.icon-btn:active { transform: scale(.94); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea, textarea, .select, .lib-search {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-size: 16px;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.field input:focus, textarea:focus, .select:focus, .lib-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.select { width: auto; padding-right: 34px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239FB0A7' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, currentColor 8%, transparent); }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; opacity: .75; min-height: 36px; }
.seg button.on { background: var(--accent); color: var(--ink-on-accent); opacity: 1; }
.seg .ic { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- estrutura */
#app { min-height: 100%; }
body.signed-in #app { display: grid; grid-template-columns: 96px 1fr; min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: calc(18px + var(--sat)) 8px calc(18px + var(--sab)) calc(8px + var(--sal));
  background: var(--bg-2); border-right: 1px solid var(--line); z-index: 5;
}
.rail-brand { display: grid; justify-items: center; gap: 4px; text-decoration: none; margin-bottom: 18px; }
.brand-mark svg { width: 34px; height: 34px; color: var(--text); display: block; }
.brand-name { font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.rail-item {
  position: relative; display: grid; justify-items: center; gap: 4px; width: 76px; padding: 10px 0 8px;
  border-radius: 14px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600;
  transition: color .15s, background .15s;
}
.rail-item:hover { color: var(--text); }
.rail-item.on { color: var(--text); background: var(--surface); }
.rail-item.on .ic { color: var(--accent); }
.badge { position: absolute; top: 4px; right: 14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--ink-on-accent); font-size: 11px; display: grid; place-items: center; }
.rail-user { margin-top: auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-family: var(--display); color: var(--accent); flex: none; }
#view { min-width: 0; padding: calc(28px + var(--sat)) calc(40px + var(--sar)) calc(60px + var(--sab)) 40px; outline: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(32px, 4.4vw, 50px); line-height: 1.05; margin: 0 0 6px; }
.page-head p { margin: 0; }

.net { position: fixed; left: 50%; top: calc(10px + var(--sat)); transform: translate(-50%, -150%); z-index: 40;
  display: flex; gap: 10px; align-items: center; max-width: min(640px, 92vw); padding: 10px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.net.show { transform: translate(-50%, 0); }
.net .ic { color: var(--accent); flex: none; }
body.reading .net { display: none; }

@media (max-width: 760px) {
  body.signed-in #app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around;
    padding: 6px 8px calc(6px + var(--sab)); border-right: 0; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-2) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  .rail-brand, .rail-user { display: none; }
  .rail-item { width: auto; flex: 1; padding: 8px 0 6px; }
  .rail-item.on { background: transparent; }
  #view { padding: calc(20px + var(--sat)) 18px calc(96px + var(--sab)); }
}

/* ---------------------------------------------------------------- entrada */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; transition: opacity .38s, transform .38s; }
.auth.leaving { opacity: 0; transform: scale(.985); }
.auth-art { position: relative; overflow: hidden; background:
  radial-gradient(ellipse 70% 55% at 30% 20%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--bg-2);
  display: flex; align-items: center; justify-content: center; padding: 40px; }
.shelf-art { width: min(560px, 90%); display: grid; gap: 34px; }
.sa-row { height: 130px; display: flex; align-items: flex-end; gap: 3px; position: relative; padding: 0 8px; }
.sa-row::after { content: ""; position: absolute; left: -12px; right: -12px; bottom: -14px; height: 14px; border-radius: 2px;
  background: linear-gradient(var(--walnut-1), var(--walnut-2)); box-shadow: 0 10px 18px -6px rgba(0,0,0,.6); }
.sa-row i { display: block; position: relative; border-radius: 2px 2px 1px 1px; box-shadow: inset -2px 0 0 rgba(0,0,0,.25), inset 2px 0 0 rgba(255,255,255,.07);
  animation: rise .7s cubic-bezier(.2,.8,.2,1) both; }
.sa-row i b { position: absolute; left: 3px; right: 3px; top: 16%; height: 2px; background: #D9B66A; opacity: .75; box-shadow: 0 6px 0 #D9B66A; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.auth-card { align-self: center; justify-self: center; width: min(420px, 100%); padding: 40px 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 18px; margin-bottom: 30px; }
.auth-brand .brand-mark svg { width: 30px; height: 30px; }
.auth h1 { font-family: var(--display); font-weight: 500; font-variation-settings: "opsz" 72; font-size: 40px; line-height: 1.08; margin: 0 0 10px; letter-spacing: -.012em; }
.auth-card > p { margin: 0 0 26px; }
.auth-error { color: var(--danger); min-height: 1.5em; margin: 0 0 10px; font-size: 14px; }
.auth-switch { margin-top: 20px; font-size: 15px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-art { padding: calc(30px + var(--sat)) 20px 34px; }
  .shelf-art { gap: 24px; } .sa-row { height: 70px; } .sa-row:nth-child(n+2) { display: none; }
}

/* ---------------------------------------------------------------- capas */
.cover {
  --cloth: #1F4D4A;
  position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 2px 5px 5px 2px; overflow: hidden;
  background: var(--cloth);
  box-shadow: 1px 0 0 #E6DECA, 3px 1px 0 #CBBFA3, 4px 2px 0 rgba(0,0,0,.2), 0 16px 22px -10px rgba(0,0,0,.6);
}
.cover img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.cover.loaded img { opacity: 1; }
.cover::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.38) 0, rgba(255,255,255,.2) 2.6%, rgba(0,0,0,.12) 4.6%, transparent 9%, transparent 92%, rgba(0,0,0,.08)); }
.cover::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(120deg, rgba(255,255,255,.12), transparent 38%); }
.cover-fallback { position: absolute; inset: 0; padding: 14% 12% 12% 16%; display: flex; flex-direction: column; justify-content: center; gap: 8px; text-align: center;
  border: 2px solid rgba(217,182,106,.6); outline: 1px solid rgba(217,182,106,.4); outline-offset: -8px; margin: 7%; }
.cf-title { font-family: var(--display); color: #F1E4C3; font-weight: 600; font-size: clamp(12px, 1.4vw, 18px); line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.cf-author { font-family: var(--display); font-style: italic; color: #E8D9B5; font-size: 11px; opacity: .85; }
.book3d { border: 0; padding: 0; background: none; display: block; width: 100%; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
@media (hover: hover) { .book3d:hover { transform: translateY(-6px) rotate(-.6deg); } }
.book3d:active { transform: scale(.97); }

/* ---------------------------------------------------------------- biblioteca */
.lib-head { align-items: center; }
.search-wrap { position: relative; width: min(340px, 100%); }
.search-wrap .ic-wrap { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-wrap .ic { width: 19px; height: 19px; }
.lib-search { padding-left: 42px; border-radius: 999px; background: var(--surface); }

.hero {
  position: relative; display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: 34px; align-items: center;
  padding: 34px 34px 34px 40px; margin-bottom: 34px; border-radius: 22px; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(ellipse 60% 120% at 12% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 1px, transparent 1px 4px),
    var(--surface);
  border: 1px solid var(--line);
}
.hero::after { content: ""; position: absolute; inset: 10px; border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 15px; pointer-events: none; z-index: -1; }
.hero-cover .cover { box-shadow: 1px 0 0 #E6DECA, 3px 1px 0 #CBBFA3, 5px 2px 0 rgba(0,0,0,.25), 0 30px 40px -18px rgba(0,0,0,.75); }
.hero-kicker { margin: 0 0 8px; color: var(--accent); font-weight: 600; font-size: 14px; }
.hero-title { font-family: var(--display); font-weight: 500; font-variation-settings: "opsz" 72; font-size: clamp(28px, 3.6vw, 44px); line-height: 1.06; margin: 0 0 8px; letter-spacing: -.01em; max-width: 22ch; }
.hero-author { margin: 0 0 18px; font-family: var(--display); font-style: italic; font-size: 18px; color: var(--muted); }
.hero-progress { display: flex; align-items: center; gap: 12px; max-width: 420px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-progress .bar { flex: 1; }
.hero-chapter { margin: 8px 0 0; font-size: 14px; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.hero-quiet { grid-template-columns: 1fr auto; padding: 30px 34px; }
.bar { height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 13%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.goal { display: grid; justify-items: center; gap: 12px; text-decoration: none; padding: 18px 18px 14px; border-radius: 18px; background: color-mix(in srgb, var(--bg) 55%, transparent); border: 1px solid var(--line); min-width: 170px; text-align: center; }
.goal-ring { position: relative; width: 92px; height: 92px; }
.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring circle { fill: none; stroke-width: 7; }
.goal-ring .track { stroke: color-mix(in srgb, var(--text) 12%, transparent); }
.goal-ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.goal-num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.goal-text { display: grid; gap: 2px; }
.goal-text strong { font-size: 15px; }
.goal-streak { display: inline-flex; gap: 4px; align-items: center; justify-content: center; color: var(--accent); font-size: 13px; font-weight: 600; margin-top: 4px; }
.goal-streak .ic { width: 16px; height: 16px; }

.lib-tools { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.lib-tools-right { display: flex; gap: 6px; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: transparent; border-radius: 999px; min-height: 40px; padding: 0 14px; font-weight: 600; font-size: 14px; display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.chip .count { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }

.shelf.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); row-gap: 40px; column-gap: 0; }
.book { position: relative; min-width: 0; }
.shelf.grid .book { padding: 0 16px; }
.shelf.grid .book-stand { position: relative; padding: 0 6% 0; }
.shelf.grid .book-stand::after { content: ""; position: absolute; left: -16px; right: -16px; bottom: -13px; height: 13px; z-index: -1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--walnut-1) 100%, #fff 12%) 0 2px, var(--walnut-1) 2px, var(--walnut-2));
  box-shadow: 0 12px 18px -8px rgba(0,0,0,.55); }
.shelf.grid .book-stand { isolation: isolate; }
.book-fav { position: absolute; top: -6px; right: 2%; z-index: 2; color: var(--accent); filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.book-fav .ic { width: 20px; height: 20px; fill: var(--accent); }
.book-meta { position: relative; padding: 24px 30px 0 0; }
.book-meta h3 { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.book-author { margin: 2px 0 8px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.book-line .bar { flex: 1 1 50px; height: 4px; }
.book-status { font-weight: 700; font-variant-numeric: tabular-nums; }
.book-status.concluido { color: var(--ok); }
.book-offline .ic { width: 15px; height: 15px; color: var(--accent); }
.book-fmt { opacity: .75; }
.book-more { position: absolute; right: -10px; top: 14px; color: var(--muted); }
.shelf.grid .book { animation: settle .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 28ms); }
@keyframes settle { from { opacity: 0; transform: translateY(14px); } }
#view[data-route="biblioteca"].settled .book { animation: none; }

.shelf.list { display: grid; gap: 2px; }
.shelf.list .book { display: grid; grid-template-columns: 54px 1fr; gap: 16px; align-items: center; padding: 10px 8px; border-radius: 12px; }
.shelf.list .book:hover { background: var(--surface); }
.shelf.list .book-meta { padding: 0 44px 0 0; }
.shelf.list .book-more { top: 50%; transform: translateY(-50%); right: 0; }
.shelf.list .cover { box-shadow: 1px 0 0 #E6DECA, 0 8px 12px -6px rgba(0,0,0,.6); }
.shelf.list .cover-fallback { margin: 4%; padding: 6%; outline: 0; }
.shelf.list .cf-author { display: none; }
.shelf.list .book-fav { top: -4px; right: -4px; }
.shelf-empty { padding: 30px 0; }

.empty-lib { text-align: center; padding: 60px 20px; display: grid; justify-items: center; gap: 6px; }
.empty-lib h2 { font-family: var(--display); font-weight: 500; font-size: 30px; margin: 22px 0 0; }
.empty-lib p { max-width: 44ch; margin: 0 0 18px; }
.empty-shelf { position: relative; width: 240px; height: 120px; display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.empty-shelf::after { content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 12px; background: linear-gradient(var(--walnut-1), var(--walnut-2)); border-radius: 2px; }
.empty-shelf i { width: 26px; border: 1.5px dashed var(--line-2); border-bottom: 0; border-radius: 3px 3px 0 0; }
.empty-shelf i:nth-child(1) { height: 70%; } .empty-shelf i:nth-child(2) { height: 92%; } .empty-shelf i:nth-child(3) { height: 80%; transform: rotate(8deg); transform-origin: bottom left; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: minmax(110px, 160px) 1fr; padding: 28px; gap: 26px; }
  .hero .goal { grid-column: 1 / -1; grid-template-columns: auto 1fr; justify-items: start; text-align: left; align-items: center; }
  .goal .goal-ring { width: 70px; height: 70px; } .goal-num { font-size: 22px; }
  .goal-streak { justify-content: flex-start; }
  .hero-quiet .goal { grid-column: auto; }
}
@media (max-width: 560px) {
  .hero { grid-template-columns: 96px 1fr; padding: 20px; gap: 18px; align-items: start; }
  .hero-author { font-size: 15px; margin-bottom: 12px; }
  .hero-actions { margin-top: 14px; }
  .shelf.grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .shelf.grid .book { padding: 0 10px; }
  .shelf.grid .book-stand::after { left: -10px; right: -10px; }
  .lib-tools-right .select { max-width: 170px; }
}

/* ---------------------------------------------------------------- folhas, menus e avisos */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(4, 12, 12, .55); display: grid; place-items: center; padding: 20px; animation: fade .2s; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-backdrop.out { animation: fade .2s reverse forwards; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(480px, 100%); max-height: min(86dvh, 760px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); animation: pop .28s cubic-bezier(.2,.8,.2,1); }
.sheet.wide { width: min(720px, 100%); }
@keyframes pop { from { transform: translateY(18px) scale(.98); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 12px 6px 24px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 22px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sheet-body { padding: 8px 24px 20px; }
.sheet-body > p { margin: 0 0 8px; line-height: 1.55; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .sheet-backdrop { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: var(--sab); animation: up .3s cubic-bezier(.2,.8,.2,1); }
  @keyframes up { from { transform: translateY(100%); } }
}
.book-menu .bm-info { display: grid; grid-template-columns: 84px 1fr; gap: 16px; align-items: start; margin-bottom: 18px; }
.bm-author { margin: 0 0 4px; font-family: var(--display); font-style: italic; font-size: 17px; }
.bm-desc { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.menu-shelves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 14px; background: var(--bg-2); margin-bottom: 12px; }
.menu-opt { border: 0; background: transparent; min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.menu-opt.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.menu-list { display: grid; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 6px; border: 0; background: none; border-radius: 10px; text-align: left; font-size: 16px; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .ic { color: var(--muted); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.edit-book { display: grid; grid-template-columns: 120px 1fr; gap: 20px; }
.edit-book .btn { margin-top: 12px; width: 100%; }
@media (max-width: 480px) { .edit-book { grid-template-columns: 1fr; } .edit-cover { width: 120px; } }

#toasts { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; width: min(520px, calc(100vw - 28px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-radius: 14px;
  background: #EFE7D3; color: #16302D; box-shadow: 0 16px 36px -14px rgba(0,0,0,.6); font-size: 15px; font-weight: 500; animation: toastIn .32s cubic-bezier(.2,.8,.2,1); }
.toast.out { opacity: 0; transform: translateY(10px); transition: .25s; }
.toast-action { border: 0; background: #16302D; color: #EFE7D3; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }
@media (max-width: 760px) { body.signed-in:not(.reading) #toasts { bottom: calc(86px + var(--sab)); } }

/* ---------------------------------------------------------------- envio */
.drop {
  position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 54px 24px 46px; border-radius: 24px; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: background .2s, border-color .2s, transform .2s;
}
.drop:hover, .drop.over { background: var(--surface); border-color: var(--accent); }
.drop.over { transform: scale(1.01); }
.drop h2 { font-family: var(--display); font-weight: 500; font-size: 28px; margin: 16px 0 0; }
.drop p { margin: 0 0 18px; }
.drop-stack { position: relative; width: 90px; height: 70px; }
.drop-stack i { position: absolute; bottom: 0; width: 46px; height: 64px; left: 22px; border-radius: 2px 5px 5px 2px; background: #1F4D4A; box-shadow: 1px 0 0 #E6DECA, 3px 1px 0 #CBBFA3, 0 10px 16px -8px rgba(0,0,0,.6); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.drop-stack i:nth-child(1) { background: #5A2A36; transform: rotate(-14deg) translateX(-20px); }
.drop-stack i:nth-child(2) { background: #2B3A67; transform: rotate(10deg) translateX(18px); }
.drop-stack i:nth-child(3) { background: var(--accent); }
.drop.over .drop-stack i:nth-child(3), .drop:hover .drop-stack i:nth-child(3) { transform: translateY(-12px); }
.formats { text-align: center; margin: 14px auto 0; max-width: 62ch; }
.formats b { color: var(--text); font-weight: 600; }
.up-list { margin-top: 34px; display: grid; gap: 10px; }
.up-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 4px; }
.up-head h2 { font-family: var(--display); font-weight: 500; font-size: 24px; margin: 0; }
.up-head .link { margin-left: auto; font-size: 14px; }
.up-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 16px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); animation: pop .3s cubic-bezier(.2,.8,.2,1); }
.up-cover { width: 52px; aspect-ratio: 2/3; border-radius: 2px 4px 4px 2px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; box-shadow: 1px 0 0 #E6DECA, 0 6px 10px -5px rgba(0,0,0,.5); }
.up-cover img { width: 100%; height: 100%; object-fit: cover; animation: fade .4s; }
.up-fmt { font-size: 10px; font-weight: 700; color: var(--muted); }
.up-main { min-width: 0; display: grid; gap: 3px; }
.up-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; min-width: 0; }
.up-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.up-author:empty { display: none; }
.up-bar { height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; margin: 4px 0 2px; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.stage-reading .up-bar i, .stage-checking .up-bar i, .stage-waiting .up-bar i, .stage-saving .up-bar i { width: 30% !important; animation: indet 1.2s ease-in-out infinite; background: color-mix(in srgb, var(--accent) 70%, transparent); }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.stage-done .up-bar i { background: var(--ok); }
.stage-done .up-stage { color: var(--ok); font-weight: 600; }
.stage-error .up-stage { color: var(--danger); font-weight: 600; }
.stage-duplicate .up-bar i { background: var(--muted); }
.up-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- estatísticas */
.stats { display: grid; gap: 22px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { padding: 18px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.stat-label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); font-weight: 600; }
.stat-label .ic { width: 17px; height: 17px; color: var(--accent); }
.stat-value { font-family: var(--display); font-size: 32px; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; }
.panel-card { padding: 22px 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.panel-card h2 { font-family: var(--display); font-weight: 500; font-size: 22px; margin: 0 0 16px; }
.pc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.pc-head h2, .pc-head h3 { margin: 0; }
.goal-edit { display: flex; align-items: center; gap: 2px; }
.goal-edit strong { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.goal-edit .muted { margin-right: 6px; }
.bars { position: relative; height: 210px; display: grid; grid-template-columns: repeat(14, 1fr); gap: 8px; align-items: end; padding-top: 24px; margin-top: 10px; }
.bars-goal { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--accent) 70%, transparent); pointer-events: none; margin-bottom: 24px; }
.bars-goal span { position: absolute; right: 0; top: -20px; font-size: 11px; color: var(--accent); font-weight: 600; }
.bar-col { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 6px; text-align: center; }
.bar-col small { color: var(--muted); font-size: 11px; height: 18px; }
.bar-col.today small { color: var(--text); font-weight: 700; }
.bar-v { align-self: end; position: relative; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--text) 22%, transparent); min-height: 0; transition: height .6s cubic-bezier(.2,.8,.2,1); }
.bar-col.hit .bar-v { background: var(--accent); }
.bar-v span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.top-books { display: grid; gap: 4px; }
.top-book { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; text-align: left; border: 0; background: none; padding: 8px; border-radius: 12px; }
.top-book:hover { background: var(--surface-2); }
.top-book .cover { box-shadow: 1px 0 0 #E6DECA, 0 6px 10px -5px rgba(0,0,0,.5); }
.top-book .cover-fallback { margin: 3%; padding: 4%; outline: 0; } .top-book .cf-author { display: none; } .top-book .cf-title { font-size: 8px; }
.tb-main { min-width: 0; display: grid; gap: 2px; }
.tb-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-main .bar { margin-top: 6px; max-width: 360px; height: 4px; }
.tb-time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
@media (max-width: 560px) { .bars { gap: 4px; } .bar-v span { display: none; } }

/* ---------------------------------------------------------------- ajustes */
.settings { display: grid; gap: 18px; max-width: 760px; }
.set-sec { padding: 22px 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.set-sec h2 { display: flex; gap: 8px; align-items: center; font-family: var(--display); font-weight: 500; font-size: 22px; margin: 0 0 16px; }
.set-sec h2 .ic { color: var(--accent); }
.set-sec h3 { font-size: 16px; margin: 18px 0 8px; }
.set-row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.set-row .field { flex: 1; margin: 0; }
.set-row.stack { flex-direction: column; align-items: flex-start; gap: 8px; }
.set-row .btn { margin-bottom: 4px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle-row > span:first-child { display: grid; gap: 2px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 15px; background: color-mix(in srgb, var(--text) 20%, transparent); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .22s cubic-bezier(.2,.8,.2,1); box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.usage { margin: 14px 0; }
.usage p { margin: 0; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { border: 0; background: none; display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--muted); padding: 0; }
.swatch::before { content: ""; width: 40px; height: 40px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(0,0,0,.15); transition: transform .15s; }
.swatch.on::before { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
.swatch.on { color: var(--text); font-weight: 600; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.5; }
.ok-line { display: flex; gap: 8px; align-items: center; margin: 0; }
.ok-line .ic { color: var(--ok); }
.users { display: grid; gap: 2px; margin-top: 8px; }
.user-row { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ur-main { flex: 1; min-width: 0; display: grid; }
.ur-actions { display: flex; gap: 6px; }
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); font-size: 11px; font-weight: 700; vertical-align: 2px; }
.about { text-align: center; margin-top: 8px; }
@media (max-width: 560px) { .user-row { flex-wrap: wrap; } .ur-actions { width: 100%; padding-left: 50px; } .set-row { flex-direction: column; align-items: stretch; } }

/* ================================================================ LEITOR */
.reader {
  --r-bg: #FAF8F2; --r-fg: #1F201C;
  position: fixed; inset: 0; z-index: 50; background: var(--r-bg); color: var(--r-fg); outline: none; overflow: hidden;
  font-family: var(--ui);
}
.reader.fade-in { animation: fade .35s; }
.reader.closing { opacity: 0; transform: scale(.985); transition: opacity .28s, transform .28s; }
.reader-stage { position: absolute; inset: 0; top: var(--sat); bottom: var(--sab); left: var(--sal); right: var(--sar); will-change: transform; backface-visibility: hidden; }
.reader-stage foliate-view { display: block; width: 100%; height: 100%; }
.reader-light { position: absolute; inset: 0; pointer-events: none; z-index: 3; transition: background .2s, box-shadow .2s; }

.reader-top, .reader-bottom {
  position: absolute; left: 0; right: 0; z-index: 6; color: var(--r-fg);
  background: var(--r-bg); background: color-mix(in srgb, var(--r-bg) 90%, transparent);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .25s;
}
.reader-top { top: 0; display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--sat)) calc(10px + var(--sar)) 6px calc(10px + var(--sal)); transform: translateY(-105%); opacity: 0; border-bottom: 1px solid color-mix(in srgb, var(--r-fg) 10%, transparent); }
.reader-bottom { bottom: 0; padding: 12px calc(26px + var(--sar)) calc(10px + var(--sab)) calc(26px + var(--sal)); transform: translateY(105%); opacity: 0; border-top: 1px solid color-mix(in srgb, var(--r-fg) 10%, transparent); }
.reader.chrome .reader-top, .reader.chrome .reader-bottom { transform: none; opacity: 1; }
.rt-title { flex: 1; min-width: 0; display: grid; text-align: center; line-height: 1.25; }
.rt-title strong { font-family: var(--display); font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-chapter { font-size: 13px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-actions { display: flex; }
.rt-bm.on .ic { fill: var(--accent); color: var(--accent); }
.reader::after { content: ""; position: absolute; top: 0; right: 34px; width: 22px; height: 0; z-index: 4; pointer-events: none;
  background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); transition: height .35s cubic-bezier(.2,.8,.2,1); }
.reader.bookmarked::after { height: calc(46px + var(--sat)); }
.reader.chrome::after { height: 0; }

.rb-track { position: relative; height: 30px; display: flex; align-items: center; }
.rb-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; position: relative; z-index: 1; }
.rb-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--r-fg) 18%, transparent); }
.rb-slider::-moz-range-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--r-fg) 18%, transparent); }
.rb-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); margin-top: -9px; box-shadow: 0 2px 8px rgba(0,0,0,.3); border: 3px solid var(--r-bg); }
.rb-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--r-bg); }
.rb-ticks { position: absolute; left: 11px; right: 11px; top: 50%; height: 10px; transform: translateY(-50%); pointer-events: none; }
.rb-ticks i { position: absolute; top: 0; width: 1px; height: 10px; background: color-mix(in srgb, var(--r-fg) 28%, transparent); }
.rb-bubble { position: absolute; bottom: 34px; transform: translateX(-50%); padding: 5px 10px; border-radius: 8px; background: var(--r-fg); color: var(--r-bg); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; }
.rb-bubble.show { opacity: 1; }
.reader-info { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ri-left { opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-center { border: 0; background: none; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.ri-center:hover { background: color-mix(in srgb, var(--r-fg) 8%, transparent); }
.ri-right { text-align: right; opacity: .7; white-space: nowrap; }
.reader-peek { position: absolute; left: 50%; bottom: calc(10px + var(--sab)); transform: translateX(-50%); z-index: 2; font-size: 12px; opacity: .42; pointer-events: none; font-variant-numeric: tabular-nums; transition: opacity .2s; }
.reader.chrome .reader-peek { opacity: 0; }

.reader-loading { position: absolute; inset: 0; z-index: 9; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--r-bg); transition: opacity .45s; }
.reader-loading.done { opacity: 0; pointer-events: none; }
.rl-text { font-family: var(--display); font-style: italic; font-size: 18px; opacity: .75; }
.rl-bar { width: 200px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--r-fg) 14%, transparent); overflow: hidden; }
.rl-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }

.turn-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.turn-shade.fwd { background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.0) 40%, rgba(0,0,0,.18) 70%, rgba(255,255,255,.08) 74%, transparent 90%); animation: shadeFwd .43s ease-out forwards; }
.turn-shade.back { background: linear-gradient(270deg, transparent 0%, rgba(0,0,0,.0) 40%, rgba(0,0,0,.18) 70%, rgba(255,255,255,.08) 74%, transparent 90%); animation: shadeBack .43s ease-out forwards; }
@keyframes shadeFwd { from { transform: translateX(40%); opacity: 1; } to { transform: translateX(-90%); opacity: 0; } }
@keyframes shadeBack { from { transform: translateX(-40%); opacity: 1; } to { transform: translateX(90%); opacity: 0; } }

/* painel lateral do leitor */
.reader-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); z-index: 8; display: flex; flex-direction: column;
  background: var(--r-bg); background: color-mix(in srgb, var(--r-bg) 93%, var(--r-fg));
  border-left: 1px solid color-mix(in srgb, var(--r-fg) 12%, transparent);
  box-shadow: -24px 0 50px -30px rgba(0,0,0,.5); transform: translateX(102%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  padding-top: var(--sat); padding-right: var(--sar);
}
.reader-panel.open { transform: none; }
.rp-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; }
.rp-tabs { flex: 1; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--r-fg) 8%, transparent); }
.rp-tabs button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; opacity: .7; }
.rp-tabs button.on { background: var(--r-bg); opacity: 1; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.rp-body { flex: 1; overflow-y: auto; padding: 6px 12px calc(24px + var(--sab)); -webkit-overflow-scrolling: touch; }
.rp-empty { padding: 20px 10px; opacity: .7; line-height: 1.55; }
.toc, .toc ol { list-style: none; margin: 0; padding: 0; }
.toc ol { padding-left: 16px; }
.toc-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 11px 10px; border-radius: 10px; font-size: 15px; line-height: 1.35; }
.toc-item:hover { background: color-mix(in srgb, var(--r-fg) 7%, transparent); }
.toc-item.current { color: var(--accent); font-weight: 700; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.toc-item small { opacity: .55; font-variant-numeric: tabular-nums; }
.notes { display: grid; gap: 2px; }
.note-item { display: flex; align-items: flex-start; gap: 4px; border-bottom: 1px solid color-mix(in srgb, var(--r-fg) 9%, transparent); }
.note-go { flex: 1; display: flex; gap: 12px; text-align: left; border: 0; background: none; padding: 12px 6px; min-width: 0; }
.note-swatch { width: 6px; align-self: stretch; border-radius: 3px; flex: none; }
.note-kind .ic { width: 20px; height: 20px; color: var(--accent); fill: var(--accent); }
.note-text { display: grid; gap: 4px; min-width: 0; font-size: 15px; line-height: 1.45; }
.note-quote { font-family: var(--display); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.note-note { font-size: 14px; padding-left: 10px; border-left: 2px solid var(--accent); }
.note-text small { opacity: .55; }
.note-del { opacity: .5; margin-top: 6px; }
.note-del:hover { opacity: 1; color: var(--danger); }
.rp-search { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--r-fg) 20%, transparent); background: var(--r-bg); color: var(--r-fg); font-size: 16px; margin-top: 4px; }
.rp-status { font-size: 13px; opacity: .65; margin: 10px 4px; }
.search-results { display: grid; gap: 2px; }
.search-hit { display: grid; gap: 3px; text-align: left; border: 0; background: none; padding: 10px 8px; border-radius: 10px; font-size: 14px; line-height: 1.45; }
.search-hit:hover { background: color-mix(in srgb, var(--r-fg) 7%, transparent); }
.search-hit small { opacity: .55; font-weight: 600; }
.search-hit mark { background: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* aparência do leitor */
.reader-settings {
  position: absolute; top: calc(62px + var(--sat)); right: calc(12px + var(--sar)); z-index: 9; width: min(400px, calc(100vw - 24px));
  max-height: calc(100dvh - 90px - var(--sat)); overflow-y: auto; padding: 18px; border-radius: 20px;
  background: var(--r-bg); background: color-mix(in srgb, var(--r-bg) 95%, var(--r-fg)); color: var(--r-fg);
  border: 1px solid color-mix(in srgb, var(--r-fg) 12%, transparent); box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(-8px) scale(.98); transform-origin: top right; transition: opacity .2s, transform .22s cubic-bezier(.2,.8,.2,1);
}
.reader-settings.open { opacity: 1; transform: none; }
.rs-themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.rs-theme { border: 1px solid rgba(128,128,128,.35); border-radius: 14px; padding: 10px 0 8px; display: grid; justify-items: center; gap: 2px; }
.rs-theme.on { box-shadow: 0 0 0 2px var(--accent); border-color: transparent; }
.rs-aa { font-family: var(--display); font-size: 20px; font-weight: 600; }
.rs-theme small { font-size: 11px; opacity: .8; }
.rs-size { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-radius: 14px; background: color-mix(in srgb, var(--r-fg) 7%, transparent); margin-bottom: 12px; }
.rs-step { border: 0; background: none; min-height: 48px; font-family: var(--display); font-weight: 600; border-radius: 14px; }
.rs-step:active { background: color-mix(in srgb, var(--r-fg) 10%, transparent); }
.rs-size-val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 40px; text-align: center; opacity: .7; }
.rs-fonts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.rs-fonts button { border: 1px solid color-mix(in srgb, var(--r-fg) 15%, transparent); background: none; border-radius: 10px; min-height: 42px; font-size: 16px; }
.rs-fonts button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.rs-row { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--r-fg) 9%, transparent); }
.rs-label { font-size: 13px; font-weight: 600; opacity: .65; }
.rs-row .seg { background: color-mix(in srgb, var(--r-fg) 7%, transparent); }
.rs-row input[type=range] { width: 100%; accent-color: var(--accent); }

/* menu de seleção */
.sel-pop { position: fixed; left: 0; top: 0; z-index: 11; display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 16px;
  background: #1D2422; color: #F1EBDD; box-shadow: 0 18px 40px -12px rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .15s; }
.sel-pop.show { opacity: 1; pointer-events: auto; }
.sp-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); margin: 0 2px; }
.sp-color.on { border-color: #fff; }
.sp-sep { width: 1px; height: 24px; background: rgba(255,255,255,.2); margin: 0 4px; }
.sp-btn { border: 0; background: none; color: inherit; display: inline-grid; justify-items: center; gap: 1px; font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 10px; }
.sp-btn .ic { width: 19px; height: 19px; }
.sp-btn:hover { background: rgba(255,255,255,.1); }
.sp-btn.danger { color: #F3A0A8; }
.note-quote-box { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--accent); font-family: var(--display); font-style: italic; color: var(--muted); max-height: 140px; overflow: auto; }

/* leitura em voz alta */
.speech-bar { position: absolute; left: 50%; bottom: calc(20px + var(--sab)); transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 16px; border-radius: 999px; background: #1D2422; color: #F1EBDD; box-shadow: 0 18px 40px -12px rgba(0,0,0,.55); font-size: 14px; font-weight: 600; animation: pop .3s; }
.speech-bar .icon-btn { width: 40px; height: 40px; }
.sb-rate { border: 0; background: rgba(255,255,255,.12); color: inherit; border-radius: 999px; padding: 6px 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-wave { display: inline-flex; gap: 2px; align-items: center; height: 16px; margin-right: 4px; }
.sb-wave i { width: 3px; height: 100%; border-radius: 2px; background: var(--accent); animation: wave 1s ease-in-out infinite; }
.sb-wave i:nth-child(2) { animation-delay: .15s; } .sb-wave i:nth-child(3) { animation-delay: .3s; } .sb-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 50% { transform: scaleY(.35); } }
.reader.chrome .speech-bar { bottom: calc(100px + var(--sab)); }

/* PDF */
.pdf-root { position: absolute; inset: 0; }
.pdf-viewport { position: absolute; inset: 0; overflow: hidden; display: flex; touch-action: pan-y pinch-zoom; }
.pdf-viewport.zoomed { overflow: auto; -webkit-overflow-scrolling: touch; touch-action: auto; }
.pdf-sheet { margin: auto; display: flex; align-items: center; justify-content: center; padding: 0; will-change: transform; }
.pdf-page { position: relative; }
.pdf-page canvas { display: block; box-shadow: 0 10px 30px -12px rgba(0,0,0,.45); }
.pdf-page.left canvas { box-shadow: -8px 10px 30px -12px rgba(0,0,0,.45); }
.pdf-page.left::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 40px; background: linear-gradient(90deg, transparent, rgba(0,0,0,.14)); pointer-events: none; }
.pdf-page.right::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40px; background: linear-gradient(270deg, transparent, rgba(0,0,0,.12)); pointer-events: none; }
.pdf-scrolled { overflow-y: auto; overflow-x: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: calc(66px + var(--sat)) 0 calc(80px + var(--sab)); -webkit-overflow-scrolling: touch; }
.pdf-slot { flex: none; background: #fff; box-shadow: 0 8px 24px -12px rgba(0,0,0,.45); }
.pdf-slot canvas { display: block; }
.reader-stage[data-tint="sepia"] canvas { filter: sepia(.35) saturate(.95) brightness(.97); }
.reader-stage[data-tint="nevoa"] canvas { filter: saturate(.85) brightness(.95) hue-rotate(-8deg); }
.reader-stage[data-tint="noite"] canvas { filter: invert(.88) hue-rotate(180deg) brightness(.95) contrast(.95); }
.reader-stage[data-tint="breu"] canvas { filter: invert(1) hue-rotate(180deg) brightness(.85); }
.reader-stage[data-tint="noite"] .pdf-slot, .reader-stage[data-tint="breu"] .pdf-slot { background: #222; }

/* abertura do livro */
.ob-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.ob-book { position: absolute; }
.ob-pages { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-radius: 2px 6px 6px 2px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6);
  background-image: repeating-linear-gradient(0deg, transparent 0 14px, rgba(0,0,0,.035) 14px 15px); }
.ob-front { position: absolute; inset: 0; transform-origin: left center; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 2px 6px 6px 2px; overflow: hidden; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); }
.ob-front img, .ob-front .cover { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 600px) {
  .reader-bottom { padding-left: 16px; padding-right: 16px; }
  .reader-info { grid-template-columns: 1fr auto; }
  .ri-left { display: none; }
  .rt-actions .icon-btn { width: 40px; }
  .reader-settings { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(8px + var(--sab)); max-height: 76dvh; transform-origin: bottom center; }
  .sel-pop { flex-wrap: wrap; max-width: calc(100vw - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* contraste do destaque no tema claro */
[data-app-theme="dia"] .hero-kicker, [data-app-theme="dia"] .goal-streak, [data-app-theme="dia"] .link, [data-app-theme="dia"] .bars-goal span, [data-app-theme="dia"] .up-pct { color: color-mix(in srgb, var(--accent) 55%, #10201e); }

/* ---------------------------------------------------------------- versão local */
.offline-badge { display: flex; align-items: center; gap: 10px; margin: -8px 0 24px; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--muted); }
.offline-badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.offline-badge .ic { width: 19px; height: 19px; flex: none; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 25%, transparent); border-top-color: var(--accent); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.welcome-install { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.welcome-install h2 { font-family: var(--display); font-weight: 500; font-size: 20px; margin: 0 0 12px; }
.welcome-install .steps { font-size: 15px; margin-bottom: 10px; }
.welcome-install .btn { margin-bottom: 10px; }
.avatar.ready { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px color-mix(in srgb, var(--ok) 70%, transparent); }
.storage-meter { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--text) 12%, transparent); overflow: hidden; margin: 10px 0 6px; }
.storage-meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; min-width: 3px; }
