:root{
  --bg-1:#f8f1e0; --bg-2:#efe4c9;
  --surface:#fffdf8; --surface-2:#fbf3df;
  --line:#e7dcc0; --line-soft:#efe6cf;
  --ink:#2c2419; --muted:#8a7d68; --muted-2:#a89c85;
  --gold:#a9791f; --gold-deep:#7c5a16; --gold-light:#e0b94a;
  --gold-rgb:169,121,31;
  --accent-solid:#a9791f;
  --accent-fill:linear-gradient(135deg, var(--gold), var(--gold-deep));
  --text-body:#3a3123; --error:#a33;
  --glow:rgba(255,255,255,.5);
  --shadow-sm:0 1px 3px rgba(60,45,10,.08);
  --shadow-md:0 8px 24px rgba(60,45,10,.10);
  --shadow-lg:0 18px 44px rgba(60,45,10,.16);
  --radius:14px;
  color-scheme:light;
}
/* Dark theme: follows the device setting unless the reader picked Light
   or Dark with the theme switch (stored as data-theme on <html>). Filled
   gold buttons keep a deep gold fill so their white text stays readable;
   --gold-deep turns lighter because on dark surfaces it's used as text. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg-1:#1d1912; --bg-2:#15120d;
    --surface:#241f17; --surface-2:#2b251b;
    --line:#3b3427; --line-soft:#312a20;
    --ink:#eee5d3; --muted:#a6987e; --muted-2:#857966;
    --gold:#d2a246; --gold-deep:#e0b45e; --gold-light:#e8c46a;
    --gold-rgb:210,162,70;
    --accent-solid:#a9791f;
    --accent-fill:linear-gradient(135deg, #b48226, #7c5a16);
    --text-body:#ddd3bf; --error:#e8887c;
    --glow:rgba(255,220,150,.04);
    --shadow-sm:0 1px 3px rgba(0,0,0,.35);
    --shadow-md:0 8px 24px rgba(0,0,0,.35);
    --shadow-lg:0 18px 44px rgba(0,0,0,.45);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg-1:#1d1912; --bg-2:#15120d;
  --surface:#241f17; --surface-2:#2b251b;
  --line:#3b3427; --line-soft:#312a20;
  --ink:#eee5d3; --muted:#a6987e; --muted-2:#857966;
  --gold:#d2a246; --gold-deep:#e0b45e; --gold-light:#e8c46a;
  --gold-rgb:210,162,70;
  --accent-solid:#a9791f;
  --accent-fill:linear-gradient(135deg, #b48226, #7c5a16);
  --text-body:#ddd3bf; --error:#e8887c;
  --glow:rgba(255,220,150,.04);
  --shadow-sm:0 1px 3px rgba(0,0,0,.35);
  --shadow-md:0 8px 24px rgba(0,0,0,.35);
  --shadow-lg:0 18px 44px rgba(0,0,0,.45);
  color-scheme:dark;
}
*{ box-sizing:border-box; }
[hidden]{ display:none !important; }
::selection{ background:rgba(var(--gold-rgb),.25); }
html{ scroll-behavior:smooth; }
body{
  margin:0; color:var(--ink);
  font-family:'Lora',Georgia,'Times New Roman',serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--glow), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2) 340px, var(--bg-2) 100%);
  padding-bottom:70px; min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
h1,h2,.display{ font-family:'Playfair Display',Georgia,serif; }

.topbar{ height:5px; background:linear-gradient(90deg, var(--gold-deep), var(--gold-light), var(--gold-deep)); }

header{ padding:44px 20px 30px; text-align:center; animation:fadeInUp .6s ease both; }
header .eyebrow{
  font-size:11px; letter-spacing:.22em; text-transform:uppercase;
  color:var(--gold-deep); font-weight:600; margin-bottom:10px;
}
header h1{
  margin:0; font-size:clamp(28px,4vw,40px); font-weight:900;
  letter-spacing:.01em; line-height:1.15;
}
header .flourish{
  display:flex; align-items:center; justify-content:center; gap:14px;
  margin:16px auto 0; max-width:280px;
}
header .flourish::before, header .flourish::after{
  content:''; height:1px; flex:1;
  background:linear-gradient(90deg, transparent, var(--gold), transparent);
}
header .flourish span{ color:var(--gold); font-size:13px; }
header p{ margin:14px 0 0; color:var(--muted); font-size:14.5px; font-style:italic; }

.verse-search{
  display:flex; gap:8px; max-width:460px; margin:26px auto 0; padding:0 20px;
  animation:fadeInUp .7s .03s ease both;
}
.verse-search input{
  flex:1; font-family:'Lora',serif; font-size:14px; padding:11px 16px;
  border-radius:24px; border:1px solid var(--line); background:var(--surface);
  color:var(--ink); box-shadow:var(--shadow-sm); outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.verse-search input:focus{ border-color:var(--gold); box-shadow:0 0 0 3px rgba(var(--gold-rgb),.15); }
.verse-search button{
  font-family:'Lora',serif; font-size:13.5px; font-weight:600; padding:0 22px;
  border-radius:24px; border:1px solid var(--gold-deep); cursor:pointer;
  background:var(--accent-fill); color:#fff;
  box-shadow:var(--shadow-sm);
}
.verse-search button:hover{ filter:brightness(1.06); }
.verse-search-error{
  max-width:460px; margin:8px auto 0; padding:0 20px; text-align:center;
  font-size:12.5px; color:var(--error);
}

.browse-toggle-row{ text-align:center; margin:14px 0 0; }
.browse-toggle-btn{
  font-family:'Lora',serif; font-size:12.5px; color:var(--gold-deep); font-weight:600;
  background:none; border:none; cursor:pointer; padding:4px 8px;
}
.browse-toggle-btn:hover{ text-decoration:underline; }
.browse-toggle-btn.open .arrow{ display:inline-block; transform:rotate(180deg); }

.browse-panel{
  max-width:760px; margin:12px auto 0; padding:20px 24px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-md);
}
.browse-breadcrumb{
  font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted);
  margin-bottom:14px; padding-bottom:10px; border-bottom:1px solid var(--line-soft);
}
.browse-breadcrumb button{
  background:none; border:none; color:var(--gold-deep); font-family:inherit;
  font-size:inherit; text-transform:inherit; letter-spacing:inherit; cursor:pointer; padding:0;
}
.browse-breadcrumb button:hover{ text-decoration:underline; }
.browse-grid{ display:flex; flex-wrap:wrap; gap:7px; max-height:320px; overflow-y:auto; }
.browse-grid.books{ gap:8px 10px; }
.browse-item{
  font-family:'Lora',serif; font-size:13px; padding:7px 14px; border-radius:8px;
  border:1px solid var(--line); background:var(--surface-2); color:var(--ink);
  cursor:pointer; transition:background .15s ease, border-color .15s ease;
}
.browse-item:hover{ background:var(--surface); border-color:var(--gold-light); }
.browse-grid.chapters .browse-item, .browse-grid.verses .browse-item{
  min-width:38px; text-align:center; padding:7px 0;
}
.browse-section-label{
  flex-basis:100%; font-size:11px; text-transform:uppercase; letter-spacing:.08em;
  color:var(--gold-deep); font-weight:600; margin:10px 0 2px;
}
.browse-section-label:first-child{ margin-top:0; }
.browse-loading{ color:var(--muted); font-size:13px; font-style:italic; }

.today-card{
  display:block; width:calc(100% - 40px); font:inherit; color:inherit; cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  max-width:460px; margin:28px auto 0; position:relative;
  background:linear-gradient(160deg, var(--surface), var(--surface-2));
  border:1px solid var(--line); border-radius:var(--radius);
  padding:22px 28px 26px; text-align:center;
  box-shadow:var(--shadow-lg);
  animation:fadeInUp .7s .05s ease both;
}
.today-card::before{
  content:attr(data-badge); position:absolute; top:-11px; left:50%; transform:translateX(-50%);
  background:var(--accent-fill); color:#fff;
  font-size:10.5px; letter-spacing:.14em; text-transform:uppercase; font-weight:600;
  padding:5px 14px; border-radius:20px; box-shadow:var(--shadow-sm);
}
.today-card:hover{ transform:translateY(-2px); border-color:var(--gold-light); }
.today-card:focus-visible{ outline:2px solid var(--gold); outline-offset:3px; }
.today-card > span{ display:block; }
.today-card > span[hidden]{ display:none; }
.today-card .open-hint{ margin-top:14px; font-size:12.5px; color:var(--gold-deep); font-weight:600; letter-spacing:.04em; }
.today-card .date{ font-size:13.5px; color:var(--muted); margin:10px 0 10px; letter-spacing:.02em; }
.today-card .reading{ font-family:'Playfair Display',serif; font-size:26px; font-weight:700; color:var(--ink); }
.today-card.complete{ border-color:var(--gold-light); box-shadow:var(--shadow-lg), 0 0 0 3px rgba(var(--gold-rgb),.18); }
.today-card .progress-line{ margin-top:6px; font-size:12px; color:var(--muted); }
.today-card .minutes{ margin-top:8px; font-size:12px; color:var(--gold-deep); font-weight:600; letter-spacing:.02em; }

.plan-switch{
  display:flex; gap:6px; flex-wrap:wrap; justify-content:center;
  max-width:900px; margin:32px auto 0; padding:0 20px;
}
.plan-switch-btn{
  font-family:'Lora',serif; font-size:13px; font-weight:600; padding:9px 18px;
  border-radius:10px; border:1px solid var(--line); background:var(--surface);
  color:var(--muted); cursor:pointer; box-shadow:var(--shadow-sm);
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.plan-switch-btn:hover{ color:var(--ink); border-color:var(--gold-light); }
.plan-switch-btn.active{
  background:var(--accent-fill);
  color:#fff; border-color:var(--gold-deep);
}

.download-row{
  display:flex; align-items:center; justify-content:center; gap:8px; flex-wrap:wrap;
  max-width:900px; margin:14px auto 0; padding:0 20px;
}
.download-label{ font-size:12.5px; color:var(--muted); }
.download-label strong{ color:var(--ink); }
.download-btn{
  font-family:'Lora',serif; font-size:12px; font-weight:600; padding:5px 12px;
  border-radius:7px; border:1px solid var(--line); background:var(--surface);
  color:var(--gold-deep); cursor:pointer; transition:background .15s ease, border-color .15s ease;
}
.download-btn.confirm{ background:var(--error); border-color:var(--error); color:#fff; }
.progress-status{
  max-width:460px; margin:10px auto 0; padding:0 20px; text-align:center;
  font-size:12.5px; color:var(--muted); font-style:italic;
}
.download-btn:hover{ background:var(--surface-2); border-color:var(--gold-light); }

.back-bar{
  max-width:1160px; margin:0 auto; padding:22px 20px 0;
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
}
.plan-progress{ display:flex; align-items:center; gap:10px; font-size:12.5px; color:var(--muted); }
.plan-progress-track{ width:120px; height:6px; border-radius:3px; background:var(--line); overflow:hidden; }
.plan-progress-fill{
  width:0; height:100%; background:linear-gradient(90deg, var(--gold), var(--gold-deep));
  transition:width .3s ease;
}
.back-home-btn{
  font-family:'Lora',serif; font-size:13px; font-weight:600; padding:8px 16px;
  border-radius:8px; border:1px solid var(--line); background:var(--surface);
  color:var(--gold-deep); cursor:pointer; box-shadow:var(--shadow-sm);
}
.back-home-btn:hover{ border-color:var(--gold-light); }

.week-nav{
  display:flex; align-items:center; gap:14px; max-width:900px;
  margin:22px 0 0; padding:0 20px;
}
.week-nav button{
  font-family:'Lora',serif; cursor:pointer; background:var(--surface);
  border:1px solid var(--line); border-radius:8px; color:var(--ink);
  box-shadow:var(--shadow-sm);
}
#week-prev, #week-next{ width:34px; height:34px; font-size:15px; }
#week-prev:hover, #week-next:hover{ border-color:var(--gold-light); }
#week-label{ font-family:'Playfair Display',serif; font-size:18px; font-weight:700; min-width:80px; }
.week-today-btn{ font-size:12.5px; padding:8px 14px; color:var(--gold-deep); font-weight:600; }
.week-today-btn:hover{ border-color:var(--gold-light); }

nav.months{
  display:flex; flex-wrap:wrap; gap:8px; justify-content:center;
  max-width:900px; margin:34px auto 0; padding:0 20px;
}
nav.months button{
  font-family:'Lora',serif; font-size:13px; font-weight:500; padding:8px 16px;
  border-radius:20px; border:1px solid var(--line); background:var(--surface);
  color:var(--ink); cursor:pointer; box-shadow:var(--shadow-sm);
  transition:transform .15s ease, box-shadow .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
nav.months button:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); border-color:var(--gold-light); }
nav.months button.active{
  background:var(--accent-fill);
  border-color:var(--gold-deep); color:#fff; box-shadow:var(--shadow-md);
}

main{
  max-width:1160px; margin:22px auto 0; padding:0 20px;
  display:flex; align-items:flex-start; gap:28px; flex-wrap:wrap;
}

.table-col{
  flex:0 0 auto; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow-md); padding:22px 26px 10px;
}
caption{
  text-align:left; font-family:'Playfair Display',serif; font-size:21px;
  font-weight:700; margin-bottom:10px; padding-bottom:12px;
  border-bottom:2px solid var(--line-soft);
}
table{ width:auto; border-collapse:collapse; }
th, td{ text-align:left; padding:9px 16px 9px 0; font-size:14px; }
th{
  font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted);
  border-bottom:1px solid var(--line); padding-bottom:10px;
}
th.book, td.book{ padding-left:10px; font-weight:500; }
th.reading, td.reading{ text-align:center; padding-left:10px; }
td.day{
  width:30px; color:var(--muted-2); font-style:italic; text-align:left; font-size:13px;
}
tbody tr{ border-bottom:1px solid var(--line-soft); transition:background .15s ease; }
tbody tr:last-child{ border-bottom:none; }
tbody tr:hover{ background:var(--surface-2); }
tr.today{ background:linear-gradient(90deg, rgba(var(--gold-rgb),.12), rgba(var(--gold-rgb),.03)); }
tr.today td{ font-weight:600; }
tr.today td.day{
  color:var(--gold-deep); font-weight:700; font-style:normal;
  position:relative;
}
tr.today td.day::before{
  content:''; position:absolute; left:-26px; top:0; bottom:0; width:3px;
  background:var(--gold);
}
th.check, td.check{ width:24px; padding:9px 0 9px 6px; text-align:center; }
td.check input{ width:17px; height:17px; margin:0; vertical-align:middle; accent-color:var(--gold); cursor:pointer; }
tr.done td.day, tr.done td.book{ color:var(--muted-2); }
tr.done td.reading a{ color:var(--muted); text-decoration:line-through; text-decoration-color:rgba(var(--gold-rgb),.5); }
tr.done td.reading a.active{ color:#fff; }
tr td .flag{ color:var(--gold); cursor:help; margin-left:5px; font-size:12px; }

td.reading a{
  color:var(--gold-deep); text-decoration:none; font-weight:500;
  padding:3px 9px; border-radius:6px; transition:background .15s ease, color .15s ease;
}
td.reading a:hover{ background:rgba(var(--gold-rgb),.12); color:var(--ink); }
td.reading a.active{ background:var(--accent-solid); color:#fff; }

.passage-panel{
  flex:1 1 340px; min-width:290px; position:sticky; top:16px;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow-md);
  padding:26px 32px 10px; max-height:none; overflow-y:auto;
}
/* Alone in the row (Daily plan with its month table closed): keep a
   readable line length instead of stretching across the whole page. */
