/* 4K centered columns for bible-chapter */
@media (min-width: 3000px) {
  .bp-app {
    /* Example ultra-wide rules, adjust as needed */
    font-size: 1.18em;
  }
  .bp-header__jump {
    left: clamp(42rem, 30vw, 64rem) !important;
  }
  .bp-header__info {
    display: none !important;
  }
  .bp-header__right {
    gap: 1.35em;
  }
  .bp-header__explorer-link,
  .bp-header__peruser-link {
    font-size: 0.9em;
  }
  .bible-chapter {
    columns: 4;
    column-gap: 3rem;
  }
  .bible-chapter.center-1 {
    columns: 1;
    column-gap: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    font-size: calc(1.3em * var(--bp-font-scale, 1));
  }
  .bible-chapter.center-2 {
    columns: 2;
    column-gap: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    font-size: calc(1.2em * var(--bp-font-scale, 1));
  }
  .bible-chapter.center-3 {
    columns: 3;
    column-gap: 3rem;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
    font-size: calc(1.1em * var(--bp-font-scale, 1));
  }

  .bible-chapter.center-4 {
    columns: 4;
    column-gap: 3rem;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
  }
  .bp-header__info {
    display: none !important;
  }
  .bp-book-scrollbar-container {
    height: 6em;
  }
  .bp-book-scrollbar {
    scrollbar-width: large;
  }
  .bp-book-scrollbar::-webkit-scrollbar {
    height: 12px;
  }
  /* Font size classes for 4K chapters */
  .bible-chapter {
    font-size: calc(1em * var(--bp-font-scale, 1));
  }
  .bible-chapter.font-4k-psalms-119 {
    font-size: calc(1.2em * var(--bp-font-scale, 1)) !important;
  }
}
/* HD screens (width 900px - 2999px) */
@media (min-width: 900px) and (max-width: 2999px) {
  .bp-app {
    /* Example HD rules, adjust as needed */
    font-size: 1.08em;
  }
  .bp-header__right {
    gap: 0.95em;
  }
  .bible-chapter {
    columns: 2;
    column-gap: 3rem;
    font-size: calc(1em * var(--bp-font-scale, 1));
  }
  .bible-chapter.hd-center-3 {
    columns: 3;
    column-gap: 3rem;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
  .bible-chapter.hd-center-2 {
    columns: 2;
    column-gap: 3rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
  }
  .bible-chapter.hd-center-3-psalms-119 {
    columns: 3;
    column-gap: 2rem;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Font size classes for HD chapters */
  .bible-chapter.font-xsmall {
    font-size: calc(0.82em * var(--bp-font-scale, 1)) !important;
  }
  .bible-chapter.font-msmall {
    font-size: calc(0.64em * var(--bp-font-scale, 1)) !important;
  }
  .bible-chapter.font-small {
    font-size: calc(0.92em * var(--bp-font-scale, 1)) !important;
  }
  .bible-chapter.font-psalms-119 {
    font-size: calc(0.49em * var(--bp-font-scale, 1)) !important;
  }
}

/* Chapter header row with font-size slider */
.bp-chapter-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  padding: 0 0 0.25em;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-main);
}
.bp-chapter-header h2 {
  grid-column: 2;
  margin: 0.2em 0;
  text-align: center;
}
.bp-font-controls {
  display: flex;
  align-items: center;
  gap: 0.5em;
  justify-content: flex-end;
}
.bp-font-slider {
  width: 7em;
  cursor: pointer;
  accent-color: var(--accent);
}
.bp-font-label-sm {
  font-size: 0.72em;
  color: var(--text-secondary);
}
.bp-font-label-lg {
  font-size: 1.1em;
  color: var(--text-secondary);
}
.bp-font-reset {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1em;
  padding: 0 0.35em;
  line-height: 1;
  transform: scale(1.6);
}
.bp-font-reset:hover {
  color: var(--accent);
}
.bp-font-overview {
  background: none;
  border: 1px solid var(--text-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75em;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  line-height: 1.3;
  white-space: nowrap;
}
.bp-font-overview:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.bp-font-overview.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.bp-font-slider:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.bible-book.bible-book--dense.bp-overview-active {
  columns: 5 !important;
}
.bible-book.bible-book--dense.book-psa.bp-overview-active {
  columns: 6 !important;
}
@media (min-width: 3000px) {
  .bible-book.bible-book--dense.bp-overview-active {
    columns: 6 !important;
  }
  .bible-book.bible-book--dense.book-psa.bp-overview-active {
    columns: 7 !important;
  }
}

/* style.css - Prototrope dark mode layout */
:root {
  --bg-main: #181a1b;
  --bg-header: #23272a;
  --bg-footer: #23272a;
  --bg-sidebar: #202225;
  --text-main: #f5f6fa;
  --text-secondary: #b9bbbe;
  --accent: #2a6e5c;
  --accent-light: #a3e0cf; /* light seafoam — link/text color paired with --accent */
  --accent-vivid: #17a589; /* saturated emerald — high-contrast highlight blocks */
  --verse-highlight: #176d5a; /* between the too-dark original (#17392f) and --accent-vivid (#17a589), leaning toward the darker side */
  --search-highlight: #ffe923;
  --emphasis-highlight: #26ff7b; /* starting value ported from Bible Peruser — swap freely, this is the one place to tune it */
  --sidebar-width: 14em; /* 224px at 16px base */
  --sidebar-double-width: 28em; /* 448px at 16px base */
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: "Segoe UI", Arial, sans-serif;
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Entire Book mode: maximize reading area; show both sidebars, hide footer/scrollbar.
   Keep .bp-header visible so the brand logo and the book/chapter jump field
   (.bp-header__jump) stay usable — only the chapter-relative nav controls,
   which don't apply when the whole book is on screen, are hidden below. */
.bp-app.bp-entire-book-mode .bp-book-scrollbar-container,
.bp-app.bp-entire-book-mode .bp-footer,
.bp-app.bp-entire-book-mode .bp-footer__legend {
  display: none !important;
}

.bp-app.bp-entire-book-mode .bp-header__nav-center {
  display: none !important;
}

.bp-app.bp-entire-book-mode .bp-layout {
  grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
}

.bp-app.bp-entire-book-mode .bp-main {
  padding: 0 1rem 1rem;
}

/* Chapter/book search field */
.bp-book-search-field,
.bp-chapter-search-field {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.35em 0.6em;
  font-size: 0.88em;
  margin-bottom: 0.6em;
  outline: none;
}
.bp-sidebar-sticky-controls .bp-book-search-field,
.bp-sidebar-sticky-controls .bp-chapter-search-field {
  margin: 0.45em 0 0;
}
.bp-book-search-field::placeholder,
.bp-chapter-search-field::placeholder {
  color: var(--text-muted, #888);
  opacity: 1;
}
.bp-book-search-field:focus,
.bp-chapter-search-field:focus {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

/* Extra typed-highlight fields and the study-notes hint only take up space
   once the developer's own label/highlight buttons are toggled off —
   otherwise they'd just add clutter on top of an already-full sidebar. */
.bp-chapter-search-field--extra {
  display: none;
}
html.bp-hide-study-notes .bp-chapter-search-field--extra {
  display: block;
}
.bp-study-notes-hint {
  display: none;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted, #9aa5b1);
  margin: 0.3em 0 0.6em;
}
.bp-study-notes-hint strong {
  color: var(--accent, #ffe082);
}
html.bp-hide-study-notes .bp-study-notes-hint {
  display: block;
}

.bp-app.bp-entire-book-mode #prev-chapter-btn,
.bp-app.bp-entire-book-mode #next-chapter-btn,
.bp-app.bp-entire-book-mode #chapter-dropdown {
  display: none !important;
}

.bp-app.bp-entire-book-mode #entire-book-btn {
  margin-top: 0;
}

.bp-book-view {
  width: 100%;
}

.bp-book-view__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--text-main);
}

.bp-book-view__chapter {
  margin: 1rem 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.bible-book.bible-book--dense {
  columns: 1;
  column-gap: 1.4rem;
  width: 100%;
  font-size: calc(clamp(0.62rem, 0.56rem + 0.18vw, 0.76rem) * var(--bp-font-scale, 1));
  line-height: 1.35;
}

.bible-book.bible-book--dense .verse-num {
  color: #dd8181;
  font-size: 0.92em;
  font-weight: 600;
}

@media (min-width: 1300px) {
  .bible-book.bible-book--dense {
    columns: 2;
  }
}

@media (min-width: 2200px) {
  .bible-book.bible-book--dense {
    columns: 3;
  }
}

/* BEM: bp-app */
.bp-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header navigation buttons (centered, dark mode) */
.bp-header__nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}
.bp-header__jump {
  position: absolute;
  left: clamp(15.5rem, 18vw, 20.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 0.35em;
  margin: 0;
}
.bp-header__jump-input {
  width: clamp(7.5rem, 9vw, 10rem);
  background: #1d1f22;
  color: var(--text-main);
  border: 1px solid #4b4f56;
  border-radius: 6px;
  padding: 0.28em 0.52em;
  font-size: 0.88em;
  outline: none;
}
.bp-header__jump-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.9;
}
.bp-header__jump-input:focus {
  border-color: #ffe082;
  box-shadow: 0 0 0 2px rgba(255, 224, 130, 0.2);
}
.bp-header__jump-input.bp-header__jump-input--error {
  border-color: #ff6d6d;
  box-shadow: 0 0 0 2px rgba(255, 109, 109, 0.25);
}
.bp-header__jump-btn {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.28em 0.65em;
  font-size: 0.86em;
  line-height: 1.1;
  cursor: pointer;
}
.bp-header__jump-btn:hover {
  background: #333;
  color: #ffe082;
  border: 1px solid #ffe082;
}
.bp-header__nav-center button {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.4em 1.1em;
  font-size: 1.2em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border 0.2s;
}
.bp-header__nav-center button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bp-header__nav-center button:hover:not(:disabled) {
  background: #333;
  color: #ffe082;
  border: 1px solid #ffe082;
}
.bp-header {
  position: relative;
}

/* Header navigation and chapter groups */
.bp-header__nav-group,
.bp-header__chapter-group {
  display: flex;
  align-items: center;
  gap: 0.5em;
  border: 1px solid #4c4c4c;
  border-radius: 6px;
  padding: 0.4em 1.1em;
}
.bp-header__nav-label,
.bp-header__chapter-label {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin: 0 0.5em;
  font-weight: 500;
}
.bp-header__nav-group button,
.bp-header__chapter-group button {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.4em 1.1em;
  font-size: 1.2em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border 0.2s;
}
.bp-header__nav-group button:disabled,
.bp-header__chapter-group button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bp-header__nav-group button:hover:not(:disabled),
.bp-header__chapter-group button:hover:not(:disabled) {
  background: #333;
  color: #ffe082;
  border: 1px solid #ffe082;
}

.bp-header__right {
  display: flex;
  align-items: center;
  gap: 1.1em;
  position: absolute;
  right: 2.5em;
  top: 50%;
  transform: translateY(-50%);
}

.bp-header__resource-links {
  display: inline-flex;
  align-items: center;
  gap: 0.95em;
}

.bp-header__explorer-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1em;
  line-height: 1.15;
}

