/* Scriptura v3 — layout, reading typography and components */

/* =====================================================================
   BASE
   ===================================================================== */
html {
  background-color: var(--canvas);
  color: var(--ink);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
}

html.is-ready body {
  transition: background-color var(--dur-slow) ease, color var(--dur-slow) ease;
}

/* Paper grain — behind everything, never repainted on scroll */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--grain);
  background-size: 180px 180px;
  opacity: var(--grain-opacity);
}

h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
kbd { font: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; stroke-width: 1.8; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

.skip-link {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--canvas);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

/* =====================================================================
   TYPE ROLES
   ===================================================================== */
.display {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 30;
  letter-spacing: -0.02em;
}

/* Microscopic pill that introduces a heading */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 11px/1 var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: lining-nums tabular-nums;
}

.section-title {
  margin-bottom: var(--s-3);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 560;
  font-variation-settings: "SOFT" 30;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.section-title--sm { font-size: 20px; }

.prose {
  font-family: var(--font-text);
  font-size: 18.5px;
  line-height: 1.7;
  color: var(--ink-2);
  text-wrap: pretty;
}

.text-link {
  border: 0;
  background: none;
  padding: 0;
  font: 600 13px var(--font-ui);
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}

/* =====================================================================
   SHARED COMPONENTS
   ===================================================================== */
/* Double bezel: a tinted tray with a raised core inside, radii kept concentric */
.bezel {
  padding: var(--bezel-pad);
  border-radius: var(--r-lg);
  background: var(--bezel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.bezel-core {
  border-radius: calc(var(--r-lg) - var(--bezel-pad));
  background: var(--raised);
  box-shadow: var(--shadow-sm), var(--inner-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font: 600 15px/1 var(--font-ui);
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
}
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 20px -10px var(--accent-line), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-secondary { background: var(--raised); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-danger { color: var(--rubric); }

/* Trailing icon nested in its own orb, flush with the pill's edge */
.btn-orb {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: -13px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-ink) 18%, transparent);
  transition: transform var(--dur-base) var(--ease-spring);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
}
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn.is-active,
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

.text-btn {
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font: 500 16px var(--font-ui);
  color: var(--ink-2);
}
.text-btn--strong { font-weight: 650; color: var(--accent); }

.aa-glyph {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 560;
  font-variation-settings: "SOFT" 50;
  letter-spacing: -0.03em;
  line-height: 1;
}

/* Chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.chip-label { font: 500 14px var(--font-ui); color: var(--ink-3); margin-right: 2px; }
.chip {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--raised);
  color: var(--ink-2);
  font: 500 14px var(--font-ui);
  white-space: nowrap;
}
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.chip-row--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--sheet-pad, 20px));
  padding: 2px var(--sheet-pad, 20px) 2px;
  scroll-padding-inline: var(--sheet-pad, 20px);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--sheet-pad, 20px), #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--sheet-pad, 20px), #000 calc(100% - 36px), transparent);
}
.chip-row--scroll::-webkit-scrollbar { display: none; }

/* Segmented control */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--bezel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font: 600 14px var(--font-ui);
  white-space: nowrap;
}
.segment .count { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.segment[aria-selected="true"],
.segment[aria-checked="true"] {
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line), var(--inner-light);
}

/* Switch */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  cursor: pointer;
}
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-title { font: 500 15.5px/1.35 var(--font-ui); color: var(--ink); }
.switch-sub { font: 400 13.5px/1.4 var(--font-ui); color: var(--ink-3); }

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-out);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
  transition: transform var(--dur-base) var(--ease-spring);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: var(--s-8) var(--s-6);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--raised);
  color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}
.empty-title {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 540;
  font-variation-settings: "SOFT" 30;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.empty-text { font-size: 15.5px; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.empty-state .btn { margin-top: 8px; }

/* =====================================================================
   APP LAYOUT
   ===================================================================== */
.app-shell { min-height: 100dvh; }
.main-col { min-width: 0; }

/* --- Desktop sidebar --- */
.rail { display: none; }

.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 24px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  text-align: left;
}
/* Credit: foot of Home on phones, foot of the sidebar on desktop */
.app-credit {
  margin-top: var(--s-12, 48px);
  padding-top: var(--s-6);
  border-top: 1px solid var(--line);
  font: 500 12.5px var(--font-ui);
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: center;
}
.rail-credit {
  margin-top: auto;
  padding: 16px 10px 2px;
  font: 500 12px var(--font-ui);
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.credit-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; letter-spacing: 0; }
.app-credit .credit-links { justify-content: center; }
.credit-links a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-3); text-underline-offset: 3px; }
.data-policy a, .consent-note a { color: var(--accent); text-underline-offset: 3px; }

.rail-brand img { border-radius: 9px; box-shadow: var(--shadow-sm); }
.wordmark {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  font-variation-settings: "SOFT" 50;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font: 500 15px var(--font-ui);
  text-align: left;
}
.rail-link .icon { color: var(--ink-3); }
.rail-link.is-active {
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line), var(--inner-light);
}
.rail-link.is-active .icon { color: var(--accent); }
.rail-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rail-streak:not(:empty)::before { content: '•'; margin-right: 6px; color: var(--gilt); }
.rail-kbd {
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: 500 11.5px var(--font-ui);
  color: var(--ink-3);
}

