:root {
  color-scheme: light dark;
  --bg: #f3eee4;
  --surface: #fbf8f1;
  --surface-2: #ebe3d6;
  --text: #29231f;
  --muted: #746a61;
  --line: #d8cbbc;
  --accent: #73352f;
  --accent-2: #9a6d35;
  --accent-soft: #ead9cf;
  --shadow: 0 16px 44px rgba(47, 34, 26, .08);
  --reader-size: 1.12rem;
  --max: 760px;
}

[data-theme="dark"] {
  --bg: #161311;
  --surface: #211d1a;
  --surface-2: #2a2420;
  --text: #eee6d9;
  --muted: #b6a99d;
  --line: #3d342e;
  --accent: #c6867b;
  --accent-2: #d0aa70;
  --accent-soft: #3b2926;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% -10%, color-mix(in srgb, var(--accent-soft) 65%, transparent), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 48px;
  align-items: center;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 14px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}
.topbar-title-wrap { text-align: center; min-width: 0; }
.topbar-kicker {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .61rem;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--accent-2);
}
.topbar-title { font-size: 1.05rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button, .text-button {
  border: 1px solid var(--line);
  background: var(--surface);
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.04);
}
.icon-button:active, .text-button:active, .prayer-card:active { transform: translateY(1px); }

.main-content { width: 100%; flex: 1; }
.hero, .section-block, .source-note, .prayer-reader { width: min(calc(100% - 32px), var(--max)); margin-inline: auto; }
.hero { padding: 48px 0 30px; text-align: center; }
.book-mark {
  width: 86px;
  height: 86px;
  margin: 0 auto 22px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.book-mark img { width: 66px; height: 66px; }
.eyebrow {
  margin: 0 0 8px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: var(--accent-2);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .14em;
}
h1, h2, h3, p { text-wrap: pretty; }
h1 { margin: 0; font-size: clamp(2rem, 8vw, 3.5rem); line-height: 1.02; letter-spacing: -.035em; }
.lede { max-width: 600px; margin: 18px auto 0; color: var(--muted); font-size: 1.03rem; line-height: 1.65; }
.section-block { padding: 24px 0; }
.section-heading-row { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 16px; }
.section-heading-row h2, .search-block h2 { margin: 0; font-size: 1.55rem; }
.part-heading-row { align-items: start; }
.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}
.subsection-heading h3 { margin: 0; font-size: 1.22rem; }
.subsection-heading-spaced { margin-top: 30px; }
.prayer-card {
  width: 100%;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 14px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.prayer-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.45rem;
}
.prayer-card-copy { display: grid; gap: 3px; }
.prayer-card-title { font-size: 1.18rem; font-weight: 700; }
.prayer-card-meta { color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: .8rem; line-height: 1.35; }
.prayer-card-arrow { color: var(--accent); font-size: 2rem; }
.search-block { padding-top: 30px; }
.search-field { display: block; margin-top: 14px; }
.search-field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  padding: 15px 16px;
  outline: none;
}
.search-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.search-results { display: grid; gap: 8px; margin-top: 10px; }
.search-result {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
}
.search-result strong { display: block; margin-bottom: 3px; }
.search-result span { color: var(--muted); font-size: .86rem; line-height: 1.4; }
.source-note {
  margin-top: 12px;
  margin-bottom: 40px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}
.source-note h2 { margin: 0 0 8px; font-size: 1.15rem; }
.source-note p { margin: 8px 0 0; color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: .85rem; line-height: 1.55; }

