/* === BIBLE.ngo reader components === */

:root {
  --reader-scale: 1;
  --hl-gold: rgba(255, 215, 0, .42);
  --hl-red: rgba(255, 82, 82, .35);
  --hl-green: rgba(76, 175, 80, .35);
  --hl-blue: rgba(66, 165, 245, .35);
  --hl-purple: rgba(171, 71, 188, .33);
  --sheet-bg: #fbfbfb;
  --sheet-fg: #111;
  --line: rgba(128, 128, 128, .28);
  --chip: rgba(128, 128, 128, .12);
  --select: rgba(128, 128, 128, .16);
  --vnum: #c80000;
}

:root[data-mode="dark"] {
  --sheet-bg: #1b1b1b;
  --sheet-fg: #f0f0f0;
  --hl-gold: rgba(255, 215, 0, .30);
  --chip: rgba(255, 255, 255, .08);
  --select: rgba(255, 255, 255, .09);
  --vnum: var(--red);
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
[hidden] { display: none !important; }

.visuallyHidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skipLink { position: absolute; left: -999px; top: 0; }
.skipLink:focus { left: 10px; z-index: 50; padding: 8px 12px; background: var(--sheet-bg); color: var(--red); border-radius: 8px; }

/* ---------- Reader bar ---------- */
.readerBar {
  flex: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto 6px;
  padding: 0 10px;
  max-width: 500px;
  height: 42px;
}

.barBtn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  width: 40px; height: 40px; padding: 0;
  color: var(--red);
  border-radius: 12px;
}
.chev { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.barBtn:hover:not(:disabled), .refBtn:hover, .transBtn:hover { background: var(--chip); }

.refBtn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px;
  font-weight: var(--fw7);
  font-size: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.refBtn .caret { color: var(--red); font-size: 12px; }

.transBtn {
  height: 40px; padding: 0 12px;
  font-weight: var(--fw7);
  font-size: 13px;
  letter-spacing: .5px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* ---------- Verses ---------- */
.CHAPTERVERSES { font-size: calc(16px * var(--reader-scale)); }

.verse {
  margin: 0 -8px;
  padding: 6px 8px !important;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.verse:focus-visible { outline: 2px solid var(--red); }

.vnum {
  color: var(--vnum);
  font-weight: var(--fw7);
  font-size: .78em;
  vertical-align: .12em;
  margin-right: 2px;
}

.verse.hl-gold { background: var(--hl-gold); }
.verse.hl-red { background: var(--hl-red); }
.verse.hl-green { background: var(--hl-green); }
.verse.hl-blue { background: var(--hl-blue); }
.verse.hl-purple { background: var(--hl-purple); }

.verse.hl .vnum { color: inherit; opacity: .7; }

/* Selected (not yet highlighted) verses: a soft tint plus a dotted underline, like popular Bible apps. */
.verse.selected:not(.hl) { background: var(--select); }
.verse.selected .vtext {
  text-decoration: underline dotted;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.verse.flash { animation: flash 1.6s ease; }
@keyframes flash {
  0%, 30% { background-color: rgba(255, 215, 0, .55); }
  100% { background-color: transparent; }
}

.chapterEnd {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 24px 0 0;
}

.chapterEndBtn {
  width: 44px; height: 44px;
  border: 1px solid var(--line);
}
.chapterEndBtn:disabled { visibility: hidden; }
.menuPraise { margin: 18px 0 4px; }
.menuPraise h5 { padding: 6px 0; font-size: 26px; }

/* ---------- Verse actions ---------- */
.verseActions {
  position: absolute;
  left: 18px; right: 18px; bottom: 14px;
  z-index: 20;
  padding: 12px 14px;
  color: var(--sheet-fg);
  background: var(--sheet-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.vaTop { display: flex; align-items: center; justify-content: space-between; }
.vaRef { font-weight: var(--fw7); }
.vaClose { font-size: 26px; line-height: 1; padding: 0 6px; }

.vaColors { display: flex; gap: 12px; padding: 12px 0; }

.swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line);
}
.swatch.hl-gold { background: gold; }
.swatch.hl-red { background: #ff6b6b; }
.swatch.hl-green { background: #66bb6a; }
.swatch.hl-blue { background: #42a5f5; }
.swatch.hl-purple { background: #ab47bc; }
.swatch:hover, .swatch:focus-visible { transform: scale(1.12); }

.vaButtons { display: flex; flex-wrap: wrap; gap: 8px; }
.vaButtons button {
  padding: 8px 12px;
  background: var(--chip);
  border-radius: 10px;
  font-weight: var(--fw6);
}

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 20px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 10px 16px;
  max-width: 90%;
  color: var(--sheet-fg);
  background: var(--sheet-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  text-align: center;
}
.toast:not([hidden]) { display: flex; align-items: center; gap: 12px; }
.toastAction { color: var(--red); font-weight: var(--fw7); padding: 4px 2px; white-space: nowrap; }

/* ---------- Sheets ---------- */
.scrim {
  position: fixed; inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(2px);
}

.sheet {
  position: fixed;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  z-index: 41;
  display: flex; flex-direction: column;
  width: min(560px, 100%);
  max-height: 86dvh;
  color: var(--sheet-fg);
  background: var(--sheet-bg);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
  animation: rise .18s ease-out;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheetSmall { max-height: 70dvh; }

@keyframes rise { from { transform: translate(-50%, 30px); opacity: .6; } to { transform: translate(-50%, 0); opacity: 1; } }

@media (min-width: 700px) {
  .sheet { bottom: auto; top: 8dvh; border-radius: 20px; }
}

.sheetHead {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.sheetHead h2 { font-size: 18px; font-weight: var(--fw7); }

.sheetClose { font-size: 28px; line-height: 1; padding: 0 6px; }

.sheetBody { overflow-y: auto; padding: 14px 16px 22px; }
.sheetBody p { line-height: 1.55; margin: 0 0 10px; }

.tabs { display: flex; gap: 6px; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: var(--fw6);
}
.tab[aria-selected="true"] { color: #fff; background: var(--red); }

.groupTitle {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: var(--fw7);
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: .7;
}

.field {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--sheet-fg);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.field:focus { outline: 2px solid var(--red); }
.stickyTop {
  position: sticky; top: -14px; z-index: 2;
  margin: -14px 0 0; padding: 14px 0 6px;
  background: var(--sheet-bg);
}
.fieldSmall { width: auto; flex: 1; }

.bookGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.bookBtn {
  padding: 10px 8px;
  text-align: left;
  background: var(--chip);
  border-radius: 10px;
}

.numGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.numBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  aspect-ratio: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw6);
  background: var(--chip);
  border-radius: 10px;
}

.bookBtn:hover, .numBtn:hover { color: var(--red); }
.bookBtn.current, .numBtn.current { color: #fff; background: var(--red); }

.optionList { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.optionList button {
  padding: 12px;
  text-align: left;
  background: var(--chip);
  border-radius: 12px;
}
.optionList button b { color: var(--red); margin-right: 6px; }
.optionList button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--red); }

.primaryBtn, .secondaryBtn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 16px;
  font-weight: var(--fw7);
  border-radius: 12px;
}
.primaryBtn { color: #fff; background: var(--red); }
.primaryBtn:disabled, .secondaryBtn:disabled { color: inherit; background: var(--chip); border: 1px dashed var(--line); opacity: .6; }
.field:disabled { opacity: .6; }
.badge {
  display: inline-block; vertical-align: middle;
  margin-left: 8px; padding: 2px 8px;
  font-size: 11px; font-weight: var(--fw7); letter-spacing: .4px; text-transform: uppercase;
  color: var(--red); border: 1px solid var(--red); border-radius: 999px;
}
.secondaryBtn { background: var(--chip); border: 1px solid var(--line); }
.fileBtn { cursor: pointer; }

.searchForm { display: flex; flex-direction: column; gap: 8px; }
.searchRow { display: flex; gap: 8px; }

.muted { opacity: .7; font-size: .92em; }

.results { list-style: none; margin: 8px 0 0; padding: 0; }
.results li { margin: 0 0 6px; }
.resultBtn {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: var(--chip);
  border-radius: 12px;
}
.resultBtn strong { color: var(--red); }
.resultText { flex-basis: 100%; line-height: 1.5; }
.resultText mark { background: var(--hl-gold); color: inherit; border-radius: 3px; }

.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.hl-gold { background: gold; }
.dot.hl-red { background: #ff6b6b; }
.dot.hl-green { background: #66bb6a; }
.dot.hl-blue { background: #42a5f5; }
.dot.hl-purple { background: #ab47bc; }

.rowBtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.loginForm { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.loginForm label { font-weight: var(--fw6); }
.divider { display: flex; align-items: center; gap: 10px; opacity: .6; font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.settingRow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
}
.stepper { display: flex; gap: 6px; }
.stepper button, .modeBtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  font-weight: var(--fw7);
  background: var(--chip);
  border-radius: 10px;
}
.modeBtn img { width: 20px; height: 20px; }
.modeSwitch { display: inline-flex; padding: 3px; gap: 2px; background: var(--chip); border-radius: 12px; }
.modeSwitch span { padding: 6px 12px; border-radius: 9px; font-weight: var(--fw7); opacity: .65; }
:root[data-mode="light"] .modeSwitch [data-opt="light"],
:root[data-mode="dark"] .modeSwitch [data-opt="dark"] { color: #fff; background: var(--red); opacity: 1; }

.info { font-size: .95em; }

body.sheetOpen { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .verse.flash { animation: none; }
}