.rail-section { margin-top: 32px; }
.rail-heading {
  padding: 0 14px;
  margin-bottom: 6px;
  font: 600 11px var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.passage-link {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  text-align: left;
}
.pl-ref { font: 600 13.5px var(--font-ui); color: var(--ink); }
.pl-title { font-family: var(--font-text); font-style: italic; font-size: 14.5px; color: var(--ink-3); }

/* --- Top island (reader only) --- */
.top-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-bar);
  padding: calc(env(safe-area-inset-top, 0px) + var(--bar-gap)) 12px 0;
  pointer-events: none;
  transition: transform var(--dur-slow) var(--ease-out);
}
body:not([data-view="reader"]) .top-bar { display: none; }

.top-bar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  max-width: 760px;
  height: var(--bar-h);
  margin: 0 auto;
  padding: 0 4px 0 6px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.6) blur(20px);
  backdrop-filter: saturate(1.6) blur(20px);
  box-shadow: var(--shadow-md), inset 0 0 0 1px var(--glass-edge), 0 0 0 1px var(--line);
  pointer-events: auto;
}
.top-lead, .top-actions { display: flex; align-items: center; gap: 0; min-width: 0; }
.top-actions .icon-btn, .top-lead .icon-btn { width: 40px; height: 40px; }

.location-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 580;
  font-variation-settings: "SOFT" 40;
  letter-spacing: -0.015em;
  white-space: nowrap;
  min-width: 0;
}
.location-text { overflow: hidden; text-overflow: ellipsis; }
.location-btn .icon { color: var(--ink-3); }

.offline-pill {
  margin-right: 4px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--gilt-soft);
  font: 600 11.5px var(--font-ui);
  letter-spacing: 0.02em;
  color: var(--ink-2);
}


.read-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(var(--progress, 0));
  opacity: 0.8;
  pointer-events: none;
}

body:not([data-view="reader"]) .reader-only { display: none !important; }

/* --- Views --- */
.view {
  display: none;
  width: 100%;
  max-width: var(--view-max, 760px);
  margin: 0 auto;
  padding: var(--s-4) var(--gutter) calc(var(--tabbar-h) + 88px + env(safe-area-inset-bottom, 0px));
}
.view:not(#view-reader) { padding-top: calc(env(safe-area-inset-top, 0px) + var(--s-6)); }
.view.is-active { display: block; }
html.is-ready .view.is-active { animation: view-in 360ms var(--ease-out) both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

#view-reader {
  --view-max: calc(var(--reader-font-size) * var(--reader-scale) * 34 + var(--gutter) * 2);
}
#view-daily { --view-max: 1080px; }

.view-head { margin: 0 0 var(--s-8); }
.view-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: var(--s-3);
}
.view-head-top .icon-btn { margin-right: -8px; }
.view-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 8vw, 64px);
  font-weight: 520;
  font-variation-settings: "SOFT" 30;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
}

/* =====================================================================
   READER
   ===================================================================== */
.chapter-head { margin: var(--s-8) 0 var(--s-10); }
.chapter-head .eyebrow-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--s-4); }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font: 600 11px/1 var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.chapter-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 7.6vw, 60px);
  font-weight: 520;
  font-variation-settings: "SOFT" 30;
  line-height: 1.02;
  letter-spacing: -0.032em;
  color: var(--ink);
  text-wrap: balance;
}
.chapter-sub {
  margin-top: var(--s-3);
  font-family: var(--font-text);
  font-style: italic;
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink-3);
}
/* Gilt ornament: rule · lozenge · rule */
.chapter-head::after {
  content: '';
  display: block;
  width: 76px;
  height: 12px;
  margin-top: var(--s-8);
  background: var(--gilt);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='76' height='12'%3E%3Cpath d='M0 6h28M48 6h28' stroke='black' stroke-width='1.2'/%3E%3Cpath d='M38 1.5l4.5 4.5-4.5 4.5-4.5-4.5z' fill='black'/%3E%3C/svg%3E") no-repeat left center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='76' height='12'%3E%3Cpath d='M0 6h28M48 6h28' stroke='black' stroke-width='1.2'/%3E%3Cpath d='M38 1.5l4.5 4.5-4.5 4.5-4.5-4.5z' fill='black'/%3E%3C/svg%3E") no-repeat left center / contain;
}

/* Notice between the header and the text (excerpts, loading problems) */
.chapter-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: calc(-1 * var(--s-4)) 0 var(--s-8);
  padding: 12px 14px 12px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
.chapter-notice p { flex: 1 1 220px; }
.chapter-notice strong { color: var(--ink); font-weight: 600; }
.chapter-notice .btn { min-height: 36px; padding: 0 14px; font-size: 14px; }

