:root{
  --paper:#101B31;
  --paper-2:#182642;
  --paper-3:#20304F;
  --ink:#D7E0EC;
  --ink-soft:#EDE4CE;
  --ink-faint:#6E85A0;
  --maroon:#C9A45C;
  --gold:#C9A45C;
  --gold-soft:#DCC28C;
  --gold-line:#C9A45C;
  --cream:#EDE4CE;
  --rule:#28395A;
  --shadow: rgba(0,0,0,0.45);
  --focus-ring:#DCC28C;
  --verse-size: 19px;
}
html[data-theme="light"]{
  --paper:#FAF6EC;
  --paper-2:#FFFFFF;
  --paper-3:#F1E9D6;
  --ink:#1E2A44;
  --ink-soft:#3C4A66;
  --ink-faint:#7A8398;
  --maroon:#8A6516;
  --gold:#8A6516;
  --gold-soft:#B08D3C;
  --gold-line:#C79A3D;
  --cream:#101B31;
  --rule:#E0D5BC;
  --shadow: rgba(16,27,49,0.10);
  --focus-ring:#6B4E0C;
}

*{box-sizing:border-box;}
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
html,body{margin:0; padding:0; max-width:100%;}
html{
  overflow-x:hidden;
  overflow-x:clip;
  scroll-behavior:smooth;
}
body{
  background:var(--paper);
  color:var(--ink);
  font-family:Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing:antialiased;
  min-height:100vh;
  min-height:100svh;
  background-image:
    radial-gradient(circle at 100% 0%, rgba(201,164,92,0.05), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(31,92,87,0.05), transparent 45%);
  background-attachment:scroll;
}
@media (hover:hover) and (pointer:fine){
  body{background-attachment:fixed;}
}
::selection{background:var(--gold-soft); color:var(--paper);}
a{color:inherit; text-decoration:none;}
:focus{outline:2px solid var(--focus-ring); outline-offset:2px; border-radius:4px;}
@supports selector(:focus-visible){
  :focus{outline:none;}
  :focus-visible{outline:2px solid var(--focus-ring); outline-offset:2px; border-radius:4px;}
}

#shell{display:block; min-height:100vh;}
#main{margin-left:0; padding:0 0 80px;}
.container{max-width:980px; margin:0 auto; padding:0 40px;}

