:root {
  --creme: #FBF6F1;
  --fundo-leitura: #EFE6DD;
  --papel: #FFFFFF;
  --pessego: #F8E7DC;
  --azul: #4E6D8C;
  --azul-claro: #E7EEF4;
  --coral: #E48A73;
  --coral-escuro: #B0513C;
  --tinta: #2D3946;
  --tinta-suave: #596777;
  --borda: #EADFD5;
  --verde: #3F8A6B;
  --erro: #A33A2A;
  --raio: 16px;
  --sombra: 0 10px 30px -12px rgba(45, 57, 70, .25);
  --titulo: "Fraunces", Georgia, serif;
  --texto: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --barra: 56px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--creme); color: var(--tinta); font: 400 1rem/1.55 var(--texto); }
img { display: block; max-width: 100%; }
a { color: var(--coral-escuro); }
h1, h2, h3 { font-family: var(--titulo); font-variation-settings: "SOFT" 100; font-weight: 600; color: var(--azul); line-height: 1.15; margin: 0 0 .5em; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 1.3em; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--coral-escuro); color: #fff; font: 800 1rem/1 var(--texto); text-decoration: none;
}
.botao:hover { background: #973F2D; }
.botao--claro { background: var(--papel); color: var(--tinta); box-shadow: inset 0 0 0 1.5px var(--borda); }
.botao--claro:hover { background: var(--pessego); }
.botao:disabled { opacity: .55; cursor: wait; }
.link { background: none; border: 0; padding: .4em 0; color: var(--coral-escuro); font: 700 .95rem var(--texto); cursor: pointer; text-decoration: underline; }

/* ---------- telas de conta (entrar, senha) ---------- */
.conta { min-height: 100dvh; display: grid; place-items: center; padding: 88px 16px 24px; }
.cartao {
  width: 100%; max-width: 420px; background: var(--papel); border-radius: 22px;
  box-shadow: var(--sombra); padding: 28px 22px;
}
.cartao__capa { width: 92px; border-radius: 10px; box-shadow: var(--sombra); margin: -64px auto 14px; }
.cartao h1 { font-size: 1.6rem; text-align: center; }
.cartao__sub { text-align: center; color: var(--tinta-suave); margin: 0 0 1.4em; }
.campo { display: block; margin: 0 0 14px; }
.campo span { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 4px; }
.campo input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--borda); border-radius: 12px;
  font: 400 1rem var(--texto); color: var(--tinta); background: var(--creme);
}
.campo input:focus { outline: none; border-color: var(--azul); background: #fff; }
.senha-caixa { position: relative; }
.senha-caixa input { padding-right: 76px; }
.senha-caixa button {
  position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px;
  background: var(--azul-claro); color: var(--azul); font: 700 .85rem var(--texto); cursor: pointer;
}
.cartao .botao { width: 100%; margin-top: 6px; }
.aviso { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-size: .95rem; }
.aviso--erro { background: #FBE9E5; color: var(--erro); }
.aviso--ok { background: #E6F2EC; color: #245E47; }
.cartao__rodape { text-align: center; margin-top: 16px; }
.cartao hr { border: 0; border-top: 1px solid var(--borda); margin: 20px 0; }

/* ---------- leitor ---------- */
.leitor { background: var(--fundo-leitura); overflow: hidden; height: 100dvh; }
.topo, .base {
  position: fixed; left: 0; right: 0; z-index: 5; height: var(--barra);
  display: flex; align-items: center; gap: 4px; padding: 0 8px;
  background: rgba(251, 246, 241, .96); backdrop-filter: blur(8px);
}
.topo { top: 0; border-bottom: 1px solid var(--borda); }
.base { bottom: 0; border-top: 1px solid var(--borda); padding-bottom: env(safe-area-inset-bottom); height: calc(var(--barra) + env(safe-area-inset-bottom)); }
.icone {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px;
  background: none; color: var(--tinta); cursor: pointer; text-decoration: none;
}
.icone:hover { background: var(--pessego); }
.icone svg { width: 24px; height: 24px; }
.icone:disabled { opacity: .3; cursor: default; background: none; }
.topo__meio { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.topo__cap { display: block; font-weight: 800; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo__pag { font-size: .8rem; color: var(--tinta-suave); }
.base input[type=range] { flex: 1; accent-color: var(--coral-escuro); min-width: 0; height: 44px; }

.palco {
  position: fixed; top: var(--barra); bottom: calc(var(--barra) + env(safe-area-inset-bottom)); left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; padding: 10px; touch-action: pan-y pinch-zoom;
}
.palco img {
  max-height: 100%; max-width: 100%; width: auto; height: auto; aspect-ratio: 9 / 16;
  border-radius: 10px; box-shadow: var(--sombra); background: var(--papel); user-select: none; -webkit-user-drag: none;
}
.palco.ampliada { display: block; overflow: auto; padding: 10px 10px 40px; }
.palco.ampliada img { max-height: none; width: min(100%, 1080px); margin: 0 auto; }
.seta {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 4; width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--papel); box-shadow: var(--sombra); color: var(--tinta); cursor: pointer; display: none;
}
.seta svg { width: 26px; height: 26px; }
.seta--ant { left: 16px; } .seta--prox { right: 16px; }
@media (min-width: 760px) and (hover: hover) { .seta { display: grid; place-items: center; } }

/* painéis laterais (sumário, busca, conta) */
.painel { position: fixed; inset: 0; z-index: 10; display: flex; }
.painel__fundo { position: absolute; inset: 0; background: rgba(45, 57, 70, .45); border: 0; }
.painel__caixa {
  position: relative; width: min(420px, 92vw); height: 100%; background: var(--creme);
  display: flex; flex-direction: column; box-shadow: var(--sombra);
}
.painel__topo { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--borda); }
.painel__topo h2 { flex: 1; margin: 0; font-size: 1.3rem; }
.painel__corpo { overflow-y: auto; padding: 8px 12px 24px; flex: 1; }
.cap {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: 12px;
  background: none; text-align: left; cursor: pointer; font: 600 .98rem/1.3 var(--texto); color: var(--tinta);
}
.cap:hover, .cap[aria-current] { background: var(--pessego); }
.cap img { width: 44px; border-radius: 6px; flex: none; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.cap small { display: block; color: var(--tinta-suave); font-weight: 400; }
.busca { padding: 12px; border-bottom: 1px solid var(--borda); }
.busca input { width: 100%; min-height: 46px; padding: 0 14px; border: 1.5px solid var(--borda); border-radius: 12px; font: 400 1rem var(--texto); }
.achado mark { background: #FFE27A; color: inherit; border-radius: 3px; padding: 0 2px; }
.achado small { display: block; color: var(--tinta-suave); font-weight: 400; font-size: .88rem; margin-top: 2px; }
.vazio { color: var(--tinta-suave); padding: 16px 8px; }
.conta-painel { padding: 18px; }
.conta-painel p { margin: 0 0 4px; }
.conta-painel .botao { width: 100%; margin-top: 12px; }

/* ---------- imprimir ---------- */
.imp { max-width: 980px; margin: 0 auto; padding: 18px 16px 120px; }
.imp__topo { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.imp__topo h1 { flex: 1; margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); }
.imp__dica { color: var(--tinta-suave); margin: 0 0 20px; }
.grupo { margin: 0 0 28px; }
.grupo__topo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.grupo__topo h2 { margin: 0; font-size: 1.25rem; flex: 1 1 240px; }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.folha-item { position: relative; background: var(--papel); border-radius: 14px; padding: 8px; box-shadow: 0 2px 10px -4px rgba(0,0,0,.18); cursor: pointer; }
.folha-item input { position: absolute; top: 14px; left: 14px; width: 24px; height: 24px; accent-color: var(--coral-escuro); }
.folha-item img { border-radius: 8px; aspect-ratio: 9 / 16; width: 100%; object-fit: cover; }
.folha-item span { display: block; font-size: .88rem; font-weight: 700; margin-top: 6px; line-height: 1.3; }
.folha-item:has(input:checked) { box-shadow: 0 0 0 3px var(--coral-escuro); }
.imp__barra {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; justify-content: center; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(251, 246, 241, .97); border-top: 1px solid var(--borda);
}
.imp__barra span { color: var(--tinta-suave); font-size: .92rem; }
#folhas { display: none; }
@media print {
  @page { size: A4 portrait; margin: 8mm; }
  body { background: #fff; }
  body > *:not(#folhas) { display: none !important; }
  #folhas { display: block; }
  .folha { height: 280mm; display: flex; align-items: center; justify-content: center; break-after: page; page-break-after: always; }
  .folha:last-child { break-after: auto; page-break-after: auto; }
  .folha img { height: 100%; width: auto; max-width: 100%; object-fit: contain; }
}
.botao svg { width: 20px; height: 20px; flex: none; }
