:root {
  --azul: #1f2a5a; --azul2: #2f3f80; --ouro: #c9a227; --ouro2: #e6c65c;
  --fundo: #fbf7ef; --card: #ffffff; --texto: #2a2a33; --suave: #6f6a60; --borda: #ece4d3;
  --sombra: 0 2px 10px rgba(31, 42, 90, .08);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) { --fundo:#11131c; --card:#1b1e2b; --texto:#ece8de; --suave:#a29d92; --borda:#2a2e40; --azul:#a9b6ff; --azul2:#7f8fe0; color-scheme: dark; } }
:root[data-tema="escuro"] { --fundo:#11131c; --card:#1b1e2b; --texto:#ece8de; --suave:#a29d92; --borda:#2a2e40; --azul:#a9b6ff; --azul2:#7f8fe0; color-scheme: dark; }

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--fundo); color: var(--texto); line-height: 1.5; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; margin: 0 0 .4rem; }
[hidden] { display: none !important; }

/* ---------- Topo ---------- */
.topo { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; padding-top: calc(.7rem + env(safe-area-inset-top));
  background: linear-gradient(135deg, #1f2a5a, #34488f); color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
.topo-titulo { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.topo-titulo strong { display: block; font-family: var(--serif); font-size: 1.08rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-titulo small { display: block; opacity: .8; font-size: .75rem; }
.topo-cruz { color: var(--ouro2); font-size: 1.4rem; }
.topo-voltar { font-size: 2rem; line-height: 1; padding: 0 .3rem; }
.topo-tema { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }

.conteudo { max-width: 680px; margin: 0 auto; padding: 1rem 1rem calc(90px + env(safe-area-inset-bottom)); }

/* ---------- Navegação inferior ---------- */
.nav-inferior { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-around; background: var(--card);
  border-top: 1px solid var(--borda); padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(0,0,0,.06); }
.nav-inferior a { display: flex; flex-direction: column; align-items: center; font-size: .7rem; color: var(--suave); padding: .2rem .6rem; border-radius: 12px; }
.nav-inferior a .ic { font-size: 1.3rem; line-height: 1.3; }
.nav-inferior a.ativo { color: var(--azul); font-weight: 600; background: color-mix(in srgb, var(--ouro) 14%, transparent); }

/* ---------- Cards ---------- */
.card { display: block; background: var(--card); border: 1px solid var(--borda); border-radius: 16px; padding: 1rem; margin-bottom: .9rem; box-shadow: var(--sombra); }
.card small { color: var(--suave); }
.card-rotulo { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ouro); font-weight: 700; margin-bottom: .3rem; }
.card-destaque { background: linear-gradient(135deg, #1f2a5a, #34488f); color: #fff; border: 0; }
.card-destaque small { color: rgba(255,255,255,.8); display: block; }
.card-destaque .card-rotulo { color: var(--ouro2); }
.prox { display: flex; align-items: center; gap: 1rem; }
.prox-hora { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; color: var(--ouro2); }
.card-liturgia { border-left: 6px solid var(--cor-lit, #2e7d32); }
.card-liturgia strong { display: block; font-family: var(--serif); font-size: 1.1rem; }
.secao { font-size: 1.15rem; margin: 1.4rem 0 .7rem; color: var(--azul); }
.secao small { font-family: var(--sans); font-size: .8rem; color: var(--suave); font-weight: 400; }
.vazio { text-align: center; color: var(--suave); padding: 1.5rem; }
.intro { margin-top: 0; color: var(--suave); }
.tag { font-family: var(--sans); font-size: .7rem; background: var(--ouro); color: #fff; padding: .1rem .5rem; border-radius: 99px; vertical-align: middle; }

/* ---------- Hero ---------- */
.hero { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.hero-img { width: 92px; height: 92px; object-fit: cover; border-radius: 50%; border: 3px solid var(--ouro); box-shadow: var(--sombra); flex-shrink: 0; }
.hero h1 { font-size: 1.45rem; color: var(--azul); }
.hero p { margin: 0; color: var(--suave); }
.hero-saud { font-size: .85rem; }

/* ---------- Grade de ações ---------- */
.grade-acoes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1rem; }
.grade-acoes a { background: var(--card); border: 1px solid var(--borda); border-radius: 16px; padding: .9rem .4rem; text-align: center; font-size: .82rem; font-weight: 600; box-shadow: var(--sombra); transition: transform .15s; }
.grade-acoes a:active { transform: scale(.96); }
.grade-acoes span { display: block; font-size: 1.8rem; margin-bottom: .2rem; }
.contadores { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; background: var(--card); border: 1px solid var(--borda); border-radius: 16px; padding: .8rem; }
.contadores b { display: block; font-family: var(--serif); font-size: 1.5rem; color: var(--ouro); }
.contadores small { color: var(--suave); font-size: .75rem; }

/* ---------- Formulários ---------- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .8rem; }
input:not([type=radio]):not([type=checkbox]), textarea, select {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .8rem; font: inherit; font-weight: 400; color: var(--texto);
  background: var(--fundo); border: 1px solid var(--borda); border-radius: 12px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ouro); border-color: transparent; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.hp { position: absolute; left: -9999px; }
.btn { display: inline-block; border: 0; border-radius: 12px; padding: .75rem 1.1rem; font: inherit; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, var(--ouro), #b58b14); color: #fff; text-align: center; }
.btn:disabled { opacity: .6; }
.btn-sec { background: var(--card); color: var(--azul); border: 1px solid var(--borda); font-weight: 600; }
.bloco { display: block; width: 100%; }
fieldset.cores { border: 0; padding: 0; margin: 0 0 .8rem; }
fieldset.cores legend { font-size: .85rem; font-weight: 600; margin-bottom: .4rem; }
fieldset.cores { display: flex; flex-wrap: wrap; gap: .4rem; }
.cor-op { position: relative; margin: 0; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .5rem; border: 2px solid var(--borda); border-radius: 12px; cursor: pointer; min-width: 68px; font-weight: 400; }
.cor-op input { position: absolute; opacity: 0; }
.cor-op:has(input:checked) { border-color: var(--ouro); background: color-mix(in srgb, var(--ouro) 10%, transparent); }
.cor-op small { font-size: .7rem; }

/* ---------- Velas ---------- */
.vela { position: relative; display: inline-block; width: 18px; height: 46px; border-radius: 4px 4px 3px 3px; background: var(--cv, #f6f1e4); box-shadow: inset -4px 0 0 rgba(0,0,0,.08); margin-top: 22px; }
.vela::before { content: ''; position: absolute; top: -6px; left: 8px; width: 2px; height: 7px; background: #333; }
.chama { position: absolute; top: -26px; left: 2px; width: 14px; height: 22px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 75%, #fff 0 18%, #ffd54f 30%, #ff9800 65%, transparent 72%);
  filter: drop-shadow(0 0 8px rgba(255, 170, 40, .9)); animation: tremer 1.6s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes tremer { 0% { transform: rotate(-3deg) scaleY(1); } 50% { transform: rotate(2deg) scaleY(1.08); } 100% { transform: rotate(-1deg) scaleY(.95); } }
.vela-mini { width: 12px; height: 26px; border-radius: 3px; background: var(--cv); display: block; border: 1px solid rgba(0,0,0,.1); }
.c-branca { --cv: #f6f1e4; } .c-vermelha { --cv: #c62828; } .c-azul { --cv: #3f6fd8; }
.c-amarela { --cv: #f2c230; } .c-verde { --cv: #3a9b4b; } .c-rosa { --cv: #ec8fb5; }
.capela { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: .6rem; padding: 1rem; border-radius: 18px;
  background: radial-gradient(ellipse at top, #3a2f22, #15120e 70%); min-height: 120px; }
.capela .vazio { grid-column: 1 / -1; color: #d8c9a8; }
.vela-item { background: none; border: 0; color: #f3e6c4; display: flex; flex-direction: column; align-items: center; gap: .3rem; cursor: pointer; padding: .2rem; }
.vela-item small { color: #e7d8b3; font-size: .7rem; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vela-acendendo { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(10, 8, 5, .7); z-index: 50; animation: sumir 1.6s forwards; }
.vela-acendendo .vela { transform: scale(2.6); }
@keyframes sumir { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.dlg { border: 0; border-radius: 18px; padding: 1.2rem; max-width: 420px; width: 90%; background: var(--card); color: var(--texto); }
.dlg::backdrop { background: rgba(0,0,0,.55); }

/* ---------- Rosas ---------- */
.altar { text-align: center; padding: 1rem; margin-bottom: 1rem; border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, var(--ouro) 18%, var(--card)), var(--card)); border: 1px solid var(--borda); }
.altar-img img, .altar-placeholder { width: 150px; height: 190px; object-fit: cover; border-radius: 80px 80px 14px 14px; border: 4px solid var(--ouro); box-shadow: 0 0 30px color-mix(in srgb, var(--ouro) 50%, transparent); }
.altar-placeholder { display: inline-grid; place-items: center; font-size: 4rem; color: var(--ouro); background: var(--card); }
.altar-rosas { display: flex; flex-wrap: wrap; justify-content: center; gap: .1rem; margin-top: -.6rem; font-size: 1.5rem; }
.altar-cont { margin: .5rem 0 0; color: var(--suave); font-size: .9rem; }
.rosa { font-size: 1.6rem; display: inline-block; }
.r-branca { filter: grayscale(1) brightness(2.6) contrast(.75); } .r-rosa { filter: hue-rotate(-25deg) saturate(.7) brightness(1.35); }
.r-amarela { filter: hue-rotate(55deg) saturate(1.4) brightness(1.3); } .r-vermelha { filter: none; }

/* ---------- Mural (rosas/pedidos) ---------- */
.mural { display: flex; gap: .8rem; align-items: flex-start; }
.mural p { margin: .3rem 0 .5rem; white-space: pre-line; }
.flex1 { flex: 1; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--azul2); color: #fff; font-weight: 700; flex-shrink: 0; }
.btn-rezei { border: 1px solid var(--borda); background: var(--fundo); color: var(--texto); border-radius: 99px; padding: .4rem .9rem; font: inherit; font-size: .85rem; cursor: pointer; }
.btn-rezei.feito { background: color-mix(in srgb, var(--ouro) 18%, transparent); border-color: var(--ouro); }

/* ---------- Horários ---------- */
.dia.hoje { border: 2px solid var(--ouro); }
.horarios { list-style: none; padding: 0; margin: 0; }
.horarios li { display: flex; gap: .9rem; padding: .55rem 0; border-top: 1px dashed var(--borda); }
.horarios li:first-child { border-top: 0; }
.horarios .h { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--azul); min-width: 56px; }
.horarios small { display: block; }
.filtros, .abas, .valores { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .8rem; }
.chip { border: 1px solid var(--borda); background: var(--card); color: var(--texto); border-radius: 99px; padding: .45rem .9rem; font: inherit; font-size: .85rem; white-space: nowrap; cursor: pointer; }
.chip.ativo { background: var(--azul); border-color: var(--azul); color: var(--fundo); }

/* ---------- Leituras / orações ---------- */
.nav-data { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; text-align: center; }
.nav-data b, .nav-data small { display: block; }
.leitura .texto { font-family: var(--serif); font-size: 1.05rem; line-height: 1.75; white-space: normal; }
.fonte { display: flex; gap: .5rem; justify-content: center; }
.busca { margin-bottom: .5rem; }
.lista { list-style: none; padding: 0; margin: 0 0 .8rem; background: var(--card); border: 1px solid var(--borda); border-radius: 16px; overflow: hidden; }
.lista li + li { border-top: 1px solid var(--borda); }
.lista a { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; }
.lista a span { margin-left: auto; color: var(--suave); font-size: 1.3rem; }
.lista-ic i { font-style: normal; font-size: 1.3rem; }
.rodape-txt { text-align: center; color: var(--suave); font-size: .8rem; margin-top: 1.5rem; }

/* ---------- PIX ---------- */
.pix-qr { display: grid; place-items: center; padding: .8rem; background: #fff; border-radius: 12px; margin: .5rem auto; width: fit-content; min-height: 60px; }
.pix-codigo { font-family: monospace; font-size: .75rem; margin-bottom: .6rem; }
.dica { font-size: .8rem; color: var(--suave); text-align: center; margin-bottom: 0; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #1f2a5a; color: #fff; padding: .75rem 1.1rem;
  border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 90%; box-shadow: 0 6px 20px rgba(0,0,0,.25); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.erro { background: #b3261e; }