#sidebar{
  width:100%;
  background:var(--uecf-ink);
  color:#D6E4F0;
  display:flex; flex-direction:row; align-items:center; flex-wrap:wrap;
  position:sticky; top:var(--uecf-header-h);
  overflow:visible; z-index:40;
  border-bottom:1px solid var(--rule);
  box-shadow:0 2px 14px rgba(0,0,0,0.18);
  padding:10px 20px; gap:18px;
}
#sidebar .brand{display:flex; align-items:center; flex-shrink:0;}
.brand-mark{display:flex; align-items:center; gap:10px;}
.brand-mark svg{flex-shrink:0;}
.brand-eyebrow{
  font-family:'Source Sans 3','Inter',sans-serif; font-size:0.625rem; letter-spacing:.16em;
  text-transform:uppercase; color:var(--uecf-gold-soft); font-weight:600;
}
.brand-title{font-family:'Fraunces',Georgia,serif; font-size:1.125rem; line-height:1.2; color:#fff; margin:0;}

.search-wrap{position:relative; flex:1 1 220px; min-width:160px;}
.search-box{
  display:flex; align-items:center; gap:8px;
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.38);
  border-radius:6px; padding:9px 12px;
}
.search-box:focus-within{border-color:var(--uecf-gold-soft);}
.search-box svg{flex-shrink:0; opacity:.7;}
#searchInput{
  background:none; border:none; outline:none; color:#fff;
  font-family:Georgia,serif; font-size:0.875rem; width:100%;
  appearance:none; -webkit-appearance:none;
}
#searchInput::-webkit-search-cancel-button,
#searchInput::-webkit-search-decoration{-webkit-appearance:none; display:none;}
#searchInput::placeholder{color:#9FB8D4; font-family:'Source Sans 3','Inter',sans-serif; font-size:0.8125rem;}
.search-results{
  position:absolute; left:0; right:0; top:100%;
  background:var(--paper); color:var(--ink);
  border-radius:0 0 8px 8px;
  box-shadow:0 18px 40px rgba(0,0,0,0.35);
  max-height:60vh; overflow-y:auto;
  display:none; z-index:60;
  border:1px solid var(--rule); border-top:none;
}
.search-results.open{display:block;}
.sr-item{
  display:flex; align-items:baseline; gap:10px;
  padding:10px 14px; border-bottom:1px solid var(--rule);
  cursor:pointer; font-size:0.875rem; width:100%; text-align:left;
  background:none; border-left:none; border-right:none; border-top:none;
  color:inherit; font-family:inherit;
}
.sr-item:last-child{border-bottom:none;}
.sr-item:hover,.sr-item:focus-visible{background:var(--paper-2);}
.sr-num{
  font-family:'Source Sans 3','Inter',sans-serif; font-weight:700; font-size:0.71875rem;
  color:var(--gold); flex-shrink:0; min-width:26px; text-align:left;
}
.sr-title{flex:1; font-family:Georgia,serif; text-align:left;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.sr-empty{padding:16px 14px; font-family:'Source Sans 3','Inter',sans-serif; font-size:0.8125rem; color:var(--ink-faint);}

.bar-tools{display:flex; gap:8px; flex:0 0 auto;}
.tool-btn{
  width:34px; height:34px; border-radius:50%;
  border:1px solid rgba(255,255,255,0.40);
  background:rgba(255,255,255,0.06);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; color:#E9F0F8; flex-shrink:0; padding:0;
  transition:border-color .15s ease, color .15s ease, background .15s ease;
}
.tool-btn:hover{border-color:var(--uecf-gold-soft); color:var(--uecf-gold-soft); background:rgba(228,198,133,.12);}
.icon-moon{display:none;}
html[data-theme="light"] .icon-sun{display:none;}
html[data-theme="light"] .icon-moon{display:block;}

.page-head{padding:40px 40px 0; max-width:980px; margin:0 auto;}
.breadcrumb{
  font-family:'Source Sans 3','Inter',sans-serif; font-size:0.78125rem; color:var(--ink-faint);
  display:flex; align-items:center; gap:8px; margin-bottom:18px; flex-wrap:wrap;
}
.breadcrumb a{color:var(--maroon); font-weight:600;}
.breadcrumb a:hover{text-decoration:underline;}
.page-head h1{
  font-family:'Fraunces',Georgia,serif; font-size:clamp(1.875rem,4.4vw,2.75rem);
  color:var(--gold); margin:0 0 8px; line-height:1.25;
}
.cat-en-line{font-family:'Source Sans 3','Inter',sans-serif; font-size:0.8125rem; color:var(--ink-faint); margin-bottom:22px;}
.rule-double{border-top:1px solid var(--rule); border-bottom:1px solid var(--rule); height:3px; margin:0 0 30px;}
.section-label{
  font-family:'Source Sans 3','Inter',sans-serif; font-size:0.6875rem; letter-spacing:.14em;
  text-transform:uppercase; color:var(--ink-faint); font-weight:700;
  margin:0 0 14px; display:flex; align-items:center; gap:10px;
}
.section-label::after{content:""; flex:1; height:1px; background:var(--rule);}

.chapters{max-width:980px; margin:0 auto; padding:0 40px 34px;
  scroll-margin-top:calc(var(--uecf-header-h) + var(--uecf-subbar-h, 76px) + 12px);}
.chap-grid{display:flex; flex-wrap:wrap; gap:6px;}
.chap-chip{
  min-width:40px; padding:8px 10px; border-radius:6px;
  background:var(--paper-2); border:1px solid var(--rule);
  font-family:'Source Sans 3','Inter',sans-serif; font-size:0.8125rem; font-weight:600;
  color:var(--ink); text-align:center; cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease;
}
@media (hover:hover) and (pointer:fine){
  .chap-chip:hover{
    transform:translateY(-2px); box-shadow:0 10px 22px var(--shadow);
    border-color:var(--gold-line); color:var(--gold);
  }
}
.chap-chip.is-current{
  background:var(--gold-line); border-color:var(--gold-line);
  color:var(--uecf-ink); cursor:default;
}

.chapter-nav-row{
  max-width:980px; margin:0 auto; padding:0 40px 30px;
  display:flex; justify-content:space-between; align-items:center; gap:16px;
  font-family:'Source Sans 3','Inter',sans-serif; font-size:0.8125rem;
}
.nv{
  display:flex; align-items:center; gap:8px; color:var(--maroon); font-weight:600;
  padding:9px 14px; border:1px solid var(--rule); border-radius:6px;
  background:var(--paper-2);
  transition:border-color .15s ease, transform .15s ease;
}
.nv:hover{border-color:var(--gold-line); transform:translateY(-1px);}
.nv.is-disabled{visibility:hidden; pointer-events:none;}

.icon-btn{
  width:36px; height:36px; border-radius:50%; border:1px solid var(--rule);
  background:var(--paper-2); display:flex; align-items:center; justify-content:center;
  cursor:pointer; color:var(--ink-soft); flex-shrink:0; padding:0;
  transition:border-color .15s ease, color .15s ease;
}
.icon-btn:hover{border-color:var(--gold-line); color:var(--maroon);}

.song-detail{max-width:980px; margin:0 auto; padding:0 40px 40px;}
.sd-card{
  background:var(--paper-2); border:1px solid var(--rule); border-radius:10px;
  padding:44px 48px; box-shadow:0 18px 50px var(--shadow); position:relative;
}
.sd-top{display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:6px;}
.sd-medallion{
  width:56px; height:56px; border-radius:50%; border:2px solid var(--gold-line);
  display:flex; align-items:center; justify-content:center;
  font-family:'Fraunces',Georgia,serif; font-size:1.25rem; color:var(--maroon);
  background:var(--paper-2); flex-shrink:0;
}
.sd-title{
  font-family:'Fraunces',Georgia,serif; font-size:clamp(1.5rem,3.2vw,2rem);
  color:var(--cream); line-height:1.3; margin:0 0 10px;
}
.sd-meta{
  display:flex; gap:10px 22px; flex-wrap:wrap; font-family:'Source Sans 3','Inter',sans-serif;
  font-size:0.78125rem; color:var(--ink-soft); margin-bottom:26px;
}
.sd-meta b{color:var(--ink); font-weight:600;}
.sd-meta .divider{color:var(--rule);}

.textBody{font-family:Georgia, 'Times New Roman', serif; font-size:var(--verse-size); line-height:1.95; color:var(--ink);}
.verse-block{margin:0 0 14px; scroll-margin-top:calc(var(--uecf-header-h) + var(--uecf-subbar-h, 76px) + 12px);}
.verse-block:last-child{margin-bottom:0;}
.v-num{
  font-family:'Source Sans 3','Inter',sans-serif; font-size:.62em; font-weight:700;
  color:var(--gold); vertical-align:.45em; margin-inline-end:.5em;
  scroll-margin-top:calc(var(--uecf-header-h) + var(--uecf-subbar-h, 76px) + 12px);
}
.verse-block:first-of-type::first-letter{
  float:left; font-size:300%; line-height:100%;
  margin-right:9px; padding:4px 8px 0 3px;
  color:var(--gold); font-family:Georgia, serif;
}
.verse-block.is-hit{
  background:var(--paper-3); border-radius:6px;
  box-shadow:0 0 0 6px var(--paper-3);
  transition:background .4s ease, box-shadow .4s ease;
}
.word{color:#E06B6E;}
html[data-theme="light"] .word{color:#AA2023;}
.person,.place{font-style:inherit;}

.page-actions{
  max-width:980px; margin:0 auto; padding:0 40px 50px;
  display:flex; gap:10px; justify-content:flex-end;
}

@media (max-width: 880px){
  #sidebar{padding:10px 14px; gap:10px;}
  .brand-title{font-size:1rem;}
  .search-wrap{order:3; width:100%; flex:1 1 100%;}
  .page-head{padding:26px 20px 0;}
  .chapters,.chapter-nav-row,.song-detail,.page-actions{padding-left:20px; padding-right:20px;}
  .sd-card{padding:26px 20px;}
  .container{padding:0 20px;}
}
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  *{animation-duration:.01ms !important; transition-duration:.01ms !important; scroll-behavior:auto !important;}
}
@media print{
  header.site-header,#sidebar,.breadcrumb,.chapters,.chapter-nav-row,
  .page-actions,footer.site-footer{display:none !important;}
  body{background:#fff; color:#000;}
  .sd-card{box-shadow:none; border:none; padding:0; background:#fff;}
  .sd-title,.v-num{color:#000;}
}
