/* Local paper preference: only the free reader and the marathon reader opt in. */
html[data-theme][data-reader-background="yellow"]:has(body:is(.bible-v2,[data-page="read"],[data-page="listen"].combined-mode)) {
  --b27-reader-base:#fff3cf;--b27-reader-chrome:#fff3cf;
  --b27-reader-ambient:linear-gradient(#fff3cf,#fff3cf);
}
html[data-theme][data-reader-background="white"]:has(body:is(.bible-v2,[data-page="read"],[data-page="listen"].combined-mode)) {
  --b27-reader-base:#ffffff;--b27-reader-chrome:#ffffff;
  --b27-reader-ambient:linear-gradient(#fff,#fff);
}
html[data-theme][data-reader-background="gradient"]:has(body:is(.bible-v2,[data-page="read"],[data-page="listen"].combined-mode)) {
  --b27-reader-base:#eee0fa;--b27-reader-chrome:#eee0fa;
  --b27-reader-ambient:linear-gradient(145deg,#eee0fa 0%,#dfd4f3 44%,#f5dfef 78%,#faecd9 100%);
}
html[data-theme][data-reader-background]:not([data-reader-background="default"]):has(body:is(.bible-v2,[data-page="read"],[data-page="listen"].combined-mode)) {
  --b27-reader-ink:#20251f;--b27-reader-number:#526044;
}
html[data-theme][data-reader-background]:not([data-reader-background="default"]) body.bible-v2 .reader-v2__header h1,
html[data-theme][data-reader-background]:not([data-reader-background="default"]) body.bible-v2 .search-entry-row a {
  color:var(--b27-reader-ink)!important;
}
.reader-backgrounds {margin-top:12px;min-width:0}
.reader-backgrounds__label {display:block;font-size:12px;font-weight:600;margin-bottom:7px}
.reader-backgrounds__choices {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
html[data-theme] :is(.settings-panel-v2,.fontbox,.combined-settings) .reader-backgrounds__choices button {
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;
  width:100%;height:auto;min-height:64px;min-width:0;margin:0;padding:6px 2px;
  border:2px solid transparent;border-radius:12px;background:rgba(127,127,127,.09);
  color:inherit;box-shadow:none;font:600 10px/1.2 Montserrat,system-ui,sans-serif;
}
.reader-backgrounds__choices button i {display:block;width:36px;height:25px;max-width:90%;border:1px solid #80808055;border-radius:7px;background:linear-gradient(145deg,#e6efdf,#f6f4e9)}
.reader-backgrounds__choices [data-reader-background="yellow"] i {background:#fff3cf}
.reader-backgrounds__choices [data-reader-background="white"] i {background:#fff}
.reader-backgrounds__choices [data-reader-background="gradient"] i {background:linear-gradient(145deg,#e8d5fa,#d4bfed,#f4d5e9,#f8e6cd)}
html[data-theme] :is(.settings-panel-v2,.fontbox,.combined-settings) .reader-backgrounds__choices button[aria-pressed="true"] {border-color:#72933b;background:rgba(126,165,57,.16)}
html[data-theme="dark"] .reader-backgrounds__choices [data-reader-background="default"] i {background:#191c1b}
html[data-theme] body[data-page="read"] .fontbox {max-height:calc(100dvh - 180px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain}

/* A solid enough panel keeps the added controls readable above Scripture. */
html[data-theme] body[data-page="read"] .fontbox {
  background:rgba(247,249,244,.97)!important;
  color:#223128!important;
  border:1px solid rgba(92,111,90,.24)!important;
  box-shadow:0 12px 32px rgba(20,30,23,.17)!important;
  backdrop-filter:blur(22px)!important;-webkit-backdrop-filter:blur(22px)!important;
}
html[data-theme="dark"] body[data-page="read"] .fontbox {
  background:rgba(36,40,37,.97)!important;color:#eef1ec!important;
  border-color:rgba(255,255,255,.18)!important;
}
html[data-theme] body[data-page="read"] .fontbox .reader-backgrounds__choices button[aria-pressed="true"] {
  border:2px solid #72933b!important;background:rgba(126,165,57,.20)!important;color:inherit!important;
}
html[data-theme="dark"] body[data-page="read"] .fontbox {--rp-ink:#eef1ec}
html[data-theme="dark"][data-reader-background]:not([data-reader-background="default"]) body[data-page="read"] .top .back {color:#eef1ec!important}

/* Combined reader uses the same settings rhythm, with breathing room at the sides. */
html[data-theme] body[data-page="listen"].combined-mode .combined-reading {
  margin-left:0!important;margin-right:0!important;padding-left:4px!important;padding-right:4px!important;
  color:var(--b27-reader-ink);
}
html[data-theme] body[data-page="listen"] .combined-settings {
  width:100%;padding:12px!important;border-radius:24px!important;
  background:rgba(247,249,244,.97)!important;color:#223128!important;
}
html[data-theme="dark"] body[data-page="listen"] .combined-settings {background:rgba(36,40,37,.97)!important;color:#eef1ec!important}
html[data-theme] body[data-page="listen"] .combined-settings .font-options {
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:10px;
}
html[data-theme] body[data-page="listen"] .combined-settings .font-options button {
  width:100%!important;height:48px!important;min-height:48px;display:grid!important;place-items:center;
  padding:6px 2px!important;margin:0!important;border-radius:14px!important;text-align:center!important;
  font-size:14px!important;line-height:1.2!important;color:inherit;
}
html[data-theme] body[data-page="listen"] .combined-settings .font-options button.is-active {
  background:rgba(126,165,57,.22)!important;box-shadow:inset 0 0 0 2px #72933b!important;
}
html[data-theme] body[data-page="listen"] .combined-settings .combined-size {text-align:center}
html[data-theme] body[data-page="listen"] .combined-settings .reader-backgrounds__choices button[aria-pressed="true"] {
  border:2px solid #72933b!important;background:rgba(126,165,57,.20)!important;color:inherit!important;
}
html[data-theme] body[data-page="listen"].combined-mode .combined-tools button {color:var(--b27-reader-ink)!important}
html[data-theme="dark"] body[data-page="listen"] .combined-settings .font-options button {
  background:rgba(255,255,255,.08)!important;color:#eef1ec!important;
}
html[data-theme] body[data-page="listen"] .combined-settings .font-options button.is-active {color:inherit!important}
html[data-theme="dark"] body[data-page="listen"].combined-mode .player {
  background:rgba(36,40,37,.97)!important;color:#eef1ec!important;
}
html[data-theme][data-reader-background]:not([data-reader-background="default"]) body[data-page="listen"].combined-mode .combined-tools button {
  background:rgba(255,255,255,.85)!important;color:#20251f!important;
}
html[data-theme="dark"][data-reader-background]:not([data-reader-background="default"]) body[data-page="listen"].combined-mode .combined-toggle {
  background:#ffe075!important;color:#594a0a!important;
}
