:root {
  --bg: #F7F4EF;
  --bg-elevated: #FFFFFF;
  --bg-subtle: #EFEAE3;
  --ink: #1C1917;
  --ink-muted: #78716C;
  --ink-faint: #A8A29E;
  --accent: #C45C3E;
  --accent-soft: #F3E4DE;
  --border: #E7E2DB;
  --danger: #B42318;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text-hero-size: 28px;
  --text-hero-lh: 1.25;
  --text-hero-weight: 600;
  --text-prayer-size: 18.5px;
  --text-prayer-lh: 1.4;
  --text-prayer-weight: 400;
  --text-body-size: 16px;
  --text-body-lh: 1.45;
  --text-body-weight: 400;
  --text-label-size: 14px;
  --text-label-lh: 1.35;
  --text-label-weight: 500;
  --text-meta-size: 13px;
  --text-meta-lh: 1.35;
  --text-meta-weight: 400;
  --text-caption-size: 12px;
  --text-caption-lh: 1.3;
  --text-caption-weight: 400;
  --page-x: 20px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow-soft: 0 1px 2px rgba(28,25,23,0.04), 0 8px 24px rgba(28,25,23,0.06);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-body-size);
  line-height: var(--text-body-lh);
  font-weight: var(--text-body-weight);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-top: var(--safe-t);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}

#app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
}

.screen[hidden], [hidden] { display: none !important; }

.page {
  padding: 16px var(--page-x) 24px;
}

.onboarding-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: calc(100dvh - var(--safe-t) - 40px);
  justify-content: center;
  padding-bottom: 40px;
}

.onboarding-hero { margin-bottom: 4px; }

.page-header {
  margin-bottom: 16px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.eyebrow, .meta {
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-lh);
  font-weight: var(--text-meta-weight);
  color: var(--ink-muted);
}

.hero-title, .soft-header {
  font-size: var(--text-hero-size);
  line-height: var(--text-hero-lh);
  font-weight: var(--text-hero-weight);
  margin: 4px 0 8px;
  letter-spacing: -0.02em;
}

.soft-header { margin-top: 0; }

.body-text {
  font-size: var(--text-body-size);
  line-height: var(--text-body-lh);
  color: var(--ink-muted);
  margin: 0;
}

.label, .field-label {
  display: block;
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--text-label-weight);
  color: var(--ink);
  margin-bottom: 6px;
}

.caption {
  font-size: var(--text-caption-size);
  line-height: var(--text-caption-lh);
  font-weight: var(--text-caption-weight);
  margin: 8px 0 0;
}

.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}

.card.elevated {
  border-radius: var(--r-lg);
  border-color: transparent;
}

#today-card.elevated {
  box-shadow: var(--shadow-soft);
}

.prayer-card { padding: 20px; }

.prayer-card .card-title {
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}

.prayer-card .card-meta {
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-lh);
  color: var(--ink-muted);
  margin: 0 0 16px;
}

.prayer-text {
  font-size: var(--text-prayer-size);
  line-height: var(--text-prayer-lh);
  font-weight: var(--text-prayer-weight);
  white-space: pre-wrap;
  margin: 0 0 20px;
  color: var(--ink);
}

.what-it-means {
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.what-it-means h3 {
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--text-label-weight);
  margin: 0 0 6px;
  color: var(--ink-muted);
}

.what-it-means p {
  margin: 0;
  font-size: var(--text-body-size);
  line-height: var(--text-body-lh);
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  cursor: pointer;
  background: var(--bg-subtle);
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { filter: brightness(0.97); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-muted);
}

.btn-block { width: 100%; }

.text-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  min-height: 44px;
  padding: 8px 0;
  cursor: pointer;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.icon-btn:hover { background: var(--bg-subtle); }

.pin-btn[aria-pressed="true"] {
  color: var(--accent);
}

.pin-btn[aria-pressed="true"] .pin-icon path {
  fill: var(--accent);
  stroke: var(--accent);
}

.input {
  font-family: inherit;
  font-size: var(--text-body-size);
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  color: var(--ink);
}

.row { display: flex; align-items: center; }
.row.gap { gap: 12px; flex-wrap: wrap; }

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: var(--text-label-size);
  cursor: pointer;
}

.seg-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--r-md);
  margin-top: 12px;
}

.seg-tab {
  flex: 1;
  min-height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: var(--text-caption-size);
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
}

.seg-tab.active {
  background: var(--bg-elevated);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.list { display: flex; flex-direction: column; gap: 10px; }

.list-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  min-height: 64px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  box-shadow: none;
}

.list-card:active { background: var(--bg-subtle); }

.list-card .list-title {
  font-size: var(--text-label-size);
  font-weight: 600;
  margin: 0 0 2px;
}

.list-card .list-sub {
  font-size: var(--text-meta-size);
  color: var(--ink-muted);
  margin: 0;
}

.list-card .stub-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 999px;
}

.empty-state {
  text-align: center;
  color: var(--ink-muted);
  padding: 48px 16px;
  font-size: var(--text-body-size);
}

.samaritans {
  text-align: center;
  color: var(--ink-faint);
  padding: 8px 8px 24px;
  margin: 8px 0 0;
}

.samaritans a {
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-card { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
  cursor: pointer;
}

.switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.switch-track {
  width: 48px;
  height: 28px;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s;
  position: relative;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}

.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 4px 8px calc(4px + var(--safe-b));
  z-index: 40;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 10px;
}

.nav-item.active { color: var(--accent); }

/* Sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.35);
  z-index: 50;
}

.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  max-height: 78dvh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-soft);
  padding: 12px var(--page-x) calc(20px + var(--safe-b));
  z-index: 60;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 4px auto 16px;
}

.sheet-title {
  font-size: var(--text-hero-size);
  line-height: var(--text-hero-lh);
  font-weight: var(--text-hero-weight);
  margin: 0 0 4px;
  font-size: 22px;
}

.sheet-body {
  margin: 12px 0 20px;
}

#screen-onboarding ~ #bottom-nav,
body.onboarding #bottom-nav { display: none !important; }

body.onboarding #app { padding-bottom: 24px; }

/* Today land: prayer above fold */
.page-today { padding-top: 10px; padding-bottom: 12px; }
.page-header-today { margin-bottom: 8px; }
.page-header-today .meta-row { min-height: 40px; }
.meta-stack { display: flex; flex-direction: column; gap: 1px; }
.meta-stack .eyebrow {
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--text-label-weight);
  color: var(--ink);
}
.prayer-card-land { padding: 14px 16px; }
.prayer-card-land .card-title {
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-lh);
  font-weight: 500;
  color: var(--ink-muted);
  margin: 0 0 2px;
}
.prayer-card-land .card-meta {
  margin: 0 0 10px;
  font-size: var(--text-caption-size);
}
.prayer-card-land .prayer-text {
  font-size: 18.5px;
  line-height: 1.4;
  margin: 0;
}
.today-more {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.today-more .what-it-means { margin-bottom: 0; }
.today-more .scroll-hint {
  font-size: var(--text-caption-size);
  color: var(--ink-faint);
  text-align: center;
  margin: 0 0 4px;
}
