:root {
  --bg: #fbfaf7; --surface: #ffffff; --ink: #1d1d1b; --muted: #6b6a66; --line: #e4e1da;
  --accent: #8a2c1f; --accent-ink: #ffffff; --mark: #fde9a8; --chip: #f2efe8;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161513; --surface: #1f1e1b; --ink: #ecebe6; --muted: #a3a19a; --line: #34322e;
          --accent: #e0846f; --accent-ink: #161513; --mark: #5b4a12; --chip: #2a2925; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); padding-bottom: 96px; }
a { color: var(--accent); }
main { max-width: 860px; margin: 0 auto; padding: 12px 16px 0; }
h1 { font: 600 2rem/1.2 var(--serif); margin: 1.2rem 0 .6rem; }
h2 { font: 600 1.25rem/1.3 var(--serif); margin: 1.6rem 0 .6rem; }
.top { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.brand { font: 700 1.1rem var(--serif); color: var(--ink); text-decoration: none; white-space: nowrap; }
.topsearch { flex: 1; min-width: 200px; }
input[type=search] { width: 100%; padding: 9px 12px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
button { font: inherit; cursor: pointer; }
.hero { padding: 1.5rem 0 .5rem; }
.hero h1 { font-size: 2.4rem; }
.hero p { color: var(--muted); max-width: 40em; }
.bigsearch { display: flex; gap: 8px; margin: 1rem 0; }
.bigsearch button, .play { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.play.small { padding: 2px 8px; font-size: .8rem; font-weight: 500; margin-left: 6px; }
.bookgrid, .chaptergrid { list-style: none; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.chaptergrid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.bookgrid a, .chaptergrid a { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.chaptergrid a { flex-direction: column; align-items: center; }
.bookgrid a:hover, .chaptergrid a:hover { border-color: var(--accent); }
.n { color: var(--muted); font-size: .8rem; }
.empty { opacity: .45; }
.ch { font-weight: 600; }
.note, .hint, .meta, .crumbs { color: var(--muted); font-size: .9rem; }
.crumbs a { color: var(--muted); }
.chnav { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.verse { padding: 10px 0; border-bottom: 1px solid var(--line); }
.vtext { font: 1.08rem/1.6 var(--serif); margin: 0 0 6px; }
.vn { font: 600 .75rem var(--sans); color: var(--muted); text-decoration: none; vertical-align: super; margin-right: 2px; }
.verse:target { background: var(--chip); }
.refs { background: var(--chip); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; font-size: .85rem; }
.refs[aria-expanded=true] { border-color: var(--accent); }
.hits { list-style: none; padding: 0; margin: 8px 0 0; }
.hit { padding: 10px 12px; margin: 6px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.hit .t { font-weight: 600; }
.hit .t a { color: var(--ink); text-decoration: none; }
.hit .t a:hover { text-decoration: underline; }
.hit .sub { color: var(--muted); font-size: .85rem; }
.hit .ctx { font-size: .95rem; margin: 4px 0 0; }
mark { background: var(--mark); color: inherit; padding: 0 1px; }
.more { margin: 6px 0; background: none; border: 1px solid var(--line); color: var(--accent); border-radius: 8px; padding: 4px 12px; }
.cited ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.transcript .segs { font: 1.02rem/1.7 var(--serif); margin: 0 0 1em; }
.seg { cursor: pointer; border-radius: 3px; }
.seg:hover { background: var(--chip); }
.seg.now { background: var(--mark); }
.auto { font: 500 .75rem var(--sans); color: var(--muted); background: var(--chip); border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.warn { background: var(--chip); padding: 8px 12px; border-radius: 8px; }
.foot { max-width: 860px; margin: 3rem auto 0; padding: 1rem 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.foot a { color: var(--muted); }
.player { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(0,0,0,.08); }
.player[hidden] { display: none; }
.player-info { flex: 0 1 30%; min-width: 0; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player audio { flex: 1; min-width: 0; height: 40px; }
#player-close { background: none; border: 0; color: var(--muted); font-size: 1.5rem; line-height: 1; }
.pager { display: flex; gap: 12px; align-items: center; margin: 1rem 0; }
@media (max-width: 560px) {
  h1, .hero h1 { font-size: 1.6rem; }
  .player { flex-wrap: wrap; }
  .player-info { flex-basis: calc(100% - 40px); }
  .player audio { flex-basis: 100%; }
}
.navlink { color: var(--ink); text-decoration: none; font-size: .95rem; white-space: nowrap; }
.navlink:hover { color: var(--accent); }
.proglist { list-style: none; padding: 0; margin: 0; columns: 2 16rem; column-gap: 24px; }
.proglist li { break-inside: avoid; padding: 5px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.proglist a { color: var(--ink); text-decoration: none; }
.proglist a:hover { color: var(--accent); }
.scope { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px 3px 12px; font-size: .9rem; margin: 4px 0 8px; }
.scope a { color: var(--muted); text-decoration: none; font-size: 1.1rem; line-height: 1; padding: 0 6px; }
.scope a:hover { color: var(--accent); }

/* Signed in (header) and the door pages (/auth). */
.who { display: inline-flex; gap: 10px; align-items: center; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.who .linkish { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; font: inherit; cursor: pointer; }
.door { display: grid; place-items: start center; min-height: 100vh; padding: 10vh 16px 16px; }
.door-main { width: 100%; max-width: 24rem; }
.door-main h1 { margin-top: 0; }
.invite { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); align-items: end; margin: 1rem 0; }
.invite label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
.invite input, .invite select { padding: 8px 10px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.invite button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.invite-link { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 14px; margin: 1rem 0; }
.invite-link code { word-break: break-all; }
.people { width: 100%; border-collapse: collapse; font-size: .92rem; }
.people th, .people td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.people .actions button { padding: 4px 10px; font-size: .85rem; }
.status-row-disabled td { color: var(--muted); }
