#sourceHome{max-width:1160px;margin:0 auto;padding:clamp(28px,5vw,72px) clamp(8px,3vw,36px)}
.shelfHead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:20px}
.views .shelfHead h1{font-size:clamp(27px,3vw,38px);letter-spacing:-.05em;color:#173f32;margin:0}
#sourceHome .importArea{border:1px dashed #91b5a2;border-radius:16px;background:#f8fbf9;text-align:center;padding:26px}
.importArea.dragOver{outline:3px solid #558971}.importArea button{background:#235b46;color:white;font-weight:650;padding:10px 22px}.importArea p{font-size:14px;color:#556b60;margin:8px 0 0}
.historyHead{display:flex;align-items:baseline;gap:10px;margin:38px 0 16px}.historyHead h2{margin:0}.historyHead small{color:#62776a}
.shelfGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,175px),1fr));gap:24px 20px}
.bookCard{display:flex;flex-direction:column;gap:5px;text-align:left;color:#18372a;text-decoration:none;min-width:0}.bookCover{display:grid;width:100%;aspect-ratio:4/4.7;place-items:center;background:#e2e9e4;border-radius:12px;overflow:hidden}
.bookCover img{width:76%;height:82%;object-fit:contain;filter:drop-shadow(2px 5px 5px #26382c33);transition:transform .15s}.bookCard:hover img{transform:translateY(-3px)}
.bookCard strong{line-height:1.45;margin-top:4px;overflow-wrap:anywhere}.bookCard small{font-variant-numeric:tabular-nums}.bookCard:focus-visible{outline:2px solid #337659;outline-offset:4px;border-radius:8px}
#shelfFeedback:empty{display:none}#shelfFeedback{color:#305744;margin:12px 0}#pdfCanvas{display:block;max-width:100%;height:auto;margin:10px auto 0}#sourceHome .shelfGrid a{align-self:start}
@media(max-width:540px){.shelfGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 12px}.shelfHead{margin-bottom:14px}}

#canvasTree .nodeInline{font:inherit;margin:0;padding:6px 9px;line-height:1.45;border:1.5px solid #317459;border-radius:6px;color:#173f30;background:white;min-width:0;max-width:245px;user-select:text}
#canvasTree .nodeBody{display:flex;flex-direction:column;align-items:flex-start;min-width:0}
#canvasTree .inlineMemo{margin:4px;width:min(210px,100%);resize:vertical;font-size:.9rem}

.mapBar{gap:8px;font-size:14px}
.mapBar>button,.mapBar .mapSearch input,.chapterSelect select{height:38px;border-radius:8px;line-height:1.4}
.mapBar>button{padding:0 12px;white-space:nowrap}
.chapterField{display:flex;align-items:center;gap:9px;min-width:0;color:#51665a}
.chapterField>span:first-child{flex:none;font-weight:600}
.chapterSelect{position:relative;display:block;min-width:0;width:clamp(176px,20vw,270px)}
.chapterSelect:after{content:"";position:absolute;right:14px;top:calc(50% - 5px);width:6px;height:6px;border:solid #496453;border-width:0 1.5px 1.5px 0;transform:rotate(45deg);pointer-events:none}
.mapBar .chapterSelect select,.mapBar .mapSearch input{box-sizing:border-box;width:100%;border:1px solid #c9d8ce;background:white;color:#244734;font:inherit}
.mapBar .chapterSelect select{appearance:none;cursor:pointer;padding:0 33px 0 12px;text-overflow:ellipsis;font-weight:550}
.mapBar .chapterSelect select:hover,.mapBar .mapSearch input:hover{border-color:#88ab96}
.mapBar .chapterSelect select:focus-visible,.mapBar .mapSearch input:focus-visible,.mapBar>button:focus-visible{outline:2px solid #387957;outline-offset:2px}
.mapBar .mapSearch{flex:1 1 148px;min-width:min(145px,100%);max-width:236px}
.mapBar .mapSearch input{padding:0 12px}
@supports (appearance:base-select) and selector(::picker(select)){
 .mapBar .chapterSelect select,#chapterPick::picker(select){appearance:base-select}
 .mapBar .chapterSelect select{align-items:center}
 #chapterPick::picker-icon{display:none}
 #chapterPick::picker(select){margin-block:5px;padding:5px;max-block-size:min(340px,50vh);max-inline-size:calc(100vw - 24px);overflow:auto;overscroll-behavior:contain;border:1px solid #cad8cf;border-radius:12px;background:white;color:#294937;box-shadow:0 8px 24px #203d2c20}
 #chapterPick optgroup{padding:7px 0 0;color:#5f7567;font-size:.88em}
 #chapterPick optgroup legend{padding:4px 10px}
 #chapterPick option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;color:#254533;font:400 14px/1.45 system-ui,sans-serif}
 #chapterPick option::checkmark{order:1;margin-left:auto;color:#276947}
 #chapterPick option:checked{background:#e8f2ec;color:#195338;font-weight:650}
 #chapterPick option:hover,#chapterPick option:focus-visible{background:#f0f5f1;outline:1px solid #afc8b8;outline-offset:-1px}
}

.brand,.pdfBrand{display:inline-flex;align-items:center;gap:8px;color:#204f3d;font-weight:730;white-space:nowrap}
.brand{text-decoration:none;font-size:20px;letter-spacing:.04em}
.brand img{width:32px;height:32px}.pdfHeading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:12px}.pdfHeading #bookPos{margin:0}
.pdfBrand{font-size:14px;gap:5px}.pdfBrand img{width:22px;height:22px}
.shelfItem{position:relative;min-width:0}.bookCard{touch-action:pan-y;-webkit-touch-callout:none;user-select:none}
.bookCard img{pointer-events:none}.bookMore{position:absolute;top:8px;right:8px;width:32px;height:32px;padding:0;background:#fff;color:#254f3e;border:1px solid #d1dfd5;opacity:0}
.shelfItem:hover .bookMore,.shelfItem:focus-within .bookMore{opacity:1}
@media(hover:none){.bookMore{opacity:1}}
.deletedShelf{margin-top:30px;padding-top:14px;border-top:1px solid #d4dfd7;color:#526959}
.deletedShelf summary{cursor:pointer;width:fit-content}.deletedShelf ul{list-style:none;padding:0;margin:8px 0}
.deletedShelf li{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid #dce4df;padding:10px 0}
.deletedShelf li strong,.deletedShelf li small{display:block;overflow-wrap:anywhere}.deletedShelf li button,#keepBook{background:#e1ece6;color:#20523d}
#removeBookDialog{max-width:min(92vw,420px);border:1px solid #cbdace;border-radius:14px;padding:22px;color:#254434}
#removeBookDialog::backdrop{background:#18362850}#removeBookDialog p{color:#52645a}#removeBook{background:#904137;color:white}

#pdfTools{position:sticky;top:0;z-index:2;padding:6px 0;background:#fff;display:flex;align-items:center;flex-wrap:wrap;gap:6px}
#pdfTools button,#snapGallery button{background:#eaf3ed;color:#23553e}
#pdfTools #takeSnap[aria-pressed=true],#pdfTools #saveSnap{background:#245f46;color:white}
#snapBar{display:flex;flex:1 0 100%;align-items:center;gap:6px;flex-wrap:wrap}
#snapPrompt{font-size:.87rem;margin-right:auto;overflow-wrap:anywhere}
#pdfStage{position:relative;margin:8px auto 0;width:100%}
#pdfStage #pageImage,#pdfStage #pdfCanvas{display:block;width:100%;max-width:none;height:auto;margin:0}
#pdfStripe,#pdfCrop{position:absolute;pointer-events:none;box-sizing:border-box}
#pdfStripe{background:rgba(255,212,83,.38);mix-blend-mode:multiply;border-radius:3px}
#pdfStage.selecting{cursor:crosshair;touch-action:none;user-select:none}
#pdfStage.selecting img{pointer-events:none}
#pdfCrop{border:2px solid #256e50;background:#459c6e17}
#canvasTree .snapshotLink{padding:3px 7px;border-radius:5px;white-space:nowrap;background:#fff2cb;color:#644e17;font-size:12px;flex:none}
#snapGallery{width:min(680px,92vw);max-height:82vh;border:1px solid #cbdace;border-radius:12px;padding:18px}
#snapGallery::backdrop{background:#16302055}
#snapGallery figure{margin:12px 0;padding:10px;border:1px solid #d5dfd8;border-radius:8px}
#snapGallery canvas{display:block;max-width:100%;height:auto;margin:auto}
#snapGallery figcaption{margin-top:8px;display:flex;align-items:center;justify-content:space-between;font-size:.85rem}

.fragmentStrip,.fragmentTools{display:flex;gap:4px;flex-wrap:wrap}.fragmentStrip{max-width:205px;padding:3px 2px}
.fragmentTools{margin:10px 0}.fragmentTools button{padding:6px 10px}#fragmentStatus{font-size:.9rem;color:#435c50}#fragmentStatus:empty{display:none}
#pdfStripe.sourceFragment{background:#e6bd4138;outline:2px solid #b78b27}
#snapGallery .chosenFragment{border-color:#a88d98}
#snapGallery figcaption{flex-wrap:wrap;gap:5px}#snapGallery figcaption span{margin-right:auto}

.paneHeading,.historyTools,.fragmentActions{display:flex;align-items:center;gap:6px}
.paneHeading{justify-content:space-between;flex-wrap:wrap;margin-bottom:12px;gap:8px}.paneHeading h2{margin:0}
.historyTools{flex-wrap:wrap}.historyTools button,#pdfTools button,#locateOriginal{min-height:36px;padding:6px 11px;border-radius:8px;font:550 14px/1.35 system-ui,sans-serif;color:#2a503e;background:#eef4f0;white-space:nowrap}
.historyTools .iconTool{min-width:32px;padding:2px 5px;background:transparent;font-size:21px;line-height:1}
.historyTools #openHistory{background:transparent}.historyTools button.mainTool,#pdfTools #takeSnap,#pdfTools #saveSnap{background:#245e46;color:white}
.historyTools button:hover:enabled,#pdfTools button:hover:enabled,#locateOriginal:hover{box-shadow:inset 0 0 0 1px #8caa99}
.historyTools button:focus-visible,#pdfTools :is(button,a):focus-visible,#locateOriginal:focus-visible{outline:2px solid #387957;outline-offset:2px}
.historyTools button:disabled,#pdfTools button:disabled{opacity:.45}
#mapView .mapBar{gap:8px;margin-bottom:10px}#mapView .mapSearch{max-width:300px}#locateOriginal{margin-left:auto;background:white;border:1px solid #c9d8ce}
#mapView #editStatus:empty{display:none}
#pdfTools{column-gap:12px;row-gap:6px;margin:0 0 8px;border-bottom:1px solid #e0e8e3}
#bookPanes #pdfTools .pageTools{display:inline-flex;flex-wrap:nowrap;margin:0;gap:2px}.pageTools button{background:transparent!important}
.fragmentActions{padding-left:10px;border-left:1px solid #d9e3dc;flex-wrap:wrap}
#fullPdf{margin-left:auto;font-size:13px;color:#4e6457;text-decoration:none;white-space:nowrap}#fullPdf:hover{text-decoration:underline}
#pdfTools:has(#snapBar:not([hidden]))>:is(.pageTools,.fragmentActions,#fullPdf){display:none}
#snapBar:not([hidden]){min-height:36px}
.historyTitle,.historyFilters{display:flex;align-items:center;gap:12px}.historyTitle{justify-content:space-between}.historyTitle h3{margin:0}.historyTitle button{background:#edf4ef;color:#255440}
#mapHistory{box-sizing:border-box;width:min(800px,calc(100vw - 36px));height:min(740px,86dvh);max-width:none;max-height:calc(100dvh - 20px);padding:0;border:1px solid #cbdbd1;border-radius:20px;color:#203c30;background:#fff;box-shadow:0 24px 90px #142d2438}
#mapHistory[open]{display:flex;flex-direction:column}#mapHistory::backdrop{background:#152b234d}
.historyTop{padding:23px 30px 0;border-bottom:1px solid #dce5df;background:#f5f9f6}#historyTitle{font-size:25px;line-height:1.35}
#closeHistory{width:38px;height:38px;padding:0;border:1px solid #d7e2da;background:#fff;border-radius:50%;font:24px/1 system-ui;color:#3e5649}
.historyFilters{gap:24px;margin-top:14px}.historyFilters button{padding:8px 1px 12px;background:none;border-radius:0;border-bottom:3px solid transparent;color:#596a60;font-size:15px}
.historyFilters [aria-pressed=true]{border-color:#23654b;color:#194e38;font-weight:700}
.historyScroll{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain;padding:6px 30px 20px;scrollbar-gutter:stable}
.historyDay{margin:16px 0 3px;font-size:14px;color:#496352}.historyRows{list-style:none;padding:0;margin:0}
.historyRows li{position:relative;display:grid;grid-template-columns:58px minmax(0,1fr) max-content;gap:16px;align-items:center;padding:14px 0 14px 16px;border-bottom:1px solid #e9eeeb}
.historyRows li:before{content:'';position:absolute;left:0;top:22px;width:6px;height:6px;border-radius:50%;background:#becdc3}.historyRows li[data-saved]:before{background:#337553}
.historyRows time{align-self:start;font:500 13px/1.9 system-ui;color:#5e7166;font-variant-numeric:tabular-nums}
.historyDescription{display:block;overflow-wrap:anywhere;font-size:16px;line-height:1.5;font-weight:550;color:#253c30}.historyRows li[data-saved] .historyDescription{color:#174e37}
.historyMeta{display:block;margin-top:3px;color:#627469;font-size:13px}
.historyRows button,#olderVersions{min-height:36px;padding:6px 13px;border:1px solid #ceded3;border-radius:8px;background:white;color:#225a40;font:600 14px/1.4 system-ui}
.historyRows [data-saved] button{background:#e9f4ed;border-color:#d6e8db}.historyState{font-size:13px;color:#627469;padding:0 6px}
#mapHistory button:focus-visible{outline:2px solid #3c7b58;outline-offset:2px}#mapHistory button:hover{color:#143d2a;background-color:#eaf2ed}
#olderVersions{display:block;margin:16px auto 0}#historyHint{margin:0;padding:10px 30px 13px;border-top:1px solid #e5ebe6;color:#596c60;font-size:13px}
@media(max-width:560px){
 #mapHistory{width:calc(100vw - 18px);height:88dvh;border-radius:15px}
 .historyTop{padding:16px 16px 0}.historyScroll{padding:3px 14px 14px}#historyTitle{font-size:22px}#historyHint{padding:10px 16px}
 .historyRows li{grid-template-columns:minmax(0,1fr) max-content;gap:5px 9px;padding:12px 0 12px 13px}
 .historyRows time{grid-column:1/-1;line-height:1.2}.historyRows li:before{top:17px}.historyDescription{font-size:15px}.historyRows button{padding:6px 9px}.historyState{padding:0}
}

.publicBook{display:flex;gap:18px;align-items:center;margin-top:24px;padding:18px 20px;border:1px solid #d3e1d9;border-radius:14px;background:#fff;color:#203d31}
.publicBookSpine{align-self:stretch;display:grid;place-items:center;writing-mode:vertical-rl;letter-spacing:.15em;font:600 16px/1.5 Georgia,serif;letter-spacing:.16em;padding:8px 14px;background:#235440;color:#fff6dc;border-left:4px solid #b69c63;border-radius:2px 5px 5px 2px}
.publicBook p,.publicBook h2{margin:0}.publicBook h2{font-size:21px}.publicBook p{font-size:14px;color:#51675b}.publicBook p.publicBookMeta{font-size:12px;margin-bottom:4px}
.publicBookLinks{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;margin-top:10px}.publicBookLinks a{font-size:14px;color:#235440;text-underline-offset:3px}.publicBookLinks .readPublic{background:#e6f1ea;border-radius:6px;padding:6px 10px;text-decoration:none;font-weight:650}
