/*
  VOICE   quiet, reverent, plain
  IDEA    a well-made pocket prayer book: one page, one column, wide margins
  PICTURE the open page itself; the timer is a large set of hanging numerals
  COLOUR  soft grey-white paper, warm black ink, one deep red for rubrics
  TYPE    Literata throughout, left aligned
*/
:root {
  color-scheme: light dark;
  --paper: #f6f5f1;
  --paper-2: #efede7;
  --ink: #26241f;
  --ink-2: #6b675e;
  --rule: #dedad1;
  --rubric: #8a2d27;
  --tab-h: 64px;
  --serif: "Prayer Serif", "STIX Two Math", "STIX Two Text", "Iowan Old Style", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1a18;
    --paper-2: #24231f;
    --ink: #e9e5dc;
    --ink-2: #a39d91;
    --rule: #3a3731;
    --rubric: #d98a7d;
  }
}
* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.6 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 3px; border-radius: 4px; }

/* ---------- frame ---------- */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) max(22px, env(safe-area-inset-right)) calc(var(--tab-h) + env(safe-area-inset-bottom) + 32px) max(22px, env(safe-area-inset-left));
}
.view { display: none; }
.view.on { display: block; }
h1 { font-size: 34px; line-height: 1.1; font-weight: 500; margin: 8px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 22px; line-height: 1.25; font-weight: 500; margin: 32px 0 8px; }
.sub { color: var(--ink-2); margin: 0 0 24px; font-size: 16px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 28px 0; }

.btn {
  min-height: 48px; padding: 10px 22px;
  border: 1px solid var(--ink); background: transparent; border-radius: 999px;
  font-size: 17px;
}
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.quiet { border-color: var(--rule); }
.link { background: none; border: 0; padding: 10px 0; color: var(--rubric); font-size: 16px; min-height: 44px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- tab bar ---------- */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--rule);
}
nav.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-2); text-decoration: none; font-size: 13px; letter-spacing: 0.02em;
}
nav.tabs a svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs a svg circle { fill: currentColor; stroke: none; }
nav.tabs a svg .accent { transition: fill .2s, stroke .2s; }
nav.tabs a span { position: relative; padding-bottom: 5px; }
nav.tabs a span::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 0; height: 2px; border-radius: 2px;
  background: var(--rubric); transform: translateX(-50%); transition: width .2s;
}
nav.tabs a.on { color: var(--ink); }
nav.tabs a.on span::after { width: 26px; }
nav.tabs a.on svg .accent { stroke: var(--rubric); }
nav.tabs a.on svg .foot { stroke-width: 1.8; }
nav.tabs a.on svg path.accent[d$="Z"] { fill: var(--rubric); }
body.sitting nav.tabs { display: none; }