/* Scripture body */
.scripture {
  font-family: var(--reader-font);
  font-size: calc(var(--reader-font-size) * var(--reader-scale));
  line-height: var(--reader-line-height);
  color: var(--ink);
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
  text-wrap: pretty;
  hyphens: manual;
  outline: none;
}
html.is-ready .scripture.is-entering { animation: text-in 460ms var(--ease-out) both; }
@keyframes text-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.verse { cursor: pointer; border-radius: 3px; }
.verse:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.verse-num {
  position: relative;
  top: -0.72em;
  margin-right: 0.3em;
  font-family: var(--font-ui);
  font-size: 0.52em;
  font-weight: 600;
  line-height: 0;
  letter-spacing: 0.01em;
  color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
  vertical-align: baseline;
  -webkit-user-select: none;
  user-select: none;
}

.verse-ink {
  border-radius: 0.2em;
  padding: 0.04em 0;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-color var(--dur-base) ease, box-shadow var(--dur-base) ease, text-decoration-color var(--dur-base) ease;
  text-decoration: underline dotted transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}
.verse.is-selected .verse-ink { text-decoration-color: var(--accent); }
.verse.hl-gold .verse-ink { background-color: var(--hl-gold); }
.verse.hl-rose .verse-ink { background-color: var(--hl-rose); }
.verse.hl-emerald .verse-ink { background-color: var(--hl-emerald); }
.verse.hl-sky .verse-ink { background-color: var(--hl-sky); }
.verse.hl-amethyst .verse-ink { background-color: var(--hl-amethyst); }
.verse.is-flash .verse-ink { animation: verse-flash 1.8s var(--ease-out); }
@keyframes verse-flash {
  0%, 35% { background-color: var(--hl-gold); box-shadow: 0 0 0 0.14em var(--hl-gold); }
}

.words-of-christ { color: var(--rubric); }
.divine-name { font-variant-caps: small-caps; letter-spacing: 0.03em; }

/* Bookmark ribbon after the verse */
.verse.is-bookmarked .verse-text::after {
  content: '';
  display: inline-block;
  width: 0.46em;
  height: 0.66em;
  margin-left: 0.32em;
  background: var(--gilt);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
  vertical-align: 0.02em;
}

.note-chip {
  display: inline-grid;
  place-items: center;
  width: 1.2em;
  height: 1.2em;
  margin-left: 0.3em;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: 0.08em;
}
.note-chip .icon { width: 0.72em; height: 0.72em; stroke-width: 2; }

/* Prose chapters: printed-Bible drop numeral, set in gilt */
.chapter-drop {
  float: left;
  margin: 0.04em 0.14em 0 -0.03em;
  font-family: var(--font-display);
  font-size: 3.35em;
  font-weight: 480;
  font-variation-settings: "SOFT" 100;
  line-height: 0.84;
  color: var(--gilt);
  font-variant-numeric: lining-nums;
  -webkit-user-select: none;
  user-select: none;
}

/* Poetry chapters: one verse per line group, numbers hang in the margin */
.scripture.is-poetry .verse {
  display: grid;
  grid-template-columns: 1.7em minmax(0, 1fr);
  align-items: baseline;
  margin-bottom: 0.5em;
}
.scripture.is-poetry .verse-num { top: -0.3em; margin-right: 0; }

.verse-gap {
  margin: 0 0.3em;
  font-family: var(--font-ui);
  font-size: 0.8em;
  letter-spacing: 0.25em;
  color: var(--ink-4);
  -webkit-user-select: none;
  user-select: none;
}
.scripture.is-poetry .verse-gap { display: block; margin: 0 0 0.5em 2.1em; }

/* Loading skeleton shaped like the text it replaces */
.reader-skeleton { display: flex; flex-direction: column; gap: 0.95em; padding-top: 0.2em; }
.reader-skeleton span {
  display: block;
  height: 0.62em;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 55%, var(--raised)) 40%, var(--surface) 80%);
  background-size: 260% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
.reader-skeleton span:nth-child(4n + 1) { width: 96%; }
.reader-skeleton span:nth-child(4n + 2) { width: 100%; }
.reader-skeleton span:nth-child(4n + 3) { width: 88%; }
.reader-skeleton span:nth-child(4n) { width: 62%; margin-bottom: 0.8em; }
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -60% 0; }
}

/* Chapter not available */
.chapter-empty {
  padding: var(--s-6);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-ui);
}
.chapter-empty .empty-title { margin-bottom: 8px; }
.chapter-empty .empty-text { margin-bottom: var(--s-4); }
.chapter-empty .btn { margin-bottom: var(--s-4); }

.suggest-list { display: flex; flex-direction: column; gap: 2px; }
.suggest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "ref icon"
    "title icon";
  align-items: center;
  column-gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  text-align: left;
}
.suggest-ref { grid-area: ref; font: 600 12.5px var(--font-ui); color: var(--accent); }
.suggest-title { grid-area: title; font-family: var(--font-text); font-size: 16.5px; line-height: 1.35; color: var(--ink); }
.suggest .icon { grid-area: icon; color: var(--ink-3); }

/* End of chapter */
.chapter-end { height: 1px; }

