/* Shared reading surfaces. Loaded after each page's legacy styles. */
:root { --reading-surface: #101d30; }
html[data-theme="leaf"] {
  --bg-main:#f6f0e3!important; --bg-darker:#eee5d3!important;
  --bg-card:#fffaf0!important; --bg-card-hover:#f0e5cd!important;
  --bg-card-active:#e9dcc0!important; --ink:#30291e!important;
  --ink-bright:#211b13!important; --ink-muted:#625b4e!important;
  --ink-dim:#736957!important; --lamp:#875316!important;
  --lamp-bright:#75430d!important; --lamp-dim:#87652e!important;
  --lamp-glow:rgba(135,83,22,.08)!important;
  --line:#d7cbb4!important; --line-bright:#ac8a52!important;
  --tulsi:#42674e!important; --tulsi-bg:#e7ede1!important;
  --reading-surface:#fffaf0;
  --bg:#f6f0e3!important; --bg2:#eee5d3!important;
  --fg:#30291e!important; --fg2:#625b4e!important;
  --accent:#875316!important; --gloss:#42674e!important;
}
body { background:var(--bg,var(--bg-main))!important; }
body::before { opacity:.35; }
:focus-visible { outline:2px solid var(--accent,var(--lamp)); outline-offset:4px; }
.theme-toggle,.filter-toggle {
  min-height:44px; padding:.55rem .85rem; border:1px solid var(--line);
  border-radius:10px; background:var(--bg2,var(--bg-card));
  color:var(--fg,var(--ink)); font:500 .82rem var(--font-ui); cursor:pointer;
}
.theme-toggle { margin-left:auto; flex-shrink:0; }
.top-bar,.nav,.gita-nav { align-items:center; flex-wrap:wrap; }
.theme-toggle:hover,.filter-toggle:hover { border-color:var(--lamp); }
html[data-theme="leaf"] .domain-pill,
html[data-theme="leaf"] .stat-tag,
html[data-theme="leaf"] .filter-pill,
html[data-theme="leaf"] .search-input-wrap input,
html[data-theme="leaf"] .quote-banner,
html[data-theme="leaf"] .resume-card,
html[data-theme="leaf"] .reader-toolbar,
html[data-theme="leaf"] .ls-bar { background:var(--bg-card)!important; color:var(--ink)!important; box-shadow:none!important; }
html[data-theme="leaf"] .brand h1 { text-shadow:none; }
html[data-theme="leaf"] .reader-card,
html[data-theme="leaf"] .social-card { background:var(--bg-card)!important; box-shadow:0 8px 30px #30291e08; }
html[data-theme="leaf"] .filter-pill.active { background:var(--lamp-glow)!important; border-color:var(--lamp)!important; }
body.library-page .wrap { max-width:50rem; }
body.library-page header { padding-bottom:1.5rem; }
body.library-page .stats-strip { display:none; }
body.library-page .brand h1 { font-size:clamp(2.8rem,8vw,3.8rem); line-height:1.3; }
body.library-page .brand .subtitle { max-width:29rem; margin:.65rem auto 0; line-height:1.6; font-style:normal; }
body.library-page a.card { padding:1.15rem 1.2rem; border-radius:12px; background:var(--bg-card); box-shadow:none; }
body.library-page a.card:hover { transform:translateY(-1px); background:var(--bg-card-hover); }
body.library-page .t { min-width:0; }
body.library-page .t .dv { display:block!important; font-size:1.3rem; line-height:1.6; }
body.library-page .t .rm { display:block!important; margin-top:.3rem; font-size:.9rem; line-height:1.5; color:var(--ink-muted); }
body.library-page .meta .n { font-size:.7rem; color:var(--ink-muted); }
body.library-page .section-title { margin-top:1.8rem; letter-spacing:.13em; }
.filter-toggle { display:none; }
.filter-pill { min-height:40px; }
/* Paused words remain readable; only an active dimming stage fades words. */
.stage:not(.dimmed) .tok,.stage:not(.dimmed) .punc { opacity:1!important; }
.stage.dimmed .tok:not(.now) { opacity:.55!important; }
.stage.dimmed .tok.now { opacity:1!important; }
.reader-toolbar { box-shadow:0 6px 24px rgba(0,0,0,.16)!important; }
.reader-toolbar .toolbar-btn { min-height:40px; }
/* The toolbar already offers settings; retain the header control as fallback. */
html:has(#btnReaderSettings) #setBtn { display:none; }
@media(max-width:600px) {
  body.library-page { padding-left:1rem; padding-right:1rem; }
  body.library-page header { margin-bottom:1.1rem; }
  body.library-page .top-bar { margin-bottom:.7rem; gap:.5rem; }
  body.library-page .brand .subtitle { font-size:.9rem; }
  body.library-page .continue-section { margin-bottom:1rem; }
  body.library-page .search-container { margin-bottom:.65rem; }
  .filter-toggle { display:flex; align-items:center; justify-content:space-between; width:100%; margin-bottom:.75rem; }
  .filter-controls[data-collapsed="true"] { display:none; }
  body.library-page a.card { gap:.7rem; padding:.95rem; }
  body.library-page .t .dv { font-size:1.16rem; }
  body.library-page .t .rm { font-size:.84rem; }
  body.library-page .meta { flex-shrink:0; }
  body.library-page .arrow-icon { display:none; }
  .theme-toggle { font-size:.76rem; }
}
@media(prefers-reduced-motion:reduce) { a.card { transition:none!important; } }
