body .theme-toggle{border:1px solid #9eb3bd;border-radius:10px;padding:10px 12px;background:#e8efef;color:#375464;font:inherit;font-size:14px;white-space:nowrap;cursor:pointer;min-height:42px}body .reader-journal textarea{font-size:16px;line-height:1.8;padding:14px;min-height:130px;resize:vertical;box-sizing:border-box;width:100%}body .reader-journal [data-journal-thought]{min-height:250px}body .reader-journal{gap:14px}
html[data-theme="dark"]{color-scheme:dark;--study-bg:#171e20;--study-ink:#e3dfd0;--xuan-border:#43504b;--xuan-surface:linear-gradient(#222a29f0,#222a29f0),url('assets/xuan-paper-fibres.png')}
html[data-theme="dark"] body{background:#171e20!important;background-image:linear-gradient(#171e20f5,#171e20f5),url('assets/xuan-paper-fibres.png')!important;color:#e3dfd0!important}
html[data-theme="dark"] body :is(h1,h2,h3,h4,h5,strong,p,label,li,output,small,em,span,dt,dd,blockquote){color:#e3dfd0!important}
html[data-theme="dark"] body :is(.topbar,.mobile-jump-nav,.mobile-more-menu,.study-strip,.author-match-game,.feihua-game,.library,.notebook-section,.map,.rewards-view,.rhyme-portal,.article-card,.detail-panel,.match-scroll,.focus-reader,.reader-text,.reader-notes,.account-dialog,.quest-card,.shop-card,.reward-stats>div,.career-view,.career-summary,.career-branch,.notebook-card,.notebook-tools,.notebook-empty,.shop-goal,.daily-checkin-card,.reward-progress,.badge,.shop-preview,.shop-preview-scene,.reader-journal,.reader-toolbar,.reading-preferences,.reader-entry,.match-author-panel,.match-author-options button,.feihua-panel,.home-pet-info,.reader-companion-panel,.reader-journal-recent article,dialog){background-color:#242e2c!important;background-image:none!important;border-color:#47574f!important;box-shadow:none!important;color:#e3dfd0!important}
html[data-theme="dark"] body :is(input,textarea,select){background:#182321!important;color:#ebe6d8!important;border-color:#63736a!important}
html[data-theme="dark"] body :is(input,textarea)::placeholder{color:#a7b2a8!important}
html[data-theme="dark"] body :is(button,.nav a,.study-wallet,.study-level,.notebook-card-tags i,.reader-keywords>*,.reader-facts>*,.match-mode-switch button){background:#354641!important;background-image:none!important;color:#e3dfd0!important;border-color:#687d6e!important}
html[data-theme="dark"] body a{color:#aac8df!important}
html[data-theme="dark"] body :is(button.is-active,.nav a[aria-current="page"],.career-branch.is-selected){background:#3b5145!important;border-color:#9cae7e!important}
html[data-theme="dark"] body :is(.daily-checkin-link,[data-journal-save],[data-checkin]){background:#78473c!important;color:#fff0d7!important}
html[data-theme="dark"] body .nav a[href="#career"]{background:#27415f!important;color:#b4d4ff!important;border-color:#648ebd!important}
html[data-theme="dark"] body :is(.career-tasks a,.career-ladder li,.career-step-mark){background:#30413a!important;border-color:#647a62!important;color:#e5e3ca!important}
html[data-theme="dark"] body .career-ladder li.is-reached{background:#554637!important;border-color:#b09359!important}
/* Match hints and nested note surfaces must not retain their daylight fills. */
html[data-theme="dark"] body .reader-parallel-block{background:#263630!important;background-image:none!important;border-color:#63776a!important}
html[data-theme="dark"] body .reader-parallel-block:is(:hover,.reader-hover-focus){background:#30443a!important}
html[data-theme="dark"] body :is(.reader-original,.reader-translation)::before{color:#edc396!important}
html[data-theme="dark"] body .reader-parallel-block::before,html[data-theme="dark"] body .reader-content p[data-paragraph]::before{color:#b8c5b7!important}
html[data-theme="dark"] body .author-match-stage{background:#1e2b26!important;background-image:none!important;border-color:#52665a!important}
html[data-theme="dark"] body :is(.author-match-scoreboard>span,.match-author-card>span){background:#35463b!important;color:#f0eadb!important;border-color:#63776a!important}
html[data-theme="dark"] body :is(.author-match-panel,.reader-gloss-popover,.reader-inline-notes,.reader-inline-notes article,.reader-pdf-notes article,.reader-baihua-notes article,.reader-terms article,.reader-baihua-source,.reader-interaction-hint){background:#293833!important;background-image:none!important;border-color:#63776a!important;box-shadow:none!important;color:#eee9dc!important}
html[data-theme="dark"] body :is(.author-match-panel,.reader-gloss-popover,.reader-inline-notes,.reader-pdf-notes,.reader-baihua-notes,.reader-terms,.notebook-card-body){color:#eee9dc!important}
html[data-theme="dark"] body :is(.reader-inline-notes summary,.reader-gloss-popover strong,.notebook-card>strong,.match-current-source strong){color:#f2ead8!important}
html[data-theme="dark"] body :is(.reader-inline-notes article,.reader-pdf-notes article,.reader-baihua-notes article,.reader-terms article).is-focused{background:#3b4d40!important;border-left-color:#edc396!important}
html[data-theme="dark"] body :is(.reader-journal-feedback,.reader-journal label span,.reader-pdf-notes article small,.reader-terms article small,.notebook-card>span,.notebook-tools output,.match-scroll p,.match-current-source p){color:#d5dece!important;opacity:1}
html[data-theme="dark"] body :is(.reader-note-number,.reader-term-number){background:#78473c!important;color:#fff0d7!important}
html[data-theme="dark"] body .match-author-card:disabled{opacity:1}
html[data-theme="dark"] body .match-author-card.is-wrong{background:#49312e!important;border-color:#d59e91!important;filter:none;opacity:1}
html[data-theme="dark"] body .match-author-card.is-correct{background:#36553f!important;border-color:#b6d699!important;filter:none;opacity:1}
html[data-theme="dark"] body .match-feedback{background:#172720!important;color:#ffe4a7!important;border-color:#8e9b75!important}
html[data-theme="dark"] body .reader-toolbar{background:#202b28!important}
/* Keep the entry summary and its nested cells on matching night surfaces. */
html[data-theme="dark"] body .reader-entry-card{background:#293833!important;border-color:#52665a!important;border-left-color:#c89771!important;box-shadow:none!important;color:#f0eadb!important}
html[data-theme="dark"] body .reader-entry-copy strong{color:#f0eadb!important}
html[data-theme="dark"] body .reader-entry-copy p{color:#e3dfd0!important}
html[data-theme="dark"] body .reader-entry-copy>span{color:#edc396!important}
html[data-theme="dark"] body .reader-entry-stats>div{background:#1e2b26!important;border-color:#52665a!important}
html[data-theme="dark"] body .reader-entry-stats strong{color:#f0eadb!important}
html[data-theme="dark"] body .reader-entry-stats small{color:#c2cbbf!important}
html[data-theme="dark"] body .reader-entry-tags span{background:#35463b!important;border-color:#63775d!important;color:#e8d5a9!important}
html[data-theme="dark"] body .reader-scroll{background-color:#1e2825!important}
html[data-theme="dark"] body .reader-content :is(.reader-original,.reader-translation){background:transparent!important;color:#e5dfd0!important}
html[data-theme="dark"] body :is(.reader-content p,.reader-baihua p,.reader-note-heading,.reader-breadcrumb,.career-footnote,.preview-verse){color:#ddd8c9!important}
html[data-theme="dark"] body .paper-garden{opacity:.2}
html[data-theme="dark"] body dialog::backdrop{background:#070e11bc}
html[data-theme="dark"] body :is(.career-insignia,.career-branch-art,.reward-art){filter:brightness(.88) saturate(.85)}
html[data-theme="dark"] body button:disabled{opacity:.55}
html[data-theme="dark"] body .theme-toggle{background:#344651!important;color:#d4e6ee!important}
@media(max-width:640px){body .topbar{flex-wrap:wrap;gap:8px}body .topbar .theme-toggle{font-size:13px;padding:8px}body .reader-journal [data-journal-thought]{min-height:230px}}

@media(min-width:1000px){body .focus-reader[data-reader-view="clean"].show-reading-notes .reader-layout{grid-template-columns:minmax(0,1fr) minmax(340px,400px);max-width:1240px;gap:30px;padding-inline:30px}}
html[data-theme="dark"] body :is(.reader-view-toggle,.reader-script-toggle,.reader-floating-view-toggle,.match-mode-switch,.rhyme-display,.rhyme-slot,.rhyme-portal-stage,.portal-stage,.reader-journal-status,.catalog-view,.volume-card,.catalog-card,.match-history li,.reader-facts,.reader-note-heading){background-color:#293833!important;background-image:none!important;border-color:#52665a!important}

body .theme-toggle{position:relative;border-color:#709cce;background:#e5efff;color:#244e80;font-weight:800;animation:theme-beacon 2.8s ease-in-out infinite}body .theme-toggle::after{content:'';display:inline-block;width:6px;height:6px;margin-left:7px;border-radius:50%;background:#5895de;box-shadow:0 0 7px #5895de;vertical-align:middle}html[data-theme="dark"] body .theme-toggle{border-color:#80afe2!important;background:#2b465f!important;color:#e3f2ff!important}@keyframes theme-beacon{0%,100%{box-shadow:0 0 0 0 #5895de20,0 0 5px #5895de20}50%{box-shadow:0 0 0 4px #5895de18,0 0 16px #5895de70}}@media(prefers-reduced-motion:reduce){body .theme-toggle{animation:none;box-shadow:0 0 8px #5895de50}}

body .theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px}body .theme-toggle .theme-symbol,html[data-theme="dark"] body .theme-toggle .theme-symbol{display:inline-flex;width:29px;height:29px;flex-shrink:0;color:#e7ae28!important;filter:drop-shadow(0 0 4px #ffd76666)}body .theme-symbol svg{width:100%;height:100%;overflow:visible}body .theme-toggle::after{margin-left:1px}html[data-theme="dark"] body .theme-toggle .theme-symbol{color:#ffd76a!important}@media(max-width:640px){body .theme-toggle .theme-symbol{width:26px;height:26px}}

/* Complete the dark surfaces used by article previews, matching and the atlas. */
html[data-theme="dark"] body :is(.article-detail,.author-match-panel,.author-match-stage,.author-match-scoreboard>span,.archive-index,.scroll-paper){background:#242e2c!important;background-image:none!important;border-color:#586b61!important;color:#eee8d9!important;box-shadow:none!important}
html[data-theme="dark"] body :is(.article-detail,.author-match-panel,.author-match-stage,.archive-index,.scroll-paper) :is(p,span,strong,small,output,h3,blockquote,.volume-work-title,.volume-work-guide,.volume-work-number){color:#eee8d9!important}
html[data-theme="dark"] body .scroll-paper-heading::before{background:none!important}
html[data-theme="dark"] body .volume-work-title{background-image:none!important;-webkit-text-fill-color:currentColor}
html[data-theme="dark"] body .volume-work-list button{background:transparent!important;border-bottom:1px solid #52655a!important}
html[data-theme="dark"] body .volume-work-list button:hover{background:#35483f!important}
html[data-theme="dark"] body .match-author-card span{background:#475e52!important}
html[data-theme="dark"] body .match-author-options button:disabled{opacity:1}
html[data-theme="dark"] body .match-author-options button.is-correct{background:#244e3e!important;border-color:#88c5a0!important}
html[data-theme="dark"] body .match-author-options button.is-wrong{background:#633b3b!important;border-color:#d89c91!important}
html[data-theme="dark"] body .archive-index-button.is-active{background:#7d4438!important;border-color:#e0bc7c!important;color:#fff2d5!important}
html[data-theme="dark"] body .archive-index-button:focus-visible{outline:2px solid #e0bc7c;outline-offset:2px}
/* The desktop quick index opens on demand; the shelf remains the main selector. */
@media(min-width:641px){
 body .archive-index{height:auto;max-height:74%;padding:12px;gap:10px;grid-template-rows:auto auto minmax(0,1fr);overflow:auto;background:#f2eddc}
 body .archive-index-heading{gap:12px;min-height:36px}
 body .archive-index-heading strong,body .archive-index-heading output{font-size:14px}
 body .archive-index-toggle{display:inline-flex;align-items:center;justify-content:center;padding:8px 12px;min-height:36px;border:1px solid #9b8967;border-radius:5px;background:#e8ddc4;color:#463b2b;font:inherit;font-size:14px;cursor:pointer;white-space:nowrap}
 body .archive-index-search{font-size:16px;height:40px;flex-shrink:0}
 body .archive-index-grid{grid-template-columns:repeat(10,minmax(0,1fr));grid-template-rows:repeat(6,minmax(36px,auto));gap:5px}
 body .archive-index-button{font-size:14px;min-height:36px}
 body .archive-scene.is-mobile-index-collapsed .archive-index{grid-template-rows:auto}
 body .archive-scene.is-mobile-index-collapsed :is(.archive-index-search,.archive-index-grid){display:none}
 body .archive-scene:not(.is-mobile-index-collapsed) .archive-shelf{visibility:hidden}
 body .scroll-paper{grid-template-columns:minmax(110px,.26fr) 1px minmax(0,1fr) 32px;gap:12px;width:72%;left:24%;padding:14px;height:31%;top:59%;min-height:145px}
 body .scroll-paper-heading>strong{font-size:28px;line-height:1.2}
 body .scroll-paper-heading>span,body .scroll-paper-heading>p{font-size:14px}
 body .volume-work-title{font-size:18px;line-height:1.5}
 body .volume-work-guide{font-size:14px;line-height:1.5}
 body .volume-work-list{min-height:0}
}
@media(min-width:641px) and (max-width:1200px){body .volume-work-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}body .scroll-paper{grid-template-columns:110px 1px minmax(0,1fr)}body .scroll-paper-meta{display:none}}