.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: var(--s-12);
  padding-top: var(--s-8);
  border-top: 1px solid var(--line);
}
.read-mark {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font: 500 14px var(--font-ui);
  color: var(--ink-3);
}
.read-mark .icon { color: var(--gilt); }
.cn-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 80px;
  padding: 15px 18px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  text-align: left;
  min-width: 0;
}
.cn-next { align-items: flex-end; text-align: right; }
.cn-dir { display: inline-flex; align-items: center; gap: 2px; font: 600 11px var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.cn-title { font-family: var(--font-display); font-size: 20px; font-weight: 560; font-variation-settings: "SOFT" 30; letter-spacing: -0.015em; line-height: 1.2; }
.cn-sub {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 13px var(--font-ui);
  color: var(--ink-3);
}
.cn-empty { visibility: hidden; }

/* =====================================================================
   TODAY
   ===================================================================== */
.day-nav { display: flex; align-items: center; gap: 4px; margin-left: -6px; }
.day-nav .eyebrow { margin: 0 4px; }
.day-nav .text-link { margin-left: 8px; }

/* --- Home dashboard --- */
.home-sub {
  margin-top: var(--s-3);
  font-family: var(--font-text);
  font-style: italic;
  font-size: 18px;
  color: var(--ink-3);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-10);
}
.home-verse .today-verse { margin-bottom: var(--s-5); }

/* Quick actions: one wide primary tile, then three small ones */
.home-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.home-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 118px;
  padding: 16px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  text-align: left;
}
.tile-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: auto;
  border-radius: 50%;
  background: var(--raised);
  color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}
.tile-title {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 560;
  font-variation-settings: "SOFT" 30;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.tile-sub { font: 400 13px/1.35 var(--font-ui); color: var(--ink-3); }
.home-tile--primary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon title" "icon sub";
  align-items: center;
  column-gap: 14px;
  min-height: 0;
  padding: 18px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 12px 26px -14px var(--accent-line), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.home-tile--primary .tile-icon {
  grid-area: icon;
  width: 48px;
  height: 48px;
  margin: 0;
  background: color-mix(in srgb, var(--accent-ink) 16%, transparent);
  color: var(--accent-ink);
  box-shadow: none;
}
.home-tile--primary .tile-title { grid-area: title; margin: 0; font-size: 21px; }
.home-tile--primary .tile-sub { grid-area: sub; color: color-mix(in srgb, var(--accent-ink) 78%, transparent); }

/* How are you feeling?: a horizontal shelf of verse cards that bleeds to the screen edge */
.passage-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 72%);
  gap: 10px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter) 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.passage-strip::-webkit-scrollbar { display: none; }
.mood-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 188px;
  padding: 16px 18px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  scroll-snap-align: start;
}
.mood-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 560;
  font-variation-settings: "SOFT" 30;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}
.mood-te { font-family: var(--font-text); font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }
.mood-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 10px 0 14px;
  font-family: var(--font-text);
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.mood-text:lang(te) { font-style: normal; font-size: 14.5px; line-height: 1.7; }
.mood-ref { margin-top: auto; font: 600 11px var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.mood-ref:lang(te) { letter-spacing: 0; font-size: 12.5px; }

.home-col { display: flex; flex-direction: column; gap: var(--s-10); min-width: 0; }
.home-reflect { padding-top: var(--s-8); border-top: 1px solid var(--line); }
.reflect-block + .reflect-block { margin-top: var(--s-8); }

@media (min-width: 640px) {
  .passage-strip { grid-auto-columns: minmax(240px, 32%); }
}

@media (min-width: 1100px) {
  .passage-strip { grid-auto-columns: minmax(230px, 24%); margin: 0; padding: 2px 0 6px; }
}

.continue-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
  padding: 18px 18px 16px 20px;
}
.continue-label { font: 600 11px var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.continue-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 560;
  font-variation-settings: "SOFT" 30;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.continue-sub { font-family: var(--font-text); font-style: italic; font-size: 15.5px; color: var(--ink-3); }
.continue-card .btn { grid-column: 2; grid-row: 1 / span 3; width: 52px; height: 52px; min-height: 0; padding: 0; }
.continue-stats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font: 500 13.5px var(--font-ui);
  color: var(--ink-2);
}
.continue-stats span { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.continue-stats .icon { color: var(--gilt); }

/* The day's theme sits above the verse as a small gilt eyebrow */
.today-theme {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--s-4);
  color: var(--accent);
  font: 600 11px/1 var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.today-theme::after { content: ''; flex: 0 1 48px; height: 1px; background: var(--gilt); }

.today-verse { margin-bottom: var(--s-6); }
.today-verse p {
  margin-bottom: var(--s-4);
  font-family: var(--font-display);
  font-size: clamp(26px, 4.6vw, 36px);
  font-style: italic;
  font-weight: 400;
  font-variation-settings: "SOFT" 60;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-indent: -0.42em;
  text-wrap: pretty;
}
.today-verse cite {
  display: inline-flex;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  background: var(--gilt-soft);
  color: var(--ink-2);
  font: 600 11px/1 var(--font-ui);
  font-style: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.today-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.today-actions .btn-quiet { padding: 0 14px; }

.today-section { margin-top: var(--s-10); padding-top: var(--s-8); border-top: 1px solid var(--line); }
.prayer { padding-left: var(--s-4); border-left: 2px solid var(--gilt); font-style: italic; color: var(--ink); }

.plan-list { display: grid; gap: var(--s-4); }
.plan-core { padding: 20px 20px 10px; }
.plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plan-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 560;
  font-variation-settings: "SOFT" 30;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.plan-count { font: 600 12.5px var(--font-ui); color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-progress { height: 5px; margin: 12px 0 12px; border-radius: 5px; background: var(--line); overflow: hidden; }
.plan-progress span { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--gilt))); transition: width var(--dur-slow) var(--ease-out); }
.plan-desc { margin-bottom: 8px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }

