:root{
  --chrome:#6e1423; --chrome-dark:#43101a; --chrome-soft:#f3e8e6;
  --bg:#faf7f2; --surface:#ffffff; --text:#1a1a1a; --muted:#6b6560;
  --border:#e3ddd5; --accent:#6e1423; --scripture-bg:#ffffff; --scripture-text:#111111;
  --highlight:#ffe9a8; --verse-num:#8a7f78; --radius:12px;
  --font-size:18px;
}
[data-theme="blue"]{--chrome:#2f5d8a;--chrome-dark:#1d3f60;--chrome-soft:#e8eef4;--accent:#2f5d8a}
[data-theme="red"]{--chrome:#a33327;--chrome-dark:#6e2018;--chrome-soft:#f6e9e7;--accent:#a33327}
[data-theme="green"]{--chrome:#2e6b4f;--chrome-dark:#1d4634;--chrome-soft:#e7f0ea;--accent:#2e6b4f}
[data-theme="gold"]{--chrome:#96700f;--chrome-dark:#6b4f08;--chrome-soft:#f5eedd;--accent:#96700f}
[data-theme="purple"]{--chrome:#5b4a8a;--chrome-dark:#3d3160;--chrome-soft:#edeaf4;--accent:#5b4a8a}
[data-theme="teal"]{--chrome:#1f7a6d;--chrome-dark:#14544b;--chrome-soft:#e6f1ef;--accent:#1f7a6d}
[data-theme="brown"]{--chrome:#7a5230;--chrome-dark:#54371e;--chrome-soft:#f2ebe2;--accent:#7a5230}
[data-theme="slate"]{--chrome:#4a5568;--chrome-dark:#2d3748;--chrome-soft:#eceef1;--accent:#4a5568}
[data-theme="crimson"]{--chrome:#6e1423;--chrome-dark:#43101a;--chrome-soft:#f3e8e6;--accent:#6e1423}
[data-mode="dark"]{
  --bg:#171412; --surface:#221e1c; --text:#f2ede8; --muted:#a89f96;
  --border:#3a332f; --chrome-soft:#2c2622;
  --scripture-bg:#1c1917; --scripture-text:#f5f1ec;
}
*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);color:var(--text);font-size:16px;line-height:1.55;
  max-width:640px;margin:0 auto;min-height:100vh;position:relative}
button{font:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select,textarea{font:inherit;color:inherit}
a{color:var(--accent)}
.hidden{display:none!important}

/* Splash */
#splash{position:fixed;inset:0;background:#43101a;display:flex;flex-direction:column;
  align-items:center;justify-content:center;z-index:200;gap:18px}
#splash img{width:148px;height:148px;border-radius:28px;box-shadow:0 12px 40px rgba(0,0,0,.45)}
#splash .splash-name{color:#f5ede4;font-size:26px;letter-spacing:.35em;text-transform:uppercase;font-weight:600}
#splash .splash-sub{color:#c9a98f;font-size:13px;letter-spacing:.2em;text-transform:uppercase}

/* Header */
header.app-header{position:sticky;top:0;z-index:50;background:var(--chrome);color:#fff;
  display:flex;align-items:center;gap:10px;padding:10px 14px}
header.app-header img.mark{width:34px;height:34px;border-radius:8px;cursor:pointer;flex:none}
header.app-header .title{font-size:18px;font-weight:650;letter-spacing:.04em;cursor:pointer;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
header.app-header .hdr-btn{color:#fff;opacity:.92;padding:6px 8px;font-size:14px;border-radius:8px}
header.app-header .hdr-btn:active{background:rgba(255,255,255,.15)}

main{padding:0 0 96px}
.view{padding:18px 18px 8px}
.view h1{font-size:24px;font-weight:700;margin-bottom:4px}
.view h2{font-size:18px;font-weight:650;margin:22px 0 8px}
.view p.lede{color:var(--muted);margin-bottom:14px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-bottom:14px}
.card h3{font-size:16px;margin-bottom:6px}
.card p{color:var(--muted);font-size:14.5px}
.btn{display:inline-block;background:var(--chrome);color:#fff;padding:11px 18px;border-radius:10px;
  font-weight:600;font-size:15px;text-align:center}
.btn.ghost{background:transparent;color:var(--accent);border:1.5px solid var(--accent)}
.btn.block{width:100%}
.btn.small{padding:7px 12px;font-size:14px}
.btn:disabled{opacity:.45}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.row .grow{flex:1}
.muted{color:var(--muted);font-size:14px}
.small{font-size:13px}
hr.sep{border:none;border-top:1px solid var(--border);margin:18px 0}

/* Bottom nav */
nav.bottom{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:640px;
  background:var(--chrome);display:flex;z-index:60;padding-bottom:env(safe-area-inset-bottom)}
nav.bottom button{flex:1;color:rgba(255,255,255,.72);padding:11px 0 12px;font-size:12.5px;font-weight:600;
  display:flex;flex-direction:column;align-items:center;gap:2px}
nav.bottom button .ic{font-size:19px;line-height:1}
nav.bottom button.active{color:#fff}
nav.bottom button.active .ic{opacity:1}

/* Home */
.home-hero{padding:26px 18px 10px;text-align:center}
.home-hero img{width:96px;height:96px;border-radius:22px;margin-bottom:12px}
.home-hero h1{font-size:26px}
.home-hero p{color:var(--muted)}
.today-card{cursor:pointer}
.today-card .ref{font-size:19px;font-weight:700;color:var(--text)}
.today-card .meta{color:var(--muted);font-size:14px;margin-top:2px}
.progress{height:8px;background:var(--border);border-radius:99px;overflow:hidden;margin-top:10px}
.progress i{display:block;height:100%;background:var(--accent);border-radius:99px}
.notice{background:var(--chrome-soft);border:1px solid var(--border);border-radius:10px;
  padding:12px 14px;font-size:14px;margin-bottom:14px}

/* Bible */
.bible-toolbar{display:flex;gap:8px;align-items:center;padding:12px 14px;background:var(--surface);
  border-bottom:1px solid var(--border);position:sticky;top:52px;z-index:40;flex-wrap:wrap}
.bible-toolbar button.loc{background:none;border:0;padding:0;font:inherit;font-weight:700;font-size:17px;color:inherit;cursor:pointer;text-align:left;flex:1;min-width:120px}
.bible-toolbar button.loc::after{content:" \25BE";font-size:.75em;color:var(--accent)}
.bible-toolbar .nav-arrow{border:1.5px solid var(--accent);color:var(--accent);border-radius:99px;width:30px;height:30px;min-width:30px;font-size:20px;line-height:1;font-weight:700;background:none;cursor:pointer;padding:0}
.chip{border:1.5px solid var(--accent);color:var(--accent);border-radius:99px;padding:6px 12px;font-size:13.5px;font-weight:600}
.chip.on{background:var(--accent);color:#fff}
.chapter-wrap{background:var(--scripture-bg);color:var(--scripture-text);padding:20px 20px 30px;min-height:60vh}
.verse{font-size:var(--font-size);line-height:1.75;margin-bottom:10px;color:var(--scripture-text)}
.verse .vn{color:var(--verse-num);font-size:.68em;font-weight:700;margin-right:6px;cursor:pointer;
  padding:2px 4px;border-radius:5px;vertical-align:super}
.verse .vn:active{background:var(--chrome-soft)}
.verse.hl{background:var(--highlight);border-radius:6px}
.verse.hl-yellow{background:rgba(255,217,77,.55)}
.verse.hl-orange{background:rgba(255,159,67,.55)}
.verse.hl-pink{background:rgba(255,126,182,.55)}
.verse.hl-red{background:rgba(255,107,107,.55)}
.verse.hl-purple{background:rgba(167,139,250,.55)}
.verse.hl-blue{background:rgba(96,165,250,.55)}
.verse.hl-green{background:rgba(74,222,128,.55)}
.verse.sel{background:var(--highlight);border-radius:6px}
.hl-palette{margin-top:16px;text-align:center}
.hl-palette .swatches{display:flex;gap:10px;justify-content:center;margin-top:8px;flex-wrap:wrap}
.hl-swatch{width:34px;height:34px;border-radius:50%;border:2px solid var(--border);cursor:pointer;padding:0}
.hl-swatch:active{transform:scale(.92)}
.verse .w{cursor:pointer;border-radius:4px;padding:0 1px}
.verse .w.hl{background:#ffe08a}
.verse .w.hl-yellow{background:rgba(255,217,77,.55)}
.verse .w.hl-orange{background:rgba(255,159,67,.55)}
.verse .w.hl-pink{background:rgba(255,126,182,.55)}
.verse .w.hl-red{background:rgba(255,107,107,.55)}
.verse .w.hl-purple{background:rgba(167,139,250,.55)}
.verse .w.hl-blue{background:rgba(96,165,250,.55)}
.verse .w.hl-green{background:rgba(74,222,128,.55)}
.verse .w.sel{text-decoration:underline;text-decoration-style:dashed;text-decoration-thickness:2px;text-underline-offset:3px;text-decoration-color:var(--accent)}
.verse .w.ul{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}
.verse sup.strong{font-size:.6em;vertical-align:super;color:var(--accent);font-weight:700;margin-left:2px;cursor:pointer}
.verse sup.strong.off{display:none}
.chapter-nav{display:flex;justify-content:space-between;padding:14px 18px}
.chapter-nav button{color:var(--accent);font-weight:600;padding:8px 12px}
.loading{padding:40px 20px;text-align:center;color:var(--muted)}

/* Selection bar / sheets */
.sheet{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:100%;max-width:640px;
  background:var(--surface);border-top:1px solid var(--border);border-radius:16px 16px 0 0;
  padding:16px 18px calc(18px + env(safe-area-inset-bottom));z-index:90;box-shadow:0 -8px 30px rgba(0,0,0,.18);
  max-height:72vh;overflow:auto}
.sheet h3{margin-bottom:4px}
.sheet .actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.sheet .actions .btn{flex:1;min-width:100px}
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:80}
.picker-list{max-height:52vh;overflow:auto;margin-top:10px}
.picker-list button{display:block;width:100%;text-align:left;padding:11px 8px;border-bottom:1px solid var(--border);font-size:16px}
.picker-list button:active{background:var(--chrome-soft)}
.picker-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-top:12px}
.picker-grid button{border:1px solid var(--border);border-radius:8px;padding:10px 0;font-weight:600}
.picker-grid button:active{background:var(--accent);color:#fff}
.tabs{display:flex;gap:6px;margin-bottom:12px}
.tabs button{flex:1;padding:9px 0;border:1px solid var(--border);border-radius:99px;font-weight:600;font-size:14px}
.tabs button.on{background:var(--chrome);color:#fff;border-color:var(--chrome)}

/* Forms */
label.f{display:block;font-size:13.5px;font-weight:600;margin:14px 0 5px}
input.f,select.f,textarea.f{width:100%;padding:11px 12px;border:1.5px solid var(--border);border-radius:10px;background:var(--surface)}
textarea.f{min-height:120px;resize:vertical;line-height:1.6}
.field-err{color:#a33327;font-size:13.5px;margin-top:6px}

/* Study */
.list-item{display:block;width:100%;text-align:left;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:14px 16px;margin-bottom:10px}
.list-item .t{font-weight:650;font-size:16px}
.list-item .s{color:var(--muted);font-size:13.5px;margin-top:2px}
.list-item .p{color:var(--muted);font-size:14px;margin-top:6px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.editor{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px}
.editor textarea{border:none;min-height:220px;padding:4px 0}
.editor textarea:focus{outline:none}

/* Plan */
.plan-card{cursor:pointer}
.plan-card .days{font-size:14px;color:var(--muted)}
.estimate{background:var(--chrome-soft);border-radius:10px;padding:14px;margin:12px 0;font-size:15px;line-height:1.8}
.estimate b{float:right}
.day-row{display:flex;align-items:center;gap:10px;padding:11px 4px;border-bottom:1px solid var(--border)}
.day-row input[type=checkbox]{width:22px;height:22px;accent-color:var(--accent)}
.day-row.done .dref{opacity:.55;text-decoration:line-through}
.day-row .dref{font-weight:600;flex:1}
.code-box{font-family:ui-monospace,Menlo,Consolas,monospace;background:var(--bg);border:1px dashed var(--border);
  border-radius:8px;padding:12px;word-break:break-all;font-size:13px}

/* Settings */
.theme-balls{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:10px}
.theme-ball{border:2px solid transparent;border-radius:14px;padding:8px;text-align:center;background:var(--surface)}
.theme-ball.on{border-color:var(--accent)}
.theme-ball .ball{width:52px;height:52px;border-radius:50%;margin:0 auto 6px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}
.theme-ball .nm{font-size:13px;font-weight:600}
.theme-ball .nm::first-letter{text-transform:uppercase}
.seg{display:flex;border:1.5px solid var(--border);border-radius:10px;overflow:hidden}
.seg button{flex:1;padding:10px 0;font-weight:600;font-size:14.5px}
.seg button.on{background:var(--chrome);color:#fff}
.tier{border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-bottom:10px}
.tier h3{font-size:17px}
.tier .price{font-size:14px;color:var(--muted);margin:4px 0 8px}
.tier.current{border-color:var(--accent);border-width:2px}
.switch-row{display:flex;justify-content:space-between;align-items:center;padding:13px 0;border-bottom:1px solid var(--border);gap:12px}
.switch-row:last-child{border-bottom:none}
.switch-row .lbl{font-weight:600}
.switch-row .desc{font-size:13.5px;color:var(--muted)}
input[type=checkbox].switch{width:48px;height:28px;accent-color:var(--accent);flex:none}

/* Dialog */
.dialog{position:fixed;inset:0;z-index:120;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.5)}
.dialog .box{background:var(--surface);width:100%;max-width:480px;border-radius:18px 18px 0 0;padding:22px 20px calc(22px + env(safe-area-inset-bottom))}
.dialog h2{margin-bottom:4px}
.dialog .link{color:var(--accent);font-weight:600;font-size:14.5px}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:92px;background:#222;color:#fff;
  padding:10px 16px;border-radius:99px;font-size:14px;z-index:150;max-width:90vw;text-align:center}
.dict-panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin:14px 18px}
.dict-panel h3{font-size:16px}
.dict-panel .lex{color:var(--muted);font-size:14px;margin:4px 0 8px}
.dict-panel .def{font-size:15px;line-height:1.6}
.dict-panel .def b{font-weight:700}
@media (min-width:641px){
  .bible-toolbar{top:54px}
  .dialog{align-items:center}
  .dialog .box{border-radius:18px}
}
@media print{
  nav.bottom,header.app-header,.bible-toolbar,.chapter-nav,.sheet,.overlay{display:none!important}
  body{max-width:100%}
  .chapter-wrap{min-height:0}
}
/* Library */
.lib-book-meta{color:var(--muted);font-size:14px}
.link{color:var(--accent);font-weight:600;font-size:14.5px}
.lib-cover{display:block;max-width:220px;width:100%;height:auto;margin:14px 0 4px;border:1px solid var(--border);border-radius:6px}
.lib-cover-thumb{display:block;max-width:120px;width:100%;height:auto;margin-bottom:12px;border:1px solid var(--border);border-radius:6px}
.lib-portrait{display:block;max-width:200px;width:100%;height:auto;margin:0 0 8px;border:1px solid var(--border);border-radius:6px}
.lib-buy-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-top:1px solid var(--border)}
.lib-buy-row:first-child{border-top:0;padding-top:2px}
.lib-prose{font-family:Georgia,'Times New Roman',serif;font-size:var(--font-size);line-height:1.75;color:var(--scripture-text)}
.lib-prose .lib-p{margin-bottom:14px}
.lib-prose .lib-epigraph{font-style:italic;color:var(--muted);padding-left:14px;border-left:3px solid var(--border)}
.lib-qbox{border:1px solid var(--border);border-radius:10px;padding:14px 16px;margin-top:26px;background:var(--surface);color:var(--text)}
.lib-qbox h3{font-size:15px;margin-bottom:6px}
.lib-qbox ol{margin:6px 0 0 20px}
.lib-qbox li{margin-bottom:10px;font-size:15px;line-height:1.6}
.lib-qbox li:last-child{margin-bottom:0}

/* Focus mode: dim everything but the chapter. */
body.focus-mode .bible-toolbar,
body.focus-mode .chapter-nav,
body.focus-mode #appHeader .hdr-btn{opacity:.25}
body.focus-mode .chapter-wrap{padding-top:28px}
