:root {
  --cream: #fbf6ec;
  --cream-deep: #f3ead6;
  --ink: #1c140f;
  --burgundy: #6b1c2a;
  --burgundy-deep: #4a1019;
  --gold: #8d6b2f;
  --gold-line: #c6a15a;
  --all-bg: #f6ead3;
  --line: #e4d3b4;
  --prayer-size: 22px;
  --header-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--burgundy-deep);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  line-height: 1.45;
}

.frame {
  max-width: 40rem;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--cream);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--cream);
  border-bottom: 3px solid var(--burgundy);
  box-shadow: 0 2px 0 var(--gold-line);
  padding-top: env(safe-area-inset-top);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 8px 12px;
}

.home-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--burgundy);
  color: #fffaf3;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}

.home-link[hidden] { display: none; }

#view-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: var(--burgundy-deep);
}

#view-title:focus {
  outline: none;
}

.font-controls {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.font-controls button,
.prayer-tools button,
.expand-btn,
.helper-link {
  font-family: inherit;
  cursor: pointer;
}

.font-controls button {
  min-width: 48px;
  min-height: 48px;
  border: 2px solid var(--burgundy);
  border-radius: 12px;
  background: #fffaf3;
  color: var(--burgundy);
  font-size: 22px;
  font-weight: 700;
}

.font-controls button:disabled {
  opacity: 0.35;
  cursor: default;
}

.prayer-tools {
  padding: 0 12px 10px;
}

.prayer-tools button,
.show-prayers-home {
  width: 100%;
  min-height: 52px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: var(--cream-deep);
  color: var(--ink);
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  padding: 10px 14px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

main {
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.cover-copy {
  margin: 16px 16px 8px;
  text-align: center;
  white-space: pre-line;
  font-size: var(--prayer-size);
  line-height: 1.35;
}

.cover-copy.church {
  color: var(--burgundy);
  font-weight: 700;
  font-size: calc(var(--prayer-size) + 4px);
  margin-bottom: 12px;
}

.cover-photo,
.chaplet-photo,
.music-sheet {
  display: block;
  width: calc(100% - 32px);
  margin: 0 auto 12px;
  border-radius: 12px;
  background: #111;
}

.cover-photo {
  height: 240px;
  object-fit: cover;
  object-position: center 18%;
}

.chaplet-photo {
  width: auto;
  max-width: calc(100% - 32px);
  max-height: 52vh;
  height: auto;
  margin-top: 8px;
}

.music-sheet {
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
}

.big-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  margin: 12px 16px;
  padding: 16px 18px;
  border-radius: 16px;
  text-decoration: none;
}

.big-btn.primary {
  background: var(--burgundy);
  color: #fffaf3;
}

.big-btn.primary:active { background: var(--burgundy-deep); }

.big-btn.secondary {
  background: #fffaf3;
  color: var(--burgundy);
  border: 3px solid var(--burgundy);
}

.big-kicker {
  font-size: calc(var(--prayer-size) + 6px);
  font-weight: 700;
  line-height: 1.15;
}

.big-sub {
  margin-top: 4px;
  font-size: var(--prayer-size);
  line-height: 1.3;
}

.sunday-note,
.app-note,
.fill-in,
.credit,
.added-banner,
.printed-footer {
  margin: 12px 16px;
  font-size: max(20px, calc(var(--prayer-size) - 2px));
}

.sunday-note,
.app-note,
.fill-in {
  padding: 12px 14px;
  background: var(--cream-deep);
  border-left: 6px solid var(--gold);
  border-radius: 0 12px 12px 0;
}

.home-tools {
  margin: 4px 16px 8px;
}

.list-heading {
  margin: 22px 16px 8px;
  font-size: calc(var(--prayer-size) + 2px);
  color: var(--burgundy);
}

.section-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.section-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--prayer-size);
  font-weight: 700;
  line-height: 1.25;
}

.section-link.today {
  background: #fff8ea;
  box-shadow: inset 6px 0 0 var(--gold-line);
}

.section-link .chev {
  color: var(--burgundy);
  font-size: 28px;
  line-height: 1;
}

