:root{--paper:#fbfbf6;--ink:#292723;--muted:#77736a;--line:#deddd3;--accent:#79574d;--wash:#f1f0e8}*{box-sizing:border-box}html{scroll-padding-top:90px;scroll-behavior:smooth}body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.7 'Noto Serif SC','Songti SC',Georgia,serif}a{color:inherit;text-decoration:none}a:hover{color:var(--accent)}button,input,select,textarea{font:inherit}button{background:var(--ink);color:var(--paper);border:1px solid var(--ink);padding:.45em .9em;cursor:pointer;border-radius:3px}button:hover{background:var(--accent);border-color:var(--accent)}button:disabled{opacity:.45;cursor:wait}button.secondary{background:transparent;color:var(--ink);border-color:var(--line)}button.secondary:hover{background:var(--wash)}a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px}label{display:block;margin:1em 0;color:var(--muted);font-size:.9rem}input,select,textarea{display:block;width:100%;margin-top:.4em;padding:.5em .65em;border:1px solid var(--line);background:#fffefb;color:var(--ink);border-radius:3px}textarea{resize:vertical;min-height:100px;line-height:1.8}label.check-label{display:flex;align-items:center;gap:.7em}label.check-label input{width:auto;margin:0}h1,h2,h3{font-weight:500;line-height:1.4}h1{font-size:2.4rem;margin:.25em 0 .6em}h2{font-size:1.7rem}h3{font-size:1.4rem}.site-bar{height:68px;padding:0 4vw;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;background:var(--paper);position:sticky;top:0;z-index:10;font:14px/1.4 system-ui,sans-serif}.site-bar nav{display:flex;align-items:center;gap:1.2em}.muted{color:var(--muted)}.small{font-size:.8rem}.eyebrow{font:12px/1.5 system-ui,sans-serif;letter-spacing:.15em;color:var(--muted)}.heading-row{display:flex;justify-content:space-between;gap:2em;align-items:center}.shelf{max-width:1080px;margin:5em auto;padding:0 28px}.book-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:3.5em 2.5em;margin:3em 0}.book-cover{aspect-ratio:3/4;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#eae8dc;position:relative;border:1px solid #d7d3c5;box-shadow:4px 4px 0 #eeede4;padding:1.6em;text-align:center}.book-cover img{position:absolute;width:100%;height:100%;inset:0;object-fit:cover}.cover-title{font-size:1.5rem;letter-spacing:.15em}.cover-mark{font-size:11px;letter-spacing:.3em;position:absolute;bottom:2em}.book-card h2{font-size:1.3rem;margin:1.2em 0 .3em}.book-card p{font-size:.85rem;margin:.5em 0}.book-description{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.quiet-link{color:var(--muted);font-size:.8rem}.empty-state{grid-column:1/-1;padding:4em 0;color:var(--muted)}dialog{border:1px solid var(--line);border-radius:4px;background:var(--paper);color:var(--ink);padding:2em;width:min(680px,92vw);max-height:85vh}dialog::backdrop{background:#29272370}.actions,.dialog-heading{display:flex;gap:1em;align-items:center;justify-content:space-between}.reading-toc{position:fixed;left:3vw;top:100px;bottom:75px;width:235px;overflow:auto;font-size:.85rem}.toc-book-title{font-size:1rem;display:block;margin-bottom:1.5em}.reading-toc ol,#outline{list-style:none;padding:0;margin:0}.reading-toc li{padding:.35em 0 .35em calc(var(--depth)*12px);border-left:1px solid var(--line)}.reading-toc li a{display:block;padding-left:12px}.book-body{max-width:700px;margin:0 auto 0 max(300px,calc((100vw - 520px)/2));padding:2em 40px 7em}.book-front{padding:4em 0 3em;text-align:center;border-bottom:1px solid var(--line);margin-bottom:3em}.front-cover{max-width:220px;max-height:300px;margin-bottom:2em}.front-description{margin:2em auto 0;max-width:32em;text-align:left}.literary-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:2}.edition-picker{display:inline-block;text-align:left;min-width:150px}.book-section{padding-top:2em}.section-chapter{margin-top:3em;border-top:1px solid var(--line)}.section-label{font-size:.85rem;color:var(--muted);margin-bottom:0}.book-section>h2{margin:.3em 0 1em}.section-group>h2{font-size:1.6rem}.book-entry{padding:2.5em 0 2em;border-bottom:1px solid #eae9e0}.book-entry h3{margin:.3em 0 .5em}.entry-number{font-size:.85rem;color:var(--muted);margin:0}.byline{font-size:.9rem;color:var(--muted);margin:.5em 0 1.5em}.preface{font-size:.9rem;color:#666158;margin:1em 0 1.5em}.poem-content{font-size:1.13rem;margin:1.5em 0;letter-spacing:.035em}.footnote,.editorial-note{font-size:.82rem;color:var(--muted);margin:1.7em 0 1em}.editorial-note span{display:block;color:var(--accent);margin-bottom:.5em}.author-biography{font-size:.8rem;color:var(--muted);margin-bottom:1em}.source-link{display:inline-block;margin-top:1em}.book-credits{border-top:1px solid var(--line);margin-top:4em;padding:2em 0;font-size:.85rem}.book-credits span{color:var(--muted);margin-right:1em}.reading-controls{position:fixed;bottom:0;right:0;left:280px;display:flex;justify-content:center;gap:3em;background:var(--paper);border-top:1px solid var(--line);padding:10px}.toc-toggle{display:none}.editing-page{font-family:system-ui,'PingFang SC',sans-serif}.editor-heading{padding:1.5em 3vw 0;display:flex;align-items:baseline;gap:2em}.editor-heading h1{font-size:1.5rem}.editor-heading h1 span{font-size:.9rem;color:var(--muted)}#editor-status{font-size:.85rem}.editor-toolbar{display:flex;gap:.7em;align-items:center;flex-wrap:wrap;padding:0 3vw 1em;border-bottom:1px solid var(--line)}.editor-toolbar label{display:flex;align-items:center;gap:.7em;margin:0 0 0 auto}.editor-toolbar select{margin:0;max-width:200px}.editor-layout{display:grid;grid-template-columns:330px 1fr;max-width:1280px;margin:auto;min-height:75vh}.editor-outline{padding:1.5em;border-right:1px solid var(--line)}.outline-tools{display:flex;gap:.4em;flex-wrap:wrap;font-size:.8rem}#outline li{padding:3px 0 3px calc(var(--depth)*12px)}#outline button{width:100%;text-align:left;background:transparent;color:var(--ink);border-color:transparent;font-size:.85rem;padding:.45em .5em}#outline button[aria-current=true]{background:var(--wash);border-color:var(--line)}#outline .outline-section{font-weight:600}#editor-fields{padding:1.5em 3em;max-width:850px;width:100%;min-width:0}#editor-fields h2{font-size:1.3rem;margin-top:0}.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 1.2em}.form-help{font-size:.82rem;color:var(--muted)}.node-actions{display:flex;gap:.6em;flex-wrap:wrap;margin:2em 0}.node-actions .delete{color:#9a4536}.work-result{padding:1em 0;border-bottom:1px solid var(--line)}.work-result h3{font-size:1rem;margin:.2em 0}.work-result p{font-size:.8rem;white-space:pre-wrap;max-height:7em;overflow:auto;color:var(--muted)}#work-search{display:flex;gap:1em;align-items:flex-end}#work-search label{flex:1;margin:0}#work-search button{margin-bottom:1px}.error-status{color:#9a4536}.author-card{padding:1em 0;border-bottom:1px solid var(--line)}.author-card h3{font-size:1rem}.nullable-help{display:flex;gap:.5em;align-items:center;font-size:.8rem;color:var(--muted)}.nullable-help button{font-size:.75rem;padding:.2em .5em}.dirty-marker{color:var(--accent)}
@media(min-width:1500px){.book-body{margin-left:auto;margin-right:auto}.reading-toc{left:calc((100vw - 1180px)/2)}}@media(max-width:900px){.reading-toc{display:none;left:0;top:68px;bottom:60px;width:min(330px,85vw);padding:25px;background:var(--paper);border-right:1px solid var(--line);z-index:9}.reading-toc.is-open{display:block}.toc-toggle{display:inline-block}.book-body{margin:auto;padding:1.5em 25px 6em}.reading-controls{left:0}.editor-layout{grid-template-columns:250px 1fr}#editor-fields{padding:1.5em}.editor-toolbar label{margin-left:0}}@media(max-width:640px){.site-bar{padding:0 16px;height:64px}.site-bar nav{gap:.65em}.site-bar button{font-size:12px;padding:.45em .65em}.shelf{margin:3em auto;padding:0 22px}.heading-row{align-items:flex-start;gap:1em}h1{font-size:2rem}.heading-row>button{font-size:.85rem;white-space:nowrap}.book-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:2em 1.2em}.cover-title{font-size:1.2rem}.book-cover{padding:1em}.book-front{padding:2em 0}.poem-content{font-size:1.03rem;letter-spacing:0}.editor-heading{display:block;padding:1em 16px 0}.editor-heading h1{margin:0}.editor-toolbar{padding:0 16px 1em;font-size:.8rem}.editor-layout{display:block}.editor-outline{border-right:0;border-bottom:1px solid var(--line);padding:1em;max-height:310px;overflow:auto}#editor-fields{padding:1.5em 18px}.field-grid{grid-template-columns:1fr}.book-entry{padding:2em 0}.reading-toc{top:64px}.dialog-heading h2{font-size:1.3rem}dialog{padding:1.25em}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

.author-biography summary{cursor:pointer;list-style:none;width:fit-content;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:.3em}.author-biography summary::-webkit-details-marker{display:none}.author-biography[open] summary{margin-bottom:.5em}.author-biography .literary-text{font-size:.85rem;margin:0 0 1.5em}

.entry-date{font-size:.8rem;color:var(--muted);margin:.5em 0 1em;font-variant-numeric:tabular-nums}

/* Continuous reading: the spacing follows the original digital 南洋集. */
html.collection-reader{scrollbar-width:none}
html.collection-reader::-webkit-scrollbar{display:none}
.reading-page{-webkit-font-smoothing:antialiased}
.reading-page .book-body{padding-top:1.5rem;padding-bottom:6rem}
.reading-page .book-front{padding:2.5rem 0 2rem;margin-bottom:1.5rem}
.reading-page .front-cover{object-fit:contain;margin-bottom:1.25rem}
.reading-page .literary-text{line-height:1.7}
.reading-page .poem-content{font-size:1.1rem;line-height:1.55;letter-spacing:.015em;margin:.9rem 0 1.15rem}
.reading-page .book-entry{padding:1.7rem 0 1.35rem}
.reading-page .book-entry h3{font-size:1.45rem;margin:0 0 .4rem}
.reading-page .byline{margin:.25rem 0 .9rem}
.reading-page .entry-date{margin:.3rem 0 .8rem}
.reading-page .preface{margin:.85rem 0 1rem}
.reading-page .footnote,.reading-page .editorial-note{margin:1rem 0 .75rem;line-height:1.7}
.reading-page .book-section{padding-top:1.4rem}
.reading-page .section-chapter{margin-top:2.5rem;padding-top:2rem}
.reading-page .book-front + .section-chapter{margin-top:0;border-top:0;padding-top:1rem}
.reading-page .book-section>h2{margin:.3rem 0 .75rem}
.reading-page .section-group{margin-top:1.4rem;margin-bottom:1.8rem}
.reading-page .section-group .book-entry{border-bottom:0;padding:.35rem 0 .5rem}
.reading-page .section-group .book-entry + .book-entry{margin-top:.65rem}
.reading-page .section-group .book-entry h3{font-size:1.2rem}
.reading-page .section-group .entry-untitled .poem-content{margin:.5rem 0 .75rem}
.reading-page .reading-toc{overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;padding-right:8px}
.reading-page .reading-toc li{padding-top:.22rem;padding-bottom:.22rem;line-height:1.5}
.reading-toc a[aria-current=location]{color:var(--accent);font-weight:600;background:var(--wash)}
.reading-page .reading-controls{gap:1.5rem;padding:8px 15px;background:var(--paper)}
.reading-controls button{font-size:.8rem;padding:.35em .85em}
#reading-position{font:12px/1.5 system-ui,sans-serif;color:var(--muted);min-width:5em;text-align:center;align-self:center;font-variant-numeric:tabular-nums}
.toc-scrim{display:none}
@supports(content-visibility:auto){.reading-page .book-entry{content-visibility:auto;contain-intrinsic-size:auto 240px}}
@media(max-width:900px){
 .reading-page.toc-open{overflow:hidden}
 .reading-page .reading-toc{top:68px;bottom:53px;padding:24px 20px}
 .toc-scrim:not([hidden]){display:block;position:fixed;inset:68px 0 53px;background:#29272338;border:0;border-radius:0;z-index:8}
 .reading-page .book-body{padding-left:26px;padding-right:26px}
}
@media(max-width:640px){
 .reading-page .book-body{padding-left:22px;padding-right:22px}
 .reading-page .poem-content{font-size:1.05rem;line-height:1.6;letter-spacing:0}
 .reading-page .book-front{padding:1.6rem 0;margin-bottom:1rem}
 .reading-page .book-entry{padding:1.4rem 0 1rem}
 .reading-page .reading-toc{top:64px}
 .toc-scrim:not([hidden]){top:64px}
 .reading-page .section-group{margin-top:1rem}
}
.reading-page .section-group .entry-untitled{padding:.15rem 0 .25rem}
.reading-page .section-group .entry-untitled + .entry-untitled{margin-top:.25rem}
.reading-page .section-group .entry-untitled .poem-content{margin:.45rem 0 .65rem}
.reading-controls button:disabled{cursor:default}
.reading-page .reading-controls{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
/* Use the poem page's SVG action controls, with the reader's paper palette. */
.reading-page{--action-bg:#eeede5;--action-color:#77736a;--action-hover-bg:#e5e3d8;--action-hover-color:#292723;--action-shadow:rgba(41,39,35,.1)}
.reading-page .book-entry.entry-last{border-bottom:0}
.reading-page .reading-controls .action-btn{width:42px;height:42px;padding:0;font-size:inherit}
.reading-page .toc-toggle{display:none}
.reading-page .author-home{display:inline-flex;font-size:.8rem;margin-left:.25em;white-space:nowrap;vertical-align:baseline;text-decoration:none;color:var(--accent)}
.reading-page .author-home svg{width:14px;height:14px;align-self:center}
.reading-page .author-home:hover{text-decoration:underline;text-underline-offset:.2em}
@media(max-width:900px){.reading-page .toc-toggle{display:inline-flex}.reading-page .reading-toc{bottom:calc(59px + env(safe-area-inset-bottom))}.toc-scrim:not([hidden]){bottom:calc(59px + env(safe-area-inset-bottom))}}

.editing-page,.shelf{--action-bg:#eeede5;--action-color:#555149;--action-hover-bg:#e5e3d8;--action-hover-color:#292723;--action-shadow:rgba(41,39,35,.1)}
.editing-page .action-text-btn,.shelf .action-text-btn,.action-text-btn.secondary{border:0}
.site-bar .action-text-btn{--action-bg:#eeede5;--action-color:#555149;--action-hover-bg:#e5e3d8;--action-hover-color:#292723;--action-shadow:rgba(41,39,35,.1)}
body{--action-bg:#eeede5;--action-color:#555149;--action-hover-bg:#e5e3d8;--action-hover-color:#292723;--action-shadow:rgba(41,39,35,.1)}
/* Collection controls communicate through labels, icons and actual content. */
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.shelf-filter{margin:24px 0 32px}.shelf-search{display:flex;gap:12px}.shelf-search input{flex:1;min-width:0}.shelf-filters{display:flex;gap:16px;align-items:center;flex-wrap:wrap;margin-top:16px}.shelf-filters select{width:auto;max-width:100%;margin:0}.shelf-filters .mine-filter{display:flex;align-items:center;gap:8px;margin:0}.mine-filter input{width:16px;height:16px;accent-color:var(--accent)}.shelf-filters output{margin-left:auto;color:var(--muted)}
.collection-shelf svg,.editing-page svg,.arrange-page svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}.empty-state svg{width:32px;height:32px;opacity:.4}.site-bar>a:has(svg){display:inline-flex;align-items:center;padding:10px}.book-card>.action-btn{margin-top:10px}

/* ========================================================================
   UX pass: name the actions, calm the layout, keep the paper palette.
   Controls used to be bare glyphs; consequential ones now carry their label
   and only collapse to an icon when the viewport cannot afford the words.
   ======================================================================== */

/* --- labelled actions ------------------------------------------------- */
.btn-label{font:13px/1 system-ui,-apple-system,'PingFang SC',sans-serif;letter-spacing:.02em;white-space:nowrap}
.action-text-btn.primary{background:var(--ink);color:var(--paper)}
.action-text-btn.primary:hover{background:var(--accent);color:#fff}
.action-text-btn.is-on{background:#e3dfd2;color:var(--ink);box-shadow:inset 0 0 0 1px #cfc9b8}
.site-bar nav{gap:10px}
.site-brand{font-weight:600;letter-spacing:.04em}
.site-brand svg{width:18px;height:18px}

/* --- shelf ------------------------------------------------------------ */
.shelf{max-width:1140px;margin:0 auto;padding:44px 32px 96px}
.shelf-hero{max-width:40em}
.shelf-hero h1{font-size:2.6rem;margin:0}
.shelf-filter{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:32px 0 10px;padding:14px 16px;background:#f5f4ec;border:1px solid var(--line);border-radius:12px}
.shelf-search{flex:1 1 230px;min-width:0;position:relative;display:flex;align-items:center}
.shelf-search .search-icon{position:absolute;left:13px;top:50%;transform:translateY(-50%);color:var(--muted);display:inline-flex;pointer-events:none}
.shelf-search .search-icon svg{width:18px;height:18px}
.shelf-search input{flex:1;min-width:0;margin:0;height:40px;padding-left:40px;border-radius:10px;background:#fffefb}
.shelf-filter>.action-text-btn{height:40px;min-height:40px;flex:0 0 auto}
.filter-field{flex:0 1 auto;min-width:0}
.shelf-filter .mine-filter{display:flex;align-items:center;gap:8px;margin:0;font-size:.88rem;color:var(--ink);background:#fffefb;border:1px solid var(--line);border-radius:999px;height:40px;padding:0 14px;cursor:pointer;white-space:nowrap}
.clear-filters{display:inline-flex;align-items:center;gap:5px;font-size:.85rem;color:var(--accent)}
.clear-filters svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2}
.clear-filters:hover{text-decoration:underline;text-underline-offset:3px}
.result-count{margin-left:auto;color:var(--muted);font-size:.85rem;font-variant-numeric:tabular-nums}
.book-grid{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:3em 2.2em;margin:2.5em 0 0}
.book-card{display:flex;flex-direction:column}
.book-cover{border-radius:3px;transition:transform .2s ease,box-shadow .2s ease}
.book-card:hover .book-cover{transform:translateY(-4px);box-shadow:6px 8px 0 #e8e6da}
.cover-series{position:absolute;top:8px;left:8px;background:#fbfbf6e6;color:#5e5a50;font:11px/1 system-ui,sans-serif;letter-spacing:.12em;padding:5px 8px;border-radius:3px;box-shadow:0 1px 3px rgba(41,39,35,.12)}
.book-card h2{font-size:1.22rem;margin:1em 0 .35em;line-height:1.35}
.book-card .book-meta{display:flex;flex-wrap:wrap;align-items:center;gap:3px 5px;font-size:.76rem;color:var(--muted);margin:0 0 .5em}
.book-card .book-meta>span+span::before{content:'·';margin-right:5px;color:#c9c5b8}
.book-kind{padding:2px 8px}
/* The edit affordance sits on the cover, so no card gains an extra row. */
.cover-slot{position:relative;display:block}
.card-edit{position:absolute;right:8px;bottom:8px;background:#fbfbf6ee;color:var(--ink);border-color:#d7d3c5;box-shadow:0 1px 3px rgba(41,39,35,.14);opacity:0;transform:translateY(4px);transition:opacity .18s ease,transform .18s ease}
.book-card:hover .card-edit,.book-card:focus-within .card-edit{opacity:1;transform:none}
@media(hover:none){.card-edit{opacity:1;transform:none}}
.book-kind{background:var(--wash);border-radius:999px;padding:3px 9px;color:#5e5a50}
.meta-dot{color:#c4c0b3}
.book-description{font-size:.86rem;color:var(--muted);line-height:1.65;margin:0}
.card-edit{height:30px;min-height:30px;padding:0 11px;font-size:.78rem;border-radius:999px}
.card-edit:hover{background:var(--accent);color:#fdfbf7;border-color:var(--accent)}
.empty-state{display:flex;flex-direction:column;align-items:center;gap:14px;text-align:center}
.empty-state p{margin:0}
#new-dialog{overflow:auto;scrollbar-width:none}
#new-dialog::-webkit-scrollbar,#new-dialog .select2-results__options::-webkit-scrollbar{display:none}
#new-dialog .select2-results__options{scrollbar-width:none}
#new-dialog .actions{margin-top:1.8em}

/* --- reader: a centred two-column shell instead of a drifting margin --- */
.reading-shell{display:grid;grid-template-columns:262px minmax(0,1fr);gap:56px;max-width:1180px;margin:0 auto;padding:0 32px;align-items:start}
.reading-page .reading-toc{position:sticky;left:auto;top:92px;bottom:auto;align-self:start;width:auto;max-height:calc(100dvh - 160px);padding:4px 8px 24px 0}
.reading-page .book-body{max-width:760px;margin:0;padding:1.5rem 0 7rem}
.toc-book-title{font-size:1.02rem;font-weight:600;margin-bottom:1em;padding-bottom:.8em;border-bottom:1px solid var(--line)}
.toc-filter{position:relative;margin-bottom:14px}
.toc-filter span{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--muted);display:inline-flex;pointer-events:none}
.toc-filter svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8}
.toc-filter input{margin:0;height:34px;padding:0 10px 0 32px;font-size:.82rem;border-radius:8px}
.toc-empty{font-size:.8rem;color:var(--muted);padding:14px 12px}
.reading-toc li.toc-chapter{border-left-color:#cdc8b8}
.reading-toc li.toc-chapter>a{font-weight:600;color:var(--ink);letter-spacing:.03em}
.reading-toc li.toc-section>a{font-weight:600;color:#5e5a50}
.reading-toc li.toc-group>a{color:#5e5a50}
.reading-toc li.toc-entry>a{color:var(--muted)}
.reading-toc a{border-radius:0 4px 4px 0}
.reading-toc a:hover{background:var(--wash);color:var(--accent)}
.reading-toc a[aria-current=location]{box-shadow:inset 2px 0 var(--accent)}

/* reading progress sits on the header's own edge, so it costs no height */
.reading-progress{position:absolute;left:0;right:0;bottom:-1px;height:2px;background:transparent}
.reading-progress span{display:block;height:100%;width:0;background:var(--accent);transition:width .15s linear}
.reading-page .site-bar{position:sticky}
.bar-title{flex:1;min-width:0;margin:0 24px;text-align:center;color:var(--muted);font-size:.85rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:0;transition:opacity .2s}
.reading-page.is-scrolled .bar-title{opacity:1}

/* front matter: say how big the book is before the reader commits */
.front-stats{display:flex;justify-content:center;flex-wrap:wrap;gap:7px;font-size:.82rem;color:var(--muted);margin:.6rem 0 0;font-variant-numeric:tabular-nums}
.front-actions{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;margin-top:1.8rem}
.edition-picker{margin:0;display:inline-flex;align-items:center;gap:8px;font-size:.82rem}
.edition-picker select{margin:0;width:auto;height:42px;border-radius:10px;font-size:.85rem}
.resume-chip{display:inline-flex;align-items:center;gap:7px;font-size:.82rem;color:var(--accent);background:var(--wash);border:1px solid var(--line);border-radius:999px;padding:8px 15px}
.resume-chip:hover{background:#e9e7dc}

/* reader type size, remembered per visitor */
html[data-type-scale="s"]{--read-scale:.92}
html[data-type-scale="l"]{--read-scale:1.14}
html{--read-scale:1}
.reading-page .poem-content{font-size:calc(1.1rem * var(--read-scale))}
.reading-page .literary-text:not(.poem-content){font-size:calc(1rem * var(--read-scale))}
.reading-page .book-entry h3{font-size:calc(1.45rem * var(--read-scale))}
.reading-page .book-section>h2{font-size:calc(1.7rem * var(--read-scale))}
#type-size{height:42px;min-height:42px}

.reading-controls{border-radius:0}
.reading-page .reading-controls{gap:1rem;justify-content:center}
#reading-position{min-width:9em;font-size:12px}
#reading-position b{font-weight:600;color:#5e5a50}

@media(max-width:900px){
  .reading-shell{display:block;max-width:none;padding:0}
  .reading-page .book-body{margin:0 auto;padding-left:max(26px,env(safe-area-inset-left));padding-right:max(26px,env(safe-area-inset-right))}
  .reading-page .reading-toc{position:fixed;top:68px;bottom:calc(59px + env(safe-area-inset-bottom));left:0;width:min(330px,85vw);max-height:none;padding:22px 20px;background:var(--paper);border-right:1px solid var(--line);z-index:9;align-self:stretch}
  .bar-title{display:none}
}
@media(max-width:640px){
  .reading-page .book-body{padding-left:max(22px,env(safe-area-inset-left));padding-right:max(22px,env(safe-area-inset-right))}
}
@media(max-width:720px){
  .shelf{padding:28px 20px 80px}
  .shelf-hero h1{font-size:2.1rem}
  .shelf-filter{padding:14px;margin-top:24px}
  .result-count{margin-left:0;width:100%}
  .book-grid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:2.2em 1.2em}
  .site-bar nav .btn-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .site-bar nav .action-text-btn{width:42px;padding:0}
  .front-actions{flex-direction:column;gap:12px}
}

/* --- editor feedback, shared by both editing surfaces ----------------- */
.status-pill{display:inline-flex;align-items:center;gap:7px;margin:0;padding:7px 13px;border-radius:999px;background:var(--wash);color:#5e5a50;font-size:.82rem;border:1px solid transparent}
.status-pill:empty{display:none}
.status-pill svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.status-pill.is-dirty{background:#f6efe2;color:#8a5f36;border-color:#e6d7bd}
.status-pill.error-status{background:#f8eae7;color:#9a4536;border-color:#e8cfc9}

/* ---正文与出版资料 editor ---------------------------------------------- */
.editing-page .editor-heading{align-items:center;gap:16px;flex-wrap:wrap;padding:1.4em 3vw .2em}
.editing-page .editor-heading h1{margin:0}
.editor-toolbar{gap:10px;padding:1em 3vw 1em;align-items:center}
.toolbar-edition{display:flex;align-items:center;gap:10px;margin-left:auto}
.toolbar-edition label{margin:0;white-space:nowrap;font-size:.85rem}
.toolbar-edition select{margin:0;width:auto;max-width:230px;height:42px;border-radius:10px;font-size:.88rem}
/* Three short actions fit on one line; they do not each need a row. */
.editing-page .editor-outline{padding:18px 16px}
.outline-tools{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px}
.outline-tools .action-text-btn{height:34px;min-height:34px;font-size:.75rem;padding:0 8px;gap:4px;flex:0 1 auto;white-space:nowrap}
.outline-tools .action-text-btn svg{width:16px;height:16px}
#work-results .work-result .action-text-btn{margin-top:8px}
@media(max-width:900px){
  .toolbar-edition{margin-left:0;width:100%}
  .toolbar-edition select{flex:1;min-width:0;max-width:none}
}

.basket-pane #basket-list li{display:flex;align-items:center;gap:12px}
.basket-pane #basket-list .action-btn{width:34px;height:34px;flex:none}
.basket-pane #basket-list .action-btn svg{width:18px;height:18px}

/* The reader's footer bar follows the text column, not the window. */
.reading-page .reading-controls{left:0;right:0}
.reading-page .reading-controls>*{flex:none}

@media(max-width:720px){
  /* A wrapped meta line should not start with an orphaned separator. */
  .book-card .book-meta>span+span::before{content:none}
  .book-card .book-meta{gap:4px 10px}
}

/* --- select2, dressed in the same paper as everything else ------------- */
/* The stock theme is a Bootstrap grey; these rules restore our ink, rule
   colour and radii so a dropdown does not look pasted in from elsewhere. */
.select2-container{width:100%!important;vertical-align:middle}
.select2-container--default .select2-selection--single{height:42px;background:#fffefb;border:1px solid var(--line);border-radius:10px;transition:border-color .15s ease,box-shadow .15s ease}
.select2-container--default .select2-selection--single:hover{border-color:#c9c5b5}
.select2-container--default.select2-container--focus .select2-selection--single,.select2-container--default.select2-container--open .select2-selection--single{border-color:var(--accent);box-shadow:0 0 0 3px rgba(121,87,77,.12)}
.select2-container--default .select2-selection--single .select2-selection__rendered{line-height:40px;padding-left:12px;padding-right:30px;color:var(--ink);font-size:.92rem}
.select2-container--default .select2-selection--single .select2-selection__placeholder{color:var(--muted)}
.select2-container--default .select2-selection--single .select2-selection__arrow{height:40px;right:6px}
.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:var(--muted) transparent transparent}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent var(--muted)}
.select2-container--default.select2-container--disabled .select2-selection--single{background:var(--wash);opacity:.7}
.select2-dropdown{background:var(--paper);border:1px solid var(--line);box-shadow:0 10px 26px rgba(41,39,35,.14);overflow:hidden}
/* The edge meeting the closed box stays square: box and list read as one sheet. */
.select2-dropdown--below{border-radius:0 0 10px 10px}
.select2-dropdown--above{border-radius:10px 10px 0 0}
.select2-container--default .select2-results__option{padding:9px 12px;font-size:.9rem;color:var(--ink)}
.select2-container--default .select2-results__option[aria-selected=true]{background:var(--wash);font-weight:600}
.select2-container--default .select2-results__option--highlighted[aria-selected]{background:var(--accent);color:#fdfbf7}
.select2-container--default .select2-results__message{color:var(--muted);font-size:.86rem}
.select2-search--dropdown{padding:8px}
.select2-container--default .select2-search--dropdown .select2-search__field{height:34px;padding:0 10px;border:1px solid var(--line);border-radius:8px;background:#fffefb;color:var(--ink);font-size:.9rem}
.select2-container--default .select2-search--dropdown .select2-search__field:focus{outline:none;border-color:var(--accent)}
.select2-results__options{max-height:280px}

label>.select2-container{margin-top:.4em}
/* A field name and its reset share one line. */
.field-title{display:flex;align-items:center;gap:10px;min-height:1.6em}
#editor-fields .field-title>.action-text-btn,#editor-fields .field-title>button{height:24px;min-height:24px;padding:0 8px;font-size:.72rem;margin-left:auto;flex:none}
/* A pane title that carries its own action. */
.pane-title{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.pane-title>span{margin-right:auto}
.pane-title>.action-text-btn,.pane-title>button{height:32px;min-height:32px;font-size:.8rem;padding:0 11px;font-family:system-ui,'PingFang SC',sans-serif}
#editor-fields .nullable-help{display:none}

/* Pill-shaped pickers for the shelf's filter row. */
.filter-field .select2-container--default .select2-selection--single{height:40px;border-radius:999px}
/* A pill that only loses its bottom corners becomes half a capsule, so an open
   filter drops the pill entirely and squares off into the list below it. */
.filter-field .select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-radius:10px 10px 0 0}
.filter-field .select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-radius:0 0 10px 10px}
.filter-field .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:38px;font-size:.88rem;padding-left:14px}
.filter-field .select2-container--default .select2-selection--single .select2-selection__arrow{height:38px}
.filter-field .select2-container{width:auto!important;min-width:132px}

/* Compact pickers inside the editing panes and the reader's footer. */
.outline-pane .select2-container--default .select2-selection--single,.arrange-inspector .select2-container--default .select2-selection--single,.reading-controls .select2-container--default .select2-selection--single,.library-pane .select2-container--default .select2-selection--single{height:36px;border-radius:8px}
.outline-pane .select2-container--default .select2-selection--single .select2-selection__rendered,.arrange-inspector .select2-container--default .select2-selection--single .select2-selection__rendered,.reading-controls .select2-container--default .select2-selection--single .select2-selection__rendered,.library-pane .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:34px;font-size:.86rem}
.outline-pane .select2-container--default .select2-selection--single .select2-selection__arrow,.arrange-inspector .select2-container--default .select2-selection--single .select2-selection__arrow,.reading-controls .select2-container--default .select2-selection--single .select2-selection__arrow,.library-pane .select2-container--default .select2-selection--single .select2-selection__arrow{height:34px}
.edition-picker .select2-container{width:auto!important;min-width:180px}
.toolbar-edition .select2-container{width:auto!important;min-width:170px;max-width:240px}
.toolbar-edition .select2-container--default .select2-selection--single{height:40px;border-radius:10px}
.toolbar-edition .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:38px;font-size:.86rem}
.toolbar-edition .select2-container--default .select2-selection--single .select2-selection__arrow{height:38px}
/* A dialog lives in the top layer; its dropdown must sit above the backdrop. */
dialog .select2-container--open .select2-dropdown{z-index:10}

/* Shared scrolling policy for the shelf, reader, editor and arranger.
   Hide browser chrome without disabling wheel, touch or keyboard scrolling. */
*{scrollbar-width:none}
*::-webkit-scrollbar{display:none}
html :is(.reading-toc,.editor-outline,.work-result p,.basket-pane,.inspector-pane,.inspector-poem,#basket-list){scrollbar-width:thin;scrollbar-color:transparent transparent}
html :is(.reading-toc,.editor-outline,.work-result p,.basket-pane,.inspector-pane,.inspector-poem,#basket-list)::-webkit-scrollbar{display:block;width:4px;height:4px}
html :is(.reading-toc,.editor-outline,.work-result p,.basket-pane,.inspector-pane,.inspector-poem,#basket-list)::-webkit-scrollbar-track{background:transparent}
html :is(.reading-toc,.editor-outline,.work-result p,.basket-pane,.inspector-pane,.inspector-poem,#basket-list)::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}
html :is(.reading-toc,.editor-outline,.work-result p,.basket-pane,.inspector-pane,.inspector-poem,#basket-list):is(:hover,:focus-within){scrollbar-color:var(--accent) transparent}
html :is(.reading-toc,.editor-outline,.work-result p,.basket-pane,.inspector-pane,.inspector-poem,#basket-list):is(:hover,:focus-within)::-webkit-scrollbar-thumb{background:var(--accent);border-radius:4px}

/* Shared toolbar geometry and the explicit light/dark switch. */
html{color-scheme:light}
html[data-theme=dark]{color-scheme:dark;--paper:#1c1b19;--ink:#e4dfd5;--muted:#aaa397;--line:#454139;--accent:#995577;--wash:#292722}
body .action-text-btn{font:13px/1.2 system-ui,-apple-system,'PingFang SC',sans-serif}
.site-bar :is(.action-btn,.action-text-btn){height:42px;min-height:42px;box-sizing:border-box}
.site-bar .back-button{padding:0 12px;white-space:nowrap}
.theme-toggle>span{display:inline-flex}
.theme-toggle .theme-sun,html[data-theme=dark] .theme-toggle .theme-moon{display:none}
html[data-theme=dark] .theme-toggle .theme-sun{display:inline-flex}
body .action-text-btn.publish-action{background:#8e4437;color:#fff9ef;font-weight:600;box-shadow:0 2px 8px #66372a24}
body .action-text-btn.publish-action:hover{background:#713226;color:white}
body .action-text-btn[hidden]{display:none}
#reader-status{margin:1.2em 0 0;font:14px/1.6 system-ui,sans-serif;color:var(--accent)}
#reader-status:empty{display:none}
html[data-theme=dark] body,html[data-theme=dark] #collection-arranger .action-btn,html[data-theme=dark] :is(.action-btn,.action-text-btn,.shelf){--action-bg:#34312c;--action-color:#d4cec3;--action-hover-bg:#454037;--action-hover-color:#fff4e3;--action-shadow:#0004}
html[data-theme=dark] :is(input,select,textarea,.select2-container--default .select2-selection--single,.select2-container--default .select2-search--dropdown .select2-search__field){background:#24221e;color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.shelf-filter,.shelf-filter .mine-filter,.book-kind,.card-edit,.cover-series){background:var(--wash);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .book-cover{background:#302c25;border-color:var(--line);box-shadow:4px 4px 0 #131210}
html[data-theme=dark] .book-card:hover .book-cover{box-shadow:6px 8px 0 #131210}
html[data-theme=dark] :is(.preface,.reading-toc li.toc-section>a,.reading-toc li.toc-group>a,#reading-position b,.status-pill,.pending-toolbar){color:var(--muted)}
html[data-theme=dark] :is(.book-entry,.reading-toc li.toc-chapter){border-color:var(--line)}
html[data-theme=dark] :is(.arrange-row[aria-selected=true],.action-text-btn.is-on){background:#393228;box-shadow:inset 3px 0 var(--accent);color:var(--ink)}
html[data-theme=dark] .resume-chip:hover{background:var(--wash)}
html[data-theme=dark] .status-pill.is-dirty{background:#392e20;color:#e9c58f;border-color:#655036}
html[data-theme=dark] :is(.status-pill.error-status,.remove-node:hover){background:#3b2521;color:#f0b2a4;border-color:#704239}
html[data-theme=dark] :is(.error-status,.remove-node,.drift-gauge.is-over){color:#f0b2a4}
html[data-theme=dark] .action-text-btn.primary{background:var(--ink);color:var(--paper)}
html[data-theme=dark] .action-text-btn.publish-action{background:#ba7160;color:#17120f}
@media(max-width:720px){
 .site-bar{gap:8px}
 .site-bar nav{gap:6px}
 .site-bar .back-button{width:42px;padding:0;font-size:0;gap:0;overflow:hidden}
 .site-bar nav .publish-action{width:auto;padding:0 10px;gap:5px}
 .site-bar nav .publish-action .btn-label{position:static;width:auto;height:auto;margin:0;clip:auto;overflow:visible}
 .editing-page .site-bar{height:auto;min-height:64px;padding-top:10px;padding-bottom:10px;flex-wrap:wrap}
}
