:root {
  --bg: #0f1226;
  --surface: #181c3a;
  --surface2: #20254a;
  --line: #2c325e;
  --text: #f4f1ea;
  --muted: #9aa0c4;
  --accent: #3dd6c3;
  --accent-ink: #062b27;
  --warn: #f2b134;
  --danger: #ef4b4b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.45; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h3 { font-size: 1.05rem; margin-top: 1.4em; }
a { color: var(--accent); text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.error { color: var(--danger); min-height: 1.2em; margin: .3em 0; }

.page { max-width: 760px; margin: 0 auto; padding: 14px 14px 110px; padding-top: calc(14px + env(safe-area-inset-top)); }
.page.narrow { max-width: 440px; }
.page.center-v { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding-bottom: 30px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand img { border-radius: 18px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.topbar h1 { margin: 0; }

/* controles */
input, textarea, select { width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
textarea { resize: vertical; }
.btn, button { font: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-weight: 600; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: #5b2a3a; background: transparent; }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn.small { padding: 8px 12px; font-size: .9rem; border-radius: 10px; }
.btn:disabled, button:disabled { opacity: .45; cursor: default; }
button.ghost, a.ghost { background: transparent; border: 0; color: var(--accent); padding: 8px 4px; font-weight: 600; }
.card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.tabs { display: flex; background: var(--surface); border-radius: 12px; padding: 4px; }
.tabs button { flex: 1; background: transparent; border: 0; color: var(--muted); padding: 10px; border-radius: 9px; font-weight: 600; }
.tabs button.on { background: var(--surface2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; }
.field > span { font-size: .85rem; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; margin-top: 8px; }
.row > input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.banner { background: var(--surface2); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: .9rem; }
.banner.warn { background: #3a2f12; color: var(--warn); }

/* lista */
.list { display: flex; flex-direction: column; gap: 10px; }
.msg-card { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--text); }
.msg-card .meta { font-size: .8rem; color: var(--muted); }
.empty { text-align: center; padding: 50px 10px; }
.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 14px 24px; border-radius: 999px; box-shadow: 0 8px 24px #0008; }

/* editor */
.topics { display: flex; flex-direction: column; gap: 8px; }
.topic { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.t-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.t-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.t-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: .8rem; }
.t-body { padding: 0 14px 14px; }
.t-slide { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.t-actions { margin-top: 12px; flex-wrap: wrap; }
.slide-ed .slide { margin: 8px 0; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* slides (editor + telão) */
.slide { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; color: #fff; background: #000; }
.slide.mini { border-radius: 10px; border: 1px solid var(--line); }
.s-inner { position: absolute; inset: 7% 7% 13% 7%; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: .5em; }
.s-title { margin: 0; font-size: 1.6em; line-height: 1.1; text-transform: uppercase; font-weight: 800; letter-spacing: .01em; text-shadow: 0 2px 12px #0009; }
.s-bullets { margin: 0; padding-left: 1.1em; font-size: .85em; line-height: 1.3; text-shadow: 0 2px 10px #0009; }
.s-bullets li { margin: .25em 0; }
.s-ref { position: absolute; left: 7%; right: 7%; bottom: 4.5%; font-size: .9vw; font-size: clamp(10px, 1.4vw, 22px); color: #ffffffcc; letter-spacing: .08em; text-transform: uppercase; }
.slide.mini .s-ref { font-size: 9px; }
.slide.verse { background: #05060f; }
.v-text { margin: 0; line-height: 1.35; text-wrap: pretty; }
.v-text sup { color: var(--accent); font-size: .55em; margin-right: .15em; }
.slide.verse .s-ref { color: var(--accent); }
.slide.blank { background: #000; }
.mood-noite { background: radial-gradient(ellipse at 80% 10%, #3b3f8f66, transparent 55%), linear-gradient(160deg, #0c0f28, #05060f); }
.mood-luz { background: radial-gradient(ellipse at 50% -10%, #ffd98a99, transparent 60%), linear-gradient(180deg, #1a2150, #090c22); }
.mood-montanha { background: linear-gradient(180deg, #2b3a55 0%, #1a2336 55%, #0a0e18 100%); }
.mood-mar { background: radial-gradient(ellipse at 30% 0%, #2fb7c455, transparent 55%), linear-gradient(180deg, #0b3a4f, #04121f); }
.mood-deserto { background: radial-gradient(ellipse at 70% 0%, #f2a24a66, transparent 55%), linear-gradient(180deg, #5a3a1d, #1c1208); }
.mood-aurora { background: radial-gradient(ellipse at 20% 0%, #4cf2b055, transparent 50%), radial-gradient(ellipse at 90% 20%, #8a5cf655, transparent 50%), linear-gradient(180deg, #0c1a33, #060a16); }
.mood-campo { background: radial-gradient(ellipse at 50% 0%, #b9e87a44, transparent 55%), linear-gradient(180deg, #163a24, #07140c); }
.mood-fogo { background: radial-gradient(ellipse at 50% 110%, #ff7a1a88, transparent 60%), linear-gradient(180deg, #3b0b10, #12040a); }

/* modo pregação */
.pregar { height: 100dvh; display: flex; flex-direction: column; background: #000; transition: box-shadow .4s; padding-top: env(safe-area-inset-top); }
.pregar > header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.pregar .box { flex: 1; background: var(--surface); border-radius: 12px; padding: 6px 12px; display: flex; flex-direction: column; position: relative; }
.pregar .box small { font-size: .65rem; color: var(--muted); letter-spacing: .08em; }
.pregar .box strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pregar .timer-box { flex: 1.5; padding-right: 52px; transition: background .4s, color .4s; }
.pregar .play { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.pregar .badge { background: var(--surface); color: var(--muted); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px; font-size: .8rem; white-space: nowrap; }
.pregar .badge.on { color: var(--accent); border-color: var(--accent); }
.pregar[data-alert='warn'] .timer-box { background: var(--warn); color: #231a00; }
.pregar[data-alert='warn'] .timer-box small { color: #231a00aa; }
.pregar[data-alert='warn'] .play { background: #231a00; color: var(--warn); }
.pregar[data-alert='danger'] { box-shadow: inset 0 0 90px 10px #c4141466; }
.pregar[data-alert='danger'] .timer-box { background: var(--danger); color: #fff; animation: pulse 1.4s infinite; }
.pregar[data-alert='danger'] .timer-box small { color: #ffffffcc; }
.pregar[data-alert='danger'] .play { background: #fff; color: var(--danger); }
@keyframes pulse { 50% { filter: brightness(1.25); } }
.topicbar { display: flex; justify-content: space-between; gap: 10px; padding: 4px 14px 8px; font-size: .72rem; color: var(--muted); letter-spacing: .05em; }
.topicbar .next { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; }
.topicbody { flex: 1; overflow-y: auto; padding: 4px 16px 16px; font-size: 20px; line-height: 1.5; -webkit-overflow-scrolling: touch; }
.topicbody h2 { font-size: 1.3em; color: var(--accent); text-transform: uppercase; }
.topicbody .theme { color: var(--warn); font-size: .8em; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .5em; }
.topicbody .text { white-space: pre-wrap; margin: .6em 0; }
.topicbody blockquote { margin: .8em 0; padding: .6em .9em; border-left: 4px solid var(--warn); background: #f2b13418; font-style: italic; color: #ffe7b0; }
.topicbody .note { margin: .8em 0; padding: .7em .9em; background: var(--surface); border-radius: 12px; color: var(--muted); font-size: .85em; white-space: pre-wrap; }
.verse-chip { margin: 0 10px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.verse-chip[hidden] { display: none; }
.verse-chip small { font-size: .65rem; color: var(--muted); letter-spacing: .08em; }
.verse-chip strong { color: var(--accent); }
.verse-chip span { font-size: .85rem; color: var(--muted); }
.pregar > nav { display: flex; gap: 10px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
.pregar .nav { flex: 1; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 1rem; }
.pregar .nav.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* janelas de baixo */
.sheet-back { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { width: 100%; max-width: 640px; max-height: 82dvh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: 20px 20px 0 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sheet-body { overflow-y: auto; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }
.verses { font-size: 1.15rem; line-height: 1.55; }
.verse { margin: 0 0 .3em; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.verse sup { color: var(--accent); font-weight: 700; }
.verse.sel { background: #3dd6c326; outline: 1px solid var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #fff; color: #111; padding: 10px 16px; border-radius: 999px; z-index: 99; max-width: 90vw; font-size: .9rem; box-shadow: 0 6px 20px #0008; }

/* telão */
.telao-body { background: #000; overflow: hidden; }
.telao-body .slide { position: fixed; inset: 0; width: 100vw; height: 100vh; aspect-ratio: auto; display: none; }
.idle { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; background: radial-gradient(ellipse at 50% 0%, #1b2160, #05060f 70%); }
.idle h1 { font-size: 2.2rem; }
.idle .code { font-size: clamp(48px, 12vw, 130px); font-weight: 800; letter-spacing: .08em; color: var(--accent); font-variant-numeric: tabular-nums; }
.idle .qr { width: min(34vh, 260px); background: #fff; padding: 8px; border-radius: 12px; min-height: 40px; }
.idle .qr svg { width: 100%; height: auto; display: block; }
.full-btn { position: fixed; right: 16px; bottom: 16px; z-index: 5; background: #ffffff22; color: #fff; border: 1px solid #ffffff44; border-radius: 10px; padding: 8px 14px; transition: opacity .4s; }
.fab-row { position: fixed; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; gap: 10px; justify-content: center; align-items: center; padding: 0 12px; }
.fab-row .fab { position: static; transform: none; }
.fab-row .btn { border-radius: 999px; padding: 14px 18px; background: var(--surface); box-shadow: 0 8px 24px #0008; }
