/* ============================================================
   Lectio — a reading desk for scripture
   Palette: cool paper ground, white reading surface,
   rubric red (the manuscript tradition) + lapis as the two
   data hues, validated for CVD in both themes.
   ============================================================ */

:root {
  /* structure */
  --ground:      #F2F3F6;
  --surface:     #FFFFFF;
  --surface-2:   #FAFAFC;
  --rule:        #E1E3EA;
  --rule-soft:   #EDEEF3;
  --ink:         #17171C;
  --ink-2:       #4E5058;
  --ink-3:       #83858F;
  /* data + accent */
  --rubric:      #A02C3A;
  --rubric-soft: #F6E9EB;
  --rubric-line: #E8CDD1;
  --lapis:       #1160B4;
  --lapis-soft:  #E8F0FA;
  --done:        #3C6E52;
  --done-soft:   #E6F0EA;
  --gold:        #8A6A1F;
  /* sequential ramp for the reading heatmap (one hue, light to dark) */
  --heat-0:      #EBECF1;
  --heat-1:      #F0D5D9;
  --heat-2:      #DFA6AE;
  --heat-3:      #C4707C;
  --heat-4:      #A02C3A;
  --heat-5:      #6E1B26;

  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .06);
  --shadow-md: 0 6px 24px -8px rgba(20, 20, 30, .18);
  --shadow-lg: 0 18px 50px -14px rgba(20, 20, 30, .3);

  --ui: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Spectral", Iowan Old Style, Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --rail: 232px;
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #0F1015;
    --surface:     #16181F;
    --surface-2:   #1C1F27;
    --rule:        #282B35;
    --rule-soft:   #21242C;
    --ink:         #E9EAF0;
    --ink-2:       #A8AAB6;
    --ink-3:       #7B7E8B;
    --rubric:      #CC6E79;
    --rubric-soft: #2C1A1E;
    --rubric-line: #45272C;
    --lapis:       #3E9AD8;
    --lapis-soft:  #14222E;
    --done:        #5FA37D;
    --done-soft:   #16241D;
    --gold:        #C8A555;
    --heat-0:      #1E212A;
    --heat-1:      #3A2229;
    --heat-2:      #5E2F39;
    --heat-3:      #8C4551;
    --heat-4:      #C06673;
    --heat-5:      #E29AA3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 24px -8px rgba(0, 0, 0, .6);
    --shadow-lg: 0 18px 50px -14px rgba(0, 0, 0, .75);
  }
}

:root[data-theme="dark"] {
  --ground:      #0F1015;
  --surface:     #16181F;
  --surface-2:   #1C1F27;
  --rule:        #282B35;
  --rule-soft:   #21242C;
  --ink:         #E9EAF0;
  --ink-2:       #A8AAB6;
  --ink-3:       #7B7E8B;
  --rubric:      #CC6E79;
  --rubric-soft: #2C1A1E;
  --rubric-line: #45272C;
  --lapis:       #3E9AD8;
  --lapis-soft:  #14222E;
  --done:        #5FA37D;
  --done-soft:   #16241D;
  --gold:        #C8A555;
  --heat-0:      #1E212A;
  --heat-1:      #3A2229;
  --heat-2:      #5E2F39;
  --heat-3:      #8C4551;
  --heat-4:      #C06673;
  --heat-5:      #E29AA3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 24px -8px rgba(0, 0, 0, .6);
  --shadow-lg: 0 18px 50px -14px rgba(0, 0, 0, .75);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--lapis); }

:focus-visible {
  outline: 2px solid var(--lapis);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--rubric-soft); color: var(--ink); }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100%; }

.rail {
  display: none;
  width: var(--rail);
  flex: none;
  flex-direction: column;
  gap: 2px;
  padding: 20px 14px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  border-right: 1px solid var(--rule);
  background: var(--surface);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 10px 18px;
}
.wordmark b {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.wordmark span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-align: left;
  font-size: 14.5px;
  transition: background .12s, color .12s;
}
.nav-btn svg { flex: none; opacity: .85; }
.nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-btn[aria-current="page"] {
  background: var(--rubric-soft);
  color: var(--rubric);
  font-weight: 600;
}
.nav-btn[aria-current="page"] svg { opacity: 1; }
.nav-sep { height: 1px; background: var(--rule); margin: 12px 10px; }

