/* ==========================================================================
   Rosário da Adoração Perpétua
   Layout "Anel": o rosário é a página. Cores da Fraternidade de Ars:
   verde-floresta, verde-esmeralda, branco e o dourado da medalha.
   ========================================================================== */

:root {
  --bg: #002415;
  --bg-deep: #001b10;
  --surface: #082b1c;
  --surface-2: #0c3926;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .16);
  --accent: #35c084;
  --accent-hi: #5ad49d;
  --accent-ink: #00170d;
  --accent-soft: rgba(53, 192, 132, .14);
  --text: #fff;
  --text-2: rgba(255, 255, 255, .76);
  --text-3: rgba(255, 255, 255, .5);
  --gold: #d6b460;
  --gold-hi: #f3d98a;
  --gold-grad: radial-gradient(circle at 35% 28%, #fbecbb 0%, #d6b460 50%, #7d5f1c 100%);

  --font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --serif: "Roboto Serif", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ps: 1; /* tamanho do texto (ajustes) */

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden; color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.55;
  background: radial-gradient(70vmax 60vmax at 30% 40%, #04331f 0%, var(--bg) 60%, var(--bg-deep) 100%) var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
p, h1, h2, h3 { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 14px; height: 14px; }

/* ---------- Barra do topo ---------- */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; border-radius: 10px; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand-text { font-size: 13px; line-height: 1.25; color: var(--text-3); }
.brand-text b { display: block; font-size: 14.5px; color: #fff; font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.pill {
  position: relative; height: 38px; min-width: 38px; padding: 0 12px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  border: 1px solid var(--line-2); background: rgba(0, 27, 16, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: color .2s, border-color .2s;
}
.pill:hover, .pill:focus-visible { color: #fff; border-color: rgba(255, 255, 255, .34); }
.pill--round { width: 38px; padding: 0; font-size: 16px; font-weight: 700; }

/* Menu de idiomas (próprio, para não depender da lista nativa do navegador) */
.lang { position: relative; }
.lang-btn[aria-expanded="true"] { color: #fff; border-color: rgba(53, 192, 132, .55); }
.lang-chev { transition: transform .25s var(--ease); }
.lang-btn[aria-expanded="true"] .lang-chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 196px; padding: 6px;
  border-radius: 16px; border: 1px solid var(--line-2); background: rgba(8, 43, 28, .96);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6);
  transform-origin: top right; animation: menu-in .18s var(--ease);
}
.lang-menu[hidden] { display: none; }
.lang-item {
  width: 100%; height: 42px; padding: 0 10px 0 12px; border-radius: 10px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  font-size: 15px; color: var(--text-2); transition: background .15s, color .15s;
}
.lang-item:hover, .lang-item:focus-visible { background: rgba(255, 255, 255, .07); color: #fff; outline: none; }
.lang-item .lang-name { flex: 1; }
.flag { display: block; width: 21px; height: 14px; flex: none; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.lang-flag { display: inline-flex; }
.lang-item .ic { width: 16px; height: 16px; stroke-width: 2.2; color: var(--accent-hi); visibility: hidden; }
.lang-item[aria-checked="true"] { color: #fff; font-weight: 600; }
.lang-item[aria-checked="true"] .ic { visibility: visible; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.97); } }

/* ---------- Palco: rosário + leitura ---------- */
.app {
  height: 100dvh; display: grid; grid-template-rows: minmax(0, 44fr) minmax(0, 56fr);
  padding-top: calc(max(12px, env(safe-area-inset-top)) + 54px);
}
.stage { position: relative; min-height: 0; display: grid; place-items: center; }
.stage-inner { position: relative; }
.stage-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* Rosário (SVG de js/rosary.js) */
.r-cord { stroke: rgba(255, 255, 255, .16); stroke-width: 1; fill: none; }
.r-aura { opacity: .55; }
.r-bead { opacity: .42; transition: opacity .4s, fill .4s; }
.r-bead.is-done, .r-bead.is-current { opacity: 1; }
.r-small.is-done, .r-santo.is-done { fill: var(--accent); }
.r-large, .r-first { opacity: .62; }
.r-medal { opacity: .9; }
.r-medal-glow { opacity: .5; transition: opacity .4s; }
.r-medal.is-current .r-medal-glow { opacity: 1; }
.r-halo { fill: none; stroke: #fff; stroke-width: 1.6; opacity: 0; transition: opacity .3s, cx .45s var(--ease), cy .45s var(--ease), r .45s var(--ease); }
.r-halo.on { opacity: 1; animation: halo 2.4s ease-in-out infinite; }
.r-glow { opacity: 0; transition: opacity .3s, fill .3s, cx .45s var(--ease), cy .45s var(--ease), r .45s var(--ease); }
.r-glow.on { opacity: .8; }
.r-hit { fill: transparent; cursor: pointer; }
.is-complete .r-bead { opacity: 1; }
@keyframes halo { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .3; } }

/* Centro do laço */
.hub { position: absolute; display: grid; place-items: center; text-align: center; border-radius: 50%; transform: translate(-50%, -50%); }
.hub-in { display: grid; justify-items: center; gap: 4px; padding: 0 6%; }
.hub-big { font-family: var(--serif); font-weight: 300; line-height: 1.02; font-size: var(--hub-big, 40px); letter-spacing: -.01em; }
.hub-big.is-text { font-size: calc(var(--hub-big, 40px) * .62); }
.hub-small { font-size: var(--hub-small, 12px); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
.hub-logo { width: 34%; aspect-ratio: 1; margin-bottom: 4px; }
.hub-start { display: grid; justify-items: center; gap: 6px; border-radius: 50%; padding: 10%; }
.hub-start .hub-small { color: var(--accent); }
.hub-start .hub-logo { transition: transform .4s var(--ease); }
.hub-start:hover .hub-logo { transform: scale(1.05); }
.hub-medal { width: 46%; aspect-ratio: 1; border-radius: 50%; padding: 4%; background: var(--gold-grad); box-shadow: 0 0 40px -6px rgba(243, 217, 138, .55); margin-bottom: 6px; transition: transform .3s var(--ease); }
.hub-medal:hover { transform: scale(1.04); }
.hub-medal img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.hub.is-preview .hub-big { color: var(--gold-hi); }
.hub-in.swap { animation: soft .45s var(--ease); }

/* Leitura */
.reading { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.scroll {
  min-height: 0; overflow: auto; padding: 6px 20px 10px; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.copy { max-width: 560px; margin: 0 auto; }
.copy.swap { animation: soft .45s var(--ease); }
@keyframes soft { from { opacity: 0; filter: blur(3px); } }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.title { margin: 6px 0 12px; font-size: calc(clamp(24px, 3vw, 32px) * var(--ps)); line-height: 1.15; font-weight: 800; }
.body { font-size: calc(18px * var(--ps)); line-height: 1.6; color: var(--text-2); }
.pr-text { font-family: var(--serif); font-weight: 300; }
.pr-lead { margin-top: .9em; font-family: var(--serif); font-style: italic; font-weight: 300; color: var(--accent-hi); }
.pr-v, .pr-r { font-family: var(--serif); font-size: 1.12em; }
.pr-v { font-weight: 300; }
.pr-r { margin-top: .35em; color: var(--accent-hi); }

/* Botões fixos: a altura da leitura não depende do texto */
.controls {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 600px; margin: 0 auto;
  padding: 10px 20px max(16px, env(safe-area-inset-bottom));
}
.nav-btn {
  width: 50px; height: 50px; flex: none; border-radius: 50%; border: 1px solid var(--line-2);
  display: grid; place-items: center; color: var(--text-2); transition: border-color .2s, color .2s, opacity .2s;
}
.nav-btn:hover { color: #fff; border-color: rgba(255, 255, 255, .35); }
.nav-btn:disabled { opacity: .28; cursor: default; }
.next-btn {
  flex: 1; min-width: 0; height: 50px; border-radius: 999px; padding: 0 16px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .2s, transform .15s;
}
.next-btn:hover { background: var(--accent-hi); }
.next-btn:active { transform: scale(.985); }
.progress { width: 70px; flex: none; text-align: right; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Início: escolha entre Rosário e Terço */
.intro-text { margin-bottom: 18px; }
.modes { display: grid; gap: 10px; }
.mode {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; width: 100%; padding: 14px 16px; text-align: left;
  border-radius: 14px; border: 1px solid var(--line-2); background: rgba(8, 43, 28, .6); transition: border-color .2s, background .2s;
}
.mode b { font-size: 16px; }
.mode span { grid-column: 1; font-size: 14px; color: var(--text-3); }
.mode em { grid-row: 1 / span 2; grid-column: 2; font-style: normal; font-size: 13px; color: var(--text-3); }
.mode:hover { border-color: rgba(255, 255, 255, .3); }
.mode[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mode[aria-checked="true"] em { color: var(--accent-hi); }
/* Opção "Não estou diante do Sacrário" */
.away {
  display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 12px 16px; cursor: pointer;
  border-radius: 14px; border: 1px solid var(--line-2); background: rgba(8, 43, 28, .6); transition: border-color .2s;
}
.away:hover { border-color: rgba(255, 255, 255, .3); }
.away-text { flex: 1; min-width: 0; }
.away-text b { display: block; font-size: 15px; font-weight: 600; }
.away-text span { display: block; font-size: 13.5px; color: var(--text-3); line-height: 1.4; }
.resume {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 12px 16px; text-align: left;
  border-radius: 14px; border: 1px dashed rgba(243, 217, 138, .45); color: var(--gold-hi); transition: background .2s;
}
.resume:hover { background: rgba(243, 217, 138, .06); }
.resume span { display: block; font-size: 13.5px; color: var(--text-3); }
.resume b { font-weight: 600; }
.resume .ic { margin-left: auto; }
.done-stats { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.done-stats span { padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-hi); font-size: 13.5px; font-weight: 500; }

@media (min-width: 900px) {
  .app {
    grid-template-rows: none; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); gap: 3vw;
    padding: 76px 4vw 28px;
  }
  /* Caixa de leitura com altura fixa: o botão "Próxima" fica sempre no mesmo lugar */
  .reading { align-self: center; height: min(600px, calc(100dvh - 150px)); }
  .scroll { padding: 0 6px 0 0; }
  .copy { margin: 0; }
  .controls { margin: 0; padding: 24px 0 0; }
  .title { font-size: calc(34px * var(--ps)); }
  .body { font-size: calc(19px * var(--ps)); }
}

/* ---------- Painel (Como rezar, Mãe Celeste, ajustes, a devoção) ---------- */
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.sheet {
  width: min(600px, calc(100% - 24px)); max-height: min(88dvh, 820px); padding: 30px 24px 26px;
  border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(0, 12, 7, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet-close { position: absolute; right: 10px; top: 10px; }
.sheet-section + .sheet-section { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.sheet-kicker { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.sheet-title { margin: 6px 0 14px; font-size: 24px; font-weight: 800; line-height: 1.15; padding-right: 36px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before { content: counter(s); grid-row: span 3; font-size: 13px; font-weight: 700; color: var(--accent); padding-top: 2px; }
.steps b { font-size: 15.5px; font-weight: 600; }
.steps .where { font-size: 14px; color: var(--gold-hi); }
.steps .detail { font-size: 14px; color: var(--text-3); font-weight: 300; }
.medal-row { display: flex; gap: 18px; align-items: center; padding: 16px; border-radius: 16px; background: var(--bg); }
.medal-frame { flex: none; width: 96px; aspect-ratio: 1; padding: 5px; border-radius: 50%; background: var(--gold-grad); box-shadow: 0 0 36px -6px rgba(243, 217, 138, .45); transition: transform .25s var(--ease); }
.medal-frame:hover { transform: scale(1.04); }
.medal-frame img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.medal-row b { display: block; font-size: 17px; }
.medal-row p { font-size: 14px; color: var(--text-2); font-weight: 300; }
.link { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--accent); font-weight: 600; font-size: 14px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link .ic { width: 16px; height: 16px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.setting:first-of-type { border-top: 0; }
.sizes { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line-2); }
.sizes button { width: 40px; height: 32px; border-radius: 999px; color: var(--text-3); font-weight: 700; }
.sizes button[aria-pressed="true"] { background: var(--accent-soft); color: #fff; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.prose p { font-size: 15px; color: var(--text-2); font-weight: 300; }
.prose p + p { margin-top: 10px; }
.sheet-sub { margin: 22px 0 6px; font-size: 16px; font-weight: 700; color: #fff; }

/* Promessas: lista numerada com números dourados */
.promises { margin: 16px 0 0; padding: 0; list-style: none; counter-reset: pr; display: grid; gap: 8px; }
.promises li {
  counter-increment: pr; display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border-radius: 14px; background: var(--bg); font-size: 15px; line-height: 1.4; color: #fff;
}
.promises li::before {
  content: counter(pr); flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-grad); color: #3d2c07; font-size: 13px; font-weight: 800;
}
.quote { margin: 16px 0 0; padding-left: 14px; border-left: 2px solid var(--gold); font-family: var(--serif); font-style: italic; font-weight: 300; color: #fff; }
.quote small { display: block; margin-top: 4px; font-family: var(--font); font-style: normal; font-size: 12.5px; color: var(--text-3); }
.credit { margin-top: 16px; font-size: 13px; color: var(--text-3); }
.sheet-foot { display: flex; align-items: center; gap: 14px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.sheet-foot img { width: 64px; height: 64px; flex: none; }
.sheet-foot p { font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 14.5px; color: var(--text-2); }
.sheet-foot p.credit { margin-top: 8px; font-family: var(--font); font-style: normal; font-size: 13px; color: var(--text-3); }
.sheet-foot .link { margin-top: 4px; }

/* ---------- Mãe Celeste ampliada ---------- */
.lightbox { width: min(560px, calc(100% - 24px)); max-height: 94dvh; padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--text); overflow: visible; }
.lightbox::backdrop { background: rgba(0, 10, 6, .85); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lightbox-fig { margin: 0; }
.lightbox-fig img { width: 100%; max-height: calc(94dvh - 56px); object-fit: contain; border-radius: 18px 18px 0 0; background: #000; }
.lightbox-fig figcaption { padding: 14px 18px; font-weight: 700; }
.lightbox-close { position: absolute; right: -8px; top: -8px; background: var(--surface); border: 1px solid var(--line-2); }

.noscript { position: fixed; inset: auto 16px 16px; padding: 14px; border-radius: 12px; background: var(--surface); text-align: center; }

@media (max-width: 420px) {
  .brand-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
