:root {
  --bg: #fbfaf7; --card: #ffffff; --text: #1b1f24; --muted: #5d6670; --line: #e3e0d8;
  --brand: #1f3a5f; --brand-2: #b5532a; --accent-bg: #eef3f9; --pick: #fff3d6;
  --font: "Noto Sans Tamil", "Nirmala UI", "Latha", "Tamil Sangam MN", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --read-scale: 1;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171b; --card: #1c2026; --text: #eceae4; --muted: #a3abb4; --line: #2c3239;
    --brand: #9cc0ea; --brand-2: #f0a47e; --accent-bg: #1f2833; --pick: #3a3220; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; font-size: 17px; }
a { color: var(--brand); }
small { font-size: .72em; color: var(--muted); font-weight: 400; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.sr, .skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--card); padding: 6px 10px; z-index: 10; }
button { font: inherit; cursor: pointer; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { text-decoration: none; display: flex; flex-direction: column; line-height: 1.15; }
.brand-ta { font-weight: 700; font-size: 1.2rem; color: var(--brand); }
.brand-en { font-size: .78rem; color: var(--muted); letter-spacing: .03em; }
.tabs { display: flex; gap: 4px; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 999px; color: var(--text); font-weight: 600; }
.tabs a small { display: none; }
@media (min-width: 560px) { .tabs a small { display: inline; } }
.tabs a[aria-current="page"] { background: var(--accent-bg); color: var(--brand); }

/* search */
.search { padding-bottom: 10px; position: relative; }
.search-row { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); }
.search input:focus { outline: none; border-color: var(--brand); }
.search button { padding: 0 16px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .search button { color: #14171b; } }
.search.big input { font-size: 1.15rem; padding: 14px 16px; }
.search.big .wrap { padding: 0; }
.results { list-style: none; margin: 6px 0 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.top .results { position: absolute; left: 16px; right: 16px; max-width: 828px; margin: 6px auto 0; }
.results li a, .results li.off, .results li.none { display: block; padding: 10px 14px; text-decoration: none; color: var(--text); border-top: 1px solid var(--line); }
.results li:first-child a, .results li:first-child.off, .results li:first-child.none { border-top: 0; }
.results li a:hover, .results li a.active { background: var(--accent-bg); }
.results .ta { display: block; font-weight: 600; }
.results .tl { display: block; font-size: .88rem; color: var(--muted); }
.results .first { display: block; font-size: .85rem; }
.results.full { position: static; box-shadow: none; }

/* home */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 1.6rem; margin: 0 0 14px; line-height: 1.3; }
.hero h1 span { display: block; font-size: 1rem; font-weight: 400; color: var(--muted); }
.hints { margin: 12px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: .9rem; }
.hint { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 12px; }
.hint:hover { border-color: var(--brand); }
h1 { font-size: 1.5rem; line-height: 1.3; }
h2 { font-size: 1.15rem; margin-top: 28px; }
.more { font-weight: 600; }

/* lists */
.list, .books { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
@media (min-width: 640px) { .list, .books { grid-template-columns: 1fr 1fr; } }
.list a, .books a, .books li.off { display: block; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); }
.list a:hover, .books a:hover { border-color: var(--brand); }
.list .ta, .books .ta { display: block; font-weight: 600; }
.list .tl, .books .en { display: block; font-size: .85rem; color: var(--muted); }
.books li.off { opacity: .45; }
.chapters { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.chapters a, .chapters li.off { display: block; text-align: center; padding: 10px 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); }
.chapters li.off { opacity: .35; }

/* song + bible pages */
.crumbs { font-size: .85rem; color: var(--muted); margin: 18px 0 0; }
.song-title { margin: 6px 0 4px; }
.tl-title { display: block; font-size: 1rem; font-weight: 400; color: var(--muted); }
.credit { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 0; font-size: .92rem; }
.credit div { display: flex; gap: 6px; }
.credit dt { color: var(--muted); }
.credit dd { margin: 0; font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.switch, .size { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.switch button, .size button { border: 0; background: none; padding: 7px 12px; color: var(--text); }
.switch button + button, .size button + button { border-left: 1px solid var(--line); }
.switch button[aria-pressed="true"] { background: var(--brand); color: var(--bg); }
.present-btn { border: 0; border-radius: 10px; padding: 7px 14px; background: var(--brand-2); color: #fff; font-weight: 700; }
.present-btn small { color: inherit; opacity: .85; }
@media (prefers-color-scheme: dark) { .present-btn { color: #14171b; } }

.lyrics { font-size: calc(1.12rem * var(--read-scale)); }
.sec { margin: 0 0 22px; }
.sec-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-2); margin: 0 0 4px; }
.sec-label small { text-transform: none; letter-spacing: 0; }
.line { margin: 0 0 4px; }
.line .ta, .line .tl { display: block; }
.view-both .line .tl { font-size: .82em; color: var(--muted); margin-bottom: 6px; }
.view-ta .line .tl, .view-tl .line .ta { display: none; }
.report { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 12px; }
.yt { font-weight: 600; }

.verses { font-size: calc(1.05rem * var(--read-scale)); }
.verse { display: grid; grid-template-columns: 2.2em 1fr; gap: 0 8px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.verse:hover { background: var(--accent-bg); }
.verse.picked { background: var(--pick); }
.verse .vn { grid-row: span 2; color: var(--brand-2); font-weight: 700; text-decoration: none; font-size: .85em; padding-top: .15em; }
.verse p { margin: 0; grid-column: 2; }
.verse .en { color: var(--muted); font-size: .95em; }
.view-ta .verse .en, .view-en .verse .ta { display: none; }
.view-en .verse .en { color: var(--text); font-size: 1em; }
@media (min-width: 760px) {
  .view-both .verse { grid-template-columns: 2.2em 1fr 1fr; gap: 0 18px; }
  .view-both .verse .vn { grid-row: auto; }
  .view-both .verse .en { grid-column: 3; grid-row: 1; }
  .view-both .verse .ta { grid-row: 1; }
}
.pager { display: flex; justify-content: space-between; margin: 24px 0; font-weight: 600; }
.notice { margin-top: 30px; }
.button { display: inline-block; padding: 10px 16px; background: var(--brand); color: var(--bg); border-radius: 10px; text-decoration: none; font-weight: 700; }

.foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 18px 0 28px; font-size: .9rem; }
.foot p { margin: 4px 0; }

/* show on screen */
.presenting { overflow: hidden; }
.present { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: flex; flex-direction: column; }
.stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3vh 4vw; overflow: hidden; background: #000; color: #fff; }
.stage.blank .slide { visibility: hidden; }
.slide { text-align: center; line-height: 1.35; font-family: var(--font); max-width: 100%; }
.slide p { margin: 0; }
.slide .s-song p, .slide .s-title p { white-space: nowrap; }
.slide .s-ta { font-weight: 600; }
.slide .s-tl, .slide .s-en { font-size: .62em; opacity: .8; margin-top: .6em; }
.slide .s-tl.s-main { font-size: 1em; opacity: 1; margin-top: 0; font-weight: 600; }
.slide .s-title .s-ta { font-size: 1.2em; }
.slide .s-ref { font-size: .45em; opacity: .7; margin-top: 1em; }
.present .bar { display: flex; gap: 6px; justify-content: center; align-items: center; padding: 8px; background: #111; flex-wrap: wrap; }
.present .bar button { background: #2a2a2a; color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; }
.present .bar small { color: #bbb; }
.present .count { color: #bbb; min-width: 4em; text-align: center; font-size: .9rem; }
.screen-only { background: #000; margin: 0; }
.screen-only .stage { position: fixed; inset: 0; }
.screen-help { font-size: 22px; opacity: .7; }

/* Bible version picker */
.versions { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 12px; }
.ver select { font: inherit; font-size: .9rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); max-width: 100%; }

/* copy / download buttons */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 18px; }
.actions button, .verse-actions button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 7px 12px; }
.actions button:hover, .verse-actions button:hover { border-color: var(--brand); }
.actions button:disabled { opacity: .5; cursor: progress; }
.verse-actions { display: flex; gap: 8px; margin: 2px 0 10px 2.8em; }
.verse-actions button { padding: 5px 12px; font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: #1b1f24; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .92rem; transition: .2s; z-index: 200;
  display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: #fff; color: #1b1f24; border-radius: 8px; padding: 5px 10px; font-weight: 700; }

/* printing (PDF): just the song, clean and black on white */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .top, .foot, .tools, .actions, .report, .crumbs, .yt, .skip, .toast, .verse-actions { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .song-title { font-size: 20pt; margin: 0; }
  .tl-title, small, .muted { color: #444 !important; }
  .lyrics { font-size: 13pt; }
  .sec { break-inside: avoid; }
  .sec-label { color: #000; }
  .view-both .line .tl { color: #444; }
  .song::after { content: "jesussongbook.com"; display: block; margin-top: 10mm; font-size: 9pt; color: #666; }
}
/* one compact row of four buttons, also on phones */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 560px; gap: 6px; }
.actions button { padding: 6px 4px; font-size: .88rem; line-height: 1.25; }
.actions button small { display: block; font-size: .72rem; }
.tools { gap: 6px; }
@media (max-width: 480px) { .tools .switch button, .tools .size button { padding: 6px 9px; } .present-btn small { display: none; } }