.rail-foot { margin-top: auto; padding-top: 14px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  min-height: 52px;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .mobile-mark { display: flex; }
@media (min-width: 900px) { .topbar .mobile-mark { display: none; } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--ink-2);
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { background: var(--rubric-soft); color: var(--rubric); }

.view {
  flex: 1;
  padding: 22px 16px 96px;
}
@media (min-width: 900px) {
  .view { padding: 30px 32px 60px; }
}
.wrap { max-width: 860px; margin: 0 auto; }
.wrap-narrow { max-width: 640px; margin: 0 auto; }

/* ---------- bottom tabs (mobile) ---------- */

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 8px;
  color: var(--ink-3);
  font-size: 9px;
  letter-spacing: -.02em;
  white-space: nowrap;
  min-width: 0;
}
.tab span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (min-width: 430px) { .tab { font-size: 10px; letter-spacing: 0; } }
@media (min-width: 560px) { .tab { font-size: 10.5px; letter-spacing: .01em; } }
.tab[aria-current="page"] { color: var(--rubric); font-weight: 600; }
@media (min-width: 900px) {
  .tabs { display: none; }
  .rail { display: flex; }
  .view { padding-bottom: 60px; }
}

/* ---------- generic pieces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px;
}
.card + .card { margin-top: 14px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
}

h2.section-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 30px 0 12px;
}
h2.section-title:first-child { margin-top: 0; }

.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.tnum { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn.primary {
  background: var(--rubric);
  border-color: var(--rubric);
  color: #fff;
}
.btn.primary:hover { background: color-mix(in srgb, var(--rubric) 86%, #000); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: default; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
}
.chip.on { background: var(--rubric-soft); border-color: var(--rubric-line); color: var(--rubric); font-weight: 600; }

.field {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}
.field:focus { outline: none; border-color: var(--lapis); background: var(--surface); }
textarea.field { resize: vertical; min-height: 84px; line-height: 1.55; }

.meter {
  height: 5px;
  border-radius: 999px;
  background: var(--rule-soft);
  overflow: hidden;
}
.meter > i { display: block; height: 100%; background: var(--rubric); border-radius: 999px; transition: width .35s ease; }
.meter.nt > i { background: var(--lapis); }
.meter.full > i { background: var(--done); }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-3);
}
.empty p { max-width: 34ch; margin: 8px auto 0; line-height: 1.6; }

/* ---------- today ---------- */

.today-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.greeting {
  font-family: var(--serif);
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0;
  text-wrap: balance;
}
.greeting + p { margin: 6px 0 0; color: var(--ink-2); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 15px;
}
.stat b {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}
.stat.accent b { color: var(--rubric); }

.next-card {
  border: 1px solid var(--rubric-line);
  background: linear-gradient(180deg, var(--rubric-soft), var(--surface) 70%);
  border-radius: 14px;
  padding: 20px;
}
.next-card h3 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  margin: 6px 0 4px;
  letter-spacing: -.015em;
}
.next-card .refs { color: var(--ink-2); font-size: 14px; margin: 0 0 16px; }
.next-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- progress / checklist ---------- */

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 0 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}
.sec-head:first-child { margin-top: 0; }
.sec-head h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.sec-head .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.book-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--rule-soft);
}
.book-row:last-child { border-bottom: none; }