.plan-days li { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); }
.plan-check {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
}
.plan-check::before {
  content: '';
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  transition: background-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.plan-check .icon { grid-area: 1 / 1; position: relative; transition: color var(--dur-base) ease; }
.plan-day.is-done .plan-check { color: var(--accent-ink); }
.plan-day.is-done .plan-check::before { background: var(--accent); box-shadow: none; }
.plan-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "day ref"
    "title title";
  align-items: baseline;
  gap: 1px 10px;
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 9px 6px 9px 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.pd-day { grid-area: day; font: 600 11px var(--font-ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pd-title { grid-area: title; font-family: var(--font-text); font-size: 16.5px; line-height: 1.3; color: var(--ink); }
.pd-ref { grid-area: ref; font: 500 12px var(--font-ui); color: var(--ink-3); white-space: nowrap; }
.plan-day.is-done .pd-title { color: var(--ink-3); }
.plan-day.is-next .pd-day { color: var(--accent); }

/* =====================================================================
   SEARCH
   ===================================================================== */
.search-box { position: relative; display: flex; align-items: center; margin-bottom: var(--s-4); }
.search-input {
  width: 100%;
  height: 56px;
  padding: 0 54px 0 50px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--raised);
  color: var(--ink);
  font: 400 17px var(--font-ui);
  box-shadow: var(--shadow-sm), var(--inner-light);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.search-input::placeholder { color: var(--ink-3); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-icon { position: absolute; left: 18px; color: var(--ink-3); pointer-events: none; }
.search-clear { position: absolute; right: 6px; }

#view-search .chip-row { margin-bottom: var(--s-8); }

.result-group + .result-group { margin-top: var(--s-8); }
.result-group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font: 600 11px var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.result-group-title span { font-weight: 500; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

.result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 15px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.result-ref { font: 600 13px var(--font-ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.result-text { font-family: var(--font-text); font-size: 17.5px; line-height: 1.55; color: var(--ink-2); }
.result-title { font-family: var(--font-display); font-size: 20px; font-weight: 540; font-variation-settings: "SOFT" 30; color: var(--ink); }
.result mark { padding: 0 0.08em; border-radius: 3px; background: var(--hl-gold); color: var(--ink); }

.goto-result {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-bottom: var(--s-6);
  padding: 14px 16px 14px 22px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  text-align: left;
  box-shadow: 0 10px 24px -12px var(--accent-line), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.goto-result .goto-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.goto-label { font: 600 11px var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.8; }
.goto-ref { font-family: var(--font-display); font-size: 23px; font-weight: 560; font-variation-settings: "SOFT" 30; line-height: 1.2; }
.goto-result .btn-orb { width: 40px; height: 40px; margin-right: 0; }

.search-empty { margin-bottom: var(--s-8); }
.search-empty .empty-title { margin-bottom: 6px; }

.offline-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); column-gap: var(--s-6); }
.offline-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.oi-ref { min-width: 8.2em; font: 600 13px var(--font-ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.oi-title { font-family: var(--font-text); font-size: 16.5px; color: var(--ink); }

/* =====================================================================
   LIBRARY
   ===================================================================== */
#library-tabs { margin-bottom: var(--s-4); }

.color-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--s-4); }
.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--raised);
  color: var(--ink-2);
  font: 500 13.5px var(--font-ui);
}
.color-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.hl-dot { display: inline-block; flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--dot, var(--ink-4)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.hl-dot-gold { --dot: var(--sw-gold); }
.hl-dot-rose { --dot: var(--sw-rose); }
.hl-dot-emerald { --dot: var(--sw-emerald); }
.hl-dot-sky { --dot: var(--sw-sky); }
.hl-dot-amethyst { --dot: var(--sw-amethyst); }

.lib-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.lib-open {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 16px 0;
  border: 0;
  background: transparent;
  text-align: left;
  min-width: 0;
}
.lib-ref {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 13.5px var(--font-ui);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lib-date { font-weight: 500; color: var(--ink-3); }
.lib-date::before { content: '·'; margin-right: 8px; }
.lib-text, .lib-note {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  font-family: var(--font-text);
  font-size: 17.5px;
  line-height: 1.55;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.lib-note { color: var(--ink); white-space: pre-line; }
.lib-quote {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  padding-left: 12px;
  border-left: 2px solid var(--gilt);
  font-family: var(--font-text);
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-3);
}
.lib-remove { margin-top: 8px; color: var(--ink-3); }

.lib-backup { margin-top: var(--s-12); padding-top: var(--s-8); border-top: 1px solid var(--line); }
.lib-backup-text { max-width: 54ch; margin-bottom: var(--s-4); font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.lib-backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-backup-actions label.btn { cursor: pointer; }

/* =====================================================================
   SHEET CONTENT
   ===================================================================== */
/* Picker */
.picker-pane { display: none; }
.picker-pane.is-active { display: block; }
html.is-ready .picker-pane.is-active { animation: pane-forward 260ms var(--ease-out) both; }
html.is-ready [data-dir="back"] .picker-pane.is-active { animation-name: pane-back; }
@keyframes pane-forward { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes pane-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

/* Filters stay reachable while the book list scrolls */
.picker-filters {
  position: sticky;
  top: -6px;
  z-index: 1;
  margin: -6px 0 var(--s-3);
  padding: 8px 0 10px;
  background: var(--raised);
}

.book-group + .book-group { margin-top: var(--s-6); }
.book-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font: 600 11px var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.book-group-title span { font-weight: 500; letter-spacing: 0.02em; text-transform: none; font-size: 12px; color: var(--ink-3); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.book-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 62px;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
}
.book-name { font-family: var(--font-display); font-size: 17px; font-weight: 540; font-variation-settings: "SOFT" 30; letter-spacing: -0.01em; line-height: 1.25; color: var(--ink); }
.book-meta { display: flex; align-items: center; gap: 6px; font: 500 12px var(--font-ui); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.book-read { color: var(--accent); font-weight: 600; }
.book-read::before { content: '·'; margin-right: 6px; color: var(--ink-4); font-weight: 400; }
.book-btn.is-current { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.book-btn.is-current .book-name { color: var(--accent); }

.dot, .legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.picker-legend { display: flex; gap: 16px; margin-bottom: var(--s-4); font: 500 13px var(--font-ui); color: var(--ink-3); }
.picker-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot.is-read { width: 12px; height: 3px; border-radius: 2px; background: var(--gilt); }

.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.ch-btn {
  position: relative;
  height: 52px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font: 500 16px var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.ch-btn.is-read::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 14px;
  height: 3px;
  margin-left: -7px;
  border-radius: 2px;
  background: var(--gilt);
}
.ch-btn.is-current { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 18px -10px var(--accent-line); }
.ch-btn.is-current::before, .ch-btn.is-current::after { background: var(--accent-ink); }

/* Settings */
.setting + .setting { margin-top: var(--s-6); }
.setting-label { margin-bottom: 10px; font: 600 11px var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.setting-label--flush { margin-bottom: 2px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-row .setting-label { margin-bottom: 10px; }
.setting-value { margin-bottom: 10px; font: 600 13.5px var(--font-ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.setting-note { margin-top: 8px; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }
.setting--toggles { padding: 2px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.setting--storage .setting-note { margin-top: 0; }
.setting--storage .setting-row { align-items: center; }
#settings-install { margin-top: var(--s-6); }

.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  font: 500 12.5px var(--font-ui);
  color: var(--ink-2);
}
.theme-swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.35 / 1;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 560;
  font-variation-settings: "SOFT" 50;
  letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  transition: box-shadow var(--dur-fast) ease;
}
/* Each swatch shows its paper, ink and accent */
.theme-swatch::after {
  content: '';
  position: absolute;
  right: 9px;
  bottom: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--swatch-accent);
}
.swatch-auto { background: linear-gradient(135deg, #FBFAF7 50%, #0C1020 50%); color: #8C6A1F; --swatch-accent: #3343B0; }
.swatch-parchment { background: #FBFAF7; color: #151A30; --swatch-accent: #3343B0; }
.swatch-sepia { background: #F5EEE1; color: #2A2119; --swatch-accent: #1C6168; }
.swatch-cathedral { background: #0C1020; color: #EDEFF7; --swatch-accent: #E9C46F; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.theme-btn[aria-checked="true"] { color: var(--ink); font-weight: 650; }
.theme-btn[aria-checked="true"] .theme-swatch { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--accent); }

.font-sample { font-size: 16px; font-weight: 500; }
.sample-text { font-family: var(--font-text); }

.size-control { display: flex; align-items: center; gap: 4px; }
.size-control input[type="range"] { flex: 1; height: 28px; margin: 0 4px; accent-color: var(--accent); cursor: pointer; }
.size-a { font-family: var(--font-display); line-height: 1; color: var(--ink); }
.size-a--sm { font-size: 15px; }
.size-a--lg { font-size: 25px; }

.type-preview {
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--reader-font);
  font-size: calc(var(--reader-font-size) * var(--reader-scale));
  line-height: var(--reader-line-height);
  color: var(--ink);
}

/* Note */
.note-ref { margin-bottom: 10px; font: 600 11px var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.note-verse {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  margin-bottom: var(--s-4);
  padding-left: 14px;
  border-left: 2px solid var(--gilt);
  font-family: var(--font-text);
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.note-input {
  display: block;
  width: 100%;
  min-height: 168px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font: 400 17.5px/1.6 var(--font-text);
  resize: vertical;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.note-input::placeholder { color: var(--ink-3); font-style: italic; }
.note-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-top: 8px; }
.note-hint { font-size: 12.5px; color: var(--ink-3); }
@media not all and (hover: hover) and (pointer: fine) {
  .note-hint { visibility: hidden; }
}

/* Share card */
.vc-shell { border-radius: calc(var(--r-lg) + var(--bezel-pad)); }
.verse-card {
  --vc-bg: radial-gradient(130% 90% at 15% 0%, #1E2858 0%, #0B1026 64%);
  --vc-ink: #EEF0FA;
  --vc-accent: #E9C46F;
  --vc-muted: rgba(238, 240, 250, 0.5);
  position: relative;
  overflow: hidden;
  padding: 38px 30px 26px;
  border-radius: var(--r-lg);
  background: var(--vc-bg);
  color: var(--vc-ink);
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(233, 196, 111, 0.3);
}
.verse-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--grain-light);
  background-size: 180px;
  opacity: 0.05;
}
.verse-card[data-style="paper"] {
  --vc-bg: radial-gradient(130% 90% at 15% 0%, #FFFFFF 0%, #F1EFE8 72%);
  --vc-ink: #151A30;
  --vc-accent: #3343B0;
  --vc-muted: rgba(21, 26, 48, 0.45);
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(51, 67, 176, 0.18);
}
.verse-card[data-style="paper"]::before { background-image: var(--grain-dark); opacity: 0.05; }
.verse-card[data-style="olive"] {
  --vc-bg: radial-gradient(130% 90% at 15% 0%, #4B5A33 0%, #263019 70%);
  --vc-ink: #F3F1E3;
  --vc-accent: #E6CD8C;
  --vc-muted: rgba(243, 241, 227, 0.55);
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(230, 205, 140, 0.3);
}
.vc-mark { width: 22px; height: 22px; margin-bottom: 18px; fill: none; stroke: var(--vc-accent); stroke-width: 1.6; stroke-linecap: round; }
.vc-text {
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: 24px;
  font-style: italic;
  font-weight: 400;
  font-variation-settings: "SOFT" 60;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
.vc-ref { font: 600 11.5px var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--vc-accent); }
.vc-sign {
  position: absolute;
  right: 22px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.vc-credit { font: 500 10.5px var(--font-ui); letter-spacing: 0.04em; color: var(--vc-muted); opacity: 0.85; }
.vc-brand {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 560;
  font-variation-settings: "SOFT" 50;
  color: var(--vc-muted);
}

.card-styles { display: flex; justify-content: center; gap: 6px; margin: var(--s-4) 0; }
.card-style {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font: 500 13.5px var(--font-ui);
}
.card-style[aria-checked="true"] { border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.cs-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.cs-night { background: #131A3C; }
.cs-paper { background: #F6F4EE; }
.cs-olive { background: #3A4728; }

.sheet-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.sheet-actions .btn { padding: 0 12px; }

/* Memorize */
.memorize-text {
  margin-bottom: var(--s-6);
  font-family: var(--reader-font);
  font-size: calc(22px * var(--reader-scale));
  line-height: 1.75;
  color: var(--ink);
}
/* A blank keeps the word's width and first letter, so length and sound still cue recall */
.mem-blank {
  display: inline;
  padding: 0;
  border: 0;
  border-bottom: 2px solid var(--accent-line);
  border-radius: 0;
  background: transparent;
  color: transparent;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
  transition: color var(--dur-base) ease, border-color var(--dur-base) ease;
}
.mem-blank .mem-first { color: var(--accent); }
.mem-blank.is-revealed { color: var(--accent); border-bottom-color: transparent; }
.memorize-levels .segmented { margin-top: 2px; }

/* Permission to save */
.consent-lead { font: 400 16px/1.55 var(--font-ui); color: var(--ink-2); }
.consent-points { list-style: none; margin: var(--s-5) 0; padding: 0; display: grid; gap: 10px; }
.consent-points li { display: flex; gap: 10px; align-items: flex-start; font: 400 14.5px/1.5 var(--font-ui); color: var(--ink-2); }
.consent-points .icon { flex-shrink: 0; margin-top: 3px; color: var(--accent); }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.consent-note { margin-top: var(--s-4); font: 400 13px/1.5 var(--font-ui); color: var(--ink-3); text-align: center; }
.data-actions { display: flex; gap: 6px; flex-shrink: 0; }
.data-policy { margin-top: var(--s-3); }

/* Related verses sheet */
.xref-source {
  margin: 4px 0 var(--s-5);
  padding: 14px 16px;
  border-radius: var(--r-md, 14px);
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--gilt);
}
.xref-source-ref { font: 600 11px var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.xref-source-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin-top: 6px;
  font-family: var(--font-text);
  font-size: 16px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink);
}
.xref-source-text:lang(te) { font-style: normal; line-height: 1.75; }
.xref-summary, .xref-status, .xref-note { font: 400 14px/1.5 var(--font-ui); color: var(--ink-3); }
.xref-status { padding: var(--s-6) 0; text-align: center; }
.xref-note { margin-top: var(--s-3); }
.xref-filters { margin-top: var(--s-4); scroll-margin-top: 8px; gap: 6px; }
.xref-filters .chip { height: 34px; padding: 0 12px; font-size: 13.5px; }
.chip-count { margin-left: 7px; font-variant-numeric: tabular-nums; opacity: 0.7; }
.xref-group { margin-top: var(--s-6); }
.xref-book {
  position: sticky;
  top: -6px;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 560;
  font-variation-settings: "SOFT" 30;
  color: var(--ink);
}
.xref-book span { font: 500 12.5px var(--font-ui); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.xref-list { list-style: none; margin: 0; padding: 0; }
.xref-list li + li { border-top: 1px solid var(--line); }
.xref-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}
.xref-item:active { background: var(--surface); }
.xref-ref { font: 600 13.5px var(--font-ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.xref-text { font-family: var(--font-text); font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.xref-text:lang(te) { font-size: 15.5px; line-height: 1.8; }
.xref-text sup { margin-right: 2px; font: 600 10px var(--font-ui); color: var(--ink-3); }
.xref-skel {
  display: block;
  height: 0.6em;
  margin: 0.45em 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 55%, var(--raised)) 40%, var(--surface) 80%);
  background-size: 260% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
.xref-skel + .xref-skel { width: 64%; }
.xref-missing { font: 400 14px var(--font-ui); color: var(--ink-3); }

/* =====================================================================
   RESPONSIVE LAYOUT
   ===================================================================== */
@media (min-width: 560px) {
  .theme-swatch { aspect-ratio: 1 / 1.1; }
}

@media (min-width: 640px) {
  .chapter-nav { gap: 12px; }
}

@media (min-width: 1024px) {
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: var(--z-rail);
    display: flex;
    flex-direction: column;
    width: var(--rail-w);
    padding: 18px 14px 16px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
  }
  .main-col { margin-left: var(--rail-w); }
  .app-credit { display: none; }
  .top-bar { padding-top: 14px; }
  .view { padding-bottom: 120px; }
  .view:not(#view-reader) { padding-top: var(--s-10); }
}

@media (min-width: 1100px) {
  .home-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas:
      "verse continue"
      "verse tiles"
      "passages passages"
      "side plans";
    /* Only one flexible row: extra height from the tall verse column goes below the tiles */
    grid-template-rows: auto 1fr auto auto;
    column-gap: var(--s-12);
    row-gap: var(--s-8);
    align-items: start;
  }
  .home-verse { grid-area: verse; }
  .today-continue { grid-area: continue; }
  .home-tiles { grid-area: tiles; }
  .home-col { grid-area: side; }
  .home-passages { grid-area: passages; }
  .today-plans { grid-area: plans; }
}

@media (max-width: 767px) {
  .chapter-head { margin-top: var(--s-6); }
  .sheet-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 559px) {
  .hide-xs { display: none !important; }
  .chapter-sub { font-size: 17.5px; }
  .cn-title { font-size: 18px; }
}

/* =====================================================================
   TELUGU & PARALLEL READING
   ===================================================================== */
/* Telugu letters stack vowel signs above and below, so give lines more room and never fake italics */
.scripture:lang(te) { line-height: calc(var(--reader-line-height) + 0.12); }
:lang(te) { font-synthesis: none; }
.today-verse p:lang(te),
.vc-text:lang(te),
.memorize-text:lang(te) { font-style: normal; letter-spacing: 0; text-indent: 0; }
.chapter-title, .location-btn, .book-name, .cn-title, .continue-title { overflow-wrap: anywhere; }

/* Parallel: one verse per block, the second language set smaller beneath */
.scripture.is-parallel .verse {
  display: grid;
  grid-template-columns: 1.7em minmax(0, 1fr);
  align-items: baseline;
  margin-bottom: 0.95em;
}
.scripture.is-parallel .verse-num { top: -0.3em; margin-right: 0; }
.scripture.is-parallel .verse-gap { display: block; margin: 0 0 0.9em 2.1em; }
.verse-alt {
  display: block;
  margin-top: 0.3em;
  padding-left: 0.75em;
  border-left: 2px solid var(--accent-line);
  font-size: 0.84em;
  line-height: 1.6;
  color: var(--ink-2);
}
.verse-alt:lang(te) { line-height: 1.75; }

#translation-options .segment { padding: 0 6px; }

.setting--storage .setting-row + .setting-row { margin-top: 16px; }

.search-scope-note { margin: 0 0 var(--s-6); }
.search-status { margin: 0 0 var(--s-4); font-size: 14px; color: var(--ink-3); }

/* Bilingual book cards: the second language sits quietly under the first */
.book-alt { font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.book-alt:lang(te) { font-family: var(--font-text); }
.tag-te { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
