/* ==========================================================================
   Boletim Online · Igreja Batista Central
   Ideia visual: folha de boletim com tinta e caneta marca-texto.
   Tinta azul-marinho sobre papel frio; o laranja da igreja é a caneta.
   ========================================================================== */

/* ---------- Temas ----------
   Cada tema define só 5 cores. O resto é derivado (linhas, textos de apoio). */
:root,
[data-theme="minimal"] {
  --bg: #f3f5f9; --surface: #ffffff; --text: #14213d; --accent: #c2410c; --on-accent: #ffffff;
  color-scheme: light;
}
[data-theme="papiro"]   { --bg: #f5ebd0; --surface: #fbf4e0; --text: #3a2c1a; --accent: #a8400d; --on-accent: #fff; color-scheme: light; }
[data-theme="cafe"]     { --bg: #e8dbc8; --surface: #f2e9db; --text: #2d1b0d; --accent: #7a4519; --on-accent: #fff; color-scheme: light; }
[data-theme="petala"]   { --bg: #fff0f3; --surface: #ffffff; --text: #4a0d20; --accent: #c0173f; --on-accent: #fff; color-scheme: light; }
[data-theme="sepia"]    { --bg: #2a2118; --surface: #372c20; --text: #f3e8d2; --accent: #f29441; --on-accent: #231503; color-scheme: dark; }
[data-theme="nordic"]   { --bg: #2b303b; --surface: #394050; --text: #eceff4; --accent: #88c0d0; --on-accent: #14202b; color-scheme: dark; }
[data-theme="floresta"] { --bg: #0b1c15; --surface: #133027; --text: #dff3e6; --accent: #5fd3a0; --on-accent: #04170f; color-scheme: dark; }
[data-theme="oled"]     { --bg: #000000; --surface: #101010; --text: #ececec; --accent: #ff8a3d; --on-accent: #1a0a00; color-scheme: dark; }
[data-theme="cyber"]    { --bg: #0b0b0d; --surface: #18181b; --text: #d6d6da; --accent: #e3c64a; --on-accent: #1a1500; color-scheme: dark; }
[data-theme="vinho"]    { --bg: #1d0a10; --surface: #2e1119; --text: #f1dfe3; --accent: #ff7f95; --on-accent: #2a0710; color-scheme: dark; }
[data-theme="ceu"]      { --bg: #0a1230; --surface: #121e48; --text: #e4f2ff; --accent: #5cc8ff; --on-accent: #02192a; color-scheme: dark; }
[data-theme="nocturno"] { --bg: #181825; --surface: #232336; --text: #cdd6f4; --accent: #7ee0a1; --on-accent: #07170e; color-scheme: dark; }

[data-theme="veredas"]  { --bg: #14213d; --surface: #1e2f54; --text: #f5eee0; --accent: #ff8d78; --on-accent: #2a0e08; color-scheme: dark; }
[data-theme="salvia"]   { --bg: #e4ebdd; --surface: #f4f7f0; --text: #203428; --accent: #b3321e; --on-accent: #ffffff; color-scheme: light; }
[data-theme="raiz"]     { --bg: #16301f; --surface: #214030; --text: #f1ead8; --accent: #c5b0ff; --on-accent: #1d1238; color-scheme: dark; }

:root {
  /* derivadas */
  --muted: color-mix(in srgb, var(--text) 64%, var(--bg));
  --line: color-mix(in srgb, var(--text) 14%, var(--bg));
  --surface-2: color-mix(in srgb, var(--text) 6%, var(--surface));
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --shadow: 0 8px 24px rgba(0,0,0,.14);
  --marker: color-mix(in srgb, var(--accent) 42%, transparent);

  --font-ui: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --read-font: 'Literata', Georgia, 'Times New Roman', serif;
  --read-size: 20px;
  --read-line: 1.75;

  --appbar-h: 58px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.5;
  transition: background .35s ease, color .35s ease;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { flex-shrink: 0; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 28%, transparent) transparent; }

/* ---------- Barra de leitura (progresso) ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 120; pointer-events: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; border-radius: 0 3px 3px 0; }

/* ---------- Barra superior ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50; height: var(--appbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid transparent; transition: border-color .25s;
}
.appbar.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; text-align: left; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  overflow: hidden;
}
.brand-mark .logo { width: 100%; height: 100%; display: block; }
.logo .lg-bg { fill: var(--accent); }
.logo .lg-tx { fill: var(--on-accent); }
.logo .lg-ul { stroke: var(--on-accent); opacity: .85; }
.brand-text { min-width: 0; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -.01em; }
.brand-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.appbar-actions { display: flex; gap: 2px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--text);
  transition: background .2s, color .2s;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; border: 2px solid var(--bg); display: none; }
#cloudBtn .dot { display: block; width: 11px; height: 11px; top: 7px; right: 7px; }
#cloudBtn.online .dot { background: #22c55e; }

/* ---------- Estrutura de páginas ---------- */
.page { width: 100%; max-width: 46rem; margin: 0 auto; padding: 0 clamp(18px, 5vw, 32px) calc(64px + env(safe-area-inset-bottom)); }
.tab { display: none; }
.tab.active { display: block; animation: tabIn .35s var(--ease); }
@keyframes tabIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Abertura do boletim ---------- */
.hero { padding: 26px 0 6px; }
.edition { font-size: .92rem; font-weight: 600; color: var(--muted); }
.passage-title {
  margin-top: 10px; font-weight: 800; font-size: clamp(3.1rem, 14vw, 5.6rem);
  line-height: 1.04; letter-spacing: -.04em; text-wrap: balance; overflow-wrap: break-word;
}
/* Títulos longos (frases) usam letra menor, para não ocupar a tela inteira */
.passage-title.long { font-size: clamp(2.1rem, 9vw, 3.6rem); letter-spacing: -.03em; }
.passage-title.xlong { font-size: clamp(1.7rem, 7vw, 2.8rem); letter-spacing: -.02em; }
.passage-subtitle { text-wrap: balance; }
.mk {
  padding: 0 .1em; margin-left: -.1em;
  background: linear-gradient(100deg, transparent 0 1%, var(--marker) 1% 99%, transparent 99%) 0 82% / 0% 36% no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  animation: marker .9s .3s var(--ease) forwards;
}
@keyframes marker { to { background-size: 100% 36%; } }
.passage-subtitle { margin-top: 10px; font-size: 1.3rem; font-weight: 500; color: var(--muted); }

/* ---------- Índice de parágrafos ---------- */
.pchips {
  display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 18px calc(-1 * clamp(18px, 5vw, 32px)) 6px; padding: 6px clamp(18px, 5vw, 32px);
}
.pchips::-webkit-scrollbar { display: none; }
.pchip {
  flex: 1 1 0; min-width: 34px; max-width: 44px; aspect-ratio: 1; border-radius: 50%; scroll-snap-align: center;
  display: grid; place-items: center; font-weight: 700; font-size: 1rem;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--text);
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.pchip:hover { border-color: var(--accent); }
.pchip.current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: scale(1.06); }
.pchip { position: relative; }
.pchip.has-note::after { content: ''; position: absolute; top: -1px; right: -1px; width: 11px; height: 11px; border-radius: 50%; background: #ff3b30; border: 2px solid var(--bg); }

/* ---------- Dica do modo editor ---------- */
.tip {
  display: flex; gap: 14px; align-items: flex-start; margin: 14px 0 6px; padding: 16px 16px 16px 18px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 18px;
}
.tip[hidden] { display: none; }
.tip .tip-ico { color: var(--accent); margin-top: 2px; }
.tip-body { flex: 1; font-size: .98rem; line-height: 1.45; }
.tip-body strong { display: block; font-size: 1.05rem; margin-bottom: 2px; }
.tip-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 14px; font-weight: 700; font-size: .98rem; transition: transform .15s, background .2s, opacity .2s;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: #dc2626; border-color: color-mix(in srgb, #dc2626 35%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.block { width: 100%; }

/* ---------- Texto de leitura ---------- */
.reading-area {
  font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-line);
  overflow-wrap: break-word; text-wrap: pretty; -webkit-user-select: text; user-select: text;
}
html[data-bold="1"] .reading-area { font-weight: 600; }
html[data-italic="1"] .reading-area { font-style: italic; }
#mainReading { margin-top: 18px; }
#mainReading p { position: relative; margin-bottom: 1.4em; }

.par-num {
  display: inline-grid; place-items: center; vertical-align: middle; position: relative; top: -.2em; margin-right: .3em;
  min-width: 1.9em; height: 1.9em; padding: 0 .35em; border-radius: 999px;
  font: 800 .62em/1 var(--font-ui); letter-spacing: 0;
  background: var(--accent); color: var(--on-accent); border: 0;
  -webkit-user-select: none; user-select: none; position: relative;
  transition: transform .15s, background .2s, color .2s;
}
.par-num:hover { filter: brightness(1.08); }
.par-num:active { transform: scale(.92); }
.par-num.has-note { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
@media (min-width: 1000px) {
  /* Em telas grandes o número sai para a margem, como num caderno */
  #mainReading p > .par-num { position: absolute; left: -2.5rem; top: .5em; margin: 0; font-size: .7rem; }
}

/* Três tipos de marca, três linguagens visuais:
   1) autor = texto em negrito com fundo suave (sem linha)
   2) versículo = botão de contorno, sem fundo (toque abre o texto)
   3) anotação do leitor = marca-texto colorido, sublinhado ou círculo (veja .k-hl, .k-ul, .k-ci) */
.destaque-enfase {
  font-weight: 700; padding: 0 .16em; border-radius: .3em;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.ref-link {
  color: var(--accent); font-weight: 600; font-size: 1em; cursor: pointer; white-space: nowrap;
  text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, var(--accent) 80%, transparent);
  text-decoration-thickness: .13em; text-underline-offset: .22em; text-decoration-skip-ink: none;
  border-radius: .25em; transition: background .2s;
}
.ref-link:hover, .ref-link:focus-visible { background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* ---------- Anotações livres (modo editor) ---------- */
.c-yellow { --c: #ffe066; --cu: #d99a00; }
.c-green  { --c: #9be7a8; --cu: #2b9a44; }
.c-blue   { --c: #8fd0ff; --cu: #1c7ed6; }
.c-pink   { --c: #ffadc8; --cu: #d6336c; }
.c-orange { --c: #ffbe85; --cu: #e8590c; }

mark.ann { background: none; color: inherit; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: filter .2s; }
mark.ann:hover { filter: brightness(1.06); }
mark.k-hl { background: var(--c); color: #181818; border-radius: .22em; padding: 0 .1em; margin: 0 -.06em; }
mark.k-ul { text-decoration: underline; text-decoration-color: var(--cu); text-decoration-thickness: .17em; text-underline-offset: .17em; text-decoration-skip-ink: none; }
mark.k-ci { box-shadow: inset 0 0 0 .1em var(--cu); border-radius: .9em; padding: 0 .32em; margin: 0 -.12em; }
mark.ann.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 .35em color-mix(in srgb, var(--accent) 45%, transparent); } }

.ann-pin {
  display: inline-grid; place-items: center; vertical-align: .55em; width: 1.5em; height: 1.5em; margin: 0 .1em 0 .25em;
  font-size: .55em; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.ann-pin svg { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

body.edit-on #mainReading { cursor: text; }

/* ---------- Fim do texto ---------- */
.end-mark { display: flex; align-items: center; gap: 14px; margin: 36px 0 8px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.end-mark::before, .end-mark::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Versículo da semana ---------- */
.verse-head { padding: 26px 0 8px; }
.verse-head h1 { font-size: clamp(2.2rem, 10vw, 3.4rem); font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.verse-head p { margin-top: 8px; color: var(--muted); font-weight: 500; font-size: 1.1rem; }
.verse-card { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 22px clamp(18px, 4vw, 30px) 10px; box-shadow: var(--shadow); }
.verse-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; }
.verse-card > summary::-webkit-details-marker { display: none; }
.verse-card h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.verse-card .ver { font-size: .8rem; font-weight: 700; color: var(--accent); padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); }
.verse-card .chev { transition: transform .25s; color: var(--muted); }
.verse-card[open] .chev { transform: rotate(180deg); }
.verse-card.static > .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; }

.verse-text { font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-line); }
.verse-text p { margin: 0 0 .9em; text-wrap: pretty; }
.verse-text .vn { font: 800 .62em/1 var(--font-ui); color: var(--accent); vertical-align: .55em; margin-right: .35em; }
html[data-bold="1"] .verse-text { font-weight: 600; }
html[data-italic="1"] .verse-text { font-style: italic; }

/* ---------- Camadas (modal de versículo, anotações, lista) ---------- */
.layer { position: fixed; inset: 0; z-index: 200; visibility: hidden; pointer-events: none; transition: visibility 0s .35s; }
.layer.open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.layer .backdrop { position: absolute; inset: 0; background: rgba(8, 10, 18, .52); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .28s; }
.layer.open .backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 50%; bottom: 0; width: min(580px, 100%); max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border-radius: 28px 28px 0 0; box-shadow: var(--shadow);
  transform: translate(-50%, 104%); transition: transform .38s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
.layer.open .sheet { transform: translate(-50%, 0); }
.sheet.dragging { transition: none; }
.grab { padding: 10px 0 4px; display: grid; place-items: center; touch-action: none; cursor: grab; flex-shrink: 0; }
.grab::before { content: ''; width: 42px; height: 5px; border-radius: 4px; background: var(--line); }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; padding: 6px 12px 10px 22px; flex-shrink: 0; }
.sheet-title { flex: 1; font-size: 1.6rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; padding-top: 6px; }
.sheet-title small { display: inline-block; vertical-align: middle; margin-left: 8px; font-size: .72rem; letter-spacing: 0; font-weight: 700; color: var(--accent); padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); }
.sheet-body { overflow-y: auto; padding: 4px 22px 14px; overscroll-behavior: contain; }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px 16px; border-top: 1px solid var(--line); flex-shrink: 0; }
.sheet-foot .count { flex: 1; text-align: center; font-weight: 700; color: var(--muted); font-size: .9rem; }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; border-radius: 28px; transform: translate(-50%, -44%) scale(.97); opacity: 0; transition: transform .35s var(--ease), opacity .25s; max-height: 84dvh; }
  .layer.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .grab { display: none; }
  .sheet-head { padding-top: 18px; }
}
#verseText { font-size: max(18px, calc(var(--read-size) * .96)); }

/* Anotação (sheet) */
.quote { margin: 4px 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border-left: 5px solid var(--accent); font-family: var(--read-font); font-size: 1rem; line-height: 1.5; color: var(--text); }
.field-label { display: block; font-weight: 700; font-size: .9rem; color: var(--muted); margin: 14px 0 8px; }
textarea.input, input.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text);
  font: 500 16px/1.5 var(--font-ui); padding: 12px 14px; transition: border-color .2s, box-shadow .2s;
}
textarea.input { min-height: 130px; resize: vertical; }
textarea.input:focus, input.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { width: 44px; height: 44px; border-radius: 50%; background: var(--c); border: 3px solid transparent; box-shadow: 0 0 0 1.5px var(--line); transition: transform .15s; position: relative; }
.sw:active { transform: scale(.9); }
.sw[aria-pressed="true"] { border-color: var(--surface); box-shadow: 0 0 0 3px var(--text); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; background: var(--surface-2); border-radius: 16px; }
.seg button { min-height: 44px; border-radius: 12px; font-weight: 700; font-size: .92rem; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 14%, transparent); }
.row-actions { display: flex; gap: 10px; margin-top: 18px; }
.row-actions .btn { flex: 1; }
.cloud-line { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.cloud-line .led { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; }
.cloud-line.on .led { background: #22c55e; }

/* Lista de anotações */
.ann-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ann-item { display: block; width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border-left: 6px solid var(--cu, var(--accent)); }
.ann-item .meta { font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.ann-item .q { font-family: var(--read-font); font-size: .98rem; line-height: 1.45; }
.ann-item .nt { margin-top: 8px; font-size: .95rem; font-weight: 500; padding-top: 8px; border-top: 1px dashed var(--line); white-space: pre-wrap; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; line-height: 1.55; }
.empty strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 6px; }

/* ---------- Dock de navegação ---------- */
.dock {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 60;
  width: min(440px, calc(100% - 24px)); display: flex; gap: 4px; padding: 6px; border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(-50%); transition: transform .4s var(--ease);
}
.dock.hide { transform: translate(-50%, 150%); }
.dock button {
  flex: 1; min-height: 56px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-weight: 700; font-size: .74rem; color: var(--muted); transition: background .25s, color .25s;
}
.dock button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
body.edit-on .dock { transform: translate(-50%, 160%); }

.to-top {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 55;
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.28);
  opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none; transition: opacity .25s, transform .25s var(--ease);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
/* Botão flutuante do modo editor */
.fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 65;
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  transition: transform .2s var(--ease), bottom .42s var(--ease), background .2s;
}
.fab:active { transform: scale(.92); }
.fab .ico { width: 24px; height: 24px; }
.fab .ico-check { display: none; }
.fab[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.fab[aria-pressed="true"] .ico-pen { display: none; }
.fab[aria-pressed="true"] .ico-check { display: block; }
body:not([data-tab="boletim"]) .fab { display: none; }
.to-top { bottom: calc(160px + env(safe-area-inset-bottom)); }
body.dock-hidden .fab { bottom: calc(22px + env(safe-area-inset-bottom)); }
body.dock-hidden .to-top { bottom: calc(86px + env(safe-area-inset-bottom)); }
.to-top { transition: opacity .25s, transform .25s var(--ease), bottom .42s var(--ease); }
body.edit-on .fab { bottom: calc(var(--bar-h, 130px) + 22px); }
body.edit-on .to-top { bottom: calc(var(--bar-h, 130px) + 90px); }

/* ---------- Barra do modo editor ---------- */
.editbar {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 70;
  width: min(560px, calc(100% - 20px)); border-radius: 26px; padding: 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); box-shadow: 0 14px 44px color-mix(in srgb, var(--text) 26%, transparent);
  transform: translate(-50%, 170%); transition: transform .42s var(--ease);
  -webkit-user-select: none; user-select: none;
}
body.edit-on .editbar { transform: translate(-50%, 0); }
.eb-row { display: flex; align-items: center; gap: 8px; }
.eb-hint { flex: 1; display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-size: .92rem; font-weight: 600; line-height: 1.3; min-width: 0; }
.eb-hint svg { color: var(--accent); }
.eb-tools { display: none; }
.editbar.has-sel .eb-tools { display: block; }
.eb-colors { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 2px 10px; }
.eb-colors .sw { width: 46px; height: 46px; }
.eb-kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.eb-kinds button {
  min-height: 54px; border-radius: 16px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-weight: 700; font-size: .72rem; transition: background .2s, transform .15s;
}
.eb-kinds button:active { transform: scale(.95); }
.eb-kinds button:hover { background: var(--accent-soft); }
.eb-kinds .ico { width: 20px; height: 20px; }
.eb-foot { display: flex; gap: 8px; margin-top: 8px; }
.eb-foot .btn { flex: 1; min-height: 46px; }
.eb-hint-row { display: flex; align-items: center; gap: 8px; }
.eb-extend { display: flex; gap: 8px; flex: 1; }
.eb-extend .btn { flex: 1; padding: 0 8px; }

/* ---------- Áudio ---------- */
.player-card { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; }
.waveform-strip { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 20px 20px 14px; height: 76px; }
.wb { width: 4px; border-radius: 99px; background: var(--accent); opacity: .45; animation: wave 1.3s ease-in-out infinite; transform-origin: center; }
.wb:nth-child(1) { height: 12px; animation-delay: 0s; } .wb:nth-child(2) { height: 22px; animation-delay: .1s; }
.wb:nth-child(3) { height: 32px; animation-delay: .2s; } .wb:nth-child(4) { height: 24px; animation-delay: .15s; }
.wb:nth-child(5) { height: 38px; animation-delay: .05s; } .wb:nth-child(6) { height: 28px; animation-delay: .25s; }
.wb:nth-child(7) { height: 20px; animation-delay: .12s; } .wb:nth-child(8) { height: 32px; animation-delay: .18s; }
.wb:nth-child(9) { height: 14px; animation-delay: .08s; } .wb:nth-child(10) { height: 26px; animation-delay: .22s; }
.wb:nth-child(11) { height: 38px; animation-delay: .06s; } .wb:nth-child(12) { height: 20px; animation-delay: .16s; }
@keyframes wave { 0%, 100% { transform: scaleY(.45); opacity: .4; } 50% { transform: scaleY(1); opacity: .95; } }
body:not(.playing) .wb { animation-play-state: paused; opacity: .25; }
.player-section { padding: 16px 20px; border-top: 1px solid var(--line); }
.player-section:first-of-type { border-top: 0; }
.adj-label { display: block; font-weight: 700; font-size: .92rem; color: var(--muted); margin-bottom: 10px; }
.voice-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice-btn { min-height: 46px; border-radius: 14px; border: 1.5px solid var(--line); font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); transition: all .2s; }
.voice-btn svg { width: 18px; height: 18px; }
.voice-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.text-display { padding: 16px 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 18px; max-height: 42vh; min-height: 160px; overflow-y: auto; scroll-behavior: smooth; }
.word { border-radius: 4px; padding: 0 1px; transition: background .08s, color .08s; }
.word.current { background: var(--accent); color: var(--on-accent); }
.word.in-frase { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--text); }
.time-row { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.progress-wrap { position: relative; height: 6px; border-radius: 99px; background: var(--line); }
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--accent); pointer-events: none; transition: width .25s linear; }
.progress-thumb { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); transform: translate(-50%, -50%); pointer-events: none; transition: left .25s linear; }
.progress-input { position: absolute; inset: -14px 0; width: 100%; height: calc(100% + 28px); opacity: 0; cursor: pointer; margin: 0; }
.controls-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.ctrl-btn { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); transition: transform .15s, background .2s; }
.ctrl-btn svg { width: 22px; height: 22px; }
.ctrl-btn:hover { background: var(--accent-soft); }
.ctrl-btn:active { transform: scale(.92); }
.play-btn { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); position: relative; box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 40%, transparent); transition: transform .15s; }
.play-btn svg { width: 32px; height: 32px; }
.play-btn:active { transform: scale(.93); }
.play-btn::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
body.playing .play-btn::after { animation: ring 2s ease-out infinite; }
@keyframes ring { 0% { opacity: .5; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }
.sliders-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.slider-group { display: grid; gap: 10px; }
.slider-header { display: flex; justify-content: space-between; align-items: center; }
.slider-label { font-size: .85rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.slider-label svg { width: 15px; height: 15px; color: var(--accent); }
.slider-val { font-size: .85rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.no-support { display: none; padding: 14px 20px; color: #dc2626; font-weight: 600; font-size: .9rem; }

/* Sliders */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--accent); border: 4px solid var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 4px solid var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }

/* ---------- Ajustes ---------- */
.set-head { padding: 26px 0 4px; }
.set-head h1 { font-size: clamp(2.2rem, 10vw, 3.2rem); font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.group { margin-top: 30px; }
.group > h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.015em; margin-bottom: 4px; }
.group > .lede { color: var(--muted); font-size: .95rem; margin-bottom: 14px; }
.sample { margin-top: 14px; padding: 18px 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.sample .reading-area p { margin: 0; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 10px; margin-top: 14px; }
.stepper .btn { min-height: 52px; padding: 0; font-size: 1.1rem; }
.stepper .btn.minus { font-size: .95rem; }
.stepper .btn.plus { font-size: 1.5rem; }
.stepper .val { text-align: center; font-weight: 800; font-size: .95rem; color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.toggle-btn { min-height: 52px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .2s; }
.toggle-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.font-pick { width: 100%; display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; scroll-margin-top: 84px; }
.font-pick .fo-t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.font-pick .nm { font: 700 1rem var(--font-ui); color: var(--text); }
.font-pick .ds { font: 500 .8rem var(--font-ui); color: var(--muted); }
.font-pick .aa { font-size: 1.5rem; line-height: 1.1; color: var(--text); }
.font-pick .chev { color: var(--muted); transition: transform .25s var(--ease); flex: none; }
.font-pick[aria-expanded="true"] { border-color: var(--accent); }
.font-pick[aria-expanded="true"] .chev { transform: rotate(180deg); }
.font-grid { display: grid; gap: 8px; margin-top: 10px; }
.font-grid[hidden] { display: none; }
.font-cat { font: 800 .95rem var(--font-ui); letter-spacing: -.01em; color: var(--text); margin: 14px 2px 2px; }
.font-cat:first-child { margin-top: 0; }
.font-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; padding: 10px 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); transition: border-color .2s, background .2s; min-height: 62px; }
.font-opt .fo-t { min-width: 0; display: grid; gap: 2px; }
.font-opt .aa { font-size: 1.55rem; line-height: 1.1; color: var(--text); white-space: nowrap; flex: none; }
.font-opt .nm { font: 700 .98rem var(--font-ui); color: var(--text); }
.font-opt .ds { font: 500 .8rem/1.3 var(--font-ui); color: var(--muted); }
.font-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.font-opt[aria-pressed="true"] .nm { color: var(--accent); }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.theme-opt { padding: 10px; border-radius: 18px; border: 2px solid var(--line); background: var(--bg); color: var(--text); text-align: left; display: grid; gap: 8px; transition: border-color .2s, transform .15s; }
.theme-opt:active { transform: scale(.96); }
.theme-opt .prev { height: 54px; border-radius: 12px; background: var(--bg); border: 1px solid color-mix(in srgb, var(--text) 18%, var(--bg)); display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.theme-opt .prev b { font: 800 1.35rem/1 var(--read-font); color: var(--text); }
.theme-opt .prev i { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.theme-opt .nm { font-weight: 700; font-size: .86rem; padding: 0 2px; color: var(--text); }
.theme-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.theme-opt[data-theme] { --muted: color-mix(in srgb, var(--text) 64%, var(--bg)); }

/* Login */
.auth-card { margin-top: 14px; padding: 20px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.auth-card .status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .85rem; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); margin-bottom: 12px; }
.auth-card .status .led { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; }
.auth-card.on .status .led { background: #22c55e; }
.auth-info { color: var(--muted); font-size: .95rem; margin-bottom: 14px; }
.auth-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: var(--surface-2); border-radius: 16px; margin-bottom: 14px; }
.auth-tab { min-height: 44px; border-radius: 12px; font-weight: 700; color: var(--muted); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 14%, transparent); }
.auth-card .input { margin-bottom: 10px; }
.link-btn { color: var(--accent); font-weight: 700; font-size: .9rem; padding: 6px 0 12px; display: block; margin-left: auto; }
.logged-view { display: none; }
.auth-card.on .logged-view { display: block; }
.auth-card.on .out-view { display: none; }

.menu-list { display: grid; gap: 10px; margin-top: 14px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-align: left; width: 100%; min-height: 60px; }
.menu-item .ico { color: var(--accent); }
.menu-item b { display: block; font-weight: 700; }
.menu-item span { font-size: .85rem; color: var(--muted); }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 40px 0 0; line-height: 1.6; }
.footer strong { color: var(--text); }
.footer-end { padding: 14px 0 8px; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(440px, calc(100% - 24px)); z-index: 400; display: grid; gap: 8px; pointer-events: none; }
body.edit-on .toasts { bottom: calc(var(--bar-h, 130px) + 22px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 5px solid var(--accent); box-shadow: 0 10px 28px rgba(0,0,0,.22); font-weight: 600; font-size: .95rem; pointer-events: auto; animation: toastIn .35s var(--ease); }
.toast.out { animation: toastOut .25s ease forwards; }
.toast .msg { flex: 1; }
.toast .act { font-weight: 800; color: var(--accent); padding: 8px 6px; }
.toast.success .msg::before { content: '✓ '; }
.toast.error { border-left-color: #dc2626; background: color-mix(in srgb, #dc2626 10%, var(--surface)); }
.toast.info { border-left-color: var(--muted); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.96); } }

.confirm .sheet { max-width: 420px; }
.confirm p { color: var(--muted); padding: 0 22px 10px; }

/* ---------- Telas muito pequenas ---------- */
@media (max-width: 389px) {
  .btn-fs { display: none; }
  .brand-sub { max-width: 30vw; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
  .eb-colors .sw { width: 42px; height: 42px; }
}
@media (max-width: 480px) { .sliders-grid { grid-template-columns: 1fr; gap: 16px; } }
@media (max-height: 480px) and (orientation: landscape) { .appbar { position: static; } .dock { width: min(380px, 60%); } }

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .mk { background-size: 100% 36%; }
}

/* ---------- Impressão (se alguém imprimir a página) ---------- */
@media print {
  .appbar, .dock, .editbar, .to-top, .progress, .pchips, .tip, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .tab { display: none !important; } #boletim { display: block !important; }
}

/* Interruptores do index.html (evita piscar antes do JS remover) */
body[data-editor="off"] .fab, body[data-editor="off"] #editTip,
body[data-nuvem="off"] #cloudBtn, body[data-nuvem="off"] #cloudGroup,
body[data-versiculo="off"] #btn-versiculo { display: none !important; }

/* Versículo: janela no meio da tela, também no celular */
#verseLayer .sheet { bottom: auto; top: 50%; width: min(560px, calc(100% - 28px)); max-height: 80dvh; border-radius: 26px; transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .35s var(--ease), opacity .25s; padding-bottom: 0; }
#verseLayer.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
#verseLayer .grab { display: none; }
#verseLayer .sheet-head { padding-top: 18px; }
body[data-nuvem="off"] .cloud-only { display: none; }
body:not([data-nuvem="off"]) .only-local { display: none; }

/* Avisos de confirmação: janela no meio da tela */
.layer.confirm .sheet { bottom: auto; top: 50%; width: min(420px, calc(100% - 28px)); border-radius: 26px; transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .35s var(--ease), opacity .25s; padding-bottom: 0; }
.layer.confirm.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
.layer.confirm .grab { display: none; }
.layer.confirm .sheet-head { padding-top: 20px; }

/* Telas largas: a barra de abas fica no centro e não encosta nos botões, então eles ficam no canto de baixo */
@media (min-width: 700px) {
  .fab { bottom: calc(24px + env(safe-area-inset-bottom)); }
  .to-top { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* Cabeçalho do boletim centralizado; o texto de leitura continua alinhado à esquerda */
.hero { text-align: center; }
.pchips { justify-content: center; }

/* Blocos que abrem e fecham (Privacidade, Termos): começam fechados */
.fold { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 18px; }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { margin: 0; }
.fold .chev { color: var(--muted); flex: none; transition: transform .25s var(--ease); }
.fold[open] .chev { transform: rotate(180deg); }
.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.fold[open] > .lede:first-of-type { margin-top: 0; }

/* Nas abas sem o botão da caneta, o botão de subir ocupa o lugar dele, bem embaixo */
body:not([data-tab="boletim"]) .to-top { bottom: calc(92px + env(safe-area-inset-bottom)); }
body:not([data-tab="boletim"]).dock-hidden .to-top { bottom: calc(22px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) {
  body:not([data-tab="boletim"]) .to-top, body:not([data-tab="boletim"]).dock-hidden .to-top { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* Botões flutuantes: somem quando parados e voltam ao mexer */
.fab { transition: transform .2s var(--ease), bottom .42s var(--ease), background .2s, opacity .35s; }
body:not(.edit-on).ui-idle .fab,
body:not(.edit-on).ui-idle .to-top.show { opacity: 0; pointer-events: none; transform: translateY(10px) scale(.92); }
@media (prefers-reduced-motion: reduce) { .fab, .to-top { transition-duration: .01s; } }