.tick {
  width: 28px; height: 28px;
  flex: none;
  border-radius: 8px;
  border: 1.5px solid var(--rule);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all .14s;
  position: relative;
  z-index: 1;
}
/* a thumb-sized target around a modest-looking box */
.tick::after { content: ""; position: absolute; inset: -9px -7px; }
.tick:hover { border-color: var(--done); background: var(--done-soft); }
.tick:active { transform: scale(.92); }
.tick.part { border-color: var(--rubric); background: var(--rubric-soft); color: var(--rubric); }
.tick.done { border-color: var(--done); background: var(--done); color: #fff; }

.book-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.book-name > span:first-child {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.005em;
}
.book-row.complete .book-name > span:first-child { color: var(--ink-2); }
.book-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.book-meta .meter { flex: 1; max-width: 120px; }

.note-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
  padding: 6px 0 16px 33px;
}
@media (max-width: 480px) {
  .chapter-grid { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); padding-left: 0; }
}
.ch-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 7px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
}
.ch-cell:hover { border-color: var(--ink-3); }
.ch-cell.done { background: var(--done); border-color: var(--done); color: #fff; font-weight: 500; }
.ch-cell .mk {
  position: absolute;
  top: 3px; right: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
}
.ch-cell.done .mk { background: #fff; }

.tick-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 6px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
}
.tick-mode p { margin: 0; font-size: 12.5px; line-height: 1.5; }

/* ---------- plans ---------- */

.plan-card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  padding: 15px 16px;
  margin-bottom: 10px;
}
.plan-card.on { border-color: var(--rubric); box-shadow: 0 0 0 1px var(--rubric-line); }
.plan-top { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.plan-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.plan-top .badge {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--rubric);
  background: var(--rubric-soft);
  border: 1px solid var(--rubric-line);
  border-radius: 999px;
  padding: 2px 7px;
}
.plan-top .plan-ch {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.plan-blurb { margin: 7px 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.plan-sub { margin: 7px 0 0; font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.plan-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }

/* ---------- themes ---------- */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  padding: 15px 16px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .12s, transform .12s;
}
.theme-card:hover { border-color: var(--rubric); transform: translateY(-1px); }
.theme-card.complete { border-color: var(--done); }
.theme-top { display: flex; align-items: baseline; gap: 10px; }
.theme-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.theme-top span {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.theme-card p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }

.theme-head h2 {
  font-family: var(--serif);
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  text-wrap: balance;
}
.theme-head p { margin: 0 0 14px; color: var(--ink-2); line-height: 1.55; max-width: 52ch; }

.passage-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--rule-soft);
}
.passage-row:last-child { border-bottom: none; }
.passage-row .tick { margin-top: 1px; }
.passage-body {
  flex: 1;
  min-width: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.passage-body .pref {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.005em;
}
.passage-row.done .passage-body .pref { color: var(--ink-2); }
.passage-body .pnote { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }

.theme-strip {
  border: 1px solid var(--rubric-line);
  background: var(--rubric-soft);
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.ts-head { display: flex; align-items: center; gap: 10px; }
.ts-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--rubric);
}
.ts-pos { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.ts-head .btn { margin-left: auto; }
.ts-note { margin: 7px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.ts-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }

/* ---------- about this book ---------- */

.disclosure.about[open] > summary { border-bottom-color: var(--rule-soft); }
.about-what {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink);
}
.about-meta {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  align-items: baseline;
}
.about-meta dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.about-meta dd {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

/* ---------- what happens in this chapter ---------- */

.disclosure.chapter-what[open] > summary { border-bottom-color: var(--rule-soft); }
.what-text {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.64;
  color: var(--ink-2);
}

/* ---------- reader ---------- */

.reader-bar {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 52px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: color-mix(in srgb, var(--ground) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.ref-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.ref-btn:hover { border-color: var(--ink-3); }
.tr-btn {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tr-btn:hover { border-color: var(--rubric); color: var(--rubric); }

.page {
  max-width: calc(var(--measure) + 32px);
  margin: 0 auto;
  padding: 26px 16px 40px;
}
.chapter-head { margin-bottom: 18px; }
.chapter-head .bk {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.chapter-head h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 7vw, 40px);
  font-weight: 600;
  letter-spacing: -.025em;
  margin: 3px 0 0;
  line-height: 1.1;
}
.chapter-head h2 em {
  font-style: normal;
  color: var(--rubric);
  font-variant-numeric: lining-nums;
}

.scripture {
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.72;
  color: var(--ink);
  letter-spacing: .002em;
}
.scripture.compact { font-size: 17px; line-height: 1.62; }
.scripture.roomy { font-size: 20.5px; line-height: 1.85; }

.v {
  display: block;
  position: relative;
  padding: 2px 6px 2px 8px;
  margin: 0 -6px 0 -8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background .12s;
}
.v:hover { background: var(--surface); }
.v.sel { background: var(--surface); border-left-color: var(--rubric); box-shadow: var(--shadow-sm); }
.v .n {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-3);
  vertical-align: .38em;
  margin-right: 5px;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.v.sel .n { color: var(--rubric); }

/* words of Christ — rubric is the red of the liturgical books, and is already
   the app's red; it holds its contrast against both reading surfaces */
.wc { color: var(--rubric); }
.v.hl-y { background: color-mix(in srgb, #E8C84A 26%, transparent); }
.v.hl-b { background: color-mix(in srgb, var(--lapis) 18%, transparent); }
.v.hl-g { background: color-mix(in srgb, var(--done) 20%, transparent); }
.v.hl-r { background: color-mix(in srgb, var(--rubric) 16%, transparent); }
.v .marks {
  float: right;
  margin-left: 8px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 1.4em;
}
.v .marks i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  display: block;
}
.v .marks i.star { background: var(--rubric); }

.v-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 8px 4px;
  font-family: var(--ui);
}
.swatches { display: inline-flex; gap: 4px; margin-right: 2px; }
.sw {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--rule);
}
.sw[data-c="y"] { background: #E8C84A; }
.sw[data-c="b"] { background: var(--lapis); }
.sw[data-c="g"] { background: var(--done); }
.sw[data-c="r"] { background: var(--rubric); }
.sw[data-c="x"] { background: var(--surface); position: relative; }
.sw[data-c="x"]::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-top: 1.5px solid var(--ink-3);
  transform: rotate(-45deg);
  transform-origin: center;
}
.sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }

.note-box {
  margin: 8px 0 4px;
  padding: 12px;
  border: 1px solid var(--rubric-line);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--ui);
}
.note-box .eyebrow { margin-bottom: 7px; }
.note-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
}
.note-foot .saved { margin-left: auto; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; }

