:root {
  --bg: #f6efe1;
  --card: #fffaf0;
  --ink: #2a2233;
  --muted: #6f6578;
  --line: #e4d8c2;
  --accent: #5b3a8c;
  --accent-ink: #ffffff;
  --gold: #c8921a;
  --good: #2f7d4f;
  --warn: #b45309;
  --bad: #b42318;
  --chip: #efe4cf;
  --shadow: 0 1px 2px rgb(42 34 51 / 6%), 0 4px 14px rgb(42 34 51 / 6%);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1726;
    --card: #282033;
    --ink: #f1eaf7;
    --muted: #aa9fb8;
    --line: #3b3148;
    --accent: #b794f4;
    --accent-ink: #1d1726;
    --gold: #f7c948;
    --good: #6ccf94;
    --warn: #f0a85a;
    --bad: #f97066;
    --chip: #342a41;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .75em; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 96px; }
.center { text-align: center; }
.pad { padding: 32px 0; }
.pad-sm { padding: 10px 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 700 1.15rem var(--serif); }
.brand img { border-radius: 7px; flex: none; }
.brand span { white-space: nowrap; }
.nav { display: flex; gap: 2px; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 10px; border-radius: 10px; font-weight: 600; font-size: .92rem; }
.nav a.active { color: var(--accent); background: var(--chip); }

/* cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow);
}
a.card { display: block; text-decoration: none; color: inherit; }
a.card:active { transform: scale(.99); }
.card.hero { border-color: var(--accent); border-width: 2px; }
.card.quiet { background: transparent; box-shadow: none; }
.section-title { margin: 24px 0 8px; font: 700 .78rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--chip); color: var(--ink); white-space: nowrap;
}
.chip.live { background: var(--bad); color: #fff; }
.chip.good { color: var(--good); }
.chip.warn { color: var(--warn); }

/* buttons & inputs */
button, .btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 1rem var(--sans); padding: 12px 16px; border-radius: 12px; min-height: 48px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--bad); }
button.link { background: none; border: none; color: var(--accent); padding: 8px 0; min-height: 0; font-weight: 600; }
button.block, .btn.block { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: 16px/1.4 var(--sans); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field + .field { margin-top: 12px; }

details > summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 6px 0; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; }
details[open] > summary::before { content: "▾ "; }

/* service */
.theme { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin: 4px 0; }
.theme.empty { color: var(--muted); font-style: italic; font-weight: 400; }

.order { list-style: none; margin: 0; padding: 0; }
.order li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.order li:last-child { border-bottom: 0; }
.order .num {
  flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--chip); font-weight: 700; font-size: .9rem;
}
.order li.now .num { background: var(--accent); color: var(--accent-ink); }
.order li.done .num { background: var(--good); color: #fff; }
.order .who { font-size: .9rem; color: var(--muted); }

.progress { display: flex; gap: 4px; margin: 8px 0 16px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.done { background: var(--good); }
.progress span.now { background: var(--accent); }

/* the text being read aloud */
.scripture { font-family: var(--serif); font-size: 1.32rem; line-height: 1.6; }
.scripture h2 { font-size: 1.5rem; text-align: center; margin-bottom: .8em; }
.scripture p { margin-bottom: 1em; }
.scripture .all { font-family: var(--sans); font-weight: 700; color: var(--accent); font-size: 1.1rem; }
.scripture.compact { font-size: 1.05rem; }
.scripture.compact h2 { font-size: 1.15rem; text-align: left; }

.quote { border-left: 3px solid var(--gold); padding: 4px 0 4px 12px; margin: 8px 0; white-space: pre-wrap; font-style: italic; }

.sticky-action {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
}
.sticky-action > * { max-width: 640px; margin: 0 auto; display: flex; }
.sticky-action button { font-size: 1.15rem; min-height: 56px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block; vertical-align: -3px;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.splash { min-height: 80vh; display: grid; place-items: center; text-align: center; }
.splash img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 16px; }

.switch { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 0; }
.switch input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: 480px; margin: 0 auto; padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-weight: 600; text-align: center; box-shadow: var(--shadow);
}
.toast.error { background: var(--bad); color: #fff; }

.banner { display: block; margin-bottom: 12px; border-radius: 16px; padding: 16px; background: var(--accent); color: var(--accent-ink); }
.banner a { color: inherit; font-weight: 700; }
.banner.youre-up { background: var(--gold); color: #1d1726; text-align: center; }

@media (max-width: 400px) {
  .topbar { padding-left: 12px; padding-right: 12px; gap: 4px; }
  .brand { font-size: 1rem; gap: 6px; }
  .brand img { width: 24px; height: 24px; }
  .nav a { padding: 8px 6px; font-size: .86rem; }
}
@media (min-width: 720px) {
  .wrap { padding-top: 24px; }
  h1 { font-size: 2rem; }
}
