:root {
  --ink: #1a1348;
  --muted: #5c5674;
  --navy: #1a1348;
  --green: #0c6a34;
  --gold: #8d6b32;
  --paper: #f6f3ec;
  --white: #fffcf8;
  --line: rgba(26, 19, 72, 0.12);
  --reading: 1.2rem;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #12102a;
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}

button, a { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 0;
  background: none;
}

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

.app {
  min-height: 100dvh;
  width: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: var(--paper);
  max-width: 760px;
  margin: 0 auto;
}

.app > * { min-width: 0; }

.topbar {
  display: grid;
  gap: 10px;
  padding: calc(14px + var(--safe-top)) 18px 14px;
  background: var(--navy);
  color: #f6f3ec;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.brand-row strong {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.brand-logo {
  display: block;
  width: min(110px, 35%);
  height: auto;
  margin: 0 auto;
  justify-self: center;
  background: transparent;
}

.tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.text-btn, .type-btn {
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(246, 243, 236, 0.28);
  color: #f6f3ec;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 650;
}

.type-btn { min-width: 36px; padding: 0 8px; }

.rail-wrap {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  scroll-snap-type: x proximity;
}

.rail button {
  flex: 0 0 64px;
  scroll-snap-align: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 8px 4px 7px;
  text-align: center;
}

.rail .dow {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.rail .dom {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1;
}

.rail button.is-today { border-color: var(--green); }
.rail button[aria-current="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #f6f3ec;
}
.rail button[aria-current="true"] .dow { color: #c9e7d4; }

.reading { padding: 22px 20px 32px; }

.date-line {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-size: clamp(1.9rem, 6vw, 2.7rem);
}

.focus { margin: 0 0 18px; color: var(--muted); }

.notice {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-size: 0.92rem;
}

.notice button {
  flex: 0 0 auto;
  color: var(--green);
  font-weight: 700;
}

section { margin-top: 22px; }

section h2 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.message p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.passage + .passage { margin-top: 16px; }

.ref { margin: 0 0 8px; font-weight: 700; }
.ref a { color: var(--green); text-decoration: none; }

blockquote {
  margin: 0;
  padding: 14px 16px;
  background: var(--white);
  border-left: 3px solid var(--gold);
  font-family: var(--serif);
  font-size: var(--reading);
  line-height: 1.5;
}

blockquote p { margin: 0 0 0.55em; }
blockquote p:last-child { margin-bottom: 0; }

blockquote sup {
  font-family: var(--sans);
  font-size: 0.62em;
  font-weight: 700;
  margin-right: 0.3em;
  color: var(--gold);
}

.pray ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  counter-reset: prayer;
}

.pray li {
  counter-increment: prayer;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  font-size: var(--reading);
  line-height: 1.45;
}

.pray li::before {
  content: counter(prayer);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: #f6f3ec;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.foot {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.foot a { color: var(--green); }
.status { min-height: 1.2em; margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; }

.dock {
  position: sticky;
  bottom: 0;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(246, 243, 236, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
}

.pager button {
  min-height: 48px;
  border-radius: 12px;
  background: var(--navy);
  color: #f6f3ec;
  padding: 6px 10px;
  text-align: left;
}

#today {
  text-align: center;
  padding-inline: 16px;
  background: var(--green);
}

.pager button:disabled { opacity: 0.35; }

.pager small {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.pager span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 650;
}

.share {
  display: block;
  width: 100%;
  margin-top: 8px;
  min-height: 36px;
  color: var(--green);
  font-weight: 700;
  font-size: 0.9rem;
}

.install:not([hidden]) {
  display: block;
  width: 100%;
  margin-top: 8px;
  min-height: 44px;
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--line);
  font-weight: 700;
}

.install-steps {
  padding: 16px 16px 20px;
  display: grid;
  gap: 12px;
}

.install-steps p,
.install-steps ol { margin: 0; }

.install-steps ol {
  padding-left: 1.2rem;
  display: grid;
  gap: 8px;
  line-height: 1.45;
}

.sheet {
  width: min(440px, 100%);
  max-height: min(86dvh, 760px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--paper);
  color: var(--ink);
}

.sheet::backdrop { background: rgba(12, 10, 28, 0.5); }

.sheet header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.sheet header strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
}

.sheet header span { color: var(--muted); font-size: 0.88rem; }
.sheet header .type-btn { color: var(--ink); border-color: var(--line); }

.month { padding: 14px 16px 6px; }
.month h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
}

.weekdays, .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.weekdays span {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 4px;
}

.grid button, .grid .empty {
  aspect-ratio: 1;
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 1rem;
}

.grid button { border: 1px solid transparent; }
.grid button:disabled { color: #b3adc4; }
.grid button.in-fast { border-color: var(--line); background: var(--white); }
.grid button.is-today { border-color: var(--green); color: var(--green); font-weight: 700; }
.grid button[aria-current="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #f6f3ec;
}

@media (min-width: 900px) {
  .sheet { margin: auto; border-radius: 18px; }
}