/* disclosure for book + chapter notes */
.disclosure {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 16px;
  overflow: hidden;
}
.disclosure > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--surface-2); }
.disclosure[open] > summary { border-bottom: 1px solid var(--rule); }
.disclosure .body { padding: 14px; }
.disclosure .caret { transition: transform .16s; flex: none; color: var(--ink-3); }
.disclosure[open] .caret { transform: rotate(90deg); }
.disclosure .tally {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.chapter-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.chapter-foot .spacer { flex: 1; }

/* ---------- sheets / overlays ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 10, 16, .42);
  backdrop-filter: blur(2px);
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }

.sheet {
  position: fixed;
  z-index: 61;
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  inset: auto 0 0 0;
  max-height: 86vh;
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: rise .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { transform: translateY(14px); opacity: .6; } }
@media (min-width: 760px) {
  .sheet {
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(680px, 92vw);
    max-height: 80vh;
    border-radius: 14px;
    animation: pop .18s cubic-bezier(.2, .8, .3, 1);
  }
  @keyframes pop { from { transform: translate(-50%, -48%); opacity: .5; } }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  flex: none;
}
.sheet-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}
.sheet-body { overflow-y: auto; padding: 16px; flex: 1; -webkit-overflow-scrolling: touch; }

/* right-hand assistant panel */
.ask-panel {
  position: fixed;
  z-index: 61;
  inset: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-top: env(safe-area-inset-top, 0px);
  animation: rise .2s cubic-bezier(.2, .8, .3, 1);
}
@media (min-width: 900px) {
  .ask-panel {
    inset: 0 0 0 auto;
    width: 400px;
    border-left: 1px solid var(--rule);
    box-shadow: var(--shadow-lg);
    animation: slide .2s cubic-bezier(.2, .8, .3, 1);
  }
  @keyframes slide { from { transform: translateX(22px); opacity: .5; } }
}

.ask-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 92%; }
.bubble.me {
  align-self: flex-end;
  background: var(--rubric-soft);
  border: 1px solid var(--rubric-line);
  border-radius: 12px 12px 3px 12px;
  padding: 9px 12px;
  font-size: 14.5px;
}
.bubble.ai { align-self: flex-start; }
.bubble.ai .who {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.bubble.ai .txt {
  font-size: 15px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.ai .txt strong { font-weight: 600; }
.bubble.ai .txt em.ref { font-style: normal; color: var(--rubric); font-weight: 500; }
.bubble.err {
  align-self: stretch;
  border: 1px solid var(--rubric-line);
  background: var(--rubric-soft);
  color: var(--rubric);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
}
.bubble-tools { display: flex; gap: 6px; margin-top: 8px; }

.ask-ctx {
  padding: 8px 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}
.ask-ctx b { color: var(--rubric); font-weight: 600; font-family: var(--serif); font-size: 13px; }

.starters { display: flex; flex-direction: column; gap: 7px; }
.starter {
  text-align: left;
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: 10px 12px;
  background: var(--surface-2);
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.45;
}
.starter:hover { border-color: var(--rubric); color: var(--ink); }

.ask-form {
  flex: none;
  border-top: 1px solid var(--rule);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--surface);
}
.ask-form textarea {
  flex: 1;
  resize: none;
  max-height: 128px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
  line-height: 1.45;
}
.ask-form textarea:focus { outline: none; border-color: var(--lapis); background: var(--surface); }

.thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--ink-3); font-size: 13.5px; }
.thinking i {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  animation: bob 1.1s infinite ease-in-out;
}
.thinking i:nth-child(2) { animation-delay: .14s; }
.thinking i:nth-child(3) { animation-delay: .28s; }
@keyframes bob { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

/* ---------- picker ---------- */

.picker-tabs { display: flex; gap: 6px; padding: 0 16px 12px; flex: none; }
.book-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.book-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  font-family: var(--serif);
  font-size: 15px;
}
.book-pick:hover { background: var(--surface-2); }
.book-pick.on { background: var(--rubric-soft); color: var(--rubric); font-weight: 600; }
.book-pick .pc {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tr-list { display: flex; flex-direction: column; gap: 5px; }
.tr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-align: left;
  background: var(--surface);
}
.tr-item:hover { border-color: var(--ink-3); }
.tr-item.on { border-color: var(--rubric); background: var(--rubric-soft); }
.tr-item .code {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--rubric);
  width: 46px;
  flex: none;
}
.tr-item .nm { font-size: 14px; font-weight: 500; }
.tr-item .bl { font-size: 12px; color: var(--ink-3); }
.tr-item .yr { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* ---------- rankings ---------- */

.rank-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--rule-soft);
}
.rank-pos {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.rank-name { font-family: var(--serif); font-size: 16px; font-weight: 500; text-align: left; }
.rank-name small { display: block; font-family: var(--ui); font-size: 11.5px; color: var(--ink-3); font-weight: 400; margin-top: 2px; }
.scores { display: flex; gap: 18px; align-items: center; }
.score-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.score-col > span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.score-col .score-val {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.dial { display: flex; align-items: center; gap: 3px; }
.pip {
  width: 9px; height: 20px;
  border-radius: 2px;
  background: var(--rule-soft);
  border: none;
  transition: background .1s;
  position: relative;
}
.pip::after { content: ""; position: absolute; inset: -5px -1px; }
.pip:hover { background: var(--ink-3); }
.dial.like .pip.on { background: var(--rubric); }
.dial.imp .pip.on { background: var(--lapis); }
@media (max-width: 660px) {
  .rank-row { grid-template-columns: 26px 1fr; row-gap: 10px; }
  .scores { grid-column: 1 / -1; justify-content: space-between; width: 100%; gap: 10px; }
  .pip { width: 8px; height: 22px; }
}

/* ---------- charts ---------- */

.chart-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 18px; }
.chart-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.chart-head h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0; }
.chart-sub { font-size: 12.5px; color: var(--ink-3); margin: 0 0 14px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: block; }
.chart-wrap { overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; max-width: 620px; margin: 0 auto; }
.heatmap-wrap { max-width: 430px; }
svg.chart text { font-family: var(--ui); fill: var(--ink-3); }
.tip {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  background: var(--ink);
  color: var(--ground);
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
  max-width: 220px;
}
.tip b { font-weight: 600; }