/* ---------- timer ---------- */
.clock {
  font-size: clamp(76px, 26vw, 132px); line-height: 1; font-weight: 400;
  font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.03em;
  margin: 18px 0 6px; white-space: nowrap;
}
.phase { color: var(--ink-2); font-size: 17px; min-height: 1.6em; margin: 0 0 18px; }
.track { height: 2px; background: var(--rule); margin: 0 0 30px; overflow: hidden; }
.track i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .25s linear; }
.settings { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.settings li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.settings .lab { font-size: 17px; }
.settings .lab small { display: block; color: var(--ink-2); font-size: 14px; }
.step { display: flex; align-items: center; gap: 4px; }
.step button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule); background: transparent;
  font-size: 22px; line-height: 1; display: grid; place-items: center;
}
.step output { min-width: 4.6em; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.controls { margin: 28px 0 0; }
.sitting .settings, .sitting .setup-only { display: none; }
.amen { font-size: 22px; font-style: italic; }
.log { margin-top: 26px; }

/* ---------- reader ---------- */
.readbar {
  position: sticky; top: 0; z-index: 10;
  margin: calc(-20px - env(safe-area-inset-top)) -22px 0; padding: calc(env(safe-area-inset-top) + 8px) 22px 8px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 8px; border-bottom: 1px solid transparent;
}
.readbar.lined { border-bottom-color: var(--rule); }
.ref {
  flex: 1; text-align: left; background: none; border: 0; padding: 8px 0; min-height: 44px;
  font-size: 22px; font-weight: 500;
}
.ref::after { content: " ▾"; font-size: 14px; color: var(--ink-2); }
.iconbtn { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--ink-2); font-size: 17px; }
.scripture { font-size: var(--read-size, 19px); line-height: 1.7; padding-top: 6px; -webkit-user-select: text; user-select: text; }
.scripture h3 { font-size: 0.82em; font-weight: 600; color: var(--ink-2); margin: 1.6em 0 0.4em; line-height: 1.35; }
.scripture h4 { font-size: 0.78em; font-weight: 500; font-style: italic; color: var(--ink-2); margin: 1em 0 0.3em; }
.scripture p { margin: 0 0 0.9em; }
.scripture b.verse-num, .scripture b.chapter-num, .scripture sup { color: var(--rubric); font-size: 0.6em; font-weight: 500; vertical-align: 0.5em; line-height: 0; margin-right: 0.15em; }
.scripture b.chapter-num { font-size: 1.6em; vertical-align: -0.05em; margin-right: 0.2em; font-weight: 400; }
.scripture .line { display: block; padding-left: 1.6em; text-indent: -1.6em; }
.scripture .indent { padding-left: 3em; }
.scripture .woc { color: inherit; }
.scripture .selah, .scripture .small-caps { font-variant: small-caps; }
.scripture .block-indent { padding-left: 1.2em; }
.chapnav { display: flex; justify-content: space-between; gap: 12px; margin: 34px 0 10px; }
.copyright a { color: inherit; }
.copyright { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-top: 26px; }
.empty { border: 1px solid var(--rule); border-radius: 14px; padding: 20px; margin-top: 20px; }
.empty ol { padding-left: 1.2em; margin: 8px 0 16px; }
.field { display: block; width: 100%; padding: 12px 14px; font-size: 16px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2); }

/* picker sheet */
.sheet {
  position: fixed; inset: 0; z-index: 40; background: var(--paper);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 12px) 22px calc(env(safe-area-inset-bottom) + 30px);
  display: none;
}
.sheet.on { display: block; }
.sheet-in { max-width: 640px; margin: 0 auto; }
.sheet-head { display: flex; align-items: center; gap: 10px; position: sticky; top: calc(-12px - env(safe-area-inset-top)); background: var(--paper); padding: 6px 0 10px; z-index: 2; }
.sheet-head h2 { margin: 0; flex: 1; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; margin: 4px 0 12px; }
.seg button { border: 0; background: none; border-radius: 999px; min-height: 40px; font-size: 15px; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: var(--paper); }
.books { list-style: none; margin: 0; padding: 0; }
.books > li { scroll-margin-top: 130px; }
.books > li > button {
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule);
  padding: 13px 0; font-size: 19px; min-height: 50px;
}
.books > li.cur > button { color: var(--rubric); }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; padding: 12px 0 18px; }
.chapters button {
  min-height: 48px; border: 1px solid var(--rule); background: var(--paper-2); border-radius: 10px;
  font-size: 17px; font-variant-numeric: tabular-nums;
}
.chapters button.cur { border-color: var(--rubric); color: var(--rubric); }