.reader-toolbar {
  position: sticky;
  top: 65px;
  z-index: 15;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px max(16px, calc((100vw - var(--max)) / 2));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
}
.reader-section-label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: .78rem; font-weight: 750; color: var(--muted); }
.reader-toolbar-actions { display: flex; gap: 7px; }
.text-button { width: auto; min-width: 46px; padding-inline: 10px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .78rem; font-weight: 800; }
.progress-track { position: sticky; top: 123px; z-index: 16; height: 2px; background: var(--line); }
.progress-value { width: 0; height: 100%; background: var(--accent); }
.prayer-reader { padding: 44px 0 72px; font-size: var(--reader-size); line-height: 1.72; }
.reader-title-block { text-align: center; margin-bottom: 46px; }
.reader-title-block .eyebrow { margin-bottom: 10px; }
.reader-title-block h1 { font-size: clamp(2.2rem, 9vw, 4rem); }
.reader-section { margin: 0 0 44px; scroll-margin-top: 150px; }
.reader-section h2 { margin: 0 0 22px; text-align: center; font-size: 1.42em; line-height: 1.2; color: var(--accent); }
.reader-group-title { margin: 0 0 10px !important; text-align: center; color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: .72em; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.reader-section p { margin: 0 0 1.05em; }
.reader-section .rubric { color: var(--muted); font-size: .89em; font-style: italic; line-height: 1.6; }
.reader-section .short-response { text-align: center; }
.reader-divider { width: 64px; height: 1px; margin: 42px auto; background: var(--line); }

.site-footer {
  width: min(calc(100% - 32px), var(--max));
  margin: auto auto 0;
  padding: 24px 0 max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .69rem;
  line-height: 1.5;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (min-width: 700px) {
  .topbar { padding-inline: 24px; }
  .hero { padding-top: 72px; }
  .prayer-reader { padding-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.prayer-card-list { display: grid; gap: 12px; }
.reader-section.no-heading { margin-top: -12px; margin-bottom: 26px; }
.reader-section.no-heading .rubric { text-align: center; }

.collection-hero {
  width: min(calc(100% - 32px), var(--max));
  margin-inline: auto;
  padding: 54px 0 20px;
  text-align: center;
}
.collection-hero h1 { font-size: clamp(2.2rem, 9vw, 4rem); }
.collection-list-block { padding-top: 16px; padding-bottom: 52px; }
.collection-prayer-card { box-shadow: 0 10px 30px rgba(47, 34, 26, .055); }
.prayer-number {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .88rem;
  font-weight: 850;
  letter-spacing: .02em;
}
.cross-mark { font-family: Georgia, 'Times New Roman', serif; }

@media (min-width: 700px) {
  .collection-hero { padding-top: 72px; }
}

/* Reference tables used by Spiritual Helps. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 8px 0 1.2em;
  padding-bottom: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.reference-table {
  width: 100%;
  min-width: 690px;
  border-collapse: collapse;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .73em;
  line-height: 1.35;
}
.reference-table th,
.reference-table td {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.reference-table tr > :last-child { border-right: 0; }
.reference-table tbody tr:last-child > * { border-bottom: 0; }
.reference-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
}
.reference-table tbody th {
  color: var(--accent);
  font-weight: 800;
}
.table-scroll:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-soft) 75%, transparent);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .part-heading-row { display: grid; align-items: start; }
  .reference-table { font-size: .68em; }
}


/* Spiritual Helps is reference material, not call-and-response prayer text.
   Keep its lists consistently left-aligned and use hanging indents for numbered entries. */
.reference-reader {
  line-height: 1.62;
}
.reference-reader .reader-title-block {
  margin-bottom: 38px;
}
.reference-reader .reader-section {
  margin-bottom: 34px;
}
.reference-reader .reader-section p {
  margin: 0 0 .72em;
  text-align: left;
}
.reference-reader .reader-section .rubric {
  text-align: left;
}
.reference-reader .reference-numbered {
  padding-left: 2.15em;
  text-indent: -2.15em;
  font-variant-numeric: tabular-nums;
}
.reference-reader .reference-list-line {
  padding-left: 1.15em;
}

@media (max-width: 560px) {
  .reference-reader .reference-numbered {
    padding-left: 1.85em;
    text-indent: -1.85em;
  }
  .reference-reader .reference-list-line {
    padding-left: .8em;
  }
}


/* Multi-prayer rules stay in one reader, but each constituent prayer is
   visually distinct so the continuous flow does not read as one undifferentiated block. */
.sequence-reader .reader-title-block {
  margin-bottom: 34px;
}
.sequence-reader .reader-section {
  margin: 0 0 20px;
  padding: clamp(22px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  box-shadow: 0 10px 28px rgba(47, 34, 26, .045);
}
[data-theme="dark"] .sequence-reader .reader-section {
  box-shadow: 0 12px 30px rgba(0, 0, 0, .14);
}
.sequence-reader .reader-section.no-heading {
  margin-top: 0;
}
.sequence-reader .reader-section h2 {
  margin-bottom: 24px;
}
.sequence-reader .reader-divider {
  display: none;
}
.sequence-reader .verse-block {
  margin: 0;
}
.sequence-reader .verse-line {
  margin: 0 0 .66em;
  text-align: left;
}
.sequence-reader .verse-line:last-child {
  margin-bottom: 0;
}

@media (max-width: 560px) {
  .sequence-reader .reader-section {
    padding: 20px 18px;
    border-radius: 18px;
  }
}


/* Part Three: the Divine Liturgy remains one service, with role-aware typography
   and compact jump navigation for a long continuous reader. */
.reader-subtitle {
  margin: 14px auto 0;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .75em;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.liturgy-jump {
  display: grid;
  gap: 7px;
  margin: -14px 0 42px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.liturgy-jump > span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.liturgy-jump select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: .88rem;
}
.liturgy-reader .reader-title-block { margin-bottom: 38px; }
.liturgy-reader .reader-section { margin-bottom: 48px; }
.liturgy-reader .reader-section h2 {
  margin-bottom: 26px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.liturgy-reader .reader-section.no-heading { margin-top: 0; margin-bottom: 28px; }
.liturgy-reader .reader-section.no-heading .rubric { text-align: left; }
.liturgy-line {
  display: grid;
  grid-template-columns: minmax(66px, auto) 1fr;
  gap: 12px;
  align-items: start;
  margin: 0 0 1.05em;
}
.liturgy-role {
  padding-top: .15em;
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .67em;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.liturgy-speech { margin: 0 !important; }
.liturgy-reader .rubric {
  margin-left: clamp(10px, 3vw, 28px);
  padding-left: 14px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 25%, var(--line));
}
.liturgy-subheading {
  margin: 28px 0 18px !important;
  color: var(--accent);
  text-align: center;
  font-style: italic;
  font-weight: 650;
}
.liturgy-reader .reader-divider { margin-block: 34px; }

@media (max-width: 560px) {
  .liturgy-jump { margin-top: -8px; margin-bottom: 32px; }
  .liturgy-line { grid-template-columns: 1fr; gap: 3px; margin-bottom: 1.25em; }
  .liturgy-role { padding-top: 0; }
  .liturgy-reader .rubric { margin-left: 0; padding-left: 12px; }
}


/* Short occasional services use the same speaker clarity as the Divine Liturgy,
   but without Liturgy-specific jump navigation or heavy section rules. */
.service-reader .reader-title-block { margin-bottom: 38px; }
.service-reader .reader-section { margin-bottom: 38px; }
.service-reader .reader-section.no-heading { margin-top: 0; }
.service-reader .reader-section.no-heading .rubric { text-align: left; }
.service-reader .rubric {
  margin-left: clamp(8px, 3vw, 24px);
  padding-left: 14px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 25%, var(--line));
}
.service-reader .liturgy-subheading {
  margin-top: 24px !important;
}
@media (max-width: 560px) {
  .service-reader .rubric { margin-left: 0; padding-left: 12px; }
}


/* v0.11 navigation/index pass */
.search-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .78rem;
  line-height: 1.5;
}
.search-empty { margin: 12px 2px 0; }
.index-browse-button {
  width: 100%;
  margin-top: 14px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .84rem;
  font-weight: 800;
  cursor: pointer;
}
.index-browse-button:active { transform: translateY(1px); }
.index-hero { padding-bottom: 10px; }
.index-search-field { margin-top: 22px; text-align: left; }
.index-list-block { padding-top: 14px; padding-bottom: 64px; }
.index-list { display: grid; gap: 34px; }
.index-group h2 {
  margin: 0 0 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 1.25rem;
}
.index-entry-list { display: grid; gap: 8px; }
.index-entry {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
}
.index-entry strong { font-family: Georgia, 'Times New Roman', serif; font-size: 1rem; }
.index-entry span { color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: .75rem; line-height: 1.4; }
.index-entry:active { transform: translateY(1px); }

/* Consistency pass: reader section titles and terminal spacing follow one baseline.
   Specialized readers may override alignment, but not spacing rhythm. */
.prayer-reader .reader-section > :last-child { margin-bottom: 0; }
.prayer-reader .reader-section h2 { text-wrap: balance; }
.collection-prayer-card .prayer-card-title { line-height: 1.25; }

@media (max-width: 560px) {
  .index-list { gap: 28px; }
  .index-entry { padding: 12px; }
}


/* v0.12 everyday-use pass: favorites, recent/resume, and compact reader utilities. */
.personal-home {
  padding-top: 4px;
  padding-bottom: 30px;
}
.personal-group + .personal-group { margin-top: 28px; }
.personal-prayer-card { box-shadow: 0 10px 30px rgba(47, 34, 26, .055); }
.resume-card-track {
  display: block;
  width: min(240px, 100%);
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.resume-card-value {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.reader-toolbar-left {
  min-width: 0;
  flex: 1;
}
.reader-section-label {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.reader-toolbar-actions { flex-shrink: 0; }
.favorite-button {
  min-width: 42px;
  font-size: 1rem;
  color: var(--muted);
}
.favorite-button.is-favorite {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
}
.wake-button { min-width: 62px; }
.wake-button.is-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 66%, var(--surface));
}
.text-button:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 430px) {
  .reader-toolbar {
    gap: 6px;
    padding-inline: 10px;
  }
  .reader-section-label { font-size: .69rem; }
  .reader-toolbar-actions { gap: 4px; }
  .text-button {
    min-width: 40px;
    padding-inline: 8px;
  }
  .wake-button {
    min-width: 54px;
    padding-inline: 7px;
    font-size: .69rem;
  }
}


/* v0.13 personal drawer + prayer-rule builder */
.topbar-left-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
body.drawer-open,
body.picker-open { overflow: hidden; }

.drawer-scrim,
.picker-scrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(20, 16, 13, .38);
  backdrop-filter: blur(2px);
}
.personal-drawer {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: min(390px, calc(100vw - 42px));
  display: flex;
  flex-direction: column;
  transform: translateX(-104%);
  visibility: hidden;
  background: var(--bg);
  border-right: 1px solid var(--line);
  box-shadow: 20px 0 55px rgba(0, 0, 0, .18);
  transition: transform .2s ease, visibility .2s step-end;
  padding-top: env(safe-area-inset-top);
}
.personal-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .2s ease, visibility 0s;
}
.drawer-header,
.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-header h2,
.picker-header h2 { margin: 0; font-size: 1.55rem; }
.drawer-header .eyebrow,
.picker-header .eyebrow { margin-bottom: 4px; }
.drawer-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 24px;
}
.drawer-group + .drawer-group {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.drawer-group h3 {
  margin: 0 4px 10px;
  font-size: 1.02rem;
  color: var(--text);
}
.drawer-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 10px;
}
.drawer-group-heading h3 { margin: 0; }
.drawer-add-button,
.compact-action-button,
.primary-action-button,
.secondary-action-button {
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
  cursor: pointer;
}
.drawer-add-button {
  min-height: 34px;
  padding: 5px 12px;
  font-size: .74rem;
}
.drawer-list { display: grid; gap: 7px; }
.drawer-item {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.drawer-item:hover,
.drawer-item:focus-visible {
  border-color: var(--line);
  background: var(--surface);
  outline: none;
}
.drawer-item-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.drawer-item-copy { min-width: 0; display: grid; gap: 2px; }
.drawer-item-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .92rem;
}
.drawer-item-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .69rem;
}
.drawer-item-arrow { color: var(--accent); font-size: 1.35rem; }
.drawer-empty {
  margin: 8px 4px 0;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .78rem;
  line-height: 1.5;
}
.drawer-local-note {
  margin: 0;
  padding: 14px 18px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .67rem;
  line-height: 1.45;
}

/* Home keeps only the high-value Continue card. Favorites, recent items and
   custom rules live in My Prayer Book so the printed-book hierarchy stays dominant. */
.personal-home { padding-bottom: 24px; }

.rule-editor-hero { padding-bottom: 8px; }
.rule-editor-block { padding-top: 12px; padding-bottom: 64px; }
.rule-name-field {
  display: grid;
  gap: 7px;
  margin-bottom: 34px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .03em;
}
.rule-name-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px;
  background: var(--surface);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15rem;
  outline: none;
}
.rule-name-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 70%, transparent);
}
.rule-editor-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
}
.rule-editor-heading h2 { margin: 0; font-size: 1.45rem; }
.compact-action-button {
  min-height: 42px;
  padding: 9px 13px;
  color: var(--accent);
  background: var(--surface);
  white-space: nowrap;
}
.rule-items-list { display: grid; gap: 9px; }
.rule-item-row {
  display: grid;
  grid-template-columns: 22px 28px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  transition: opacity .12s ease, border-color .12s ease, transform .12s ease;
}
.rule-item-row.is-dragging { opacity: .48; }
.rule-item-row.is-drag-target {
  border-color: var(--accent);
  transform: translateY(1px);
}
.rule-drag-handle {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: -3px;
  cursor: grab;
  user-select: none;
}
.rule-item-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .7rem;
  font-weight: 850;
}
.rule-item-copy { display: grid; gap: 2px; min-width: 0; }
.rule-item-copy strong { font-size: .96rem; line-height: 1.25; }
.rule-item-copy span {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .68rem;
  line-height: 1.3;
}
.rule-item-actions { display: flex; gap: 4px; }
.rule-mini-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 850;
  cursor: pointer;
}
.rule-mini-button:disabled { opacity: .32; cursor: default; }
.destructive { color: #9c3f35; }
[data-theme="dark"] .destructive { color: #e09488; }
.rule-empty-state {
  display: grid;
  gap: 4px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.rule-empty-state strong { color: var(--text); }
.rule-empty-state span { font-size: .8rem; line-height: 1.45; }
.rule-primary-actions { margin-top: 22px; }
.primary-action-button {
  width: 100%;
  min-height: 50px;
  padding: 11px 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff8f0;
  font-size: .9rem;
}
.primary-action-button:disabled { opacity: .4; cursor: not-allowed; }
.rule-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 10px;
}
.secondary-action-button { min-height: 44px; padding: 9px 12px; font-size: .78rem; }
.rule-local-note {
  margin: 22px 2px 0;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .72rem;
  line-height: 1.5;
}
.rule-marker-copy {
  margin: 0 !important;
  padding: 16px;
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 14px;
  color: var(--muted);
  background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
  text-align: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .78em;
  font-style: italic;
  line-height: 1.55;
}

.rule-picker {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 0;
  width: min(680px, 100%);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  transform: translate(-50%, 105%);
  visibility: hidden;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  box-shadow: 0 -22px 65px rgba(0, 0, 0, .22);
  transition: transform .2s ease, visibility .2s step-end;
  padding-bottom: env(safe-area-inset-bottom);
}
.rule-picker.is-open {
  transform: translate(-50%, 0);
  visibility: visible;
  transition: transform .2s ease, visibility 0s;
}
.rule-picker .picker-header { padding-inline: 20px; }
.picker-search-field { margin: 14px 18px 8px; }
.rule-picker-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 18px 24px;
}
.picker-group + .picker-group { margin-top: 26px; }
.picker-group h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 1rem;
}
.picker-group-list { display: grid; gap: 7px; }
.picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.picker-item > span:first-child { display: grid; gap: 2px; min-width: 0; }
.picker-item strong { font-size: .92rem; }
.picker-item span span {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .68rem;
  line-height: 1.35;
}
.picker-item > span:last-child { color: var(--accent); font-size: 1.3rem; font-weight: 800; }

@media (max-width: 560px) {
  .topbar { gap: 5px; padding-inline: 10px; }
  .topbar-left-controls { gap: 4px; }
  .topbar-left-controls .icon-button { min-width: 38px; width: 38px; height: 38px; }
  .rule-editor-heading { align-items: stretch; display: grid; }
  .compact-action-button { width: 100%; }
  .rule-item-row {
    grid-template-columns: 18px 24px minmax(0, 1fr);
    gap: 8px;
  }
  .rule-item-actions {
    grid-column: 3;
    justify-content: flex-end;
    margin-top: 3px;
  }
  .rule-drag-handle { opacity: .5; }
  .rule-picker { max-height: 88vh; border-radius: 20px 20px 0 0; }
}
