:root {
  color-scheme: light;
  --paper: #f6f4ec;
  --panel: #fffef9;
  --ink: #222e27;
  --muted: #4f6056;
  --green: #225e46;
  --wash: #e3eee4;
  --rule: #8b978e;
  --gold: #946d34;
  --serif: "Source Serif 4", Georgia, serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #16201c;
  --panel: #202d27;
  --ink: #f4f1e6;
  --muted: #c4cdc5;
  --green: #a4deb8;
  --wash: #30483a;
  --rule: #829389;
  --gold: #d4af73;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 0 1rem; background: var(--paper); color: var(--ink); font: 1rem/1.55 Roboto, Arial, sans-serif; }
.container { max-width: 72rem; margin-inline: auto; }
a, summary { color: var(--green); }
a { text-underline-offset: .2em; }
button, input, select { color: inherit; background: var(--panel); border: 1px solid var(--rule); border-radius: .45rem; padding: .6rem .85rem; font: inherit; min-height: 44px; }
button, select, summary { cursor: pointer; }
button:hover, summary:hover, .chip:hover { background: var(--wash); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.skip { position: absolute; left: 1rem; top: -6rem; background: var(--panel); padding: .8rem; }
.skip:focus { top: .5rem; }
header { padding-bottom: 2rem; }
.mast, footer, footer nav, .controls-right, .mode-banner, .verse-ref-header { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.mast, footer, .verse-ref-header { justify-content: space-between; }
.mast { border-bottom: 1px solid var(--rule); padding: .9rem 0; }
#aboutBtn { text-transform: uppercase; letter-spacing: .16em; font-weight: 700; font-size: .8rem; color: var(--green); }
#themeBtn[aria-pressed="true"], #randomBtn { background: var(--green); color: var(--panel); }
h1,h2,h3,blockquote,.verse-entry p { font-family: var(--serif); }
h1 { font-size: clamp(2.45rem,6vw,4.6rem); line-height: 1.05; letter-spacing: -.04em; margin: 2rem 0 .55rem; }
.subtitle { margin: 0 0 .5rem; color: var(--muted); }
#aboutBtn { border: 0; padding-inline: 0; background: transparent; text-decoration: none; color: var(--green); }
.toolbar, .card, dialog { border: 1px solid var(--rule); border-radius: .75rem; background: var(--panel); }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; padding: 1rem; }
.search-box { flex: 1 1 16rem; min-width: 0; }
label { display: block; font-weight: 700; margin-bottom: .25rem; }
input { width: 100%; }
.mode-banner { justify-content: space-between; background: var(--wash); padding: .7rem 1rem; margin-top: .8rem; border-radius: .5rem; }
.stats { margin: 1.3rem 0 .6rem; font-size: .9rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,19rem),1fr)); gap: 1rem; align-items: start; }
.card { padding: clamp(1rem,2vw,1.6rem); border-top: 3px solid var(--gold); }
.single-mode .card { width: 100%; max-width: 52rem; }
h2 { font-size: 1.5rem; line-height: 1.2; margin: 0; }
.card-desc { margin: .45rem 0 1rem; color: var(--muted); }
.chip-container { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { background: var(--wash); border-radius: .35rem; padding: .35rem .6rem; font-size: .88rem; text-decoration: none; }
.chip:hover { text-decoration: underline; }
details { margin-top: 1rem; border-top: 1px solid var(--rule); }
summary { padding: .75rem .1rem; font-weight: 700; }
.verse-entry { border-left: 2px solid var(--gold); margin: .7rem 0 1.3rem; padding-left: 1rem; }
.verse-ref-header { font-size: .85rem; font-weight: 700; color: var(--muted); }
.verse-entry p, blockquote { font-size: 1.13rem; }
.verse-entry p { margin: .25rem 0; }
footer.container { margin-block: 2.5rem 1rem; padding-block: 1rem; border-top: 1px solid var(--rule); }
footer nav { gap: 1rem; }
dialog { color: var(--ink); width: min(39rem,calc(100% - 2rem)); max-height: 85dvh; padding: clamp(1.2rem,4vw,2rem); }
dialog::backdrop { background: rgb(10 20 15 / .72); }
blockquote { margin-inline: 0; border-left: 3px solid var(--gold); padding-left: 1rem; }
#tooltip { display: none; position: absolute; z-index: 2; background: var(--ink); color: var(--panel); max-width: min(22rem,calc(100vw - 20px)); border-radius: .4rem; padding: .7rem 1rem; }
@media (max-width: 36rem) {
  .search-box, .controls-right { width: 100%; }
  .controls-right > * { flex: 1 1 auto; }
}

#aboutBtn:hover { text-decoration: underline; }
#themeBtn { display: grid; place-items: center; width: 44px; padding: .6rem; }
#themeBtn svg { width: 1.2rem; height: 1.2rem; }
#themeBtn .icon-sun, [data-theme="dark"] #themeBtn .icon-moon { display: none; }
[data-theme="dark"] #themeBtn .icon-sun { display: block; }
[hidden] { display: none !important; }
#sizeControl { margin: 0; font-size: .9rem; }
#pagination:not([hidden]) { display: flex; flex-wrap: wrap; gap: .35rem; margin-block: 1.25rem; }
#pagination button[aria-current="page"] { background: var(--green); color: var(--panel); }
#pagination button:disabled { opacity: .5; cursor: default; }
.ref-toggle { display: block; margin: .5rem 0 0 auto; padding: .35rem .6rem; min-height: 32px; font-size: .85rem; }
footer a { text-decoration: none; font-weight: 700; transition: color .18s ease; }
footer a:is(:hover,:focus-visible) { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { footer a { transition: none; } }