.today-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--burgundy);
  color: #fffaf3;
  font-size: 16px;
  font-weight: 700;
  vertical-align: middle;
}

.about {
  margin: 8px 16px 0;
  font-size: max(20px, calc(var(--prayer-size) - 2px));
}

.about p { margin: 0 0 12px; }

.today-lead {
  margin: 18px 16px 0;
  font-size: var(--prayer-size);
}

.today-mystery {
  margin: 4px 16px 12px;
  color: var(--burgundy);
  font-size: calc(var(--prayer-size) + 6px);
  font-weight: 700;
  line-height: 1.2;
}

.chunk { margin-top: 8px; }

.kicker,
.sticky-heading {
  margin: 0;
  padding: 12px 16px;
  line-height: 1.25;
  font-size: var(--prayer-size);
}

.kicker {
  color: var(--burgundy);
  font-weight: 700;
}

.kicker.nav {
  font-weight: 700;
}

.sticky-heading {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  background: var(--burgundy);
  color: #fffaf3;
  font-weight: 700;
  scroll-margin-top: var(--header-h);
}

.sticky-heading.nav {
  background: #7d5a28;
}

.sticky-heading .who-in-head {
  display: block;
  font-size: max(16px, calc(var(--prayer-size) - 6px));
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 2px;
}

.step {
  margin: 0 16px 18px;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

.step.leader { padding-top: 4px; }

.step.all,
.step.response {
  background: var(--all-bg);
  border-left: 6px solid var(--burgundy);
  border-radius: 0 14px 14px 0;
  padding: 12px 14px;
  margin-left: 16px;
  margin-right: 16px;
}

.step.all .prayer-text,
.step.response .prayer-text {
  font-weight: 700;
}

.who {
  margin: 0 0 4px;
  color: var(--burgundy);
  font-size: max(18px, calc(var(--prayer-size) - 2px));
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prayer-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: var(--prayer-size);
  line-height: 1.45;
}

.count-pill,
.printed-rubric {
  margin: 0 0 8px;
  font-size: max(20px, calc(var(--prayer-size) - 2px));
  font-weight: 700;
  color: var(--burgundy-deep);
}

.printed-rubric { font-style: italic; }

.step.instruction .prayer-text { font-style: italic; }

.fruits {
  margin: 8px 0 0;
  padding-left: 1.2em;
  font-size: var(--prayer-size);
}

.fruits li { margin: 6px 0; }

.fruits-head {
  font-weight: 700;
  color: var(--burgundy);
}

.expand-btn,
.helper-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--burgundy);
  background: #fffaf3;
  color: var(--burgundy);
  font-size: max(20px, var(--prayer-size));
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;
}

.expand-panel {
  margin-top: 10px;
  padding: 12px 12px 4px;
  border: 2px solid var(--gold-line);
  border-radius: 12px;
  background: #fffaf3;
}

.added-banner,
.credit {
  margin: 0 0 12px;
  color: var(--burgundy-deep);
}

.added-prayer + .added-prayer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.added-title {
  margin: 0 0 6px;
  font-size: var(--prayer-size);
  color: var(--burgundy);
}

.times {
  font-weight: 700;
}

.litany-head,
.litany-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  font-size: var(--prayer-size);
}

.litany-head {
  margin-bottom: 4px;
  color: var(--burgundy);
  font-weight: 700;
  text-transform: uppercase;
  font-size: max(18px, calc(var(--prayer-size) - 4px));
  letter-spacing: 0.03em;
}

.litany-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.litany-row .resp {
  font-weight: 700;
  color: var(--burgundy-deep);
  text-align: right;
}

.printed-footer {
  margin-top: 16px;
  color: var(--ink);
}

.noscript {
  max-width: 40rem;
  margin: 16px auto;
  padding: 16px;
  background: var(--cream);
  font-size: 22px;
}

.missing {
  margin: 24px 16px;
  font-size: var(--prayer-size);
}

@media (min-width: 700px) {
  .cover-photo { height: 320px; }
}
