body:has(.enc-sheet) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body:has(.enc-sheet) main { flex: 1; display: flex; flex-direction: column; }
.enc-sheet {
  --enc-green: #143028;
  --enc-gold: #c6a15a;
  --enc-paper: #f4f1e8;
  --enc-ink: #1c241f;
  --enc-muted: #5c675f;
  --enc-line: rgba(20, 48, 40, 0.16);
  background: var(--enc-paper);
  color: var(--enc-ink);
  flex: 1;
}
html[data-enc-theme="night"] body { background: #101a16; }
html[data-enc-theme="night"] .enc-sheet {
  --enc-paper: #101a16;
  --enc-ink: #f3ead7;
  --enc-muted: #c8bba4;
  --enc-line: rgba(198, 161, 90, 0.28);
  background: #101a16;
  color: #f3ead7;
}
.enc-sheet a { color: #8a6233; }
html[data-enc-theme="night"] .enc-sheet a { color: #e4c98a; }
.enc-identity {
  color: var(--enc-green);
  font-weight: 700;
  margin-top: -0.2rem;
}
html[data-enc-theme="night"] .enc-identity { color: var(--enc-gold); }
.enc-search, .enc-tools, .enc-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin: 1rem 0 1.4rem;
}
.enc-search input, .enc-search select, .enc-tools button {
  min-height: 44px;
  border: 1px solid var(--enc-line);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  padding: 0.45rem 0.8rem;
}
.enc-search input { flex: 1 1 16rem; }
.enc-series-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.6rem;
}
.enc-series-grid a, .enc-list, .enc-index {
  border: 1px solid var(--enc-line);
  border-radius: 16px;
  background: rgba(255, 250, 243, 0.45);
}
html[data-enc-theme="night"] .enc-series-grid a,
html[data-enc-theme="night"] .enc-list,
html[data-enc-theme="night"] .enc-index { background: rgba(20, 32, 28, 0.55); }
.enc-sheet .empty {
  background: transparent;
  color: var(--enc-muted);
  border-color: var(--enc-line);
}
.enc-series-grid a {
  display: grid;
  gap: 0.25rem;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  min-height: 7.5rem;
}
.enc-series-grid span, .enc-list span, .enc-index span { color: var(--enc-muted); }
.enc-list, .enc-index { list-style: none; padding: 0.4rem 0; margin: 0 0 1.4rem; }
.enc-list li, .enc-index li {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--enc-line);
}
.enc-list li:last-child, .enc-index li:last-child { border-bottom: 0; }
.enc-reading { width: min(68rem, calc(100% - 2rem)); }
.enc-font-sm { font-size: 1.02rem; }
.enc-font-md { font-size: 1.16rem; }
.enc-font-lg { font-size: 1.32rem; }
.enc-subtitle { font-family: var(--serif); font-size: 1.35rem; margin-top: 0; }
.enc-layout {
  display: grid;
  grid-template-columns: 16rem 1fr;
  gap: 1.5rem;
  align-items: start;
}
.enc-toc {
  position: sticky;
  top: 5.5rem;
  border-inline-start: 2px solid var(--enc-gold);
  padding-inline-start: 0.8rem;
}
.enc-toc ol { list-style: none; padding: 0; margin: 0.4rem 0 0; display: grid; gap: 0.35rem; }
.enc-toc .is-sub { padding-inline-start: 0.8rem; }
.enc-body { font-family: var(--serif); font-size: 1.2em; line-height: 2; }
.enc-body h2, .enc-body h3 { font-family: var(--sans); }
.enc-verse, .enc-quote {
  margin: 1.2rem 0;
  padding: 0.8rem 1rem;
  border-inline-start: 3px solid var(--enc-gold);
}
.enc-verse {
  background: rgba(198, 161, 90, 0.14);
  font-size: 1.15em;
  line-height: 2.15;
}
.enc-quote { background: rgba(20, 48, 40, 0.05); }
html[data-enc-theme="night"] .enc-quote { background: rgba(243, 234, 215, 0.06); }
.enc-fn { font-family: var(--sans); font-size: 0.75em; }
.enc-notes { font-family: var(--sans); font-size: 0.92rem; }
.enc-notes ol { padding-inline-start: 1.2rem; }
.enc-pager { justify-content: space-between; }
.enc-pager a { text-decoration: none; }
.enc-progress {
  position: sticky;
  top: 74px;
  z-index: 25;
  width: 100%;
  height: 4px;
  border: 0;
  appearance: none;
  background: transparent;
}
.enc-progress::-webkit-progress-bar { background: transparent; }
.enc-progress::-webkit-progress-value { background: #c6a15a; }
.enc-progress::-moz-progress-bar { background: #c6a15a; }

@media (max-width: 900px) {
  .enc-series-grid, .enc-layout { grid-template-columns: 1fr; }
  .enc-toc { position: static; }
}

@media print {
  .site-header, .site-footer, .admin-nav, .enc-tools, .enc-progress, .enc-toc, .enc-pager, .flashes { display: none !important; }
  .enc-sheet, html[data-enc-theme="night"] .enc-sheet { background: #fff; color: #000; }
  .enc-layout { display: block; }
  .enc-verse, .enc-quote { break-inside: avoid; }
}
