:root {
  --ink: #2b2014; --ink2: #5b4a36; --muted: #8a7a64;
  --paper: #fbf6ea; --paper2: #f3ead6; --line: #e2d3b2;
  --gold: #d8b24a; --gold2: #b8902a; --wine: #8f2a24; --navy: #1f2a44;
  --glass: rgba(251, 246, 234, .9); --shadow: 0 10px 30px rgba(30, 20, 5, .25);
  --serif: "Cormorant Garamond", Georgia, serif; --sans: "Be Vietnam Pro", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b2014; color: var(--ink); font-family: var(--sans); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font-size: 48px; color: var(--gold); background: #2b2014; z-index: 50; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 999px; background: var(--paper2); color: var(--ink); font-weight: 700; border: 1px solid var(--line); transition: transform .12s; }
.btn:active { transform: scale(.97); }
.btn.gold { background: linear-gradient(180deg, #ecc96a, #c99a2e); color: #2b1a04; border-color: #b8902a; box-shadow: 0 4px 14px rgba(184, 144, 42, .35); }
.btn.big { min-height: 52px; font-size: 17px; width: 100%; }
.link { color: var(--wine); font-weight: 600; text-decoration: underline; padding: 6px 0; }

/* gate */
#gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 30%, rgba(43, 32, 20, .15), rgba(43, 32, 20, .6)); transition: opacity .6s; overflow-y: auto; }
#gate.gone { opacity: 0; pointer-events: none; }
.gcard { position: relative; width: min(440px, 100%); background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 24px; padding: 26px 22px 18px; box-shadow: var(--shadow); text-align: center; }
.gcross { width: 28px; height: 40px; margin: 6px auto 0; position: relative; }
.gcross::before, .gcross::after { content: ""; position: absolute; background: var(--gold); border-radius: 2px; }
.gcross::before { left: 11px; top: 0; width: 6px; height: 40px; }
.gcross::after { left: 0; top: 10px; width: 28px; height: 6px; }
.gcard h1 { font-family: var(--serif); font-size: 40px; line-height: 1.05; margin: 8px 0 4px; color: var(--ink); }
.gsub { margin: 0 86px 0 0; text-align: left; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold2); font-weight: 700; }
.glit { margin: 4px 0 10px; font-size: 13px; color: var(--ink2); display: inline-flex; align-items: center; gap: 6px; }
.glit i, #lit i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px rgba(255, 255, 255, .8); }
.glead { margin: 0 0 16px; color: var(--ink2); font-size: 15px; line-height: 1.55; }
.glang { position: absolute; top: 12px; right: 12px; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--paper2); border: 1px solid var(--line); }
.fld { display: block; text-align: left; margin: 0 0 14px; }
.fld > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); margin-bottom: 6px; }
.fld input, textarea { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); outline: none; }
.fld input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216, 178, 74, .25); }
textarea { resize: none; margin: 10px 0 0; }
.gout { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; }
.sw i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); }
.sw.on { border-color: var(--gold2); box-shadow: 0 0 0 2px rgba(216, 178, 74, .5); }
.gdisc { margin: 12px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* hud */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; box-shadow: var(--shadow); min-width: 0; }
.brand b { display: block; font-family: var(--serif); font-size: 21px; line-height: 1; white-space: nowrap; }
#lit { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; gap: 6px; flex-shrink: 0; }
.ic, .pill { height: 40px; min-width: 40px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 17px; display: grid; place-items: center; padding: 0 10px; }
.ic.txt { font-size: 13px; font-weight: 800; }
.ic.on { background: var(--gold); }
.pill { white-space: nowrap; font-size: 14px; color: var(--gold2); font-weight: 600; }
.pill b { color: var(--ink); }
.stats { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 64px); left: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; pointer-events: none; }
.stats span { background: rgba(43, 32, 20, .72); color: #f6ebd2; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.stats b { color: #f5d77a; }
#banner { background: rgba(106, 61, 154, .85) !important; }
#travel { position: absolute; left: 0; right: 0; bottom: calc(10px + var(--safe-b)); display: flex; gap: 6px; overflow-x: auto; padding: 0 12px; scrollbar-width: none; justify-content: center; }
#travel::-webkit-scrollbar { display: none; }
#travel button { flex: 0 0 auto; height: 34px; padding: 0 12px; border-radius: 999px; background: rgba(43, 32, 20, .75); color: #f6ebd2; font-size: 13px; font-weight: 600; border: 1px solid rgba(216, 178, 74, .4); }
#joy { position: absolute; left: 22px; bottom: calc(60px + var(--safe-b)); width: 124px; height: 124px; border-radius: 50%; background: rgba(251, 246, 234, .28); border: 2px solid rgba(251, 246, 234, .6); touch-action: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f5dd8a, #c99a2e); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); pointer-events: none; }
@media (pointer: fine) { #joy { opacity: .55; } }
#actBtn { position: absolute; right: 16px; bottom: calc(66px + var(--safe-b)); max-width: min(62vw, 360px); display: flex; align-items: center; gap: 8px; padding: 12px 18px 12px 12px; border-radius: 999px; background: linear-gradient(180deg, #ecc96a, #c99a2e); color: #2b1a04; font-weight: 800; font-size: 15px; box-shadow: 0 8px 22px rgba(120, 80, 10, .45); animation: pop .25s ease-out; text-align: left; line-height: 1.25; }
#actBtn b { width: 30px; height: 30px; border-radius: 50%; background: #2b2014; color: #f5d77a; display: grid; place-items: center; flex-shrink: 0; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
#toast { position: fixed; left: 50%; top: 30%; transform: translate(-50%, 10px); max-width: min(88vw, 460px); background: rgba(43, 32, 20, .9); color: #fbf1d8; padding: 12px 18px; border-radius: 16px; font-size: 15px; line-height: 1.5; text-align: center; z-index: 40; opacity: 0; transition: .3s; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* sheet */
#sheet { position: fixed; inset: 0; z-index: 20; }
#scrim { position: absolute; inset: 0; background: rgba(20, 14, 6, .35); opacity: 0; transition: .2s; }
#sheet .panel { position: absolute; left: 50%; bottom: 0; width: min(560px, 100%); max-height: 84vh; overflow-y: auto; transform: translate(-50%, 100%); transition: transform .22s ease-out; background: var(--paper); border-radius: 24px 24px 0 0; padding: 22px 20px calc(22px + var(--safe-b)); box-shadow: var(--shadow); }
#sheet.wide .panel { width: min(720px, 100%); }
#sheet.open #scrim { opacity: 1; }
#sheet.open .panel { transform: translate(-50%, 0); }
#sheet h2 { font-family: var(--serif); font-size: 30px; margin: 0 40px 8px 0; line-height: 1.1; }
#sheet .x { position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 50%; background: var(--paper2); font-size: 16px; }
.lead { color: var(--ink2); line-height: 1.6; margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; line-height: 1.55; }
.center { text-align: center; }
.serif { font-family: var(--serif); }
.big { font-size: 24px; font-weight: 700; margin: 6px 0 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 14px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.prayer { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 14px; padding: 12px 16px; margin: 10px 0; }
.prayer h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 22px; color: var(--wine); }
.prayer p { margin: 0; line-height: 1.7; font-size: 15.5px; }
.badge { display: inline-block; background: var(--wine); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.stat-big { text-align: center; margin: 6px 0; }
.stat-big b { display: block; font-family: var(--serif); font-size: 44px; color: var(--gold2); line-height: 1; }
.stat-big span { font-size: 13px; color: var(--muted); }
.verse { margin: 8px 0; padding: 22px 18px; background: #fff; border-radius: 18px; border: 1px solid var(--line); font-family: var(--serif); font-size: 27px; line-height: 1.35; text-align: center; }
.verse cite { display: block; margin-top: 10px; font-family: var(--sans); font-style: normal; font-size: 14px; color: var(--wine); font-weight: 700; }
.examen { padding-left: 0; list-style: none; margin: 0; counter-reset: c; }
.examen li { counter-increment: c; margin: 0 0 8px; }
.examen label { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; line-height: 1.5; font-size: 14.5px; }
.examen input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--wine); flex-shrink: 0; }
.examen b { display: block; color: var(--wine); }
.examen b::before { content: counter(c) ". "; }
.note { background: #fff7e0; border: 1px solid #ecd28a; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.q { font-family: var(--serif); font-size: 24px; text-align: center; line-height: 1.3; margin: 10px 0; }
.medit { font-size: 16px; line-height: 1.65; color: var(--ink2); font-style: italic; text-align: center; }
.dots { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; margin: 12px 0 4px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--wine); }
.dots i.cur { box-shadow: 0 0 0 3px var(--gold); }
.intents { margin-top: 6px; }
.intent { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 0 0 8px; }
.ih { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.ih time { margin-left: auto; color: var(--muted); font-size: 12px; }
.tag { background: var(--paper2); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: var(--ink2); }
.intent p { margin: 6px 0; line-height: 1.55; overflow-wrap: anywhere; }
.pray { font-size: 13px; font-weight: 700; color: var(--wine); padding: 4px 0; }
.pray em { font-style: normal; color: var(--ink2); }
.pray:disabled { opacity: .55; }
.journey { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.journey li { display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 8px 10px; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.journey i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.journey li.on i { background: var(--gold); border-color: var(--gold2); }
.journey li.on { color: var(--ink); font-weight: 600; }
.sub { font-family: var(--serif); font-size: 22px; margin: 12px 0 8px; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.totals div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.totals b { display: block; font-family: var(--serif); font-size: 22px; color: var(--gold2); }
.totals span { font-size: 11px; color: var(--muted); }

/* mass */
#mass { position: fixed; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translate(-50%, 30px); width: min(620px, calc(100% - 20px)); max-height: 52vh; display: flex; flex-direction: column; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); z-index: 15; opacity: 0; transition: .3s; }
#mass.show { opacity: 1; transform: translate(-50%, 0); }
.mtop { display: flex; align-items: center; gap: 10px; padding: 12px 14px 0; }
.mbar { flex: 1; height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; }
.mbar i, .rprog i { display: block; height: 100%; background: var(--gold); transition: width .3s; }
.mpos { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--navy); color: #fff; }
.mpos:empty { display: none; }
.mclose, .rclose { width: 34px; height: 34px; border-radius: 50%; background: var(--paper2); }
.mbody { padding: 8px 18px; overflow-y: auto; }
.mbody h2 { font-family: var(--serif); font-size: 28px; margin: 2px 0 6px; }
.mbody p { line-height: 1.65; margin: 0 0 8px; font-size: 15.5px; }
.part { font-size: 12px !important; letter-spacing: .1em; text-transform: uppercase; color: var(--gold2); font-weight: 800; margin: 6px 0 0 !important; }
.mnav { display: flex; gap: 10px; padding: 10px 14px 14px; }
.mnav .mback { width: 52px; font-size: 22px; padding: 0; }
.mnav .mnext { flex: 1; }

/* rosary */
#rosary { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 12px; background: rgba(20, 14, 6, .45); opacity: 0; transition: .3s; }
#rosary.show { opacity: 1; }
.rpanel { width: min(760px, 100%); max-height: 96vh; overflow-y: auto; background: var(--paper); border-radius: 24px; padding: 16px 18px calc(16px + var(--safe-b)); box-shadow: var(--shadow); }
.rtop { display: flex; align-items: center; gap: 10px; }
.rtitle { flex: 1; font-family: var(--serif); font-size: 24px; }
.rprog { height: 5px; background: var(--line); border-radius: 9px; overflow: hidden; margin: 8px 0 10px; }
.rgrid { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.rsvg svg { width: 100%; height: auto; display: block; }
.cord { fill: none; stroke: #b9a27a; stroke-width: 1.5; }
.bead { fill: #f2e6cd; stroke: #8a6a3a; stroke-width: 1.2; transition: fill .2s; }
.bead.big { fill: #e7d3a4; }
.bead.x rect, .bead.m path { fill: #c9a24a; stroke: #6b4a1a; }
.bead.done { fill: #8f2a24; }
.bead.cur { fill: #f5d24a; stroke: #b8902a; stroke-width: 3; filter: drop-shadow(0 0 4px rgba(245, 210, 74, .9)); }
.bead.x.cur rect, .bead.m.cur path { fill: #f5d24a; }
.rhead .myst { font-family: var(--serif); font-size: 24px; margin: 2px 0 6px; color: var(--wine); line-height: 1.2; }
.pname { font-weight: 800; margin: 4px 0 8px; font-size: 16px; }
.rtext p { margin: 0 0 8px; line-height: 1.65; font-size: 15px; color: var(--ink2); }
.rnext { margin-top: 12px; }
@media (max-width: 640px) {
  .rgrid { grid-template-columns: 1fr; }
  .rsvg { width: 190px; margin: 0 auto; }
  .totals { grid-template-columns: repeat(2, 1fr); }
  .journey { grid-template-columns: 1fr; }
  #actBtn { right: 12px; bottom: calc(76px + var(--safe-b)); max-width: calc(100vw - 172px); font-size: 14px; padding: 10px 14px 10px 10px; }
  .brand { padding: 7px 10px; }
  .brand b { font-size: 18px; }
  .stats { top: calc(max(10px, env(safe-area-inset-top)) + 58px); }
  #joy { left: 16px; width: 116px; height: 116px; }
  #travel { justify-content: flex-start; }
}

/* adoration */
#adore { position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; background: radial-gradient(circle at 50% 42%, rgba(255, 236, 170, .35), rgba(15, 10, 4, .88) 60%); opacity: 0; transition: opacity .6s; text-align: center; }
#adore.show { opacity: 1; }
.mon { width: 180px; height: 180px; position: relative; }
.mon .rays { position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(245, 210, 74, .9) 0 4deg, transparent 4deg 12deg); animation: spin 60s linear infinite; mask: radial-gradient(circle, transparent 36%, #000 38%, #000 64%, transparent 70%); -webkit-mask: radial-gradient(circle, transparent 36%, #000 38%, #000 64%, transparent 70%); }
.mon .host { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: #fff8e6; box-shadow: 0 0 40px 14px rgba(255, 240, 190, .8); }
@keyframes spin { to { transform: rotate(360deg); } }
#adore .q { font-family: var(--serif); font-size: 26px; color: #fbeccb; max-width: 520px; margin: 0; line-height: 1.3; }
#adore .tm { font-size: 42px; font-weight: 300; color: #f5d77a; margin: 0; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .mon .rays { animation: none; } #sheet .panel, #mass, #rosary, #toast { transition: none; } }
