@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Caslon+Display&display=swap');
:root{--paper:#f7f5ef;--ink:#27231f;--muted:#928e86;--line:#e8e4db;--white:#fffefa;--sans:'DM Sans',Arial,sans-serif;--serif:'Libre Caslon Display',Georgia,serif}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;min-height:100vh;background:#353543;color:var(--ink);font-family:var(--sans);font-size:14px;overflow-x:hidden}button,input,select,textarea{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid #795c9d;outline-offset:3px}[hidden]{display:none!important}.ambient{position:fixed;inset:-10%;pointer-events:none;filter:blur(90px);opacity:.75}.ambient-one{background:radial-gradient(circle at 69% 4%,#e5cf91 0,transparent 30%),radial-gradient(circle at 23% 78%,#7776ae 0,transparent 32%),radial-gradient(circle at 80% 85%,#294d63 0,transparent 28%)}.ambient-two{background:radial-gradient(circle at 20% 15%,#352f47 0,transparent 28%),radial-gradient(circle at 85% 44%,#b58694 0,transparent 27%);opacity:.6}.app-shell{position:relative;width:min(1180px,calc(100% - 72px));min-height:calc(100vh - 90px);margin:46px auto;background:var(--paper);border-radius:11px;box-shadow:0 30px 100px #17172266;overflow:hidden}.topbar{height:83px;padding:0 35px;display:flex;align-items:center;gap:19px}.brand{display:flex;align-items:center;gap:10px;color:var(--ink);text-decoration:none;font:30px var(--serif);letter-spacing:-1.5px}.brand-mark{font:25px var(--sans);position:relative;transform:rotate(-4deg)}.brand-mark i{position:absolute;width:5px;height:5px;right:-3px;top:2px;background:#a95365;border-radius:50%}.brand-divider{height:20px;width:1px;background:#d9d5cb}.owner-mark{display:flex;gap:7px;align-items:center;font-size:12px;font-weight:700;color:#69635c}.owner-dots{width:18px;height:18px;display:grid;grid-template-columns:1fr 1fr;gap:2px;transform:rotate(-18deg)}.owner-dots i{border-radius:50%;background:#c255a6}.owner-dots i:nth-child(2){background:#7766cf}.owner-dots i:nth-child(3){background:#e89d50}.owner-dots i:nth-child(4){background:#9d6ac8}.breadcrumb{font-size:12px;color:#9c978f}.top-actions{margin-left:auto;display:flex;align-items:center;gap:4px}.icon-action{border:0;background:transparent;color:#8f8980;width:33px;height:33px;display:grid;place-items:center;border-radius:50%}.icon-action:hover{background:#ebe8e0;color:var(--ink)}.icon-action svg,.search-box svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.text-action{border:1px solid #ddd8ce;background:#fffdfa;border-radius:20px;padding:9px 14px;color:#554f48;font-weight:600;font-size:12px;box-shadow:0 1px 3px #0000000d}.text-action:hover{background:#f0ece3}.text-action span{font-size:19px;line-height:0;vertical-align:-2px}main{padding:55px 35px 70px}.eyebrow{font-size:12px;letter-spacing:.01em;color:#aaa49a;font-weight:600;display:flex;align-items:center;gap:8px}.eyebrow-icon{font-size:16px}h1{font:clamp(70px,8vw,113px)/.98 var(--serif);letter-spacing:-.06em;font-weight:400;margin:7px 0 16px}.period{color:#a56678}.stats{font-size:13px;color:#99938a;margin:0 0 27px;display:flex;flex-wrap:wrap;gap:12px}.stats strong{color:#625d56;font-weight:700}.stats .dot{color:#c6c1b8}.toolbar{display:flex;align-items:center;gap:13px;margin-bottom:19px}.view-switch,.sort-box{background:#eeeae3;border-radius:25px;display:flex;align-items:center;padding:3px;white-space:nowrap}.view-tab{border:0;background:transparent;padding:8px 13px;color:#99938b;font-weight:600;font-size:12px;border-radius:20px;display:flex;align-items:center;gap:8px}.view-tab span{font-size:16px;line-height:0}.view-tab.active{background:#fffefa;color:#544f48;box-shadow:0 1px 5px #3227161a}.view-tab:hover:not(.active){color:#4e4942}.search-box{display:flex;align-items:center;gap:10px;border-radius:24px;height:38px;background:#fffefa;border:1px solid #eae6dd;box-shadow:0 1px 3px #00000009;min-width:240px;max-width:280px;padding:0 11px;color:#b1aaa0;flex:1}.search-box input{border:0;outline:0;background:transparent;width:100%;min-width:0;font-size:12px;color:var(--ink)}.search-box input::placeholder{color:#b4aea5}.search-box kbd{font-size:11px;border:1px solid #ded8ce;border-radius:4px;padding:0 5px;color:#aaa49b;line-height:18px}.sort-box{margin-left:auto;gap:3px;font-size:11px;color:#aba59b;padding:4px 6px 4px 12px}.sort-box select{border:0;outline:0;appearance:none;background:#fffefa;border-radius:18px;padding:5px 11px;color:#686158;font-size:11px;font-weight:700;cursor:pointer}.filters{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:40px}.filter-chip{background:#fffefa;border:1px solid #e8e3da;border-radius:18px;padding:7px 10px;display:flex;align-items:center;gap:6px;color:#777069;font-size:11px;line-height:1;box-shadow:0 1px 2px #00000007;transition:background .2s,transform .2s}.filter-chip:hover{transform:translateY(-2px);background:#fdfbf5}.filter-chip.active{background:#292723;color:#fff;border-color:#292723}.filter-chip .chip-icon{font-size:13px}.filter-chip small{font-size:10px;color:#aaa49a}.filter-chip.active small{color:#d1cfc9}.shelf-group{margin:0 0 34px}.book-row{display:flex;align-items:end;gap:2px;min-height:259px;padding:0 21px 0 27px;overflow:visible;position:relative}.book-spine{position:relative;flex:none;border:0;border-radius:2px 3px 0 0;width:var(--spine-width);height:var(--spine-height);background:linear-gradient(90deg,#00000028 0%,#ffffff20 10%,transparent 20%,transparent 86%,#00000036 100%),var(--book-color);color:#f7ecdf;box-shadow:1px 0 2px #00000035,inset 2px 0 0 #ffffff25,inset -2px 0 0 #00000023;transition:transform .25s ease,filter .25s,box-shadow .25s;transform-origin:bottom center;text-align:left;z-index:1;padding:0;overflow:hidden}.book-spine:nth-child(4n+2){color:#3b3450}.book-spine:nth-child(4n+2)::before{content:'';position:absolute;inset:28% 5px 19%;background:#e9e3cd;box-shadow:0 0 0 1px #ffffff44}.book-spine:nth-child(6n+3)::after{content:'';position:absolute;top:7px;left:3px;right:3px;border-top:2px solid #ffffff4a;box-shadow:0 4px 0 #ffffff29}.book-spine:hover,.book-spine:focus-visible{transform:translateY(-16px) rotate(-3deg);filter:brightness(1.08);box-shadow:7px 12px 14px #211a2880;z-index:5}.spine-title{position:absolute;inset:15px 7px 32px;writing-mode:vertical-rl;text-orientation:mixed;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 11px/1.1 var(--serif);letter-spacing:.03em}.book-spine:nth-child(4n+2) .spine-title{inset:calc(28% + 10px) 12px 22%;font-size:10px}.spine-author{position:absolute;bottom:12px;left:5px;right:5px;overflow:hidden;white-space:nowrap;text-overflow:clip;text-align:center;font-size:7px;letter-spacing:.09em;text-transform:uppercase;border-top:1px solid #ffffff50;padding-top:6px}.spine-edge{position:absolute;bottom:5px;left:0;right:0;border-top:1px solid #ffffff4d}.bookend{width:21px;height:64px;background:linear-gradient(90deg,#a5a49a,#d6d3c7);border-radius:16px 2px 0 0;flex:none;box-shadow:inset -3px 0 4px #00000019}.shelf-board{height:15px;border-radius:2px;background:linear-gradient(#f3f0e8 0 36%,#d5d0c2 50%,#efebe2 92%);box-shadow:0 7px 12px #6c615327;margin-top:0}.shelf-label{display:flex;justify-content:space-between;align-items:center;margin:10px 22px 0 27px;color:#aaa49a;font-size:11px}.shelf-label span{background:#fffefa;border:1px solid #eae5dc;padding:3px 7px;border-radius:4px}.shelf-label small{font-size:11px}.shelf-hint{text-align:center;color:#b5aea4;font-size:11px;margin:40px 0 0}.empty-state{padding:90px 20px;text-align:center;border:1px dashed #ddd7cc;border-radius:12px;color:#918a80}.empty-state h2{font:36px var(--serif);color:#3f3933;margin:10px 0}.empty-state p{margin:0}.topic-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.topic-card{border:1px solid #e2ddd4;border-radius:22px;overflow:hidden;background:#fefdfa;box-shadow:0 3px 9px #3027190b;min-height:385px;cursor:pointer;text-align:left;padding:0;transition:transform .25s,box-shadow .25s}.topic-card:hover{transform:translateY(-6px);box-shadow:0 17px 24px #30271920}.topic-art{height:234px;position:relative;overflow:hidden;background:var(--topic-light);color:var(--topic-color)}.topic-art::before{content:'';position:absolute;width:240px;height:240px;border:2px solid currentColor;border-radius:50%;opacity:.38;top:45px;left:50%;transform:translateX(-50%)}.topic-art::after{content:'';position:absolute;width:350px;height:160px;border:1px solid currentColor;border-radius:50%;opacity:.18;top:145px;left:50%;transform:translateX(-50%) rotate(-20deg)}.art-circle{width:146px;height:146px;border-radius:50%;background:var(--topic-color);position:absolute;left:50%;top:43px;transform:translateX(-50%);opacity:.86}.art-icon{font:112px var(--serif);position:absolute;left:50%;top:54px;transform:translateX(-50%);color:#fff9e4;text-shadow:2px 3px 0 #00000020}.art-book{position:absolute;width:150px;height:94px;bottom:-17px;left:50%;transform:translateX(-50%) rotate(-8deg);background:#f8f3e8;border:6px double var(--topic-color);border-radius:3px;box-shadow:12px 11px 0 #00000020}.art-book::before{content:'';position:absolute;top:13px;bottom:13px;left:50%;border-left:1px solid var(--topic-color);opacity:.6}.art-stars{position:absolute;font:31px var(--serif);top:33px;left:25px;opacity:.75}.art-stars.second{top:100px;left:auto;right:25px;font-size:20px}.topic-content{padding:19px 23px 21px}.topic-content h2{font:34px/.95 var(--serif);letter-spacing:-.025em;margin:0 0 10px}.topic-content p{margin:0;color:#918a81;font-size:12px}.mini-shelf{display:flex;gap:3px;align-items:end;height:40px;margin-top:30px;border-bottom:4px solid #b7aba7}.mini-shelf i{width:13px;background:var(--topic-color);height:var(--h);border-radius:1px 1px 0 0;opacity:var(--alpha)}.map-wrap{min-height:550px;background:#f5f2ea;border:1px solid #e7e1d7;border-radius:22px;position:relative;overflow:hidden}.map-wrap::before{content:'';position:absolute;inset:0;background-image:radial-gradient(#d9d1c5 1px,transparent 1px);background-size:20px 20px;opacity:.6}.map-line{position:absolute;left:50%;top:50%;height:1px;background:#cfc6b9;transform-origin:left center}.map-center{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:155px;height:155px;border-radius:50%;background:#fffdfa;display:grid;place-items:center;text-align:center;box-shadow:0 8px 35px #453a291c;border:1px solid #e5ded2;font:25px/.95 var(--serif);z-index:2}.map-center span{display:block;font:11px var(--sans);color:#99928a;margin-top:7px}.map-node{position:absolute;left:var(--x);top:var(--y);transform:translate(-50%,-50%);border:1px solid #e1d9ca;border-radius:50%;width:118px;height:118px;display:flex;align-items:center;justify-content:center;flex-direction:column;background:var(--topic-light);color:var(--topic-color);box-shadow:0 6px 18px #453a2914;z-index:2;transition:transform .2s}.map-node:hover{transform:translate(-50%,-50%) scale(1.08)}.map-node .map-icon{font:36px var(--serif)}.map-node span:last-child{font-size:11px;font-weight:700;max-width:95px;text-align:center}.footer{border-top:1px solid #e9e4dc;margin:0 35px;padding:22px 0 29px;display:flex;justify-content:space-between;color:#aaa39a;font-size:11px}.detail-backdrop,.form-backdrop{position:fixed;inset:0;background:#f9f7f0bb;backdrop-filter:blur(9px);z-index:50;display:grid;place-items:center;padding:20px}.detail-stage{position:relative;width:min(900px,95vw);perspective:1600px}.detail-close{position:absolute;right:-13px;top:-44px;border:0;background:#29241f;color:#fff;width:31px;height:31px;border-radius:50%;z-index:10;font-size:13px}.book-object{position:relative;width:min(800px,88vw);height:510px;margin:auto;transform-style:preserve-3d}.book-cover{position:absolute;left:50%;top:50%;width:340px;height:475px;transform:translate(-50%,-50%) rotateY(-13deg) scale(.85);transform-origin:left center;background:var(--detail-color);color:#fff7e9;border:10px double #ffffff3a;border-left:17px solid #0000002b;box-shadow:18px 24px 28px #2d241e45,inset 0 0 0 2px #ffffff52;opacity:0;transition:transform .5s,opacity .5s;display:flex;flex-direction:column;padding:33px}.detail-backdrop.visible .book-cover{opacity:1;transform:translate(-50%,-50%) rotateY(-7deg) scale(1)}.detail-backdrop.is-open .book-cover{opacity:0;transform:translate(-50%,-50%) rotateY(-118deg) scale(1.07);pointer-events:none}.cover-symbol{height:58%;display:grid;place-items:center;border:1px solid #ffffff55;background:radial-gradient(circle at center,#ffffff32,transparent 57%);font:135px var(--serif);line-height:1}.cover-kicker{font-size:10px;letter-spacing:.17em;text-transform:uppercase;margin-top:22px}.cover-title{font:36px/.92 var(--serif);margin:14px 0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.cover-author{font:italic 16px var(--serif);margin-top:auto}.book-spread{position:absolute;inset:0;display:grid;grid-template-columns:1fr 1fr;border:7px solid var(--detail-color);border-radius:5px;background:#fffdf8;box-shadow:12px 25px 35px #342a2352;opacity:0;transform:scale(.8) rotateY(8deg);transition:transform .65s .1s,opacity .45s .2s;overflow:hidden}.detail-backdrop.is-open .book-spread{opacity:1;transform:scale(1) rotateY(0)}.inside-cover{position:relative;background:#e9d9c9;border-right:4px solid #715850;display:grid;place-items:center}.inside-pattern{position:absolute;inset:0;background-image:radial-gradient(#986e6280 1px,transparent 1px);background-size:17px 17px;opacity:.55}.bookplate{position:relative;width:70%;height:45%;background:#fffdf7;box-shadow:0 4px 17px #3c292728;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;color:#574a40;transform:rotate(-2deg)}.bookplate-kicker{font-size:11px;font-weight:700;letter-spacing:.35em}.bookplate-ornament{font:65px var(--serif);line-height:1.1}.bookplate em{font:italic 30px/1.1 var(--serif)}.bookplate small{margin-top:17px;color:#aaa094;font-size:10px}.book-page{padding:32px 32px 18px 36px;overflow:auto;display:flex;flex-direction:column;box-shadow:inset 9px 0 11px #33261612}.page-meta{font-size:11px;color:#999187;display:flex;align-items:center;gap:8px}.page-topic{background:#eee7df;color:#7d5e54;border-radius:12px;padding:4px 8px;font-weight:700}.book-page h2{font:clamp(27px,3vw,42px)/.95 var(--serif);letter-spacing:-.02em;margin:22px 0 10px}.page-author{font:italic 20px var(--serif);color:#696057;margin:0 0 21px}.page-rule{height:1px;background:#e7e0d7;margin-bottom:19px}.summary-label{font-size:10px;font-weight:700;letter-spacing:.16em;color:#af8173;margin-bottom:8px;text-transform:uppercase}.book-summary{font:20px/1.34 var(--serif);margin:0;color:#514b44}.page-bottom{border-top:1px solid #e9e3da;margin-top:auto;padding-top:14px;display:flex;align-items:center;gap:9px;color:#a69e94;font-size:11px}.page-bottom button{border:0;background:none;color:#81766a;font-size:11px}.page-bottom .edit-detail{margin-left:auto;text-decoration:underline;text-underline-offset:3px}.detail-nav{display:flex;justify-content:space-between;align-items:center;color:#8f887f;font-size:11px;margin:20px auto 0;max-width:800px}.detail-nav button{border:0;background:#fffefa;padding:9px 13px;border-radius:20px;color:#51493f;box-shadow:0 1px 4px #00000019}.book-form{width:min(640px,95vw);max-height:90vh;overflow:auto;background:#fffdf7;border-radius:13px;padding:30px;box-shadow:0 20px 60px #29201847}.form-head{display:flex;justify-content:space-between;align-items:start;margin-bottom:23px}.form-head .eyebrow{letter-spacing:.13em;color:#9c7887}.form-head h2{font:46px var(--serif);margin:5px 0 0}.form-close{border:0;background:transparent;color:#777;font-size:17px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px}.form-grid label{font-size:11px;font-weight:700;color:#6e675f;display:flex;flex-direction:column;gap:7px}.form-grid label.full{grid-column:1/-1}.form-grid input,.form-grid select,.form-grid textarea{border:1px solid #e5dfd6;background:#fbfaf6;border-radius:7px;padding:11px 12px;color:#332e29;outline:0}.form-grid textarea{resize:vertical}.form-actions{display:flex;align-items:center;gap:8px;margin-top:22px}.form-actions>span{flex:1}.primary-button,.secondary-button,.delete-button{border-radius:20px;padding:10px 16px;font-size:12px;font-weight:700}.primary-button{background:#292622;color:#fff;border:1px solid #292622}.primary-button span{margin-left:15px}.secondary-button{background:#fff;border:1px solid #e1dcd3;color:#666057}.delete-button{border:0;background:transparent;color:#ac5c58}.toast{position:fixed;bottom:25px;left:50%;transform:translate(-50%,20px);background:#292622;color:#fff;padding:10px 18px;border-radius:20px;font-size:12px;z-index:80;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}.toast.show{opacity:1;transform:translate(-50%,0)}
@media(max-width:900px){.app-shell{width:calc(100% - 32px);margin:16px auto}.topbar{padding:0 23px}.breadcrumb{display:none}main{padding:45px 23px}.toolbar{flex-wrap:wrap}.sort-box{margin-left:0}.filters{margin-bottom:27px}.topic-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.book-row{overflow-x:auto;scrollbar-width:thin}.detail-stage{width:95vw}.book-object{height:460px}.book-spread{width:100%}}@media(max-width:630px){.app-shell{width:100%;margin:0;border-radius:0}.topbar{height:68px;padding:0 17px;gap:11px}.brand{font-size:25px}.brand-divider,.owner-mark,.icon-action{display:none}main{padding:39px 17px 55px}h1{font-size:70px}.toolbar{gap:9px}.view-switch{width:100%;justify-content:space-between}.view-tab{flex:1;justify-content:center}.search-box{max-width:none;min-width:0}.sort-box{height:38px}.sort-box span{display:none}.topic-grid{grid-template-columns:1fr}.topic-card{min-height:350px}.topic-art{height:220px}.book-row{padding-left:8px;padding-right:8px}.shelf-label{margin-left:8px}.footer{margin:0 17px}.detail-backdrop{padding:10px}.detail-stage{width:100%}.book-object{width:95vw;height:580px}.book-spread{display:flex;flex-direction:column}.inside-cover{display:none}.book-page{height:100%;padding:27px}.book-cover{width:min(330px,85vw);height:450px}.detail-nav span{display:none}.map-wrap{height:600px}.map-node{width:94px;height:94px}.map-center{width:120px;height:120px;font-size:22px}.form-grid{grid-template-columns:1fr}.book-form{padding:22px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
.detail-cover-image{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:2;background:#eee9df}
.book-summary{white-space:pre-wrap;overflow-wrap:anywhere;margin-bottom:22px}
.book-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:26px 20px}
.grid-book{display:block;min-width:0;padding:0;border:0;background:transparent;text-align:left;color:var(--ink)}
.grid-cover{position:relative;display:block;width:100%;aspect-ratio:2/3;overflow:hidden;border-radius:4px 7px 5px 4px;border-left:8px solid #00000024;background:linear-gradient(145deg,#ffffff26,transparent 45%),var(--grid-color);box-shadow:4px 9px 15px #352c2750,inset 2px 0 0 #ffffff55;transition:transform .22s ease,box-shadow .22s ease}
.grid-book:hover .grid-cover,.grid-book:focus-visible .grid-cover{transform:translateY(-6px);box-shadow:6px 16px 22px #352c2766}
.grid-cover-fallback{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:space-between;padding:16px;color:#fff9ed;border:5px double #ffffff55}
.grid-cover-icon{font:54px var(--serif);line-height:1;opacity:.8}
.grid-cover-title{font:24px/1 var(--serif);letter-spacing:-.025em;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;overflow:hidden}
.grid-cover-author{font-size:9px;letter-spacing:.08em;text-transform:uppercase;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-top:1px solid #ffffff7a;padding-top:9px}
.grid-cover-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:top center;background:var(--grid-color)}
.grid-book-info{display:flex;flex-direction:column;gap:5px;padding:13px 3px 0}
.grid-topic{color:#a28777;font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
.grid-title{font:22px/1.04 var(--serif);letter-spacing:-.02em;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.grid-author{color:#918a80;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:630px){.view-tab{padding:8px 7px;gap:4px;font-size:11px}.book-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:23px 12px}.grid-cover-fallback{padding:11px}.grid-cover-title{font-size:19px}.grid-title{font-size:19px}}
.book-spine.has-cover::before,.book-spine.has-cover::after{display:none}
.book-spine.has-cover .spine-title,.book-spine.has-cover .spine-author,.book-spine.has-cover .spine-edge{display:none}
.spine-cover-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;pointer-events:none}
.cover-artwork-fallback{display:flex;flex-direction:column;width:100%;height:100%}
.book-cover.has-image{padding:0;border:0;background:#eee9df}
.book-cover.has-image .cover-artwork-fallback,.inside-cover.has-image .cover-artwork-fallback{display:none}
.inside-cover{padding:28px;background:var(--detail-color);color:#fff7e9;overflow:hidden}
.inside-cover.has-image{padding:0;background:#eee9df}
.inside-cover-image{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain}
@media(max-width:630px){.detail-close{right:0}.inside-cover{display:grid;flex:0 0 38%;height:38%;min-height:0;padding:12px;border-right:0;border-bottom:3px solid #715850}.inside-cover.has-image{padding:0}.inside-cover .cover-symbol{height:38%;font-size:65px}.inside-cover .cover-kicker{font-size:8px;margin-top:7px}.inside-cover .cover-title{font-size:22px;margin:5px 0}.inside-cover .cover-author{font-size:12px}.book-page{height:auto;flex:1;min-height:0}}

/* Appearance controls */
.top-actions{margin-left:auto;display:flex;align-items:center;gap:4px}
.top-actions .icon-action{display:grid;width:38px;height:38px;color:#756f69}
.top-actions .icon-action svg{width:20px;height:20px;stroke-width:1.8}
.top-actions .red-filter-toggle{color:#aa4d52}
.top-actions .red-filter-toggle svg{stroke-width:32}
.top-actions .red-filter-toggle[aria-pressed="true"]{background:#f2dfda;color:#a3363c}
.red-filter-toggle[aria-pressed="true"] svg{fill:currentColor;stroke:none}
.red-filter-control{position:relative;display:flex;align-items:center;padding-bottom:7px;margin-bottom:-7px}
.red-filter-settings-toggle{width:21px;height:26px;margin-left:-6px;border:0;background:transparent;color:#a3363c;border-radius:10px;font-size:15px}
.red-filter-settings-toggle:hover{background:#f2dfda}
.red-filter-panel{position:absolute;right:0;top:100%;z-index:70;width:min(245px,calc(100vw - 34px));padding:17px;display:grid;gap:16px;background:var(--white);border:1px solid var(--line);border-radius:15px;box-shadow:0 16px 35px #17172240;color:var(--ink)}
.red-filter-panel[hidden]{display:none}
.red-filter-panel label{display:grid;gap:9px;font-size:12px;font-weight:600}
.red-filter-panel label span{display:flex;justify-content:space-between;align-items:center}
.red-filter-panel output{color:var(--muted);font-size:11px;font-weight:500}
.red-filter-panel input{width:100%;accent-color:#aa4d52}

/* Red filter adapted from Sapiens' web component. */
html{--rf-intensity:1;--rf-brightness:1;--rf-other:calc(var(--rf-brightness) * (1 - var(--rf-intensity)))}
html::after{content:"";position:fixed;inset:0;z-index:2147483647;pointer-events:none;background:rgb(calc(255 * var(--rf-brightness)) calc(255 * var(--rf-other)) calc(255 * var(--rf-other)));mix-blend-mode:multiply;opacity:0;visibility:hidden;transition:opacity .8s ease-in-out,visibility 0s linear .8s}
html[data-red-filter]::after{opacity:1;visibility:visible;transition:opacity .8s ease-in-out,visibility 0s}
html[data-red-filter]{scrollbar-color:#5e0000 transparent}

/* Dark palette for the app, including the opened book. */
html[data-theme="dark"]{--paper:#24232a;--ink:#f1e9e2;--muted:#aaa29e;--line:#49454b;--white:#302e36;color-scheme:dark}
html[data-theme="dark"] body{background:#15141b}
html[data-theme="dark"] .ambient{opacity:.3}
html[data-theme="dark"] .app-shell{box-shadow:0 30px 100px #09080dc9}
html[data-theme="dark"] .brand-divider,html[data-theme="dark"] .footer{border-color:#49454b}
html[data-theme="dark"] .brand-divider{background:#49454b}
html[data-theme="dark"] .owner-mark,html[data-theme="dark"] .stats strong{color:#cec4bc}
html[data-theme="dark"] .breadcrumb,html[data-theme="dark"] .eyebrow,html[data-theme="dark"] .stats,html[data-theme="dark"] .shelf-hint,html[data-theme="dark"] .footer{color:#aaa29e}
html[data-theme="dark"] .top-actions .icon-action{color:#c0b5b1}
html[data-theme="dark"] .top-actions .red-filter-toggle,html[data-theme="dark"] .red-filter-settings-toggle{color:#e48d88}
html[data-theme="dark"] .icon-action:hover,html[data-theme="dark"] .red-filter-settings-toggle:hover{background:#403b44;color:#fff0e9}
html[data-theme="dark"] .red-filter-toggle[aria-pressed="true"]{background:#543338;color:#ffada3}
html[data-theme="dark"] .view-switch,html[data-theme="dark"] .sort-box{background:#37343c}
html[data-theme="dark"] .view-tab{color:#b1a7a2}
html[data-theme="dark"] .view-tab.active,html[data-theme="dark"] .sort-box select{background:#514b52;color:#fff0e8}
html[data-theme="dark"] .view-tab:hover:not(.active){color:#f1e9e2}
html[data-theme="dark"] .search-box,html[data-theme="dark"] .filter-chip,html[data-theme="dark"] .shelf-label span,html[data-theme="dark"] .topic-card,html[data-theme="dark"] .map-center,html[data-theme="dark"] .detail-nav button{background:#302e36;border-color:#4b464d;color:#e4d9d1}
html[data-theme="dark"] .search-box input{color:#f1e9e2}
html[data-theme="dark"] .search-box input::placeholder{color:#a49a97}
html[data-theme="dark"] .search-box kbd{border-color:#5b555a;color:#bbb1ad}
html[data-theme="dark"] .filter-chip:hover{background:#3e3941}
html[data-theme="dark"] .filter-chip.active{background:#a67783;border-color:#a67783;color:#1e1920}
html[data-theme="dark"] .filter-chip small,html[data-theme="dark"] .shelf-label,html[data-theme="dark"] .grid-author{color:#aaa19f}
html[data-theme="dark"] .shelf-board{background:linear-gradient(#5a5153 0 36%,#393239 50%,#4f474a 92%);box-shadow:0 7px 12px #08070a80}
html[data-theme="dark"] .bookend{background:linear-gradient(90deg,#5b5357,#827778)}
html[data-theme="dark"] .empty-state{border-color:#5a5358;color:#b5aaa6}
html[data-theme="dark"] .empty-state h2{color:#f1e9e2}
html[data-theme="dark"] .topic-content p{color:#b5aaa6}
html[data-theme="dark"] .topic-art,html[data-theme="dark"] .map-node{background:color-mix(in srgb,var(--topic-color) 28%,#24232a);color:#f1e9e2}
html[data-theme="dark"] .map-wrap{background:#2d2a31;border-color:#4b464d}
html[data-theme="dark"] .map-wrap::before{background-image:radial-gradient(#6c6268 1px,transparent 1px)}
html[data-theme="dark"] .map-line{background:#777078}
html[data-theme="dark"] .map-center span{color:#b7aaa5}
html[data-theme="dark"] .map-node{border-color:#807078;box-shadow:0 6px 18px #08070a66}
html[data-theme="dark"] .detail-backdrop{background:#121016dc}
html[data-theme="dark"] .detail-close{background:#e2d3c8;color:#272128}
html[data-theme="dark"] .book-spread{background:#302c31;box-shadow:12px 25px 35px #070609aa}
html[data-theme="dark"] .book-page{background:#302c31;color:#f1e9e2}
html[data-theme="dark"] .page-meta,html[data-theme="dark"] .page-author,html[data-theme="dark"] .page-bottom,html[data-theme="dark"] .detail-nav{color:#b8aba6}
html[data-theme="dark"] .page-topic{background:#54434a;color:#f0c3b9}
html[data-theme="dark"] .page-rule,html[data-theme="dark"] .page-bottom{border-color:#594f51;background-color:#594f51}
html[data-theme="dark"] .page-bottom{background:transparent}
html[data-theme="dark"] .summary-label,html[data-theme="dark"] .grid-topic{color:#d6a499}
html[data-theme="dark"] .book-summary{color:#e3d8d0}
html[data-theme="dark"] .grid-cover{box-shadow:4px 9px 15px #09070b9c}
@media(max-width:630px){.top-actions{gap:0}.top-actions .icon-action{width:36px;height:36px}.red-filter-panel{right:-2px}}
@media(prefers-reduced-motion:reduce){html::after,html[data-red-filter]::after{transition:none}}
/* Full view: the opened book fills the viewport */
.detail-backdrop{padding:58px 20px 14px}
.detail-stage{width:min(1480px,100%);height:100%;display:flex;flex-direction:column}
.book-object{width:100%;height:auto;flex:1;min-height:0}
.book-spread{grid-template-columns:minmax(240px,32%) 1fr}
.book-page{padding:36px max(36px,calc((100% - 760px)/2)) 18px;font-size:15px;line-height:1.65}
.book-page h2{font-size:clamp(30px,3.4vw,50px)}
.detail-close{right:0}
.detail-nav{width:100%;max-width:none;margin-top:12px}
.book-search{position:sticky;top:-36px;z-index:3;display:flex;align-items:center;gap:6px;margin:0 0 18px;padding:10px 0;background:#fffdf8;border-bottom:1px solid #e9e3da}
.book-search-field{flex:1;min-width:0;display:flex;align-items:center;gap:8px;height:40px;padding:0 12px;border:1px solid #e2dbd0;border-radius:10px;background:#fff}
.book-search-field svg{width:17px;height:17px;flex:none;fill:none;stroke:#8f877d;stroke-width:2;stroke-linecap:round}
.book-search-field input{flex:1;min-width:0;border:0;outline:0;background:none;color:inherit;font-size:14px}
.book-search-field:focus-within{border-color:#795c9d;box-shadow:0 0 0 2px #795c9d33}
.book-search-count{min-width:72px;text-align:right;color:#8f877d;font-size:12px;white-space:nowrap}
.book-search-step{width:34px;height:34px;flex:none;border:1px solid #e2dbd0;border-radius:9px;background:#fff;color:#51493f}
.book-search-step:disabled{opacity:.4;cursor:default}
.book-match{background:#f6e39a;color:inherit;border-radius:2px;padding:0 1px}
.book-match.current{background:#f0a35e;box-shadow:0 0 0 2px #f0a35e}
html[data-theme="dark"] .book-search{background:#302c31;border-color:#594f51}
html[data-theme="dark"] .book-search-field,html[data-theme="dark"] .book-search-step{background:#3b363c;border-color:#594f51;color:#f1e9e2}
html[data-theme="dark"] .book-search-count{color:#b8aba6}
html[data-theme="dark"] .book-match{background:#7a6526;color:#fff6df}
html[data-theme="dark"] .book-match.current{background:#c9772f;box-shadow:0 0 0 2px #c9772f;color:#1d1512}
@media(max-width:900px){.book-object{height:auto}.book-spread{grid-template-columns:minmax(200px,30%) 1fr}}
@media(max-width:630px){.detail-backdrop{padding:50px 8px 8px}.book-object{width:100%;height:auto}.book-spread{display:flex}.inside-cover{flex-basis:24%;height:24%}.book-page{padding:22px 18px 14px}.book-search{top:-22px}.book-search-count{min-width:0}.detail-close{top:-40px}}
