* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --ink: #202020;
  --muted: #666;
  --line: #dfdfdf;
  --paper: #fff;
  --sidebar: #f8f8f8;
  --serif: Baskerville, "Baskerville Old Face", "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", Arial, sans-serif;
  --reading-font: Georgia, "Times New Roman", serif;
  --reader-size: 1.23rem;
}
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 1rem; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; background: none; border: 0; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #777; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: fixed; z-index: 20; top: -5rem; background: #fff; color: #111; padding: .65rem 1rem; }
.skip:focus { top: .5rem; }
.masthead { height: 4.6rem; border-bottom: 1px solid #cfcfcf; padding: 0 2.25rem; display: flex; align-items: center; gap: 1.2rem; }
.brand { display: flex; align-items: center; gap: .78rem; font-family: var(--serif); font-weight: 600; font-size: 1.73rem; letter-spacing: -.065rem; white-space: nowrap; }
a.brand { color: inherit; text-decoration: none; }
.icon { width: 1.08rem; height: 1.08rem; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; fill: none; flex: none; }
.workspace { height: calc(100vh - 4.6rem); height: calc(100dvh - 4.6rem); display: grid; grid-template-columns: clamp(16rem, 21.5vw, 20rem) minmax(0,1fr); }
#library { display: flex; flex-direction: column; min-height: 0; background: var(--sidebar); border-right: 1px solid #d4d4d4; }
.library-top { padding: 2.15rem 1.4rem 0; }
.overline, .row-meta { font-family: "IBM Plex Mono", Consolas, "Courier New", monospace; text-transform: uppercase; }
.overline { font-size: .76rem; font-weight: 500; letter-spacing: .14em; }
.overline { color: var(--muted); }
.library-heading { display: flex; align-items: center; justify-content: space-between; margin: .35rem 0 1.3rem; }
.library-heading h2 { font-family: var(--serif); font-weight: 500; font-size: 2.02rem; line-height: 1.1; margin: 0; letter-spacing: -.045em; }
#library-count { font-family: Consolas, monospace; font-size: .78rem; border: 1px solid #d9d9d9; border-radius: 3px; min-width: 1.55rem; padding: .1rem .32rem; text-align: center; color: #626262; }
.search { display: flex; align-items: center; gap: .6rem; border-radius: 4px; border: 1px solid #cdcdcd; background: white; padding: 0 .66rem; height: 2.52rem; color: #666; }
.search:focus-within { outline: 1px solid #666; }
.search input { width: 100%; min-width: 0; outline: 0; border: 0; color: #252525; font-size: .87rem; background: transparent; }
.search input:focus-visible { outline: 0; }
.search kbd { border: 1px solid #ddd; border-radius: 3px; min-width: 1.13rem; text-align: center; font-size: .75rem; color: #666; }
.filters { display: flex; gap: 1.35rem; border-bottom: 1px solid #d6d6d6; margin-top: 1.05rem; }
.filters button { padding: .68rem .05rem; margin-bottom: -1px; font-size: .85rem; display: flex; align-items: center; gap: .34rem; border-bottom: 2px solid transparent; color: #686868; }
.filters .icon { width: .85rem; height: .85rem; }
.filters button[aria-pressed=true] { border-color: #202020; color: #111; font-weight: 600; }
#text-list { padding: .65rem .8rem 1rem; flex: 1; overflow: auto; }
.work { position: relative; display: grid; grid-template-columns: 1.1rem minmax(0,1fr); gap: .72rem; width: 100%; text-align: left; padding: .97rem .8rem; border-radius: 3px; }
.work:hover { background: #ebebeb; }
.work[aria-current=true] { background: #242424; color: white; }
.work .icon { margin-top: .17rem; width: 1rem; height: 1rem; }
.row-title { display: block; font: 1.11rem/1.2 var(--serif); letter-spacing: -.02em; }
.row-title, .row-context { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
.row-context { -webkit-line-clamp: 2; font-size: .78rem; line-height: 1.35; margin-top: .27rem; }
.more-texts { margin: .7rem; }
.catalog-details { margin: 0 0 1rem; font-size: .9rem; line-height: 1.5; }
.catalog-details dt { color: #666; font-size: .78rem; margin-top: .7rem; }
.catalog-details dd { margin: .1rem 0 0; overflow-wrap: anywhere; }
.row-meta { display: block; font-size: .75rem; line-height: 1.4; letter-spacing: .05em; margin-top: .32rem; color: #636363; }
.work[aria-current=true] .row-meta { color: #d3d3d3; }
.empty { padding: .4rem .65rem; line-height: 1.6; color: #676767; font-size: .9rem; }
.source-box { padding: 1rem 1.4rem; border-top: 1px solid var(--line); }
.source-line { display: flex; align-items: center; gap: .55rem; margin-top: .25rem; font-size: .8rem; }
#file-info { margin-left: auto; }
.tools { display: flex; align-items: center; justify-content: space-between; min-height: 3.7rem; border-bottom: 1px solid #cecece; background: #fff; position: sticky; top: 0; z-index: 2; }
.tools button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; font-size: .875rem; min-height: 2.45rem; border-radius: 3px; padding: .35rem .55rem; }
.tools button:hover, .icon-button:hover { background: #eee; }
.chevron { width: .75rem; height: .75rem; }
.tools-right { display: flex; align-items: center; gap: .3rem; }
.aa { font: 1.23rem/1 Georgia, serif; }
.divider { height: 1.2rem; width: 1px; margin: 0 .45rem; background: #d6d6d6; }
.icon-button { width: 2.15rem; min-height: 2.15rem; display: inline-grid; place-items: center; padding: .3rem; border-radius: 3px; }
button[aria-pressed=true] .bookmark-icon { fill: currentColor; }
.section-label { display: flex; align-items: center; gap: .55rem; color: #5a5a5a; }
.section-label::before { content: ""; height: 1px; width: 1.6rem; background: #6c6c6c; }
#section-heading { margin: .52rem 0 0; font: 400 clamp(2.3rem,3.45vw,3.3rem)/1.06 var(--serif); letter-spacing: -.045em; text-wrap: balance; }
#prose { font-family: var(--reading-font); font-size: var(--reader-size); line-height: 1.69; color: #292929; }
#prose p { margin: 0 0 1.04em; white-space: pre-wrap; overflow-wrap: anywhere; }
#prose .page-break { max-width: 3rem; border: 0; border-top: 1px solid #bababa; margin: 1.6em auto; }
dialog { width: min(28rem,calc(100vw - 2rem)); max-height: 78dvh; padding: 1.45rem; border: 1px solid #aaa; border-radius: .45rem; color: #222; box-shadow: 0 1rem 4rem #0003; }
dialog::backdrop { background: #0005; }
.dialog-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .85rem; margin-bottom: 1rem; }
.dialog-title h2 { font: 1.8rem var(--serif); letter-spacing: -.035em; margin: 0; }
.dialog-item { padding: .66rem .65rem; width: 100%; text-align: left; border-radius: 2px; display: flex; gap: .7rem; font-size: .93rem; }
.dialog-item span { color: #666; min-width: 1.75rem; font-family: Consolas,monospace; }
.dialog-item:hover { background: #eee; }
.dialog-item[aria-current=true] { color: #fff; background: #252525; }
.dialog-item[aria-current=true] span { color: #ddd; }
.field { margin: 1rem 0; }
.field h3 { font: 600 .91rem var(--sans); margin: 0 0 .6rem; }
.choices { display: flex; gap: .3rem; flex-wrap: wrap; }
.choices button { font-size: .88rem; border: 1px solid #c8c8c8; border-radius: 3px; padding: .52rem .75rem; }
.choices button[aria-pressed=true] { color: white; background: #252525; border-color: #252525; }
#panel-body .file-name { display: block; overflow-wrap: anywhere; line-height: 1.5; padding: .8rem; background: #f4f4f4; margin-bottom: 1.2rem; }
#notice { position: fixed; z-index: 10; bottom: 1.25rem; left: 50%; transform: translateX(-50%); border-radius: 4px; background: #252525; color: white; padding: .7rem 1rem; margin: 0; font-size: .88rem; box-shadow: 0 3px 10px #0002; }
#notice:empty { display: none; }

.site-nav { display: flex; align-self: stretch; align-items: stretch; gap: clamp(.8rem,2vw,2rem); margin-left: 1.6rem; }
.site-nav a { display: inline-flex; align-items: center; color: #666; text-decoration: none; font-size: .91rem; border-bottom: 2px solid transparent; padding-top: 2px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #191919; border-color: #272727; }
.reader-app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.reader-app .masthead { flex: none; }
.workspace { flex: 1; min-height: 0; height: auto; position: relative; }
#reader { display: flex; flex-direction: column; min-width: 0; min-height: 0; outline: none; }
.reader-app { --sheet: #fff; --print: #252525; --secondary: #626262; --rule: #ddd; }
.reader-app[data-tone="Gray"] { --sheet: #e9e9e9; --print: #222; --secondary: #505050; --rule: #c4c4c4; }
.reader-app[data-tone="Night"] { --sheet: #191919; --print: #e7e7e7; --secondary: #bababa; --rule: #424242; }
#reader { background: var(--sheet); color: var(--print); }
.tools { flex: none; min-height: 3.5rem; padding: .25rem clamp(.75rem,2.7vw,2.75rem); background: var(--sheet); border-color: var(--rule); position: static; }
.tools-left { display: inline-flex; gap: .55rem; }
.tools button:hover, #reader-footer button:hover:enabled { background: color-mix(in srgb,var(--print) 9%,var(--sheet)); }
.tools button:focus-visible, #reader-footer button:focus-visible { outline-color: var(--secondary); }
#read-status { color: var(--secondary); font: .8rem/1.35 var(--sans); }
#reader-footer { display: flex; flex: none; align-items: center; justify-content: space-between; gap: .55rem; min-height: 3.25rem; padding: .3rem clamp(.65rem,2.6vw,2.7rem); border-top: 1px solid var(--rule); }
#reader-footer button { padding: .52rem .6rem; font-size: .86rem; border-radius: 3px; }
.footer-center { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .25rem 1rem; text-align: center; }
#exit-focus { text-decoration: underline; text-underline-offset: .17em; }
#reading { min-height: 0; min-width: 0; flex: 1; overflow: auto; padding: clamp(1.5rem,4.6vh,4rem) clamp(1.25rem,4.7vw,6rem); outline: none; }
#page-window { width: 100%; max-width: var(--measure,43.2rem); margin-inline: auto; }
#page-flow { width: 100%; }
.section-label { display: block; line-height: 1.55; color: var(--secondary); font-size: .77rem; }
.section-label::before { display: none; }
#section-heading { margin: .65rem 0 1.5rem; font-size: clamp(2.3rem,3.7vw,3.6rem); overflow-wrap: anywhere; }
#prose { line-height: var(--leading,1.69); color: var(--print); }
#prose p { text-align: var(--alignment,start); }
#prose .verse { text-align: start; }
.reader-table { margin: 1.5em 0; max-inline-size: 100%; min-inline-size: 0; text-align: start; }
.table-bar { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .35rem 1rem; margin-bottom: .5rem; }
.table-title { white-space: pre-line; font-size: .92em; line-height: 1.35; font-weight: 600; }
.table-toggle { color: var(--secondary); font: .875rem var(--sans); text-decoration: underline; text-underline-offset: .18em; padding: .3rem 0; }
.table-viewport { max-block-size: min(65dvh, 36rem); overflow: auto; border: 1px solid var(--rule); border-radius: 3px; }
.table-viewport:focus-visible, .table-toggle:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }
.reader-table table { min-inline-size: 100%; border-spacing: 0; font-family: var(--reading-font); font-size: .91em; line-height: 1.35; font-variant-numeric: tabular-nums; }
.reader-table :is(td, th) { padding: .45em .7em; border-block-end: 1px solid var(--rule); border-inline-end: 1px solid var(--rule); vertical-align: top; min-inline-size: 3.1em; white-space: pre-wrap; }
.reader-table :is(td, th):last-child { border-inline-end: 0; }
.reader-table thead { position: sticky; inset-block-start: 0; z-index: 2; color: var(--print); background: color-mix(in srgb, var(--print) 8%, var(--sheet)); }
.reader-table thead th { min-inline-size: 6em; vertical-align: bottom; text-align: start; }
.reader-table tbody th[scope="row"], .reader-table .pinned-heading { position: sticky; inset-inline-start: 0; z-index: 1; max-inline-size: min(14em, 45vw); overflow-wrap: anywhere; background: var(--sheet); font-weight: 500; text-align: start; }
.reader-table .pinned-heading { background: color-mix(in srgb, var(--print) 8%, var(--sheet)); font-weight: 700; }
.reader-table .table-number { text-align: end; white-space: pre; }
.reader-table .table-place { background: color-mix(in srgb, var(--print) 5%, var(--sheet)); text-align: start; }
.reader-table .table-note { color: var(--secondary); font-size: .93em; }
.reader-table .source-row, .table-plaintext { font: .88em/1.5 var(--mono, monospace); white-space: pre; tab-size: 8; }
.table-plaintext { margin: 0; padding: .75em; }
.paged #page-window { container-type: size; }
.paged .reader-table { break-inside: avoid; }
.paged .table-viewport { max-block-size: min(55cqh, 30rem); }
@media print {
  .table-toggle { display: none; }
  .table-viewport { overflow: visible; max-height: none; }
  .reader-table thead, .reader-table tbody th[scope="row"] { position: static; }
}
#prose .drop:first-letter { float: left; font: 3.45em/.85 var(--serif); padding: .07em .09em 0 0; }
.paged #reading { overflow: hidden; }
.paged #page-window { height: 100%; overflow: hidden; }
.paged #page-flow { height: 100%; column-count: 1; column-gap: 0; column-fill: auto; }
.paged #section-heading { break-after: avoid; }
.paged #prose p { orphans: 2; widows: 2; }
.paged #prose .drop:first-letter { float: none; font: inherit; padding: 0; }
.library-top { padding-top: 1.5rem; }
.library-heading { gap: .45rem; margin-bottom: 1rem; }
#library-count { margin-left: auto; }
.category-field { position: relative; display: grid; grid-template-columns: 4.55rem minmax(0,1fr); align-items: center; gap: .45rem; margin-top: .75rem; font-size: .84rem; }
.category-field span { color: #666; }
.category-field select { width: 100%; }
#authorship-note { margin: .45rem 0 0; color: #555; font: .8rem/1.45 var(--sans); }
.category-field select { border: 1px solid #ccc; border-radius: 3px; min-width: 0; margin-left: auto; padding: .42rem 1.6rem .42rem .5rem; font: inherit; background: white; color: #222; appearance: none; }
.category-field::after { content: ""; position: absolute; right: .65rem; width: .35rem; height: .35rem; border: solid #555; border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); pointer-events: none; }
.filters { margin-top: .65rem; }
.year-group { color: #606060; margin: 1rem .85rem .2rem; font: .78rem Consolas, monospace; }
.year-group:first-child { margin-top: .45rem; }
.scrim, #show-library { display: none; }
.sidebar-hidden .workspace, .focus-mode .workspace { grid-template-columns: minmax(0,1fr); }
.sidebar-hidden #library, .focus-mode #library, .focus-mode .masthead, .focus-mode .tools { display: none; }
.sidebar-hidden #show-library { display: inline-flex; }
.focus-mode #reading { padding-block: clamp(1.25rem,5vh,4rem); }
#panel .dialog-title { position: sticky; top: -1.45rem; background: white; z-index: 1; padding-top: .45rem; }
.choice-note { color: #5e5e5e; font-size: .85rem; line-height: 1.55; }
.random-action { display: block; border: 1px solid #d2d2d2; width: 100%; text-align: left; margin-bottom: .65rem; border-radius: 3px; padding: .8rem 1rem; }
.random-action:hover { background: #f3f3f3; }
.random-action strong, .random-action span { display: block; }
.random-action span { color: #646464; margin-top: .25rem; font-size: .85rem; }
.action { border: 1px solid #bbb; border-radius: 3px; padding: .55rem .75rem; color: inherit; font-size: .88rem; text-decoration: none; display: inline-block; }
@media(max-width:900px) and (min-width:761px) {
  .masthead { padding-inline: 1rem; gap: .8rem; }
  .site-nav { margin-left: .35rem; }
  .workspace { grid-template-columns: 15.5rem minmax(0,1fr); }
  .library-top { padding-inline: .9rem; }
}
@media(max-width:760px) {
  .masthead { height: auto; flex-wrap: wrap; padding: .65rem 1rem 0; gap: .5rem; }
  .brand { font-size: 1.42rem; gap: .55rem; }
  .brand img { width: 1.9rem; height: 1.9rem; }
  .site-nav { order: 3; width: 100%; margin: 0; justify-content: space-between; gap: .55rem; }
  .site-nav a { min-height: 2.45rem; font-size: .86rem; }
  .workspace { display: flex; } #reader { flex: 1; } #library { display: none; }
  .library-open #library { display: flex; position: absolute; z-index: 6; inset: 0 auto 0 0; width: min(86%,20rem); }
  .library-open .scrim { display: block; position: absolute; z-index: 5; inset: 0; background: #0005; width: 100%; }
  .library-top { padding-top: 1rem; }
  #show-library { display: inline-flex; } #show-library span, .settings-label { display: none; }
  .tools { min-height: 2.9rem; padding-inline: .65rem; }
  .tools-left, .tools-right { gap: .15rem; }
  #reading { padding: 1.5rem 1.25rem; }
  #section-heading { font-size: 2.5rem; }
  #reader-footer { padding: .3rem .45rem; }
  #reader-footer button { font-size: .81rem; padding-inline: .4rem; }
}
@media print {
  .reader-app, .workspace, #reader, #reading, #page-window, #page-flow { display: block !important; height: auto !important; overflow: visible !important; columns: auto !important; }
  .reader-app .masthead, #library, .tools, #reader-footer, #notice { display: none !important; }
}
.file-metadata { display: grid; gap: .85rem; padding: 0 0 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.file-metadata label { display: grid; gap: .35rem; font-size: .9rem; }
.file-metadata input, .file-metadata select { font: inherit; min-height: 2.3rem; padding: .3rem .55rem; border: 1px solid #bbb; border-radius: 3px; color: var(--ink); background: white; }
.file-metadata button { justify-self: start; }
.credit-tag {
  display: inline-block;
  padding: .14rem .42rem;
  border: 1px solid currentColor;
  border-radius: .2rem;
  font: 500 .78rem/1.4 var(--sans);
}
.credit-tag[hidden] { display: none; }
.work .credit-tag { margin-top: .4rem; }
.document-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .65rem;
  margin-bottom: 1.35rem;
  color: var(--secondary);
}
#document-source {
  max-width: 100%;
  padding: .12rem 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: .2em;
  font: .88rem/1.5 var(--sans);
}
.catalog-details dd { white-space: pre-line; overflow-wrap: anywhere; }
.citation a { display: block; width: fit-content; color: inherit; text-underline-offset: .18em; }
