.bookshelf{max-width:1400px;margin:0 auto;padding:32px 40px 64px}.books-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px}.books-heading h1{font-size:30px}.books-heading a{color:var(--green)}.book-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:28px}.book-cover{position:relative;isolation:isolate;aspect-ratio: .72;overflow:hidden;border-radius:26px;background:linear-gradient(145deg,#758d83,#293e35);color:#fff;display:flex;flex-direction:column;justify-content:space-between;padding:26px}.book-cover:nth-child(3n+2){background:linear-gradient(145deg,#9c8160,#413529)}.book-cover:nth-child(3n){background:linear-gradient(145deg,#7891a6,#283e50)}.book-cover img{position:absolute;inset:0;z-index:-2}.book-cover:after{content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(180deg,#0007,transparent 50%,#000b)}.book-cover:hover{color:#fff}.book-cover h2{font-size:clamp(22px,2.3vw,34px);line-height:1.25;font-family:'Songti SC','SimSun',serif;overflow-wrap:anywhere}.book-cover-title p{margin-top:10px}.book-cover-bottom{display:flex;flex-direction:column;gap:6px;font-size:13px}.books-empty{padding:64px 0;color:var(--muted)}.book-reader{display:grid;grid-template-columns:220px minmax(0,800px);justify-content:center;column-gap:50px;row-gap:12px;padding:32px 40px 80px}.book-toc{position:sticky;top:32px;align-self:start;max-height:calc(100dvh - 64px);overflow:auto}.book-reader-actions{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:16px}.book-reader-actions a{display:inline-flex;align-items:center;min-height:36px;color:var(--green)}.book-reader-actions [data-book-owner]{margin-left:auto}.book-toc summary{font-size:18px;font-weight:600;cursor:pointer;margin-bottom:16px;overflow-wrap:anywhere}.book-toc nav a{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:28px;padding:3px 8px;font-size:14px;line-height:1.4;border-left:2px solid transparent}.book-toc nav a[aria-current]{color:var(--green);border-color:var(--green);background:var(--wash)}.book-toc-chapter+ .book-toc-chapter{margin-top:4px}.book-toc-chapter-title{font-weight:600}.book-toc-chapter ul{list-style:none;margin:0;padding:0 0 0 12px}.book-toc nav a span{min-width:0;overflow-wrap:anywhere}.book-toc nav a small{flex-shrink:0}.book-toc small{color:var(--muted)}.book-reading-main{min-width:0}article.book-reading{max-width:none;width:100%;margin:0;padding:24px 0}.book-reading .prose{margin:0;font-size:17px;line-height:1.5;overflow-wrap:anywhere}.book-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid var(--line);padding:18px 0}.book-pagination select{font:inherit;color:inherit;background:var(--paper);border:1px solid var(--line);padding:5px}.book-notes{margin-top:12px}.book-notes summary{cursor:pointer}.book-notes textarea{width:100%;margin:12px 0;padding:12px;background:var(--card);color:var(--ink);border:1px solid var(--line);font:inherit}.book-notes button,.book-editor button{border:1px solid var(--line);background:var(--paper);border-radius:6px;padding:6px 12px;font:inherit}.book-notes button{margin-right:12px}.book-notes [role=status]{font-size:13px}.book-audio{position:sticky;bottom:0;display:flex;flex-wrap:wrap;align-items:center;gap:12px;background:var(--paper);border-top:1px solid var(--line);padding:12px 0;margin-top:24px}.book-audio audio{height:40px;flex:1;min-width:180px;max-width:100%}.book-audio>span{font-size:13px;color:var(--muted)}.book-audio a{font-size:13px;color:var(--green)}.book-editor{padding:24px 32px}.book-editor .books-heading h1{font-size:22px}.book-editor-workspace{display:grid;grid-template-columns:270px minmax(0,1fr);gap:28px}.book-editor-fields{display:flex;flex-direction:column;gap:12px}#book-settings>summary,#book-outline>summary{display:list-item;cursor:pointer;padding:8px 0}.book-editor label{display:flex;flex-direction:column;gap:5px;font-size:13px}.book-editor input,.book-editor select{width:100%;min-width:0;font:inherit;padding:6px;background:var(--paper);color:var(--ink);border:1px solid var(--line);border-radius:4px}.book-editor input[type=file]{font-size:12px;border:0;padding:0}.book-editor-hint{font-size:12px;color:var(--muted)}#book-cover-preview{height:140px;width:100px;object-fit:cover}.book-editor-body{min-width:0}.book-editor-actions{display:flex;flex-wrap:wrap;gap:8px}#book-publish{background:var(--green);color:var(--paper)}#book-editor-status{font-size:13px;min-height:30px;margin:10px 0}#book-markdown{width:100%;height:calc(100dvh - 300px);min-height:320px;resize:vertical;background:var(--paper);color:var(--ink);border:1px solid var(--line);padding:18px;font:14px/1.6 var(--mono)}#book-preview{padding:16px;max-height:calc(100dvh - 200px);overflow:auto}.book-reader :focus-visible,.book-editor :focus-visible{outline:2px solid var(--green);outline-offset:3px}.book-editor button:disabled{opacity:.5;cursor:wait}#book-note-quote{white-space:pre-wrap;color:var(--muted);border-left:2px solid var(--line);padding-left:12px}.book-notes [hidden],.book-reader [hidden],.book-editor [hidden],.bookshelf [hidden]{display:none}
.book-editor-sidebar{min-width:0;max-height:calc(100dvh - 130px);overflow:auto;padding-right:4px}.book-editor-sidebar>details{margin-top:12px}.book-editor-fields{padding:8px 0}.book-tree-actions{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}#book-tree,#book-tree ul{list-style:none;margin:0;padding:0}#book-tree ul{padding-left:16px}#book-tree>li+li{margin-top:8px}#book-tree button{display:block;text-align:left;overflow-wrap:anywhere;width:100%;border:0;border-left:2px solid transparent;border-radius:0;background:transparent;padding:7px 10px}#book-tree>li>button{font-weight:600}#book-tree button[aria-current]{color:var(--green);background:var(--wash);border-left-color:var(--green)}#book-node-editor{border-top:1px solid var(--line);margin-top:16px;padding-top:12px}#book-node-editor label+label{margin-top:10px}#book-current-heading{font-size:16px;line-height:1.5;margin:0 0 12px;overflow-wrap:anywhere}#book-section-empty,#book-tree-empty{color:var(--muted);font-size:14px}.book-section-audio{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin-bottom:16px}.book-section-audio label{flex:1;min-width:160px;max-width:240px}.book-section-audio span{font-size:12px;color:var(--muted)}
@media(min-width:1600px){.book-grid{grid-template-columns:repeat(5,minmax(0,1fr))}}@media(max-width:1100px){.book-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.book-reader{grid-template-columns:180px minmax(0,1fr);gap:28px}}@media(max-width:760px){.bookshelf{padding:24px 0}.books-heading h1{font-size:26px}.book-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.book-cover{padding:18px;border-radius:18px}.book-cover h2{font-size:24px}.book-reader{display:block;padding:20px 0 40px}.book-reader-actions{margin-bottom:8px}.book-reader-actions a{min-height:44px}.book-toc{position:sticky;top:var(--book-header-height,48px);z-index:25;max-height:calc(100dvh - var(--book-header-height,48px));overflow:visible;margin-bottom:12px;padding:4px 0;background:var(--paper)}.book-toc nav{max-height:32dvh;overflow:auto;overscroll-behavior:contain;padding:3px 0}.book-toc nav a{min-height:32px}.book-toc summary{min-height:44px;padding:8px 0;margin-bottom:0;line-height:1.4}.book-toc details[open]>summary{margin-bottom:4px}.book-reading .prose{font-size:16px}.book-pagination{font-size:13px;gap:8px}.book-pagination select{min-height:44px}.book-editor{padding:20px 0}.book-editor-workspace{display:flex;flex-direction:column;gap:20px}.book-editor-sidebar{max-height:none;overflow:visible;padding:0}#book-outline nav{max-height:30dvh;overflow:auto}#book-settings>summary{display:list-item;padding:8px 0}#book-settings[open]>summary{margin-bottom:12px}.book-editor-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.book-editor-hint{grid-column:1/-1}.book-editor input,.book-editor select{font-size:16px}.book-editor input[type=file]{max-width:100%}.book-editor button{min-height:44px}.book-editor .books-heading{gap:10px}.book-editor .books-heading h1{font-size:18px}#book-markdown{height:60dvh;font-size:16px}.book-notes textarea{font-size:16px}}@media(max-width:370px){.book-cover{padding:14px}.book-cover h2{font-size:20px}.book-cover-bottom{font-size:11px}.book-grid{gap:12px}}

#book-tree button[data-node-type=section]{min-height:36px}

/* Compact book workspace: tools float outside the content flow. */
.book-editor{padding:16px 24px 100px}
.book-editor .books-heading{margin-bottom:16px;gap:12px}
.book-editor .books-heading h1{font-size:18px}
.book-editor button{font-size:12px;padding:4px 8px;min-height:30px;line-height:1.4}
.book-editor #book-new{font-size:22px;width:32px;height:32px;padding:0}
.book-editor-workspace{grid-template-columns:240px minmax(0,1fr);gap:20px}
.book-editor input,.book-editor select{font-size:13px;padding:4px 6px}
.book-editor-sidebar{max-height:calc(100dvh - 170px)}
.book-editor-sidebar>details{margin-top:8px}
#book-outline{position:relative}
#book-outline>summary{padding-right:92px;font-size:13px;min-height:32px}
.book-tree-add{position:absolute;top:0;right:0;margin:0;gap:2px}
#book-tree button{font-size:13px;padding:5px 8px}
#book-tree button[data-node-type=section]{min-height:30px}
#book-node-editor{position:relative;padding-top:8px;margin-top:10px}
#book-node-label{padding-right:90px;min-height:28px;display:flex;align-items:center;font-size:12px}
.book-node-actions{position:absolute;top:8px;right:0;margin:0;gap:2px}
.book-node-actions button{width:28px;padding:2px}
#book-parent-label{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px}
.book-editor-body{position:relative;min-width:0}
#book-current-heading{font-size:14px;min-height:30px;line-height:30px;margin:0 60px 8px 0}
#book-markdown{height:calc(100dvh - 210px);min-height:320px;padding:12px;font-size:13px;line-height:1.55}
#book-preview{height:calc(100dvh - 210px);max-height:none;padding:12px;overflow:auto}
.book-editor-actions{position:fixed;bottom:18px;right:24px;z-index:30;display:flex;gap:4px;padding:5px;background:var(--paper);border:1px solid var(--line);border-radius:8px;box-shadow:0 3px 14px #0001;max-width:calc(100vw - 40px)}
#book-editor-status{position:fixed;bottom:76px;right:24px;z-index:30;margin:0;min-height:0;max-width:min(560px,calc(100vw - 48px));max-height:25dvh;overflow:auto;font-size:12px;line-height:1.5;padding:7px 10px;background:var(--paper);border:1px solid var(--line);border-radius:6px;box-shadow:0 2px 10px #0001}
#book-editor-status:empty{display:none}
.book-section-audio{position:absolute;top:0;right:0;margin:0;display:block;z-index:20}
.book-section-audio>summary{font-size:12px;cursor:pointer;padding:6px;list-style:none;color:var(--green)}
.book-audio-fields{position:absolute;right:0;top:32px;width:min(300px,calc(100vw - 40px));padding:12px;background:var(--paper);border:1px solid var(--line);border-radius:6px;box-shadow:0 4px 18px #0002;display:flex;flex-wrap:wrap;gap:8px}
.book-audio-fields label{flex-basis:100%;max-width:100%;font-size:12px}
.book-audio-fields span{align-self:center;font-size:11px}
.book-editor button:disabled{cursor:default}
@media(max-width:760px){
 .book-editor{padding:12px 0 120px}.book-editor .books-heading{margin-bottom:12px}.book-editor .books-heading h1{font-size:16px}
 .book-editor-workspace{gap:12px}.book-editor-sidebar{max-height:none}.book-editor button{min-height:36px}.book-editor input,.book-editor select{font-size:16px}
 #book-outline>summary{min-height:38px}#book-node-label{min-height:36px}.book-node-actions button{width:32px}
 #book-markdown{font-size:16px;height:65dvh;padding:10px}#book-current-heading{font-size:13px}
 .book-editor-actions{right:10px;bottom:calc(10px + env(safe-area-inset-bottom));max-width:calc(100vw - 20px);gap:2px;padding:4px;justify-content:flex-end}
 .book-editor-actions button{font-size:12px;padding:4px 6px}
 #book-editor-status{right:10px;bottom:calc(64px + env(safe-area-inset-bottom));max-width:calc(100vw - 20px)}
}

/* Book metadata lives in a modal; the sidebar is reserved for the outline. */
.book-editor-sidebar>details{margin-top:0}
#book-tree>li+li{margin-top:2px}
#book-tree button{min-height:24px;padding:2px 6px;line-height:1.4}
#book-tree button[data-node-type=section]{min-height:24px}
#book-tree ul{padding-left:12px}
#book-settings{width:min(440px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);padding:18px;border:1px solid var(--line);border-radius:8px;background:var(--paper);color:var(--ink);overflow:auto;margin:auto;box-shadow:0 12px 50px #0003}
#book-settings::backdrop{background:#0005}
.book-settings-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.book-settings-heading h2{margin:0;font-size:16px}
#book-settings-close{width:30px;height:30px;font-size:20px;padding:0}
#book-settings .book-editor-fields{display:flex;flex-direction:column;gap:10px;padding:0}
#book-settings-status{font-size:12px;color:var(--muted);margin:10px 0 0;line-height:1.5}
#book-settings-status:empty{display:none}
.book-editor-actions button{white-space:nowrap}
@media(max-width:760px){
 #book-tree button,#book-tree button[data-node-type=section]{min-height:32px;padding:3px 6px}
 .book-editor-actions{gap:1px;padding:3px}.book-editor-actions button{padding:4px;font-size:11px}
 #book-settings{padding:14px}#book-settings-close{width:36px;height:36px}
}

/* Keep cover art separate from readable book information. */
.book-grid{align-items:stretch}
.book-cover{min-width:0;aspect-ratio:auto;overflow:visible;isolation:auto;border-radius:0;padding:0;background:none;color:var(--ink);justify-content:flex-start}
.book-cover:nth-child(n){background:none}
.book-cover:after{display:none}
.book-cover:hover{color:var(--ink)}
.book-cover-art{position:relative;display:flex;align-items:center;justify-content:center;aspect-ratio:4/5;overflow:hidden;border-radius:10px;background:linear-gradient(145deg,var(--wash),var(--card));border:1px solid var(--line);color:var(--green)}
.book-cover-art:before{content:'';position:absolute;inset:0 auto 0 12px;width:1px;background:var(--line)}
.book-cover-art>svg{width:64px;height:64px;opacity:.55}
.book-cover .book-cover-art img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:auto}
.book-cover-title{min-width:0;padding-top:14px}
.book-cover h2{font-family:var(--sans);font-size:21px;font-weight:600;line-height:1.45;word-break:normal;overflow-wrap:break-word}
.book-cover-title p{margin-top:6px;font-size:14px;line-height:1.5;color:var(--muted);overflow-wrap:break-word}
.book-cover-bottom{gap:5px;margin-top:auto;padding-top:12px;font-size:13px;line-height:1.5;color:var(--muted)}
.book-cover [data-book-progress]{color:var(--green)}
.book-cover:hover h2{color:var(--green)}
@media(max-width:760px){.book-grid{gap:24px 16px}.book-cover h2{font-size:18px}.book-cover-title{padding-top:12px}.book-cover-title p{font-size:13px}.book-cover-bottom{font-size:12px;padding-top:10px}.book-cover-art>svg{width:48px;height:48px}}
@media(max-width:370px){.book-grid{column-gap:12px}.book-cover h2{font-size:17px}}
