:root {
  --navy: #082950;
  --navy-2: #041b35;
  --blue: #174b7a;
  --gold: #c7922b;
  --gold-light: #f6d887;
  --cream: #fff9ed;
  --cream-2: #f6ecd8;
  --ink: #132b47;
  --muted: #6b7280;
  --white: #ffffff;
  --success: #2d7d5b;
  --danger: #a83b3b;
  --shadow: 0 18px 44px rgba(8, 41, 80, .14);
  --radius: 24px;
  --font-scale: 1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(246,216,135,.35), transparent 28rem),
    linear-gradient(180deg, #fffdf8 0%, #f4ead8 100%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: calc(16px * var(--font-scale));
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.noscript { padding: 1rem; background: #fff4d8; color: #7c2d12; text-align: center; }

/* Onboarding */
.onboarding {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  background: var(--navy-2);
}
.onboarding-visual {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 4rem;
  background:
    linear-gradient(140deg, rgba(4,27,53,.15), rgba(4,27,53,.72)),
    url("assets/images/nossa-senhora.webp") center/cover no-repeat;
}
.onboarding-visual::after {
  content: "";
  position: absolute;
  inset: auto -8rem -8rem auto;
  width: 28rem;
  height: 28rem;
  background: url("assets/images/floral.webp") center/contain no-repeat;
  opacity: .48;
  pointer-events: none;
}
.brand-panel {
  position: relative;
  z-index: 1;
  max-width: 650px;
  color: white;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0,0,0,.35);
}
.brand-panel .brand-logo { width: 112px; margin: 0 auto 1.2rem; border-radius: 50%; box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.brand-panel h1 { margin: 0; font-size: clamp(2.3rem, 5vw, 4.8rem); line-height: .98; font-weight: 500; }
.brand-panel h1 span { color: var(--gold-light); }
.brand-panel p { max-width: 560px; margin: 1.3rem auto 0; font-size: 1.12rem; line-height: 1.65; }
.onboarding-form-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: var(--cream);
}
.onboarding-card { width: min(100%, 520px); }
.eyebrow { color: var(--gold); letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; font-weight: 700; }
.onboarding-card h2 { margin: .5rem 0 .75rem; color: var(--navy); font-size: clamp(2rem, 4vw, 3rem); line-height: 1.08; }
.onboarding-card > p { color: #526276; line-height: 1.7; margin-bottom: 1.8rem; }

/* Form */
.field { display: grid; gap: .5rem; margin: 1rem 0; }
.field label { color: var(--navy); font-weight: 700; }
.field small { color: var(--muted); line-height: 1.45; }
.field input, .field textarea {
  width: 100%;
  border: 1.5px solid #d9cdb8;
  border-radius: 14px;
  padding: .95rem 1rem;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: .2s ease;
}
.field input:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(199,146,43,.14); }
.checkbox-row { display: flex; align-items: flex-start; gap: .7rem; color: #526276; font-size: .92rem; line-height: 1.45; margin: 1rem 0; }
.checkbox-row input { margin-top: .25rem; accent-color: var(--gold); }

.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: .85rem 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #d6a23a, #b77a13); box-shadow: 0 10px 24px rgba(183,122,19,.24); }
.btn-secondary { color: var(--navy); background: #fff; border: 1px solid #dfd2bb; }
.btn-ghost { color: var(--navy); background: rgba(8,41,80,.07); }
.btn-danger { color: var(--danger); background: #fff0f0; }
.btn-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.button-row .btn { flex: 1 1 180px; }

/* Main shell */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem max(1rem, calc((100vw - 1180px) / 2));
  color: white;
  background: rgba(4,27,53,.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(246,216,135,.22);
}
.brand-mini { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.brand-mini img { width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto; }
.brand-mini strong { display: block; color: var(--gold-light); font-size: 1rem; }
.brand-mini span { display: block; color: rgba(255,255,255,.76); font-size: .77rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.top-actions { display: flex; gap: .45rem; }
.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  color: white;
  background: rgba(255,255,255,.08);
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.main-content { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 7rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-head h1 { margin: 0; color: var(--navy); font-size: clamp(2rem, 4vw, 3.35rem); font-weight: 500; line-height: 1.05; }
.page-head p { margin: .5rem 0 0; color: #627086; line-height: 1.6; }

.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.3rem; align-items: stretch; }
.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 410px;
  border-radius: 30px;
  color: white;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, #082950, #134d7e);
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 48%;
  background: linear-gradient(90deg, #082950 0%, rgba(8,41,80,.12) 68%), url("assets/images/capa.webp") center/cover no-repeat;
  opacity: .94;
}
.hero-copy { position: relative; z-index: 1; width: 64%; padding: clamp(1.6rem, 4vw, 3.5rem); }
.hero-copy .eyebrow { color: var(--gold-light); }
.hero-copy h1 { margin: .55rem 0 1rem; font-size: clamp(2.2rem, 5vw, 4.2rem); line-height: .98; font-weight: 500; }
.hero-copy p { color: rgba(255,255,255,.84); line-height: 1.65; max-width: 580px; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-actions .btn-secondary { border: 0; }

.progress-card, .card {
  border: 1px solid rgba(199,146,43,.22);
  border-radius: var(--radius);
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow);
}
.progress-card { padding: 1.5rem; display: grid; align-content: center; }
.progress-ring {
  --progress: 0deg;
  width: 160px;
  aspect-ratio: 1;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--gold) var(--progress), #ebe3d5 0);
  position: relative;
}
.progress-ring::before { content: ""; position: absolute; width: 126px; aspect-ratio: 1; border-radius: 50%; background: #fff; }
.progress-ring-content { position: relative; text-align: center; }
.progress-ring-content strong { display: block; color: var(--navy); font-size: 2.3rem; line-height: 1; }
.progress-ring-content span { color: var(--muted); font-size: .82rem; }
.progress-card h2 { color: var(--navy); text-align: center; margin: .5rem 0; }
.progress-card p { text-align: center; color: #627086; line-height: 1.55; margin: .5rem 0 1rem; }

.section { margin-top: 2rem; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.section-title h2 { margin: 0; color: var(--navy); font-size: 1.55rem; }
.section-title a, .text-link { color: #8a5d0a; font-weight: 700; text-decoration: none; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.quick-card { padding: 1.3rem; display: flex; flex-direction: column; gap: .65rem; min-height: 190px; }
.quick-card .icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: #f7ead0; font-size: 1.35rem; }
.quick-card h3 { margin: .1rem 0; color: var(--navy); }
.quick-card p { margin: 0; color: #627086; line-height: 1.55; flex: 1; }

/* Day grid */
.day-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.day-card {
  position: relative;
  overflow: hidden;
  min-height: 230px;
  padding: 1.25rem;
  border: 1px solid rgba(199,146,43,.27);
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: 0 12px 30px rgba(8,41,80,.08);
  display: flex;
  flex-direction: column;
}
.day-card::after { content: ""; position: absolute; right: -55px; bottom: -58px; width: 150px; height: 150px; background: url("assets/images/floral.webp") center/contain no-repeat; opacity: .16; }
.day-card.complete { border-color: rgba(45,125,91,.45); background: #f4fbf7; }
.day-card.complete::before { content: "✓"; position: absolute; right: 1rem; top: 1rem; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--success); font-weight: 700; }
.day-number { color: var(--gold); text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; font-weight: 700; }
.day-card h3 { margin: .45rem 0; color: var(--navy); font-size: 1.45rem; }
.day-card p { color: #627086; line-height: 1.55; margin: .25rem 0 1rem; flex: 1; }
.day-card .btn { position: relative; z-index: 1; align-self: flex-start; }

/* Prayer view */
.prayer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.3rem; align-items: start; }
.prayer-main { min-width: 0; }
.prayer-banner { padding: 1.3rem 1.5rem; color: white; border-radius: 22px; background: linear-gradient(135deg, #082950, #155889); box-shadow: var(--shadow); }
.prayer-banner .day-number { color: var(--gold-light); }
.prayer-banner h1 { margin: .35rem 0 .65rem; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 500; }
.prayer-banner p { margin: 0; color: rgba(255,255,255,.84); line-height: 1.6; }
.prayer-section { padding: clamp(1.15rem, 3vw, 2rem); margin-top: 1rem; }
.prayer-section h2 { color: var(--gold); font-size: 1rem; text-transform: uppercase; letter-spacing: .11em; margin: 0 0 .8rem; }
.prayer-section p { margin: 0; color: #223b58; font-size: 1.12rem; line-height: 1.9; white-space: pre-line; }
.jaculatoria { border-left: 5px solid var(--gold); background: #fff8e8; }
.jaculatoria p { font-style: italic; font-weight: 700; color: var(--navy); }
.prayer-tools { position: sticky; top: 92px; display: grid; gap: 1rem; }
.tool-card { padding: 1.2rem; }
.tool-card h3 { margin: 0 0 .75rem; color: var(--navy); }
.tool-card p { color: #627086; line-height: 1.5; font-size: .92rem; }
.tool-card .btn { width: 100%; margin-top: .55rem; }
.audio-native { display: none; margin-top: .75rem; }
.audio-native audio { width: 100%; }
.font-controls { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.complete-message { padding: .9rem; border-radius: 14px; background: #eaf7ef; color: #256647; font-weight: 700; text-align: center; }

/* Bonus */
.bonus-hero { display: grid; grid-template-columns: 1fr .9fr; gap: 1.2rem; padding: 1.3rem; align-items: center; }
.bonus-hero img { border-radius: 18px; box-shadow: 0 10px 26px rgba(8,41,80,.12); }
.bonus-copy { padding: 1rem; }
.bonus-copy h2 { margin: .4rem 0 .8rem; color: var(--navy); font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.05; }
.bonus-copy p { color: #627086; line-height: 1.7; }
.today-blessing { margin: 1rem 0; padding: 1rem; border-radius: 16px; background: #fff6df; border: 1px solid #ead19c; }
.today-blessing strong { color: var(--gold); }
.blessings-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .75rem; margin-top: 1rem; }
.blessing-item { padding: 1rem; border-radius: 16px; background: #fff; border: 1px solid #eadfcd; display: flex; gap: .8rem; line-height: 1.5; }
.blessing-day { color: var(--gold); font-weight: 700; white-space: nowrap; }

/* Profile */
.profile-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 1.2rem; align-items: start; }
.profile-card { padding: 1.4rem; }
.profile-avatar { width: 86px; height: 86px; border-radius: 50%; margin-bottom: 1rem; }
.profile-card h2 { color: var(--navy); margin: .3rem 0; }
.profile-card p { color: #627086; line-height: 1.55; }
.settings-list { display: grid; gap: .75rem; }
.setting-row { padding: 1rem; border-radius: 16px; border: 1px solid #e4dac9; background: #fff; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.setting-row strong { display: block; color: var(--navy); }
.setting-row span { color: var(--muted); font-size: .86rem; }

/* Certificate */
.certificate-page .page-head { align-items: center; }
.certificate-form { padding: 1.2rem; margin-bottom: 1rem; }
.certificate-preview-wrap { overflow: auto; padding: .25rem; }
.certificate-preview {
  position: relative;
  width: min(100%, 1100px);
  min-width: 760px;
  margin: 0 auto;
  aspect-ratio: 1492 / 1054;
  color: #082950;
  background: #fff;
  box-shadow: 0 18px 50px rgba(8,41,80,.2);
}
.certificate-preview > img { width: 100%; height: 100%; object-fit: cover; }
.cert-field { position: absolute; text-align: center; font-weight: 700; font-size: clamp(13px, 1.6vw, 25px); line-height: 1; }
.cert-avo { left: 35%; top: 34.5%; width: 45%; }
.cert-neto { left: 21%; top: 43.4%; width: 59%; font-size: clamp(16px, 2vw, 30px); }
.cert-date { left: 24.7%; top: 84.8%; width: 17%; font-size: clamp(11px, 1.25vw, 19px); font-weight: 500; }
.cert-signature { left: 61.6%; top: 84.8%; width: 20%; font-family: cursive; font-size: clamp(12px, 1.5vw, 23px); font-weight: 500; }
.certificate-locked { padding: 2rem; text-align: center; }
.certificate-locked .lock-icon { font-size: 3rem; }
.certificate-locked h2 { color: var(--navy); }
.certificate-locked p { color: #627086; line-height: 1.6; max-width: 580px; margin: .5rem auto 1.2rem; }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(640px, calc(100% - 1.2rem));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .35rem;
  padding: .55rem;
  border: 1px solid rgba(246,216,135,.22);
  border-radius: 20px;
  color: white;
  background: rgba(4,27,53,.97);
  box-shadow: 0 14px 38px rgba(4,27,53,.32);
  backdrop-filter: blur(16px);
}
.nav-btn { border: 0; border-radius: 14px; min-height: 53px; color: rgba(255,255,255,.7); background: transparent; display: grid; place-items: center; gap: .1rem; padding: .35rem; font-size: .74rem; }
.nav-btn span:first-child { font-size: 1.15rem; }
.nav-btn.active { color: var(--gold-light); background: rgba(255,255,255,.09); }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 96px; transform: translate(-50%, 24px); max-width: calc(100% - 2rem); padding: .85rem 1rem; border-radius: 14px; color: #fff; background: #132b47; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s ease; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall 1.8s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(680deg); opacity: .2; } }

.install-banner { margin-top: 1rem; padding: 1rem; border-radius: 16px; color: white; background: linear-gradient(135deg, #082950, #174b7a); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.install-banner p { margin: 0; color: rgba(255,255,255,.82); line-height: 1.45; }
.install-banner strong { display: block; color: var(--gold-light); }

.disclaimer { color: #69778a; font-size: .88rem; line-height: 1.6; }
.back-btn { margin-bottom: 1rem; }

@media (max-width: 960px) {
  .onboarding { grid-template-columns: 1fr; }
  .onboarding-visual { min-height: 48vh; padding: 2.2rem 1.3rem; }
  .onboarding-form-wrap { min-height: auto; padding: 2rem 1.2rem 3rem; }
  .hero-grid, .bonus-hero, .profile-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 470px; }
  .hero-copy { width: 78%; }
  .hero-card::after { width: 58%; opacity: .66; }
  .card-grid, .day-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prayer-layout { grid-template-columns: 1fr; }
  .prayer-tools { position: static; grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 620px) {
  .topbar { height: 68px; }
  .brand-mini img { width: 42px; height: 42px; }
  .brand-mini strong { font-size: .91rem; }
  .brand-mini span { max-width: 145px; }
  .main-content { width: min(100% - 1.15rem, 1180px); padding-top: 1rem; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .hero-card { min-height: 515px; }
  .hero-card::after { inset: auto 0 0 0; width: 100%; height: 58%; background: linear-gradient(180deg, #082950 0%, rgba(8,41,80,.12) 60%), url("assets/images/capa.webp") top center/cover no-repeat; }
  .hero-copy { width: 100%; padding: 1.45rem; }
  .hero-copy h1 { font-size: 2.45rem; }
  .card-grid, .day-grid, .blessings-list { grid-template-columns: 1fr; }
  .prayer-tools { grid-template-columns: 1fr; }
  .prayer-section p { font-size: 1.04rem; line-height: 1.8; }
  .button-row { flex-direction: column; }
  .button-row .btn { flex: none; width: 100%; }
  .install-banner { align-items: flex-start; flex-direction: column; }
  .bottom-nav { bottom: max(7px, env(safe-area-inset-bottom)); }
  .certificate-preview { min-width: 690px; }
}

@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff; }
  .topbar, .bottom-nav, .page-head, .certificate-form, .toast, .back-btn { display: none !important; }
  .main-content { width: 100%; padding: 0; margin: 0; }
  .certificate-preview-wrap { overflow: visible; padding: 0; }
  .certificate-preview { min-width: 0; width: 100vw; height: 100vh; box-shadow: none; }
}