@media (min-width:761px){
  main:not(:has(.table-col:not([hidden]))) .passage-panel{ max-width:820px; margin:0 auto; }
}
.passage-panel::-webkit-scrollbar{ width:8px; }
.passage-panel::-webkit-scrollbar-thumb{ background:var(--line); border-radius:4px; }
.passage-panel::-webkit-scrollbar-thumb:hover{ background:var(--muted-2); }

.passage-empty{
  color:var(--muted); font-style:italic; font-size:14.5px; text-align:center;
  padding:30px 10px;
}
.passage-loading{ display:flex; align-items:center; gap:12px; color:var(--muted); font-size:14px; padding:20px 0; }
.spinner{
  width:18px; height:18px; border-radius:50%;
  border:2.5px solid var(--line); border-top-color:var(--gold);
  animation:spin .7s linear infinite; flex:none;
}

.passage-content{ animation:fadeIn .35s ease both; }
.passage-title-row{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.passage-content h2{
  margin:0 0 4px; font-size:22px; font-weight:700; color:var(--ink);
}
.listen-btn{
  flex:none; font-family:'Lora',serif; font-size:12px; font-weight:600; padding:6px 13px;
  border-radius:20px; border:1px solid var(--line); background:var(--surface);
  color:var(--gold-deep); cursor:pointer; white-space:nowrap;
  transition:background .15s ease, border-color .15s ease;
}
.listen-btn:hover{ background:var(--surface-2); border-color:var(--gold-light); }
.listen-btn.playing{ background:var(--accent-fill); color:#fff; border-color:var(--gold-deep); }
.passage-source{ font-size:11px; color:var(--muted-2); text-transform:uppercase; letter-spacing:.06em; margin-bottom:18px; }
.passage-content .chapter-head{
  font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--gold-deep);
  font-weight:600; margin:20px 0 6px; padding-top:14px; border-top:1px solid var(--line-soft);
}
.passage-content .chapter-head:first-child{ margin-top:0; padding-top:0; border-top:none; }
.passage-content p{ margin:0 0 12px; font-size:15px; line-height:1.75; color:var(--text-body); }
.passage-content sup{ color:var(--gold); font-weight:600; font-size:10px; margin-right:3px; }
.verse-highlight{
  background:rgba(var(--gold-rgb),.22); border-radius:3px; padding:1px 2px;
  box-shadow:0 0 0 1px rgba(var(--gold-rgb),.35);
}
.plan-bar{ margin-top:22px; padding-top:16px; border-top:1px solid var(--line-soft); }
.plan-bar-label{
  font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted);
  text-align:center; margin-bottom:10px;
}
.plan-bar-buttons{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.plan-bar-buttons button{
  font-family:'Lora',serif; font-size:13px; font-weight:600; padding:8px 14px;
  border-radius:8px; border:1px solid var(--line); background:var(--surface);
  color:var(--gold-deep); cursor:pointer; box-shadow:var(--shadow-sm);
  transition:background .15s ease, border-color .15s ease, color .15s ease;
}
.plan-bar-buttons button:hover:not(:disabled){ border-color:var(--gold-light); }
.plan-bar-buttons button:disabled{ opacity:.4; cursor:default; }
.plan-bar-buttons .plan-bar-done.done{ background:rgba(var(--gold-rgb),.12); border-color:var(--gold-light); }
.plan-bar-buttons .primary{
  background:var(--accent-fill); color:#fff; border-color:var(--gold-deep);
}
.passage-gw-link{
  display:inline-flex; align-items:center; gap:6px; margin-top:18px; font-size:12.5px;
  color:var(--gold-deep); text-decoration:none; font-weight:600;
  border-bottom:1px solid transparent; transition:border-color .15s ease;
}
.passage-gw-link:hover{ border-color:var(--gold-deep); }
.passage-error{ color:var(--error); font-size:14px; }

.version-panel{
  max-width:900px; margin:34px auto 0; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow-md); padding:20px 24px;
}
.version-panel-title{
  font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted);
  margin-bottom:12px; padding-bottom:10px; border-bottom:1px solid var(--line-soft);
}
#version-list{ display:flex; flex-wrap:nowrap; gap:8px; }
.version-btn{
  display:block; flex:1 1 0; min-width:0; text-align:left; font-family:'Lora',serif;
  font-size:13.5px; font-weight:500; padding:9px 12px;
  border-radius:8px; border:1px solid var(--line); background:var(--surface-2); color:var(--ink);
  cursor:pointer; transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.version-btn:hover{ background:var(--surface); border-color:var(--gold-light); }
.version-btn.active{
  background:var(--accent-fill);
  color:#fff; box-shadow:var(--shadow-sm);
}
.version-btn .full-name{
  display:block; font-size:10.5px; opacity:.75; font-weight:400; margin-top:1px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.notes{
  max-width:900px; margin:34px auto 0; padding:16px 22px;
  background:var(--surface-2); border:1px solid var(--line); border-radius:10px;
  font-size:12.5px; color:var(--muted); line-height:1.7;
}
.notes strong{ color:var(--ink); }
.notes a{ color:var(--gold-deep); }
.notes a:hover{ text-decoration:none; }

@keyframes fadeInUp{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }
@keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
@keyframes spin{ to{ transform:rotate(360deg); } }

@media (max-width:760px){
  .passage-panel{ position:static; max-height:none; max-width:none; height:80vh; height:80dvh; }
  .table-col{ padding:18px 16px 6px; width:100%; }

  /* Phones: the reading is what you land on. The month buttons stay at
     the top, and the Daily month table (closed until a month is tapped)
     opens right under them; the passage follows. The other plans' week /
     day navigation and tables come after the passage. main is flattened
     (display:contents) so its columns can be reordered around the
     navigation that sits outside it. */
  #reading-view{ display:flex; flex-direction:column; }
  #reading-view > *{ width:100%; }
  #reading-view > main{ display:contents; }
  .back-bar{ order:0; }
  nav.months{ order:1; margin-top:20px; }
  #daily-col{ order:2; }
  .passage-panel{ order:3; margin:16px 20px 0; width:auto; min-width:0; flex:none; }
  .week-nav{ order:4; }
  .table-col{ margin:20px 20px 0; width:auto; flex:none; }
  #week-col, #days-col{ order:5; }
  .version-panel{ order:6; }
  .notes{ order:7; }
  table{ width:100%; }
  main{ gap:20px; }
  #version-list{ flex-wrap:wrap; }
  .version-btn{ flex:1 1 90px; }
}

.theme-toggle{
  font-family:'Lora',serif; font-size:12px; font-weight:600; padding:6px 12px;
  border-radius:20px; border:1px solid var(--line); background:var(--surface);
  color:var(--gold-deep); cursor:pointer; box-shadow:var(--shadow-sm); white-space:nowrap;
}
.theme-toggle:hover{ border-color:var(--gold-light); }
.theme-toggle-home{ position:absolute; top:16px; right:16px; z-index:1; }
.back-bar-right{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