/* ---------- notes ---------- */
.date-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note {
  display: block; width: 100%; min-height: 46vh; resize: none;
  border: 0; background: transparent; padding: 6px 0 0; margin: 0;
  font-size: 19px; line-height: 1.7; outline: none;
  background-image: linear-gradient(transparent calc(1.7em - 1px), var(--rule) calc(1.7em - 1px), var(--rule) 1.7em, transparent 1.7em);
  background-size: 100% 1.7em; background-attachment: local; background-position: 0 6px;
}
.note::placeholder { color: var(--ink-2); font-style: italic; opacity: .7; }
.saved { font-size: 14px; color: var(--ink-2); min-height: 1.4em; }
.entries { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.entries li button {
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule);
  padding: 12px 0; display: block; min-height: 56px;
}
.entries .d { display: block; font-size: 16px; }
.entries .p { display: block; color: var(--ink-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 50; white-space: nowrap;
}
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- round two ---------- */
.config-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; border-top: 1px solid var(--rule); padding: 16px 0; margin-top: 30px;
  font-size: 19px; min-height: 52px;
}
.config-toggle::after { content: "▸"; color: var(--ink-2); font-size: 14px; transition: transform .2s; }
.config-toggle[aria-expanded="true"]::after { transform: rotate(90deg); }
.bellhead { margin-top: 26px; }
.bells { display: grid; gap: 8px; margin-bottom: 14px; }
.bells button {
  text-align: left; background: none; border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; min-height: 56px;
}
.bells button b { display: block; font-weight: 500; font-size: 17px; }
.bells button span { display: block; color: var(--ink-2); font-size: 14px; }
.bells button[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.readtop { margin-bottom: 4px; }
.readseg { margin: 0 0 6px; }
.readbar { margin-top: 0; }
#v-read .readbar { margin: 0 -22px; padding-top: max(8px, env(safe-area-inset-top)); }
.bcphead h1 { margin-top: 10px; }
.litday { color: var(--rubric); font-size: 15px; font-variant: small-caps; letter-spacing: 0.03em; margin: 4px 0 0; }
.litday + .muted { margin-top: 2px; }
.office .rubric { color: var(--rubric); font-style: italic; font-size: 0.8em; line-height: 1.5; margin: 1.4em 0 0.5em; }
.office h3 { font-variant: small-caps; letter-spacing: 0.02em; font-size: 0.9em; color: var(--ink); margin: 1.8em 0 0.5em; }
.office h4 { font-style: normal; font-weight: 500; color: var(--ink); font-size: 0.85em; margin: 1.4em 0 0.4em; }
.office .versicles p { margin: 0 0 0.35em; }
.office .spk { font-style: italic; color: var(--ink-2); font-size: 0.85em; margin-right: 0.2em; }
.office .cant p { margin: 0 0 0.55em; }
.office .half { display: inline-block; padding-left: 1.6em; }
.office .gloria { color: var(--ink-2); font-size: 0.92em; }
.office .sentence { font-style: italic; }
.office .lessonref { font-weight: 500; margin: 0 0 0.4em; }
.office .chap { color: var(--ink-2); font-size: 0.8em; margin: 1em 0 0.3em; }
.office .cname { color: var(--ink-2); font-size: 0.85em; font-style: italic; margin: 0.6em 0 0.2em; }
.office .ptitle { font-style: italic; color: var(--ink-2); font-size: 0.85em; }
.prayed { color: var(--ink-2); font-size: 15px; margin: -14px 0 14px; min-height: 0; }

/* ---------- accounts ---------- */
.tophead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.me {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper-2) center/cover no-repeat;
  display: grid; place-items: center; font-size: 17px; color: var(--ink-2); flex: none; padding: 0; overflow: hidden;
}
.me.big { width: 72px; height: 72px; font-size: 28px; }
.acct .sheet-head { justify-content: space-between; }
.step-screen h1 { margin-top: 4px; }
.step-screen > p { max-width: 34em; }
.flabel { display: block; font-size: 15px; color: var(--ink-2); margin: 18px 0 6px; }
.field.code { font-size: 28px; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; max-width: 10em; }
.ferr { color: var(--rubric); font-size: 15px; min-height: 1.4em; margin: 8px 0; }
.fine { margin-top: 22px; }
.public { border-left: 2px solid var(--rubric); padding-left: 12px; }
.saints { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 12px; margin: 18px 0; }
.saints button { background: none; border: 0; padding: 0; text-align: center; font-size: 13px; color: var(--ink-2); }
.saints img, .saints .ph {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 2px solid transparent; background: var(--paper-2);
}
.saints button[aria-checked="true"] img { border-color: var(--rubric); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--rubric); }
.saints span { display: block; margin-top: 4px; line-height: 1.25; }
.stick { position: sticky; bottom: 0; background: var(--paper); padding: 12px 0 calc(env(safe-area-inset-bottom) + 6px); }
.prof { display: flex; gap: 16px; align-items: center; margin: 10px 0 8px; }
.prof h1 { margin: 0; }
.danger { color: var(--rubric); }
.dangerbtn { background: var(--rubric); border-color: var(--rubric); }