.bp-header__explorer-link,
.bp-header__peruser-link {
  color: var(--accent);
  font-weight: bold;
  text-decoration: underline;
  font-size: 0.84em;
  white-space: nowrap;
}

.bp-header__copy-link-btn {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.35em 0.9em;
  font-size: 0.95em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border 0.2s;
}

.bp-header__copy-link-btn:hover {
  background: #333;
  color: #ffe082;
  border: 1px solid #ffe082;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.bp-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.bp-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}
.bp-layout-container {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.bp-sidebar {
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  width: var(--sidebar-width);
  padding: 1rem;
  padding-top: 0rem;
  box-sizing: border-box;
  overflow-y: auto;
}

.bp-sidebar--left {
  border-right: 1px solid #222;
  overflow-y: auto;
}
/* Sticky chapter navigation in left sidebar */
.chapter-nav-sticky {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  padding: 8px 0;
  text-align: center;
  border-bottom: 1px solid #eee;
}
.chapter-nav-sticky {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-sidebar, #000);
}
.chapter-nav-sticky button {
  margin: 0 8px;
  padding: 6px 22px;
  font-size: 1em;
  border-radius: 4px;
  border: 1px solid #bbb;
  background: var(--bg-sidebar, #000);
  color: var(--text-main, #222);
  cursor: pointer;
  transition: background 0.2s;
}
.chapter-nav-sticky button:disabled {
  background: #222;
  color: #888;
  cursor: not-allowed;
}
.chapter-nav-sticky button:not(:disabled):hover {
  background: var(--accent, #2a6e5c);
  color: #fff;
}
.bp-sidebar--right {
  border-left: 1px solid #222;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.bp-sidebar-sticky-controls {
  flex-shrink: 0;
  z-index: 20;
  background: var(--bg-sidebar);
  padding: 0.55em 0 0.6em;
  border-bottom: 1px solid #333;
}
.bp-sidebar__scroll-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
/* Sticky highlight toggle bar in right sidebar */
.sticky-highlight-toggle-bar {
  position: relative;
  background: var(--bg-sidebar);
  z-index: 1;
  padding: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.sticky-highlight-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1.08em;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.sticky-highlight-toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.2em;
}

.bp-header {
  flex-shrink: 0;
  height: 3.5em;
  z-index: 200;
  background: var(--bg-header);
  color: var(--accent);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px #0002;
}
.bp-header__title {
  margin: 0;
}
.bp-header__brand-link {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5em;
  vertical-align: middle;
}
.bp-header__brand-logo {
  height: 1.18em;
  width: auto;
  display: block;
}
.bp-header__by-gospelgo {
  font-size: 0.7em;
  font-weight: normal;
  margin-left: 0.7em;
  color: var(--text-secondary);
}
.bp-header__gospelgo-link {
  color: var(--accent);
  text-decoration: underline;
}

.by-gospelgo {
  font-size: 0.7em;
  font-weight: normal;
  margin-left: 0.7em;
  color: var(--text-secondary);
}

.by-gospelgo a {
  color: var(--accent);
  text-decoration: underline;
}

.bp-header__data {
  color: var(--text-secondary);
  font-size: 1rem;
}

.bp-header__info {
  font-size: 1em;
  color: var(--accent);
  margin-left: 0.7em;
  white-space: nowrap;
}

.bp-main {
  overflow-y: auto;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.bp-main {
  flex: 1;
  padding-bottom: 6em;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  background: var(--bg-main);
  color: var(--text-main);
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.bp-book-scrollbar-container {
  position: absolute;
  bottom: 0;
  left: var(--sidebar-width);
  right: var(--sidebar-width);
  height: 6em;
  background: var(--bg-footer);
  border: 1px solid #222;
  box-sizing: border-box;
  padding: 0.25rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 -2px 8px #0003;
  z-index: 10;
}
.bp-book-scrollbar {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  width: 100%;
  scrollbar-color: var(--accent) var(--bg-footer);
  scrollbar-width: thin;
}
.bp-book-scrollbar::-webkit-scrollbar {
  height: 8px;
}
.bp-book-scrollbar::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}
.bp-book-scrollbar::-webkit-scrollbar-track {
  background: var(--bg-footer);
}
.bp-book-scrollbar__btn {
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: none;
  border-radius: 4px;
  padding: 0.4em 0.9em;
  font-size: 1em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  outline: none;
}
.bp-book-scrollbar__btn.selected,
.bp-book-scrollbar__btn:focus {
  background: var(--accent);
  color: #fff;
}
.bp-book-scrollbar__btn:hover {
  background: #444b;
}

footer {
  background: var(--bg-footer);
  color: var(--text-secondary);
  padding: 0.75rem 2rem 0.2rem 2rem;
  text-align: center;
  font-size: 0.95rem;
  border-top: none;
  position: relative;
}

.bp-footer__legend {
  flex-shrink: 0;
  background: var(--bg-footer);
  padding: 0.5em 2rem 0.2em 2rem;
  text-align: left;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  font-size: 1em;
  width: auto;
  box-shadow: 0 -2px 8px #0002;
}
.bp-footer {
  flex-shrink: 0;
  min-height: 2.2em;
  background: var(--bg-footer);
  color: var(--text-secondary);
  padding: 0.75rem 2rem 0.75rem 2rem;
  text-align: left;
  font-size: 0.95rem;
  border-top: 1px solid #222;
  box-shadow: 0 -2px 8px #0004;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.header-info {
  font-size: 1em;
  color: var(--accent);
  margin-left: 0.7em;
}

.verse-highlight {
  background: linear-gradient(
    to bottom,
    transparent 15%,
    var(--verse-highlight, #176d5a) 35%,
    var(--verse-highlight, #176d5a) 65%,
    transparent 85%
  );
  color: #fff;
  border-radius: 4px;
  padding: 0 0px;
  transition: background 0.2s;
}

.search-highlight {
  color: var(--search-highlight);
  border-radius: 4px;
  padding: 0 0px;
  transition: background 0.2s;
}

/* Book view: stronger highlights — solid bg replaces faded gradient, box-shadow extends
   visual area without affecting layout (no clipping) */
.bible-book.bible-book--dense .verse-highlight {
  background: var(--verse-highlight, #176d5a);
  box-shadow: 0 0 0 1px var(--verse-highlight, #176d5a);
  border-radius: 2px;
}
.bible-book.bible-book--dense .search-highlight {
  font-weight: bold;
  background: color-mix(in srgb, var(--search-highlight) 18%, transparent);
  border-radius: 2px;
}
.bible-book.bible-book--dense .verse-highlight .search-highlight {
  background: none;
  font-weight: bold;
}

/* Overview mode: maximum contrast — highlights read as colored blocks at minimum font size */
.bible-book.bible-book--dense.bp-overview-active .verse-highlight {
  background: var(--accent-vivid);
  box-shadow: 0 0 0 2px var(--accent-vivid);
  border-radius: 2px;
}
.bible-book.bible-book--dense.bp-overview-active .search-highlight {
  font-weight: bold;
  background: color-mix(in srgb, var(--search-highlight) 50%, transparent);
  border-radius: 2px;
}
.bible-book.bible-book--dense.bp-overview-active .verse-highlight .search-highlight {
  background: none;
  font-weight: bold;
}

.emphasis-highlight {
  color: var(--emphasis-highlight);
}
.bible-book.bible-book--dense .emphasis-highlight {
  font-weight: bold;
  background: color-mix(in srgb, var(--emphasis-highlight) 18%, transparent);
  border-radius: 2px;
}
.bible-book.bible-book--dense .verse-highlight .emphasis-highlight {
  background: none;
  font-weight: bold;
}
.bible-book.bible-book--dense.bp-overview-active .emphasis-highlight {
  font-weight: bold;
  background: color-mix(in srgb, var(--emphasis-highlight) 50%, transparent);
  border-radius: 2px;
}
.bible-book.bible-book--dense.bp-overview-active .verse-highlight .emphasis-highlight {
  background: none;
  font-weight: bold;
}

.search-highlight.emphasis-highlight {
  color: color-mix(in srgb, var(--search-highlight), var(--emphasis-highlight));
}
.bible-book.bible-book--dense .search-highlight.emphasis-highlight {
  background: color-mix(in srgb, color-mix(in srgb, var(--search-highlight), var(--emphasis-highlight)) 18%, transparent);
}
.bible-book.bible-book--dense.bp-overview-active .search-highlight.emphasis-highlight {
  background: color-mix(in srgb, color-mix(in srgb, var(--search-highlight), var(--emphasis-highlight)) 50%, transparent);
}

.topic-btn {
  position: relative;
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.4em 1em;
  font-size: 1em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    border 0.2s;
}
.topic-btn.active {
  /* Visually distinct right sidebar highlight button when selected */
  .topic-highlight-btn.active {
    background: var(--accent);
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 0 8px var(--accent);
    cursor: default;
    pointer-events: none;
  }
  background: var(--accent);
  color: #fff;
  border: 1px solid #fff;
  box-shadow: 0 0 8px var(--accent);
}

/* Special style for topic label buttons (dark mode friendly) */
.topic-label-btn {
  background: #2d3a4a;
  color: #ffe082;
  border: 1px solid #3e4c5a;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition:
    background 0.2s,
    color 0.2s;
}
.topic-label-btn.active,
.topic-label-btn:active {
  background: #3e4c5a;
  color: #fffde7;
}
.topic-btn--with-reference {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}
/* Reference/note icons live in one trailing cluster (js: getTopicBtnIcons)
   instead of split across both sides of the label — one text-to-icons gap
   instead of two, with the icons themselves packed tighter than that. */
.topic-btn__icons {
  display: inline-flex;
  align-items: center;
  gap: 0.15em;
}
.topic-book-outline-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}
.outline-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95em;
}
.note-link-icon {
  color: var(--accent-light);
}
.suggest-link-icon {
  color: #a8e6a3;
  /* Takes zero layout space (rather than reserved-but-invisible) so it
     never affects text wrap/wrap width, hidden or not — it floats over
     the button's own right edge instead. */
  position: absolute;
  right: -0.6em;
  top: 50%;
  transform: translateY(-50%);
}
/* Hover/focus-reveal so the new suggest icon doesn't visually compete with
   an existing 📖/📝 pair on the same button; on touch devices (no hover)
   it's always present, just muted, since there's no hover to reveal it. */
@media (hover: hover) {
  .suggest-link-icon {
    opacity: 0;
    transition: opacity 0.12s;
  }
  .topic-btn:hover .suggest-link-icon,
  .topic-btn:focus-within .suggest-link-icon {
    opacity: 1;
  }
}
@media (hover: none) {
  .suggest-link-icon {
    opacity: 0.55;
  }
}

/* Custom hover tooltip for the outline/note icons (js: attachIconHoverTooltip),
   replacing the native title attribute. It's appended to document.body
   rather than positioned relative to the icon so it isn't clipped by the
   sidebars' overflow-y: auto, and so its text can be resized for 4K below. */
.bp-icon-tooltip-popover {
  position: absolute;
  z-index: 1300;
  background: #16181b;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.45em 0.65em;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-line;
  width: max-content;
  max-width: 320px;
  box-shadow: 0 2px 8px #000a;
  pointer-events: none;
}
@media (min-width: 3000px) {
  .bp-icon-tooltip-popover {
    font-size: 17px;
    max-width: 420px;
    padding: 0.5em 0.8em;
  }
}

/* Dark mode for outline reference menu tooltip */
.reference-menu {
  background: #23272a !important;
  color: #f5f6fa !important;
  border: 1px solid #444 !important;
  box-shadow: 0 2px 12px #000a !important;
  font-size: 14px;
  border-radius: 8px;
  padding: 8px 14px;
  z-index: 1000;
}
.reference-menu hr {
  border: none;
  border-top: 1px solid #333;
  margin: 8px 0;
}
.reference-menu-item {
  color: #ffe082 !important;
  padding: 4px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}
.reference-menu-item:hover {
  background: var(--accent);
  color: #fff;
}
.reference-menu-item--external {
  color: var(--accent-light) !important;
  font-style: italic;
}
.reference-menu-item--external:hover {
  background: var(--accent);
  color: #fff;
}
.reference-menu-item--external-icon {
  margin-left: 0.25em;
}
.reference-menu-compare-btn {
  display: block;
  width: 100%;
  background: #2f3640;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.4em 0.6em;
  font-size: 0.85em;
  cursor: pointer;
  margin-top: 0.3rem;
}
.reference-menu-compare-btn:hover {
  background: var(--accent);
}

/* Hover-preview popover shown when hovering a reference inside an open
   reference-menu (verse text preview). */
.reference-preview-popover__title {
  font-weight: 600;
  margin-bottom: 6px;
}
.reference-preview-popover__text {
  font-size: 13px;
  line-height: 1.35;
}
.reference-preview-popover__helper {
  margin-top: 6px;
  font-size: 11px;
  color: #666;
}

/* 4K: the reference/note menu and its hover-preview popover are appended
   to document.body (outside .bp-app), so they don't inherit the app-wide
   1.18em 4K bump above and need their own scale-up here. */
@media (min-width: 3000px) {
  .reference-menu {
    font-size: 18px;
  }
  .reference-preview-popover__title {
    font-size: 1.3em;
  }
  .reference-preview-popover__text {
    font-size: 17px;
  }
  .reference-preview-popover__helper {
    font-size: 14px;
  }
}

/* Compare References modal */
.bp-compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
  pointer-events: none;
}
.bp-compare-modal {
  background: #23272a;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 10px;
  box-shadow: 0 8px 32px #000a;
  width: min(70vw, 2200px);
  max-height: min(85vh, 85dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
}
.bp-compare-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #333;
  flex: none;
}
.bp-compare-modal__title {
  margin: 0;
  font-size: 1.15rem;
}
.bp-compare-modal__close {
  background: none;
  border: none;
  color: #f5f6fa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}
.bp-compare-modal__close:hover {
  background: var(--accent);
}
.bp-compare-modal__body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Left column: the reference selector/reorder list */
.bp-compare-sidebar {
  flex: none;
  width: 240px;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.bp-compare-sidebar__hint {
  padding: 0.7rem 0.9rem 0.4rem;
  font-size: 0.8rem;
  color: #9aa5b1;
}
.bp-compare-sidebar__list {
  display: flex;
  flex-direction: column;
  padding: 0 0.5rem 0.7rem;
  touch-action: none;
}
.bp-compare-sidebar__row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4rem 0.4rem;
  border-radius: 6px;
}
.bp-compare-sidebar__row:hover {
  background: #2a2f34;
}
.bp-compare-sidebar__row--dragging {
  background: #2f3640;
  box-shadow: 0 4px 14px #000a;
}
.bp-compare-sidebar__checkbox {
  cursor: pointer;
  flex: none;
}
.bp-compare-sidebar__label {
  font-size: 0.9rem;
  color: #ffe082;
  overflow-wrap: anywhere;
}

/* Right column: full passage text, one card per checked reference */
.bp-compare-modal__list {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 0;
}
.bp-compare-modal__empty {
  color: #9aa5b1;
  font-size: 0.9rem;
  padding: 0.5rem 0.1rem;
}
.bp-compare-card {
  background: #1b1e21;
  border: 1px solid #3a3f44;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}
.bp-compare-drag-handle {
  cursor: grab;
  touch-action: none;
  color: #9aa5b1;
  user-select: none;
  font-size: 1.2em;
  line-height: 1;
  padding: 0.3em 0.4em;
  border-radius: 4px;
  flex: none;
}
.bp-compare-drag-handle:hover {
  background: var(--accent);
  color: #fff;
}
.bp-compare-drag-handle:active {
  cursor: grabbing;
}
.bp-compare-card__title {
  font-weight: 600;
  color: #ffe082;
  margin-bottom: 0.4rem;
}
.bp-compare-card__body {
  font-size: 0.95rem;
  line-height: 1.45;
}
.bp-compare-card__verse {
  margin: 0 0 0.3em;
}
.bp-compare-card__verse sup {
  color: var(--accent-light);
  margin-right: 0.3em;
}
@media (max-width: 700px) {
  .bp-compare-modal {
    width: 100%;
  }
  .bp-compare-modal__body {
    flex-direction: column;
  }
  .bp-compare-sidebar {
    width: auto;
    max-height: 35vh;
    border-right: none;
    border-bottom: 1px solid #333;
  }
}
@media (max-width: 480px) {
  .bp-compare-overlay {
    padding: 0.75rem;
  }
  .bp-compare-modal {
    max-height: min(92vh, 92dvh);
  }
}
@media (min-width: 3000px) {
  .bp-compare-modal__header {
    padding: 1.2rem 1.5rem;
  }
  .bp-compare-modal__title {
    font-size: 1.5rem;
  }
  .bp-compare-modal__close {
    font-size: 1.4rem;
  }
  .bp-compare-sidebar__hint {
    font-size: 1.05rem;
  }
  .bp-compare-sidebar__label {
    font-size: 1.15rem;
  }
  .bp-compare-modal__list {
    padding: 1.2rem 1.5rem;
    gap: 1.1rem;
  }
  .bp-compare-modal__empty {
    font-size: 1.15rem;
  }
  .bp-compare-card {
    padding: 0.8rem 1.1rem;
  }
  .bp-compare-card__title {
    font-size: 1.2rem;
  }
  .bp-compare-card__body {
    font-size: 1.2rem;
  }
  .bp-compare-drag-handle {
    font-size: 1.5em;
  }
}

/* Timeline / People / Places footer buttons */
.bp-meta-btn {
  background: #2f3640;
  color: #f5f6fa;
  border: 1px solid #cfab5a;
  border-radius: 6px;
  padding: 0.25em 0.6em;
  margin-left: 0.6em;
  font-size: 0.85em;
  cursor: pointer;
}
.bp-meta-btn:hover {
  background: var(--accent);
  border-color: #ffe082;
}
.bp-meta-btn--off {
  color: #ffe082;
  border: 2px solid #ffe082;
  font-weight: 600;
}
.bp-meta-btn--off:hover {
  background: var(--accent);
}
.bp-meta-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bp-meta-btn:disabled:hover {
  background: #2f3640;
  border-color: #cfab5a;
}
.bp-meta-btn-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
@media (min-width: 3000px) {
  .bp-meta-btn {
    font-size: 1.05em;
    padding: 0.4em 0.9em;
  }
}

/* Custom tooltip that opens upward — footer buttons sit at the bottom of
   the viewport, where a native title tooltip (which always opens downward)
   gets clipped or runs off-screen. */
.bp-tooltip-up {
  position: relative;
}
.bp-tooltip-up::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: #16181b;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.35em 0.6em;
  font-size: 0.75rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px #000a;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.12s,
    visibility 0.12s;
  z-index: 1300;
}
.bp-tooltip-up:hover::after,
.bp-tooltip-up:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

/* Hides the developer's own study-note buttons — "label" buttons (left
   sidebar) and "highlight" toggle buttons (right sidebar) — when the
   footer's Notes toggle is switched off. Structural outline buttons
   (topic-outline-btn) and the reader's own typed-highlight search field
   are untouched. */
html.bp-hide-study-notes .topic-label-btn,
html.bp-hide-study-notes .topic-highlight-btn {
  display: none;
}

/* Hides the auto-generated structural outline buttons (topic-outline-btn)
   when the footer's Outline toggle is switched off. The developer's own
   label/highlight buttons (see bp-hide-study-notes above) are a separate,
   independent toggle — untouched here. */
html.bp-hide-outlines .topic-outline-btn {
  display: none;
}

/* Shared People/Places "info list" modal */
.bp-info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}
.bp-info-modal {
  background: #23272a;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 10px;
  box-shadow: 0 8px 32px #000a;
  width: min(560px, 100%);
  max-height: min(85vh, 85dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bp-info-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #333;
  flex: none;
}
.bp-info-modal__title {
  margin: 0;
  font-size: 1.15rem;
}
.bp-info-modal__close {
  background: none;
  border: none;
  color: #f5f6fa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}
.bp-info-modal__close:hover {
  background: var(--accent);
}
.bp-info-modal__list {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.bp-info-modal__empty {
  color: #9aa5b1;
  font-size: 0.9rem;
}
.bp-info-card {
  background: #1b1e21;
  border: 1px solid #3a3f44;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}
.bp-info-card__title {
  font-weight: 600;
  color: #ffe082;
}
.bp-info-card__meta {
  font-size: 0.8rem;
  color: var(--accent-light);
  margin-top: 0.2rem;
}
.bp-info-card__body {
  font-size: 0.9rem;
  line-height: 1.4;
  margin-top: 0.4rem;
}
.bp-info-card__toggle {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.3rem 0 0;
}
.bp-info-card__toggle:hover {
  text-decoration: underline;
}
.bp-info-card__toggle:disabled {
  cursor: default;
  opacity: 0.7;
}
.bp-info-modal__disclaimer {
  flex: none;
  padding: 0.6rem 1.1rem 0;
  border-top: 1px solid #333;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #7c8894;
  font-style: italic;
}
.bp-info-modal__credit {
  flex: none;
  padding: 0.4rem 1.1rem 0.6rem;
  font-size: 0.75rem;
  color: #9aa5b1;
}
@media (max-width: 480px) {
  .bp-info-overlay {
    padding: 0.75rem;
  }
  .bp-info-modal {
    max-height: min(92vh, 92dvh);
  }
}
@media (min-width: 3000px) {
  .bp-info-modal {
    width: min(760px, 100%);
  }
  .bp-info-modal__header {
    padding: 1.2rem 1.5rem;
  }
  .bp-info-modal__title {
    font-size: 1.5rem;
  }
  .bp-info-modal__close {
    font-size: 1.4rem;
  }
  .bp-info-modal__list {
    padding: 1.2rem 1.5rem;
    gap: 0.9rem;
  }
  .bp-info-modal__empty {
    font-size: 1.15rem;
  }
  .bp-info-card {
    padding: 0.8rem 1.1rem;
  }
  .bp-info-card__title {
    font-size: 1.1rem;
  }
  .bp-info-card__meta {
    font-size: 1.05rem;
  }
  .bp-info-card__body {
    font-size: 1.15rem;
  }
  .bp-info-card__toggle {
    font-size: 1.05rem;
  }
  .bp-info-modal__disclaimer {
    font-size: 0.95rem;
  }
  .bp-info-modal__credit {
    font-size: 0.95rem;
  }
}

/* Timeline modal */
.bp-timeline-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}
.bp-timeline-modal {
  background: #23272a;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 10px;
  box-shadow: 0 8px 32px #000a;
  width: min(70vw, 2200px);
  max-height: min(85vh, 85dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bp-timeline-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #333;
  flex: none;
}
.bp-timeline-modal__title {
  margin: 0;
  font-size: 1.15rem;
}
.bp-timeline-modal__close {
  background: none;
  border: none;
  color: #f5f6fa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}
.bp-timeline-modal__close:hover {
  background: var(--accent);
}
.bp-timeline-modal__body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.bp-timeline-zone {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid #333;
  padding: 0.7rem 0.8rem;
}
.bp-timeline-zone:last-child {
  border-right: none;
}
.bp-timeline-zone--compact {
  flex: 0 0 150px;
  overflow-y: auto;
}
.bp-timeline-zone--expanded {
  flex: 1;
  min-width: 0;
}
.bp-timeline-zone__hint {
  font-size: 0.75rem;
  color: #9aa5b1;
  margin: -0.2rem 0 0.5rem;
  flex: none;
}
.bp-timeline-zone__hint strong {
  color: #ffe082;
  font-weight: 600;
}
.bp-timeline-zone__header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #9aa5b1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
  flex: none;
}
.bp-timeline-zone__track {
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 1.2rem;
  cursor: grab;
}
.bp-timeline-zone__track--dragging {
  cursor: grabbing;
  user-select: none;
}
.bp-timeline-marker {
  flex: none;
  width: 140px;
  background: #1b1e21;
  border: 1px solid #3a3f44;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  cursor: pointer;
  color: #f5f6fa;
  text-align: left;
}
.bp-timeline-marker:hover {
  border-color: var(--accent-light);
}
.bp-timeline-marker--current {
  background: var(--accent);
  border-color: #ffe082;
}
.bp-timeline-marker__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-light);
  flex: none;
}
.bp-timeline-marker--current .bp-timeline-marker__dot {
  background: #ffe082;
}
.bp-timeline-marker__label {
  font-size: 0.8rem;
  line-height: 1.3;
}
.bp-timeline-landmark {
  display: flex;
  align-items: center;
  gap: 0.4em;
  background: none;
  border: none;
  color: #f5f6fa;
  cursor: pointer;
  padding: 0.25rem 0;
  text-align: left;
  font-size: 0.8rem;
}
.bp-timeline-landmark:hover {
  color: var(--accent-light);
}
.bp-timeline-landmark__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa5b1;
  flex: none;
}
.bp-timeline-detail {
  flex: none;
  padding: 0.7rem 1.1rem;
  border-top: 1px solid #333;
}
.bp-timeline-detail__title {
  font-weight: 600;
  color: #f5f6fa;
}
.bp-timeline-detail__title--current {
  color: #ffe082;
}
.bp-timeline-detail__meta {
  font-size: 0.85rem;
  color: var(--accent-light);
  margin-top: 0.2rem;
}
.bp-timeline-disclaimer {
  flex: none;
  padding: 0.6rem 1.1rem 0;
  border-top: 1px solid #333;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #7c8894;
  font-style: italic;
}
.bp-timeline-credit {
  flex: none;
  padding: 0.4rem 1.1rem 0.7rem;
  font-size: 0.75rem;
  color: #9aa5b1;
}
@media (max-width: 700px) {
  .bp-timeline-modal {
    width: 100%;
  }
  .bp-timeline-modal__body {
    flex-direction: column;
    overflow-y: auto;
  }
  .bp-timeline-zone {
    border-right: none;
    border-bottom: 1px solid #333;
  }
  .bp-timeline-zone--compact {
    flex: none;
    max-height: none;
    overflow-y: visible;
  }
  .bp-timeline-zone--expanded {
    flex: none;
  }
}
@media (max-width: 480px) {
  .bp-timeline-overlay {
    padding: 0.75rem;
  }
  .bp-timeline-modal {
    max-height: min(92vh, 92dvh);
  }
}
@media (min-width: 3000px) {
  .bp-timeline-modal__header {
    padding: 1.2rem 1.5rem;
  }
  .bp-timeline-modal__title {
    font-size: 1.5rem;
  }
  .bp-timeline-modal__close {
    font-size: 1.4rem;
  }
  .bp-timeline-zone {
    padding: 0.95rem 1.1rem;
  }
  .bp-timeline-zone--compact {
    flex-basis: 190px;
  }
  .bp-timeline-zone__hint {
    font-size: 1rem;
  }
  .bp-timeline-zone__header {
    font-size: 1.05rem;
  }
  .bp-timeline-marker {
    width: 180px;
    padding: 0.7rem 0.8rem;
  }
  .bp-timeline-marker__dot {
    width: 10px;
    height: 10px;
  }
  .bp-timeline-marker__label {
    font-size: 1.05rem;
  }
  .bp-timeline-landmark {
    font-size: 1.05rem;
  }
  .bp-timeline-landmark__dot {
    width: 8px;
    height: 8px;
  }
  .bp-timeline-detail {
    padding: 1rem 1.5rem;
  }
  .bp-timeline-detail__meta {
    font-size: 1.1rem;
  }
  .bp-timeline-disclaimer {
    font-size: 0.95rem;
  }
  .bp-timeline-credit {
    font-size: 0.95rem;
  }
}

/* Too-narrow overlay — the mobile layout is default-on below 900px
   (html.bp-mobile, opt out with ?mobile=0); this fallback only blocks
   screens too narrow for even the mobile layout. */
@media (max-width: 319px) {
  .bp-app {
    filter: blur(2px) grayscale(0.5);
    pointer-events: none;
    user-select: none;
  }
  .bp-mobile-overlay {
    display: flex !important;
  }
}

.bp-mobile-overlay {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(24, 26, 27, 0.98);
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2em 1em;
}
.bp-mobile-overlay__msg {
  font-size: 1.3em;
  margin-bottom: 1.5em;
}
.bp-mobile-overlay__actions {
  display: flex;
  gap: 1em;
  margin-bottom: 1.5em;
  flex-wrap: wrap;
  justify-content: center;
}
.bp-mobile-overlay__btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.7em 1.2em;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}
.bp-mobile-overlay__btn:hover {
  background: #4a5bbd;
}
.bp-mobile-overlay__logo {
  display: inline-block;
  margin-top: 1em;
}
.bp-mobile-overlay__logo img {
  height: 100px;
  width: auto;
  vertical-align: middle;
}

/* Compact header: 900px–1788px (shrink earlier to avoid overlap) */
@media (min-width: 900px) and (max-width: 1788px) {
  .bp-header {
    padding: 0.4rem 1rem;
  }
  .bp-header__title {
    font-size: 1.1em;
  }
  .bp-header__brand-logo {
    height: 1.02em;
  }
  .bp-header__nav-center {
    gap: 0.5em;
  }
  .bp-header__jump {
    left: clamp(11.25rem, 18vw, 15.25rem);
    gap: 0.25em;
  }
  .bp-header__jump-input {
    width: clamp(6.2rem, 8vw, 8rem);
    font-size: 0.78em;
    padding: 0.22em 0.45em;
  }
  .bp-header__jump-btn {
    font-size: 0.74em;
    padding: 0.2em 0.45em;
  }
  .bp-header__nav-center button {
    padding: 0.2em 0.55em;
    font-size: 0.9em;
  }
  .bp-header__nav-group,
  .bp-header__chapter-group {
    padding: 0.2em 0.55em;
    gap: 0.25em;
    margin-left: 1em !important;
  }
  .bp-header__nav-group button,
  .bp-header__chapter-group button {
    padding: 0.2em 0.55em;
    font-size: 0.9em;
  }
  .bp-header__nav-label,
  .bp-header__chapter-label {
    font-size: 0.8em;
    margin: 0 0.25em;
  }
  .bp-header__explorer-link,
  .bp-header__peruser-link {
    font-size: 0.68em;
  }
  .bp-header__info {
    margin-left: 0.3em;
    font-size: 0.82em;
  }
  .bp-header__copy-link-btn {
    padding: 0.2em 0.55em;
    font-size: 0.82em;
  }
  .bp-header__right {
    gap: 0.7em !important;
    right: 1rem !important;
  }
}

@media (min-width: 900px) and (max-width: 1260px) {
  .bp-header {
    height: auto;
    min-height: 5.9em;
    padding: 0.35rem 0.8rem 0.55rem;
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 0.4rem;
    column-gap: 0.5rem;
  }

  .bp-header__title {
    order: 1;
    font-size: 1rem;
  }

  .bp-header__jump {
    order: 2;
    position: static;
    left: auto;
    top: auto;
    transform: none;
    margin-left: 0.25rem;
    gap: 0.2em;
  }

  .bp-header__jump-input {
    width: 5.7rem;
    font-size: 0.74em;
    padding: 0.2em 0.4em;
  }

  .bp-header__jump-btn {
    font-size: 0.7em;
    padding: 0.18em 0.42em;
  }

  .bp-header__right {
    order: 3;
    position: static;
    right: auto !important;
    top: auto;
    transform: none;
    margin-left: auto;
    gap: 0.45em !important;
  }

  .bp-header__copy-link-btn {
    padding: 0.18em 0.45em;
    font-size: 0.74em;
  }

  .bp-header__resource-links {
    gap: 0.45em;
  }

  .bp-header__explorer-link,
  .bp-header__peruser-link,
  .bp-header__info {
    font-size: 0.74em;
  }

  .bp-header__nav-center {
    order: 4;
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45em;
    padding-top: 0.05rem;
  }

  .bp-header__nav-group,
  .bp-header__chapter-group {
    margin-left: 0 !important;
    gap: 0.18em;
    padding: 0.14em 0.4em;
  }

  .bp-header__nav-label,
  .bp-header__chapter-label {
    font-size: 0.72em;
    margin: 0 0.15em;
  }

  .bp-header__nav-group button,
  .bp-header__chapter-group button,
  .bp-header__nav-center button {
    font-size: 0.8em;
    padding: 0.14em 0.4em;
  }

}

/* =====================================================================
   Drawer handles + popup bottom sheet (base rules; only activated by the
   mobile layout below — handles stay hidden on desktop, the sheet class is
   only added by JS when the mobile layout is active).
   ===================================================================== */
.bp-drawer-handle {
  display: none;
}

/* Bottom-sheet variant of reference/note menus. !important is required to
   beat the menus' inline positioning styles set in bible-loader.js. */
.reference-menu--sheet {
  position: fixed !important;
  top: auto !important;
  left: 0.5rem !important;
  right: 0.5rem !important;
  bottom: calc(2.9em + env(safe-area-inset-bottom, 0px) + 0.5rem) !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: 50vh !important;
  max-height: 50dvh !important;
  overflow-y: auto !important;
  z-index: 1000 !important;
}

/* ── Suggestion modal (js/bp-suggest.js) ── */
html.bp-suggestions-hidden .suggest-link-icon,
html.bp-suggestions-hidden .bp-suggest-new-link {
  display: none !important;
}
.bp-suggest-new-link {
  display: block;
  background: none;
  border: none;
  color: #9aa5b1;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  padding: 0.3em 0.2em;
  margin-top: 0.2em;
}
.bp-suggest-new-link:hover {
  color: #ffe082;
  text-decoration: underline;
}
.bp-suggest-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}
.bp-suggest-modal {
  background: #23272a;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 10px;
  box-shadow: 0 8px 32px #000a;
  width: min(560px, 100%);
  max-height: min(85vh, 85dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Desktop-only: the modal docks off to the side (not centered) and the
   backdrop stops blocking the page, so filling out a suggestion no longer
   requires closing the form to re-read the scripture behind it. Applied
   via JS (js/bp-suggest.js) only when !bpIsMobileMode() — mobile keeps the
   original centered/dimmed/blocking behavior untouched. */
.bp-suggest-overlay--docked {
  background: transparent;
  pointer-events: none;
}
.bp-suggest-overlay--docked .bp-suggest-modal {
  pointer-events: auto;
}
.bp-suggest-modal--docked {
  position: fixed;
  width: min(440px, 92vw);
  max-height: min(80vh, 80dvh);
}
.bp-suggest-modal--docked .bp-suggest-modal__header {
  cursor: grab;
  user-select: none;
}
.bp-suggest-modal--docked .bp-suggest-modal__header--dragging {
  cursor: grabbing;
}
.bp-suggest-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #333;
  flex: none;
}
.bp-suggest-modal__title {
  margin: 0;
  font-size: 1.15rem;
}
.bp-suggest-modal__title-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4em;
  min-width: 0;
}
.bp-suggest-modal__info {
  background: none;
  border: none;
  color: var(--accent-light, #a3e0cf);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15em;
  border-radius: 50%;
  flex: none;
}
.bp-suggest-modal__info:hover,
.bp-suggest-modal__info:focus-visible {
  background: var(--accent);
  color: #fff;
}
.bp-suggest-info-popover {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5em;
  width: 20rem;
  max-width: min(20rem, 80vw);
  background: #16181b;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 0.8em 0.9em;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 4px 16px #000a;
  z-index: 1300;
}
.bp-suggest-info-popover a {
  color: var(--accent-light, #a3e0cf);
}
.bp-suggest-modal__close {
  background: none;
  border: none;
  color: #f5f6fa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}
.bp-suggest-modal__close:hover {
  background: var(--accent);
}
.bp-suggest-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1.1rem;
}
.bp-suggest-modal__footer {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 1.1rem;
  border-top: 1px solid #333;
}
.bp-suggest-help {
  font-size: 0.85rem;
  color: #9aa5b1;
  margin: 0 0 0.6rem;
}
.bp-suggest-account-line {
  font-size: 0.78rem;
  color: #9aa5b1;
}
.bp-suggest-link-btn {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
}
.bp-suggest-link-btn:hover {
  text-decoration: underline;
}
.bp-suggest-field {
  margin-bottom: 0.8rem;
}
.bp-suggest-field label {
  display: block;
  font-size: 0.85rem;
  color: #ffe082;
  margin-bottom: 0.3em;
}
.bp-suggest-field input,
.bp-suggest-field textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.4em 0.6em;
  font: inherit;
  outline: none;
}
.bp-suggest-field textarea {
  min-height: 5.5em;
  resize: vertical;
  line-height: 1.45;
}
.bp-suggest-field input:focus,
.bp-suggest-field textarea:focus {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}
.bp-suggest-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.bp-suggest-submit {
  background: #2f3640;
  color: #f5f6fa;
  border: 1px solid #cfab5a;
  border-radius: 6px;
  padding: 0.45em 0.9em;
  cursor: pointer;
}
.bp-suggest-submit:hover:not(:disabled) {
  background: var(--accent);
}
.bp-suggest-submit:disabled {
  opacity: 0.6;
  cursor: default;
}
.bp-suggest-msg {
  font-size: 0.85rem;
  margin: 0.4rem 0;
  min-height: 1.2em;
}
.bp-suggest-msg--error {
  color: #ff9c8a;
}
.bp-suggest-msg--ok {
  color: #a8e6a3;
}
.bp-suggest-my-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.bp-suggest-my-item {
  background: #1b1e21;
  border: 1px solid #3a3f44;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}
.bp-suggest-my-item__title {
  font-weight: 600;
  color: #ffe082;
  margin-bottom: 0.3em;
}
.bp-suggest-status {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: #2f3640;
  color: #9aa5b1;
}
.bp-suggest-status--approved,
.bp-suggest-status--applied {
  color: #a8e6a3;
}
.bp-suggest-status--rejected,
.bp-suggest-status--unmatched {
  color: #ff9c8a;
}
@media (max-width: 480px) {
  .bp-suggest-overlay {
    padding: 0.75rem;
  }
  .bp-suggest-modal {
    max-height: min(92vh, 92dvh);
  }
  .bp-suggest-field input,
  .bp-suggest-field textarea {
    font-size: 16px; /* prevents iOS Safari zoom-on-focus */
  }
}
@media (min-width: 3000px) {
  .bp-suggest-modal {
    width: min(760px, 100%);
  }
  .bp-suggest-modal__header {
    padding: 1.2rem 1.5rem;
  }
  .bp-suggest-modal__title {
    font-size: 1.5rem;
  }
  .bp-suggest-modal__info {
    font-size: 1.3rem;
  }
  .bp-suggest-info-popover {
    font-size: 1rem;
    width: 24rem;
  }
  .bp-suggest-modal__close {
    font-size: 1.4rem;
  }
  .bp-suggest-modal__body {
    padding: 1.2rem 1.5rem;
  }
  .bp-suggest-field label,
  .bp-suggest-help,
  .bp-suggest-msg {
    font-size: 1.05rem;
  }
}

/* ── Shared sign-in gate (js/bp-auth-ui.js) ──
   Reused by the suggestion modal (js/bp-suggest.js), the admin sign-in
   (js/bp-admin.js), and the profile page (js/bp-profile.js) — one visual
   source of truth for the OTP code-entry step, layered on top of the
   .bp-suggest-field/.bp-suggest-submit/.bp-suggest-link-btn classes above. */
.bp-auth-code-field input {
  font-size: 1.4rem;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  max-width: 8em;
}
.bp-auth-resend-row {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.82rem;
  color: #9aa5b1;
  margin-top: 0.3em;
}
.bp-auth-resend-row .bp-suggest-link-btn:disabled {
  color: #6b7280;
  cursor: default;
  text-decoration: none;
}

/* ── Floating account widget (js/bp-account-widget.js) ──
   Persistent bottom-right icon on the main reading page; the only account
   entry point on mobile, where .bp-header__right is hidden entirely. */
.bp-account-widget {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 600; /* above .bp-desktop-tip (500), below .reference-menu/.bp-suggest-overlay (1000/1200) */
}
.bp-account-widget__btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #23272a;
  border: 2px solid #55606e;
  color: #9aa5b1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  position: relative;
  padding: 0;
}
.bp-account-widget__btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bp-account-widget__btn--signed-in {
  border-color: #ffe082;
  color: #ffe082;
}
.bp-account-widget__badge {
  display: none;
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #a8e6a3;
  border: 2px solid #23272a;
}
.bp-account-widget__btn--signed-in .bp-account-widget__badge {
  display: block;
}
.bp-account-widget__popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.6rem);
  right: 0;
  width: min(300px, calc(100vw - 2rem));
  background: #23272a;
  color: #f5f6fa;
  border: 1px solid #444;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  padding: 0.9rem 1rem;
  box-sizing: border-box;
}
.bp-account-widget__popover--open {
  display: block;
}
.bp-account-widget__email {
  font-size: 0.85rem;
  color: #9aa5b1;
  margin-bottom: 0.6rem;
  word-break: break-all;
}
.bp-account-widget__link {
  display: block;
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  padding: 0.35em 0;
  text-decoration: none;
}
.bp-account-widget__link:hover {
  text-decoration: underline;
}

/* =====================================================================
   Mobile layout (<900px), opt-in via html.bp-mobile
   (?mobile=1 or the overlay's "Try Mobile View" button).
   Desktop (>=900px) is untouched: everything here is gated on both the
   media query and the html.bp-mobile class.
   ===================================================================== */
@media (max-width: 899px) {
  html.bp-mobile .bp-app {
    height: 100vh;
    height: 100dvh; /* keeps the bottom handle above mobile browser chrome */
    min-height: 0;
  }

  /* --- Compact single-row header --- */
  html.bp-mobile .bp-header {
    height: auto;
    min-height: 2.6em;
    padding: 0.3rem 0.6rem;
    gap: 0.5rem;
    box-sizing: border-box;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  /* Logo stands in for the wordmark; horizontal space is scarce */
  html.bp-mobile .bp-header__title {
    font-size: 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
  }
  html.bp-mobile .bp-header__brand-link {
    margin-left: 0;
  }
  html.bp-mobile .bp-header__brand-logo {
    height: 1.7rem;
  }
  html.bp-mobile .bp-header__jump {
    position: static;
    transform: none;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
  }
  html.bp-mobile .bp-header__jump-input {
    width: clamp(5.5rem, 28vw, 8rem);
    min-width: 0;
    font-size: 16px; /* <16px triggers iOS focus auto-zoom */
  }
  html.bp-mobile .bp-header__nav-center {
    position: static;
    transform: none;
    gap: 0;
    flex-shrink: 0;
  }
  html.bp-mobile .bp-header__nav-center button {
    font-size: 1em;
    padding: 0.3em 0.75em;
  }
  /* !important: these carry inline display:flex in index.html */
  html.bp-mobile .bp-header__nav-group,
  html.bp-mobile .bp-header__right {
    display: none !important;
  }
  html.bp-mobile .bp-header__chapter-group {
    border: none;
    padding: 0;
    margin-left: 0 !important;
  }
  html.bp-mobile .bp-header__chapter-label {
    display: none;
  }
  html.bp-mobile .bp-header__chapter-group button {
    padding: 0.3em 0.85em;
    min-height: 2.2em;
  }

  /* --- Drawer handles --- */
  html.bp-mobile .bp-drawer-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    flex-shrink: 0;
    width: 100%;
    min-height: 2.4em;
    padding: 0.2em 0.75em;
    box-sizing: border-box;
    background: var(--bg-sidebar);
    color: var(--text-main);
    border: none;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    z-index: 160; /* above the drawers so the handle edge stays crisp */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  html.bp-mobile .bp-drawer-handle--top {
    border-bottom: 1px solid var(--accent);
    box-shadow: 0 2px 6px #0006;
  }
  html.bp-mobile .bp-drawer-handle--bottom {
    border-top: 1px solid var(--accent);
    box-shadow: 0 -2px 6px #0006;
    padding-bottom: calc(0.2em + env(safe-area-inset-bottom, 0px));
  }
  html.bp-mobile .bp-drawer-handle__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  html.bp-mobile .bp-drawer-handle__chevron {
    color: #ffe082;
  }

  /* --- Sidebars become slide-in drawers over the text --- */
  html.bp-mobile .bp-sidebar--left,
  html.bp-mobile .bp-sidebar--right {
    position: absolute; /* anchored to .bp-layout-container (relative) */
    left: 0;
    right: 0;
    width: auto;
    z-index: 150; /* above sticky .bp-chapter-header (10), below header (200) */
    box-sizing: border-box;
    padding: 0.5rem 0.75rem 0.75rem;
    transition: transform 0.22s ease;
    overscroll-behavior: contain;
  }
  html.bp-mobile .bp-sidebar--left {
    top: 0;
    max-height: min(45vh, 24em);
    max-height: min(45dvh, 24em);
    overflow-y: auto;
    transform: translateY(-103%);
    border-right: none;
    border-bottom: 2px solid var(--accent);
    box-shadow: 0 6px 16px #000a;
  }
  html.bp-mobile .bp-sidebar--right {
    bottom: 0;
    max-height: min(50vh, 26em);
    max-height: min(50dvh, 26em);
    transform: translateY(103%);
    border-left: none;
    border-top: 2px solid var(--accent);
    box-shadow: 0 -6px 16px #000a;
  }
  html.bp-mobile .bp-app.bp-drawer-top-open .bp-sidebar--left,
  html.bp-mobile .bp-app.bp-drawer-bottom-open .bp-sidebar--right {
    transform: translateY(0);
  }

  /* Chapter nav inside the top drawer: one wrapping row instead of a tall
     stack. !important beats the inline styles on the injected elements. */
  html.bp-mobile .chapter-nav-sticky {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 0.4em;
    padding: 6px 0 8px;
  }
  html.bp-mobile .chapter-nav-sticky > #entire-book-btn,
  html.bp-mobile .chapter-nav-sticky > #chapter-dropdown,
  html.bp-mobile .chapter-nav-sticky > div {
    width: auto !important;
    max-width: none !important;
    margin-top: 0 !important;
  }
  html.bp-mobile .chapter-nav-sticky button {
    margin: 0;
  }
  html.bp-mobile .chapter-nav-sticky > div button {
    margin: 0 4px;
  }

  /* Book strip relocated into the top drawer (moved there by app.js) */
  html.bp-mobile .bp-sidebar--left .bp-book-scrollbar-container {
    position: static;
    height: auto;
    padding: 0.25rem 0;
    margin-top: 0.5rem;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  /* --- Main text: single column, edge to edge --- */
  html.bp-mobile .bp-main {
    padding: 0 0.75rem 1.25rem;
  }
  html.bp-mobile .bible-chapter {
    font-size: calc(1.05em * var(--bp-font-scale, 1));
    line-height: 1.5;
    max-width: none;
    column-gap: 0;
  }
  html.bp-mobile .bp-chapter-header {
    grid-template-columns: 1fr auto;
    padding: 0.15em 0 0.25em;
  }
  html.bp-mobile .bp-chapter-header h2 {
    grid-column: 1;
    text-align: left;
    font-size: 1.05em;
    margin: 0.15em 0;
  }
  html.bp-mobile .bp-font-slider {
    width: 5em;
  }
  html.bp-mobile .bp-font-overview {
    display: none; /* 0.3x overview scale is unusable on a phone */
  }
  html.bp-mobile .bp-footer,
  html.bp-mobile .bp-footer__legend {
    display: none;
  }

  /* Notes/Book/Timeline/People/Places row, relocated by bpSyncMobileUi()
     into the bottom drawer's sticky controls. Labels stay visible (no
     tooltip affordance on touch) and the row scrolls horizontally instead
     of wrapping, matching the .bp-book-scrollbar treatment used for the
     66-book strip in the top drawer. */
  html.bp-mobile .bp-meta-btn-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5em;
    margin: 0.5em 0 0.6em;
    padding-bottom: 0.15em;
    scrollbar-color: var(--accent) var(--bg-sidebar);
    scrollbar-width: thin;
  }
  html.bp-mobile .bp-meta-btn-row::-webkit-scrollbar {
    height: 6px;
  }
  html.bp-mobile .bp-meta-btn-row::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
  }
  html.bp-mobile .bp-meta-btn-row::-webkit-scrollbar-track {
    background: var(--bg-sidebar);
  }
  html.bp-mobile .bp-meta-btn-row .bp-meta-btn {
    flex: none;
    margin-left: 0;
    padding: 0.4em 0.65em;
  }

  /* --- Tap ergonomics --- */
  html.bp-mobile .topic-btn,
  html.bp-mobile .topic-highlight-btn,
  html.bp-mobile .bp-book-scrollbar__btn,
  html.bp-mobile .chapter-nav-sticky button,
  html.bp-mobile #chapter-dropdown {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 2.5em;
  }
  html.bp-mobile .bp-chapter-search-field,
  html.bp-mobile .bp-book-search-field {
    font-size: 16px; /* <16px triggers iOS focus auto-zoom */
  }

  /* --- One-time "try it on desktop" tip toast (created in app.js) --- */
  html.bp-mobile .bp-desktop-tip {
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(2.9em + env(safe-area-inset-bottom, 0px) + 0.5rem);
    z-index: 500; /* above drawers (150), below reference menus (1000) */
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.6em 0.75em;
    box-sizing: border-box;
    background: var(--bg-header);
    color: var(--text-main);
    border: 1px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 4px 14px #000a;
    font-size: 0.9em;
    line-height: 1.35;
  }
  html.bp-mobile .bp-desktop-tip__text {
    flex: 1;
    min-width: 0;
  }
  html.bp-mobile .bp-desktop-tip__copy {
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.45em 0.8em;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
    white-space: nowrap;
  }
  html.bp-mobile .bp-desktop-tip__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5em;
    line-height: 1;
    padding: 0.1em 0.25em;
    cursor: pointer;
    touch-action: manipulation;
  }

  /* --- Floating account widget: clear the bottom drawer handle --- */
  html.bp-mobile .bp-account-widget {
    right: 0.75rem;
    bottom: calc(2.9em + env(safe-area-inset-bottom, 0px) + 0.5rem);
  }
  html.bp-mobile .bp-account-widget__btn {
    width: 46px;
    height: 46px;
  }
}

/* Landscape phones: allow taller drawers (viewport is short) */
@media (max-width: 899px) and (orientation: landscape) {
  html.bp-mobile .bp-sidebar--left,
  html.bp-mobile .bp-sidebar--right {
    max-height: 70vh;
    max-height: 70dvh;
  }
}

@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  html.bp-mobile .bp-sidebar--left,
  html.bp-mobile .bp-sidebar--right {
    transition: none;
  }
}