/* ---------- search ---------- */

.hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 13px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 8px;
}
.hit:hover { border-color: var(--rubric); }
.hit .ref {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .07em;
  color: var(--rubric);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.hit .ref .kind { color: var(--ink-3); letter-spacing: .1em; }
.hit .txt { font-family: var(--serif); font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.hit mark { background: color-mix(in srgb, #E8C84A 42%, transparent); color: var(--ink); border-radius: 2px; padding: 0 1px; }

.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }

/* ---------- notes index ---------- */

.note-item {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  background: var(--surface);
  padding: 13px 14px;
  margin-bottom: 9px;
}
.note-item .ref {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.note-item .ref b { color: var(--rubric); font-weight: 600; }
.note-item .body { font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.note-item .go { margin-left: auto; }

/* ---------- compare ---------- */
.cmp-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.cmp-row:last-child { border-bottom: none; }
.cmp-row .code {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--rubric);
  padding-top: 3px;
}
.cmp-row .txt { font-family: var(--serif); font-size: 16px; line-height: 1.62; }
.cmp-row.loading .txt { color: var(--ink-3); font-style: italic; }

/* ---------- misc ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 80;
  background: var(--ink);
  color: var(--ground);
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  animation: rise .18s ease;
  max-width: calc(100vw - 32px);
}
@media (min-width: 900px) { .toast { bottom: 26px; } }

.loading-line {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--rubric), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: sweep 1.1s infinite linear;
}
@keyframes sweep { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .lbl { flex: 1; }
.setting-row .lbl b { display: block; font-weight: 600; font-size: 14.5px; }
.setting-row .lbl small { color: var(--ink-3); font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   the gate — sign-in and consent, hosted build only
   ============================================================ */

.gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: var(--paper);
}
.gate-card {
  width: 100%;
  max-width: 34rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 30px 28px 26px;
  box-shadow: var(--shadow-sm);
}
.gate-mark { margin-bottom: 22px; }
.gate-mark b {
  display: block;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.gate-mark span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.gate-card h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.gate-lede {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.gate-list {
  margin: 0 0 20px;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.gate-list li { margin-bottom: 7px; }
.gate-check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin: 0 0 16px;
  padding: 13px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.55;
  cursor: pointer;
}
.gate-check input { margin-top: 2px; flex: none; width: 17px; height: 17px; accent-color: var(--rubric); }
.gate-note { margin: 10px 0 14px; font-size: 13px; color: var(--ink-3); min-height: 1em; }
.gate-note.bad { color: var(--rubric); }
.gate-fine {
  margin: 18px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-3);
}
.gate-fine a, .prose a { color: var(--lapis); }
.gate-card .btn { width: 100%; justify-content: center; }
.gate-card .btn + .btn { margin-top: 9px; }
.btn.danger { color: var(--rubric); border-color: var(--rubric-line); }
.btn.danger:hover { background: var(--rubric-soft); }

/* a plain document page — the privacy notice */
.prose {
  max-width: 40rem;
  margin: 0 auto;
  padding: 44px 20px 80px;
}
.prose h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 6px;
}
.prose .sub { margin: 0 0 30px; color: var(--ink-3); font-size: 13px; }
.prose h2 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  margin: 32px 0 8px;
}
.prose p, .prose li { font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
