/* ===========================================================================
   TheoLogan Bible — design tokens mirror theologan.org (warm cream + amber,
   Georgia headings / Open Sans body / Karla meta), with a matching dark theme
   toggled via data-theme="dark" on <html>.
   =========================================================================== */
:root {
  --bg: #f7f2e8;            /* warm cream page background */
  --bg-soft: #efe8d6;       /* lifted cream for cards / inputs */
  --footer: #ede5d3;        /* sand / parchment */
  --accent: #a85d18;        /* darker amber — links & marks (AA on cream) */
  --accent-strong: #e49a4c; /* medium amber — button fills, verse numbers */
  --cream: #f1d9a9;         /* warm light accent */
  --offwhite: #ffffff;
  --ink: #1c2426;           /* primary text */
  --muted: #586569;         /* warmer grey */
  --rule: rgba(28, 36, 38, 0.12);   /* dividers / borders */
  --danger: #a8332a;
  --shadow: rgba(0, 0, 0, .2);

  /* aliases kept so component rules read naturally */
  --surface: var(--offwhite);
  --line: var(--rule);

  --maxread: 680px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --meta: "Karla", "Open Sans", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #1e2528;
  --bg-soft: #2a3236;
  --footer: #15191b;
  --accent: #efb071;
  --accent-strong: #e49a4c;
  --cream: #3d4549;
  --offwhite: #2a3236;
  --ink: #ede5d3;
  --muted: #9aa5a8;
  --rule: rgba(237, 229, 211, 0.1);
  --danger: #e8857d;
  --shadow: rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  transition: background-color .25s ease, color .25s ease;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Top bar (mirrors .site-header: cream, subtle bottom rule) ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: var(--bg); color: var(--ink);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
  transition: background-color .25s ease, border-color .25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
/* The brand doubles as a back-to-home link; the chevron signals "leave the reader". */
.brand-back { font-family: var(--serif); font-size: 22px; line-height: 1; color: var(--muted); transition: color .2s ease; }
.brand:hover .brand-back { color: var(--accent); }
.brand-logo { width: 36px; height: 36px; flex-shrink: 0; }
.brand-logo .logo-ink { fill: var(--ink); stroke: var(--ink); }
.brand-logo .logo-ink-line { stroke: var(--ink); }
.brand-logo .logo-accent { fill: var(--accent); }
.brand-text { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; line-height: 1; letter-spacing: .2px; }
.brand-theo { color: var(--ink); }
.brand-logan { color: var(--accent); }
.brand-bible { color: var(--muted); font-weight: 400; font-style: italic; }

.top-actions { display: flex; align-items: center; gap: 8px; }

/* Plans / Notes: understated header actions, echoing the site's pill language */
.plans-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-family: var(--meta); font-weight: 500; font-size: 13px; color: var(--ink);
  background: transparent; border: 1px solid var(--rule);
  border-radius: 999px; padding: 7px 12px; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.plans-btn:hover { background: var(--bg-soft); border-color: var(--accent); color: var(--accent); }
.plans-btn svg { display: block; }

/* Dark-mode toggle (copied from theologan.org, sized for the action row) */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 999px;
  cursor: pointer; color: var(--ink); padding: 0;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.theme-toggle:hover, .theme-toggle:focus-visible { background: var(--bg-soft); border-color: var(--accent); color: var(--accent); outline: none; }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Reading panes ---- */
/* One full-width Pane today; Phase 2 adds 2–3 side-by-side resizable columns. */
.columns { display: flex; align-items: flex-start; }
.pane { flex: 1 1 0; min-width: 0; }

/* Per-pane toolbar: the source + navigation controls. Sticky beneath the
   topbar, exactly as the old global nav bar was. */
.pane-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--rule);
  position: sticky; top: 56px; z-index: 19;
  transition: background-color .25s ease, border-color .25s ease;
}
.nav-group { display: flex; align-items: center; gap: 8px; }
.pane-nav-main { flex: 1 1 auto; min-width: 0; }
.pane-nav-tools { flex: 0 0 auto; }
.pane-toolbar select {
  font: inherit; font-family: var(--meta); font-size: 14px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 8px;
  padding: 8px 10px; cursor: pointer;
}
.pane-book { font-weight: 600; }
.arrow {
  font-size: 20px; line-height: 1; width: 40px; height: 40px;
  border: 1px solid var(--rule); background: var(--bg-soft); border-radius: 8px;
  color: var(--accent); cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.arrow:hover { background: var(--cream); border-color: var(--accent); }
.arrow:disabled { opacity: .4; cursor: default; }

/* ---- Reader ---- */
.pane-content { max-width: var(--maxread); margin: 0 auto; padding: 28px 22px 80px; }
/* No visible scrollbar on a pane — scrolling still works (wheel/touch/keys). */
.pane-content { scrollbar-width: none; }
.pane-content::-webkit-scrollbar { width: 0; height: 0; display: none; }
.chapter-title {
  font-family: var(--serif); font-size: calc(26px * var(--read-scale, 1)); font-weight: 700; color: var(--ink);
  margin: 0 0 18px; letter-spacing: .2px;
}
.verse {
  font-family: var(--serif); font-size: calc(19px * var(--read-scale, 1)); line-height: 1.75; color: var(--ink);
  margin: 0; padding: 2px 4px; border-radius: 4px; cursor: pointer;
}
.verse:hover { box-shadow: inset 0 0 0 1px var(--rule); }
/* Selected for multi-verse highlight/copy */
.verse.selected { box-shadow: inset 0 0 0 2px var(--accent); }
/* The verse currently being read aloud */
.verse.speaking { box-shadow: inset 3px 0 0 var(--accent-strong); }
.hl-yellow { background: #fdeeb0; }
.hl-green { background: #cfe9c8; }
.hl-blue { background: #cfe0f3; }
.hl-pink { background: #f4cfdd; }
.hl-orange { background: #f8ddb4; }
/* Highlights stay pastel in dark mode, so force readable dark text on them */
:root[data-theme="dark"] .verse.hl { color: #1c2426; }
:root[data-theme="dark"] .verse.hl .vnum { color: #8a5a1a; }
.verse-note {
  display: block; margin-top: 8px; padding: 8px 11px;
  border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  background: var(--bg-soft); color: var(--muted);
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; cursor: default;
}
.verse-note::before { content: "\270E  "; color: var(--accent); }
.vnum {
  font-family: var(--meta); font-size: 11px; font-weight: 700; color: var(--accent-strong);
  vertical-align: super; margin-right: 4px; user-select: none;
}
.placeholder, .error { color: var(--muted); font-family: var(--sans); text-align: center; padding: 40px 0; }
.error { color: var(--danger); }

/* ---- Footer ---- */
.appfoot { border-top: 1px solid var(--rule); background: var(--footer); }
.appfoot p { max-width: var(--maxread); margin: 0 auto; padding: 16px 22px; color: var(--muted); font-size: 13px; text-align: center; font-family: var(--meta); }
.appfoot a { color: var(--accent); text-decoration: underline; }
.appfoot a:hover { color: var(--accent-strong); }

/* ---- Verse action sheet ---- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,24,28,.45); z-index: 50; }
.sheet-backdrop[hidden], .sheet[hidden] { display: none; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  margin: 0 auto; max-width: 560px;
  background: var(--surface); border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 34px var(--shadow);
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  animation: sheet-up .18s ease;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-ref { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--ink); }
.sheet-close { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; width: 32px; height: 32px; }
.sheet-colors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--rule); cursor: pointer; padding: 0; }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface) inset; }
.swatch-clear { background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }
.sheet-note-label { display: block; font-size: 12px; color: var(--muted); font-family: var(--sans); margin-bottom: 14px; }
.sheet-note {
  display: block; width: 100%; margin-top: 6px; resize: vertical; min-height: 76px;
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 10px; padding: 10px;
}
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; }
.sheet-actions button { font-family: var(--meta); font-weight: 500; font-size: 14px; padding: 9px 16px; border-radius: 999px; cursor: pointer; }
.sheet-copy { background: var(--bg-soft); border: 1px solid var(--rule); color: var(--ink); }
.sheet-copy:hover { border-color: var(--accent); color: var(--accent); }
.sheet-save { background: var(--accent-strong); border: 1px solid var(--accent-strong); color: #fff; }
.sheet-save:hover { background: #7d4310; border-color: #7d4310; }

/* ---- Plans / Notes drawer (shared chrome) ---- */
.plans-backdrop { position: fixed; inset: 0; background: rgba(20,24,28,.5); z-index: 60; }
.plans-backdrop[hidden], .plans-panel[hidden] { display: none; }
.plans-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: 420px; max-width: 100%;
  background: var(--bg); display: flex; flex-direction: column;
  box-shadow: -12px 0 34px var(--shadow);
  animation: panel-in .2s ease;
}
@keyframes panel-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.plans-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: var(--bg-soft); color: var(--ink); border-bottom: 1px solid var(--rule); }
.plans-title { flex: 1; font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--ink); }
.plans-back, .plans-close {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 4px 9px; border-radius: 6px;
}
.plans-back:hover, .plans-close:hover { background: var(--rule); color: var(--ink); }
.plans-body { flex: 1; overflow-y: auto; padding: 14px; -webkit-overflow-scrolling: touch; }

.plan-active {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 16px;
}
.plan-active-info { display: flex; flex-direction: column; gap: 2px; }
.plan-active-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); font-weight: 700; font-family: var(--meta); }
.plan-active strong { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.plan-continue {
  font: inherit; font-family: var(--meta); font-weight: 500; font-size: 14px; background: var(--accent-strong); color: #fff;
  border: 0; border-radius: 999px; padding: 9px 16px; cursor: pointer; white-space: nowrap;
}
.plan-continue:hover { background: #7d4310; }

.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan-card {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 12px;
  padding: 14px; cursor: pointer; font: inherit;
  transition: border-color .2s ease, transform .15s ease;
}
.plan-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.plan-card-main { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.plan-name { font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--ink); }
.plan-desc { font-size: 13px; color: var(--muted); line-height: 1.45; font-family: var(--sans); }
.plan-meta { font-size: 12px; color: var(--accent); font-weight: 600; font-family: var(--meta); }
.plan-go { font-size: 22px; color: var(--muted); }

.plan-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.progress { flex: 1; height: 8px; background: var(--rule); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-strong); border-radius: 999px; transition: width .2s; }
.plan-detail-actions { margin-bottom: 12px; }
.plan-setactive, .plan-leave {
  font: inherit; font-family: var(--meta); font-weight: 500; font-size: 14px; width: 100%; padding: 10px; border-radius: 999px; cursor: pointer;
}
.plan-setactive { background: var(--accent-strong); color: #fff; border: 1px solid var(--accent-strong); }
.plan-setactive:hover { background: #7d4310; border-color: #7d4310; }
.plan-leave { background: var(--bg-soft); color: var(--danger); border: 1px solid var(--rule); }
.plan-leave:hover { border-color: var(--danger); }

.day-list { display: flex; flex-direction: column; }
.day-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); }
.day-check {
  flex: none; width: 24px; height: 24px; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--rule); background: var(--surface); position: relative;
}
.day-row.done .day-check { background: var(--accent-strong); border-color: var(--accent-strong); }
.day-row.done .day-check::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.day-cell { flex: 1; display: flex; align-items: baseline; gap: 10px; text-align: left; padding: 11px 4px; }
.day-num { font-size: 12px; font-weight: 700; color: var(--muted); width: 52px; flex: none; font-family: var(--meta); }
.day-refs { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.day-seg {
  font-family: var(--serif); font-size: 16px; color: var(--ink);
  background: transparent; border: 0; padding: 0; cursor: pointer;
}
.day-seg:hover { color: var(--accent); text-decoration: underline; }
.day-row.done .day-seg { color: var(--muted); }

/* ---- Highlights & notes drawer ---- */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%;
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; font: inherit;
  transition: border-color .2s ease, transform .15s ease;
}
.note-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid var(--rule); }
.note-ref { font-family: var(--serif); font-size: 16px; font-weight: 700; color: var(--ink); }
.note-text {
  font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--muted);
  white-space: pre-wrap; word-break: break-word;
}
.notes-empty { color: var(--muted); font-size: 14px; line-height: 1.6; text-align: center; padding: 48px 16px; font-family: var(--sans); }

/* Standalone (free-form) notes: a composer button + editable cards. */
.notes-new {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  font-family: var(--meta); font-weight: 600; font-size: 14px; color: #fff;
  background: var(--accent-strong); border: 0; border-radius: 999px;
  padding: 10px; cursor: pointer; margin-bottom: 14px;
}
.notes-new:hover { background: #7d4310; }
.notes-new span { font-size: 16px; line-height: 1; }
.snote-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.snote { position: relative; }
.snote-text {
  display: block; width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px;
  font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 10px;
  padding: 10px 36px 10px 12px;
}
.snote-text:focus { outline: none; border-color: var(--accent); }
.snote-del {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; border-radius: 6px;
}
.snote-del:hover { background: var(--rule); color: var(--danger); }

/* ---- Saved-workspaces drawer ---- */
.wf-compose { display: flex; gap: 8px; margin-bottom: 16px; }
.wf-name-input {
  flex: 1 1 auto; min-width: 0; box-sizing: border-box;
  font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 10px; padding: 9px 12px;
}
.wf-name-input:focus { outline: none; border-color: var(--accent); }
.wf-save {
  flex: 0 0 auto; font-family: var(--meta); font-weight: 600; font-size: 13px; color: #fff;
  background: var(--accent-strong); border: 0; border-radius: 999px; padding: 9px 16px; cursor: pointer; white-space: nowrap;
}
.wf-save:hover { background: #7d4310; }
.wf-card {
  display: flex; align-items: stretch; gap: 6px;
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 12px;
  padding: 4px; transition: border-color .2s ease, transform .15s ease;
}
.wf-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.wf-open {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px;
  text-align: left; background: transparent; border: 0; cursor: pointer; padding: 10px;
}
.wf-name { font-family: var(--serif); font-size: 16px; font-weight: 700; color: var(--ink); }
.wf-summary {
  font-family: var(--meta); font-size: 12.5px; color: var(--accent); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wf-del {
  flex: 0 0 auto; width: 34px; border: 0; background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer; border-radius: 8px;
}
.wf-del:hover { background: var(--rule); color: var(--danger); }

/* With four labeled drawer buttons (Plans/Notes/Bookmarks/Workspaces), drop the
   labels below a wide-desktop width so the header never crowds; icons remain. */
@media (max-width: 900px) { .plans-btn .plans-label { display: none; } }

/* Flash a verse when jumped to from notes */
@keyframes verse-flash {
  0% { box-shadow: inset 0 0 0 9999px rgba(228,154,76,.28); }
  100% { box-shadow: inset 0 0 0 9999px rgba(228,154,76,0); }
}
.verse.flash { animation: verse-flash 1.2s ease-out; }

@media (max-width: 520px) {
  .verse { font-size: 18px; }
  .pane-content { padding: 22px 16px 80px; }
  .plans-panel { width: 100%; }
  .plans-btn .plans-label { display: none; }
  .brand-bible { display: none; }
  .brand-text { font-size: 1.35rem; }
  /* The compact app actions fit beside the brand now; the per-pane toolbar (not
     the brand) is the sticky bar while reading. The toolbar's controls wrap to a
     second row on narrow screens, with the book + translation selects flexing. */
  .topbar { position: static; }
  .pane-toolbar { top: 0; padding: 10px 12px; flex-wrap: wrap; row-gap: 10px; }
  .pane-nav-main { flex: 1 1 100%; min-width: 0; }
  .pane-nav-tools { flex: 1 1 100%; justify-content: flex-end; }
  .pane-toolbar select { min-width: 0; }
  .pane-book { flex: 1 1 auto; min-width: 0; }
  .pane-source { flex: 1 1 auto; min-width: 0; max-width: none; }
}

/* ---- Library & the classics ---- */
/* Unified per-pane source picker (every translation + the classics in one
   menu). Full labels show in a single pane; capped + ellipsised once split. */
.pane-source { font-weight: 600; max-width: 260px; text-overflow: ellipsis; }

/* Pill that returns to the classic you jumped out of via a cross-reference. */
.return-pill[hidden] { display: none; }
.return-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--accent-strong);
  background: transparent; color: var(--accent);
  font-family: var(--meta); font-size: 13px; font-weight: 500;
  cursor: pointer; max-width: 220px; white-space: nowrap;
}
.return-pill .return-label { overflow: hidden; text-overflow: ellipsis; }
.return-pill:hover { background: var(--bg-soft); border-color: var(--accent); }

/* Classic reading view */
.work-byline {
  font-family: var(--meta); color: var(--muted);
  font-size: calc(14px * var(--read-scale, 1)); margin: -10px 0 26px;
}
.section-title {
  font-family: var(--serif); color: var(--ink);
  font-size: calc(1.2rem * var(--read-scale, 1)); font-weight: 600; margin: 0 0 16px;
}
.work-source {
  margin-top: 36px; padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-family: var(--meta);
  font-size: 12.5px; line-height: 1.5;
}

/* Scripture cross-references inside classic text */
.xref {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
.xref:hover { color: var(--accent-strong); border-bottom-style: solid; }

/* Group headings inside the Library and Notes drawers */
.lib-group, .notes-group {
  font-family: var(--meta); text-transform: uppercase;
  letter-spacing: .08em; font-size: 11.5px; font-weight: 700;
  color: var(--muted); margin: 20px 6px 8px;
}

@media (max-width: 520px) {
  .return-pill { max-width: 140px; }
  .pane-section { flex: 1 1 auto; min-width: 0; max-width: 52vw; }
}

/* ---- Account button + drawer ---- */
/* Reuses .theme-toggle sizing; when signed in, shows an amber initial badge. */
.account-btn.signed-in {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.account-initial {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-family: var(--meta); font-weight: 700; font-size: 14px;
  color: #fff;
}

.account-pane { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.account-lead { font-family: var(--serif); font-size: 17px; line-height: 1.45; color: var(--ink); margin: 0; }
.account-note { font-family: var(--sans); font-size: 13.5px; line-height: 1.55; color: var(--muted); margin: 0; }
.account-field { display: block; margin-top: 4px; }
.account-input {
  width: 100%; box-sizing: border-box;
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 10px;
  padding: 11px 13px;
}
.account-input:focus { outline: none; border-color: var(--accent); }
.account-btn-primary, .account-btn-secondary, .account-btn-danger {
  width: 100%; box-sizing: border-box; margin: 0;
}
.account-btn-danger {
  font-family: var(--meta); font-size: 13px; font-weight: 500;
  background: transparent; border: 0; color: var(--danger);
  padding: 10px; cursor: pointer; border-radius: 999px; margin-top: 4px;
}
.account-btn-danger:hover { text-decoration: underline; }
.account-status {
  font-family: var(--sans); font-size: 13px; line-height: 1.5;
  color: var(--muted); margin: 2px 0 0;
}
.account-status.is-error { color: var(--danger); }
.account-fine {
  font-family: var(--sans); font-size: 12px; line-height: 1.5;
  color: var(--muted); margin: 6px 0 0;
}
.account-fine a { color: var(--accent); }

/* ---- Reading-plan bottom bar ---- */
/* Appears while reading a plan day: one-tap chips for the day's readings
   (current = filled, already-read = dimmed), plus auto-complete + next-day. */
.planbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; background: var(--bg-soft);
  border-top: 1px solid var(--rule); box-shadow: 0 -2px 14px var(--shadow);
}
.planbar[hidden] { display: none; }
.planbar-day {
  flex: 0 0 auto; font-family: var(--meta); font-size: 12.5px; font-weight: 700;
  color: var(--muted); white-space: nowrap;
}
.planbar-segs { display: flex; gap: 8px; overflow-x: auto; flex: 1 1 auto; scrollbar-width: thin; }
.planbar-seg {
  flex: 0 0 auto; font-family: var(--meta); font-size: 13px; font-weight: 500;
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--rule);
  background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.planbar-seg:hover { border-color: var(--accent); color: var(--accent); }
.planbar-seg.is-read:not(.is-current) { color: var(--muted); }
.planbar-seg.is-current { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.planbar-next {
  flex: 0 0 auto; font-family: var(--meta); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; border: 0;
  background: var(--accent-strong); color: #fff; cursor: pointer; white-space: nowrap;
}
.planbar-next:hover { background: #7d4310; }
.planbar-done {
  flex: 0 0 auto; font-family: var(--meta); font-size: 12.5px; font-weight: 700;
  color: var(--accent); white-space: nowrap;
}
.planbar-exit {
  flex: 0 0 auto; background: transparent; border: 0; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.planbar-exit:hover { color: var(--ink); }
/* Keep the last verses clear of the fixed bar while a plan is open. */
body.plan-reading .pane-content { padding-bottom: 104px; }

/* ---- Text-size control + read-aloud button ---- */
.textsize { position: relative; display: inline-flex; }
.textsize-ico { font-family: var(--serif); font-weight: 700; font-size: 15px; line-height: 1; }
.textsize-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow); padding: 8px 10px; white-space: nowrap;
}
.textsize-pop[hidden] { display: none; }
.textsize-step {
  font-family: var(--meta); font-weight: 700; font-size: 15px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 8px;
  width: 38px; height: 34px; cursor: pointer;
}
.textsize-step:hover { border-color: var(--accent); color: var(--accent); }
.textsize-label { font-family: var(--meta); font-size: 13px; color: var(--muted); min-width: 44px; text-align: center; }

.listen-btn[hidden] { display: none; }
.listen-btn .icon-listen { display: block; }
.listen-btn .icon-stop { display: none; }
.listen-btn.is-playing .icon-listen { display: none; }
.listen-btn.is-playing .icon-stop { display: block; }
.listen-btn.is-playing { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

/* ===========================================================================
   Split workspace (Phase 2) — 2–3 resizable columns on desktop, swipeable
   tabs on phones. A single pane keeps the one-reader layout above; these rules
   engage only once a second pane is added (body.split).
   =========================================================================== */
.add-pane-btn[disabled] { opacity: .35; cursor: default; }
.pane-close[hidden] { display: none; }

/* Draggable divider between columns (desktop split only). */
.divider {
  flex: 0 0 10px; align-self: stretch; cursor: col-resize;
  background: transparent; position: relative; touch-action: none;
}
.divider::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; transform: translateX(-50%); background: var(--rule);
}
.divider:hover::before, .divider:active::before { width: 3px; background: var(--accent); }

/* Active-pane accent ring — only meaningful with more than one pane open. */
body.split .pane.is-active { box-shadow: inset 0 0 0 2px var(--accent-strong); }

/* Full-height shell while split: each column scrolls on its own, the window
   does not. (Single-pane mode keeps normal page scroll, unchanged.) */
body.split { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.split .topbar { position: static; flex: 0 0 auto; }
body.split #paneTabs { flex: 0 0 auto; }
/* Stretch overrides the single-pane align-items:flex-start so each column fills
   the shell height and its .pane-content (not the window) is what scrolls. */
body.split #columns { flex: 1 1 auto; min-height: 0; align-items: stretch; overflow-x: auto; overflow-y: hidden; }
body.split .appfoot { display: none; }
body.split .pane { display: flex; flex-direction: column; min-height: 0; min-width: 280px; }
body.split .pane-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; max-width: none; }

body.split .pane-toolbar { position: static; flex: 0 0 auto; }

/* Desktop split columns: the toolbar WRAPS instead of crushing its controls to
   a few unreadable pixels. On the widest 2-pane layout everything fits on one
   row; as the column narrows the tools (then the selects) drop to a following
   row, each keeping a legible minimum width. Mobile uses its own rules below. */
@media (min-width: 521px) {
  body.split .pane-toolbar { flex-wrap: wrap; row-gap: 8px; }
  /* A clean two-row toolbar: the source + book + chapter share row one (the
     source ellipsises to make room rather than stacking or being crushed), and
     the tools sit right-aligned on row two. Predictable at 2 or 3 panes. */
  body.split .pane-nav-main { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; }
  body.split .pane-nav-tools { flex: 1 1 100%; min-width: 0; justify-content: flex-end; }
  body.split .pane-source { flex: 1 1 auto; min-width: 0; max-width: none; }
  body.split .pane-book { flex: 0 0 auto; min-width: 0; }
  body.split .pane-chapter { flex: 0 0 auto; min-width: 0; }
  body.split .pane-section { flex: 1 1 auto; min-width: 0; }
}

/* Mobile: one visible pane + a horizontal tab strip. */
.pane-tabs, .pane-tabs[hidden] { display: none; }
.pane.is-collapsed { display: none !important; }

@media (max-width: 520px) {
  body.split .pane-tabs:not([hidden]) {
    display: flex; align-items: stretch; gap: 6px;
    padding: 6px 8px; background: var(--bg-soft);
    border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: thin;
  }
  .pane-tab {
    display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto;
    background: var(--bg); border: 1px solid var(--rule); border-radius: 999px;
    padding: 2px 4px 2px 12px; max-width: 62vw;
  }
  .pane-tab.is-active { border-color: var(--accent-strong); background: var(--cream); }
  .pane-tab-label {
    font-family: var(--meta); font-size: 13px; font-weight: 600; color: var(--ink);
    background: transparent; border: 0; padding: 6px 2px; cursor: pointer;
    max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .pane-tab.is-active .pane-tab-label { color: var(--accent); }
  .pane-tab-close {
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    border: 0; background: transparent; color: var(--muted);
    font-size: 16px; line-height: 1; cursor: pointer;
  }
  .pane-tab-close:hover { background: var(--rule); color: var(--ink); }
  .pane-tab-add {
    flex: 0 0 auto; width: 36px; border-radius: 999px;
    border: 1px dashed var(--rule); background: transparent; color: var(--accent);
    font-size: 18px; line-height: 1; cursor: pointer;
  }
  /* The header add-pane button is redundant on phones (tab strip has ＋). */
  .add-pane-btn { display: none; }
}
