/* Scoped to the opt-in reading theme and independently selectable bookshelf. */
body[data-theme=reading] { --bg:color-mix(in srgb,var(--accent) 5%,#f6f3eb)!important; --surface:color-mix(in srgb,var(--accent) 5%,#fffefa)!important; --soft:color-mix(in srgb,var(--accent) 12%,#f1eee5)!important; --ink:#45463c!important; --muted:#838273!important; --line:color-mix(in srgb,var(--accent) 23%,#e6e8e3)!important; }
body[data-theme=reading][data-dark=true] { --bg:color-mix(in srgb,var(--accent) 6%,#1c1f1c)!important; --surface:color-mix(in srgb,var(--accent) 18%,#20242a)!important; --soft:color-mix(in srgb,var(--accent) 24%,#272c32)!important; --ink:#e5dfce!important; --muted:#aaa695!important; --line:color-mix(in srgb,var(--accent) 28%,#353941)!important; }
.home.home-reading { position:relative; min-height:calc(100svh - 86px); padding:0 24px 165px; overflow:hidden; }
.reading-room { position:fixed; inset:0; overflow:hidden; pointer-events:none; z-index:0; background:radial-gradient(ellipse at 31% 33%,#fffdf7bb,transparent 70%),linear-gradient(165deg,#f4f1e500, #e2ddcb45); }
.reading-window-light { position:absolute; width:70vw; height:115vh; left:43%; top:-34%; transform:rotate(29deg); background:linear-gradient(90deg,transparent 0 3%,#9c927815 4% 5%,#ffffff40 6% 42%,#978d7312 43% 44%,#ffffff30 45% 82%,transparent 84%); filter:blur(12px); opacity:.65; }
.reading-desk-light { position:absolute; inset:72% -10% -30%; transform:rotate(-8deg); background:linear-gradient(#d5cbb321,transparent 30%); border-top:1px solid #c4bca219; }
.reading-composition { position:relative; z-index:1; width:min(1080px,90vw); text-align:center; padding-top:4vh; }
.reading-heading { position:relative; z-index:1; }
.reading-heading h1,.reading-heading p { white-space:pre-line; overflow-wrap:anywhere; }
.reading-edition { display:inline-flex; align-items:center; justify-content:center; gap:13px; color:var(--muted); font:10px/1.8 'Segoe UI','Microsoft YaHei',sans-serif; letter-spacing:2.3px; }
.reading-edition>i { height:1px; width:25px; background:currentColor; opacity:.35; }
.reading-heading h1 { margin:26px 0 15px; font-family:'STZhongsong','Songti SC','SimSun',serif; font-size:clamp(30px,3.2vw,55px); font-weight:400; line-height:1.55; letter-spacing:.15em; color:var(--ink); }
.reading-heading p { margin:0; color:var(--muted); font:12px/1.8 var(--font); letter-spacing:.18em; }
.reading-still-life { width:min(880px,83vw); height:clamp(255px,43svh,530px); margin:-20px auto 0; pointer-events:none; }
.reading-still-life>svg { display:block; width:100%; height:100%; overflow:visible; }
.reading-dateline { display:flex; gap:14px; align-items:center; justify-content:center; color:var(--muted); font:10px/1.8 var(--font); letter-spacing:1.4px; margin-top:-6px; }
.reading-dateline>i { width:3px; height:3px; background:currentColor; border-radius:50%; opacity:.5; }
.home-reading .utility-search { position:fixed; right:4.5%; bottom:25px; margin:0; z-index:2; }
.home-reading .scroll-invitation { position:fixed; bottom:18px; z-index:2; }
.reading-dock-book { display:grid; place-items:center; width:62px; height:51px; margin:0 auto 10px; color:var(--accent); }
.reading-dock-book svg { width:41px; height:41px; stroke-width:1; fill:color-mix(in srgb,var(--accent) 6%,transparent); transition:transform .25s; }
.dock-trigger:hover .reading-dock-book svg { transform:translateY(-3px); }
body[data-theme=reading][data-dark=true] .reading-room { background:radial-gradient(ellipse at 45% 51%,#c7a9700d,transparent 55%); }
body[data-theme=reading][data-dark=true] .reading-window-light { opacity:.1; }
body[data-theme=reading][data-dark=true] .reading-still-life { filter:brightness(.75) saturate(.7); }
body[data-theme=reading][data-dark=true] .reading-dock-book { color:#c4c4a5; }
.theme-preview.mini-reading { background:#f3f0e7; }
.theme-preview.mini-reading>svg { width:100%; height:100%; transform:scale(1.6) translateY(-7%); }
#link-view-settings [data-link-view=shelf]>span { display:grid; place-items:center; width:20px; height:20px; }
#link-view-settings [data-link-view=shelf]>span>svg { width:20px; height:20px; }

.workspace .cards[data-display=shelf] { display:grid; grid-template-columns:repeat(var(--shelf-columns,2),minmax(0,1fr)); column-gap:38px; row-gap:3px; padding:16px 10px 6px; align-items:stretch; }
.workspace .cards[data-display=shelf]>.bookmark { min-width:0; position:relative; background:none; border:0; box-shadow:none; padding:0; margin-right:var(--shelf-inset,0px); margin-left:calc(var(--shelf-inset,0px) * .4); border-radius:4px 8px 8px 4px; --shelf-cover:color-mix(in srgb,var(--accent) 52%,#555d4b); --shelf-print:#f6f0dd; }
.workspace .cards[data-display=shelf]>.bookmark[data-shelf-tone="1"] { --shelf-cover:#d8ccb0; --shelf-print:#554f3e; }
.workspace .cards[data-display=shelf]>.bookmark[data-shelf-tone="2"] { --shelf-cover:#7c898c; --shelf-print:#202b2d; }
.workspace .cards[data-display=shelf]>.bookmark[data-shelf-tone="3"] { --shelf-cover:#a2816b; --shelf-print:#30251e; }
.workspace .cards[data-display=shelf]>.bookmark[data-shelf-tone="4"] { --shelf-cover:#a9ab94; --shelf-print:#343d30; }
.workspace .cards[data-display=shelf]>.bookmark { min-height:0; height:100%; }
.workspace .cards[data-display=shelf]>.bookmark>a { display:block; width:100%; height:100%; min-height:0; padding:0; color:var(--shelf-print); border-radius:inherit; }
.shelf-spine { position:relative; display:flex; align-items:center; width:100%; height:100%; gap:15px; padding:8px 35px 8px 19px; color:var(--shelf-print); border-radius:inherit; background:linear-gradient(180deg,#ffffff14,transparent 18% 75%,#00000016),var(--shelf-cover); box-shadow:inset 0 1px #ffffff35,inset 0 -2px #00000017,1px 2px 2px #242b1c13; transition:transform .23s ease,box-shadow .23s; }
.shelf-spine::before { content:''; position:absolute; inset:5px auto 5px 8px; width:3px; border-left:1px solid currentColor; border-right:1px solid currentColor; opacity:.16; pointer-events:none; }
.shelf-spine::after { content:''; position:absolute; top:7px; right:8px; bottom:7px; width:1px; background:currentColor; opacity:.18; pointer-events:none; }
.shelf-title { min-width:0; flex:1; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; font:500 17px/1.4 'Songti SC','SimSun',Georgia,serif; letter-spacing:.06em; }
.shelf-mark { flex:0 0 27px; width:27px; height:27px; display:grid; place-items:center; }
.workspace .cards[data-display=shelf] .site-icon { width:27px; height:27px; padding:4px; border-radius:5px; background:#fbf8ed; color:#485440; font:15px var(--font); box-shadow:none; border:0; }
.shelf-domain { display:none; }
.workspace .cards[data-display=shelf]>.bookmark:where(:hover,:focus-within) { z-index:2; }
.workspace .cards[data-display=shelf]>.bookmark:where(:hover,:focus-within) .shelf-spine { transform:translateX(7px); box-shadow:inset 0 1px #ffffff35,inset 0 -2px #00000017,-4px 6px 12px #242b1c1c; }
.workspace .cards[data-display=shelf]>.bookmark>a:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
.workspace .cards[data-display=shelf]>.bookmark>.bookmark-edit { top:5px; right:4px; transform:none; width:24px; height:24px; padding:5px; color:var(--shelf-print); background:transparent; border:0; box-shadow:none; }
.workspace .cards[data-display=shelf]>.bookmark>.remove { top:auto; bottom:5px; right:4px; width:24px; height:24px; padding:0; color:var(--shelf-print); background:transparent; }
.workspace .cards[data-display=shelf]>.bookmark:focus-within>.bookmark-edit,.workspace .cards[data-display=shelf]>.bookmark:focus-within>.remove { opacity:1; }
.shelf-plank { display:block; align-self:start; height:8px; margin:3px -10px 0; border-radius:1px; background:linear-gradient(#c5bda63c,#b4ab9021); border-top:1px solid #c3b99e60; box-shadow:0 9px 14px -7px #473f2824; pointer-events:none; }
.shelf-add { display:flex; align-items:center; gap:12px; padding:8px 20px; margin:0 8px 0 4px; border:1px dashed color-mix(in srgb,var(--muted) 32%,transparent); border-radius:4px 7px 7px 4px; color:var(--muted); background:transparent; text-align:left; transition:background .2s; }
.shelf-add>span:first-child { font-size:23px; font-weight:300; }
.shelf-add>span:last-child { font:13px var(--font); }
.shelf-add small { display:block; margin-top:4px; font:9px var(--font); opacity:.7; }
.shelf-add:hover,.shelf-add:focus-visible { background:var(--soft); color:var(--ink); }
.cards[data-display=shelf]>.empty { grid-column:1/-1; }
body[data-dark=true] .cards[data-display=shelf]>.bookmark { --shelf-cover:color-mix(in srgb,var(--accent) 36%,#3e493b); --shelf-print:#ece6d5; }
body[data-dark=true] .cards[data-display=shelf]>.bookmark[data-shelf-tone="1"] { --shelf-cover:#ada48c; --shelf-print:#232820; }
body[data-dark=true] .cards[data-display=shelf]>.bookmark[data-shelf-tone="2"] { --shelf-cover:#515f64; --shelf-print:#f0ebdb; }
body[data-dark=true] .cards[data-display=shelf]>.bookmark[data-shelf-tone="3"] { --shelf-cover:#755d50; --shelf-print:#f7ebd6; }
body[data-dark=true] .cards[data-display=shelf]>.bookmark[data-shelf-tone="4"] { --shelf-cover:#6b745e; --shelf-print:#ffffed; }
@media(min-width:1800px) { .reading-composition { width:1300px; }.reading-still-life { width:1080px; height:48svh; max-height:640px; }.reading-heading h1 { font-size:60px; } }
@media(max-width:760px) { .home.home-reading { min-height:calc(100svh - 76px); padding:0 20px 155px; }.reading-composition { width:100%; padding-top:0; }.reading-heading h1 { font-size:clamp(25px,5.5vw,39px); letter-spacing:.05em; margin:22px 0 13px; }.reading-heading p { font-size:10px; letter-spacing:.1em; }.reading-edition { font-size:8px; letter-spacing:1.1px; gap:9px; }.reading-still-life { width:100%; height:34svh; min-height:225px; margin:-3px auto 0; }.reading-still-life>svg { transform:scale(1.25); }.reading-dateline { gap:8px; font-size:8px; letter-spacing:.3px; }.home-reading .utility-search button>span { display:none; }.workspace .cards[data-display=shelf] { column-gap:24px; padding:12px 6px; }.shelf-title { font-size:16px; }.shelf-spine { gap:12px; }.reading-window-light { width:130vw; left:8%; } }
@media(max-height:650px) and (min-width:761px) { .home.home-reading { padding-bottom:110px; }.reading-composition { padding:0; }.reading-heading h1 { font-size:32px; margin:12px 0 6px; }.reading-still-life { height:225px; min-height:0; margin-top:-20px; }.reading-dateline { margin-top:-20px; } }
@media(hover:none) { .workspace .cards[data-display=shelf] .bookmark-edit,.workspace .cards[data-display=shelf] .remove { opacity:1; }.workspace .cards[data-display=shelf]>.bookmark:hover .shelf-spine { transform:none; } }
@media(prefers-reduced-motion:reduce) { .shelf-spine,.shelf-add,.reading-dock-book svg { transition:none; } }

/* Page-world gallery: only the reading homepage changes. */
body[data-theme=reading][data-view=home] { --bg:#f3f4fa!important; --ink:#292c43!important; --muted:#77798e!important; }
.home.home-reading { height:calc(100svh - 86px); min-height:0; padding:0; }
.reading-gallery { --gallery-blue:#3049eb; --gallery-ribbon:#ff704b; position:fixed; inset:0; z-index:0; margin:0; overflow:hidden; background:radial-gradient(ellipse at 69% 30%,#fff 0,transparent 58%),#f3f4fa; }
.reading-gallery[data-chapter="1"] { --gallery-blue:#ee7458; --gallery-ribbon:#7062e5; }
.reading-gallery[data-chapter="2"] { --gallery-blue:#8474d9; --gallery-ribbon:#a9bcff; }
.reading-artwork,.reading-turn-hit { position:absolute; left:50%; top:43%; width:min(1000px,80vw,calc((100svh - 260px)*1.55)); aspect-ratio:1.55; transform:translate(-50%,-50%); }
.reading-artwork { perspective:1800px; transform:translate(calc(-50% + var(--reading-x,0px)),calc(-50% + var(--reading-y,0px))); transition:transform 1.2s ease; pointer-events:none; }
.reading-book-stage { position:absolute; inset:10% 2% 14%; transform-style:preserve-3d; transform:rotateX(22deg) rotateY(-13deg) rotateZ(-12deg); }
.reading-book-shadow { position:absolute; left:14%; right:10%; bottom:6%; height:12%; border-radius:50%; background:#292a6130; filter:blur(24px); transform:rotate(-9deg); }
.reading-book-cover { position:absolute; inset:1% -1% -2%; border-radius:2px 5px 7px 3px; background:var(--gallery-blue); transform:translateZ(-9px); box-shadow:0 12px 28px #25245113; transition:background .7s; }
.reading-book-edges { position:absolute; inset:0 0 -1%; border-radius:2px 4px 6px 2px; background:repeating-linear-gradient(#e3e4ef 0 1px,#fbfbff 1px 2px); transform:translateZ(-4px); }
.reading-page { position:absolute; top:0; bottom:0; width:50%; overflow:hidden; }
.reading-page-left { left:0; border-radius:2px 0 0 2px; color:var(--gallery-blue); background:linear-gradient(90deg,#fff 0,#fdfdff 65%,#f0f0f8 95%,#d7d9e6); transition:color .7s; }
.reading-page-left>svg,.reading-page-right>svg,.reading-flip-front>svg,.reading-flip-back>svg { display:block; width:100%; height:100%; }
.reading-page-right { right:0; border-radius:0 3px 3px 0; background:linear-gradient(90deg,#e4e6f1,#fff 7%); }
.reading-page-right::after { content:''; position:absolute; bottom:0; right:0; width:28px; height:28px; clip-path:polygon(100% 0,0 100%,100% 100%); background:linear-gradient(135deg,#eff0f8 48%,#d5d9e9 52%,#fff); transition:width .4s,height .4s; }
.reading-gallery:has(.reading-turn-hit:hover) .reading-page-right::after,.reading-gallery:has(.reading-turn-hit:focus-visible) .reading-page-right::after { width:65px; height:65px; }
.reading-page-number { position:absolute; bottom:7%; left:20%; font:9px/1 'Segoe UI',sans-serif; letter-spacing:2px; color:var(--gallery-blue); opacity:.5; }
.reading-binding { position:absolute; left:calc(50% - 1px); top:0; bottom:0; width:2px; background:#bfc3d58c; transform:translateZ(.5px); }
.reading-bookmark-ribbon { position:absolute; width:12%; height:38%; left:44.6%; top:96%; color:var(--gallery-ribbon); transform:translateZ(1px); overflow:visible; transition:color .7s; }
.reading-flip-sheet { display:none; position:absolute; left:50%; top:0; bottom:0; width:50%; transform-origin:left center; transform-style:preserve-3d; z-index:3; }
.reading-flip-sheet.is-active { display:block; }
.reading-flip-front,.reading-flip-back { position:absolute; inset:0; backface-visibility:hidden; overflow:hidden; border-radius:0 3px 3px 0; }
.reading-flip-front { background:linear-gradient(90deg,#e4e6f1,#fff 7%); box-shadow:8px 8px 20px #1c255b18; }
.reading-flip-back { transform:rotateY(180deg); color:var(--gallery-blue); background:linear-gradient(90deg,#fff 0,#fdfdff 65%,#f0f0f8 95%,#d7d9e6); }
.reading-turn-hit { z-index:2; padding:0; background:transparent; border:0; border-radius:20%; cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.reading-turn-hit:focus-visible { outline:1px dashed var(--gallery-blue); outline-offset:6px; }
.reading-turn-corner { position:absolute; right:10%; bottom:17%; color:var(--gallery-blue); font:22px/1 var(--font); opacity:0; transform:translate(-5px,5px); transition:opacity .25s,transform .25s; }
.reading-turn-hit:hover .reading-turn-corner,.reading-turn-hit:focus-visible .reading-turn-corner { opacity:.65; transform:none; }
.reading-gallery.is-turning .reading-turn-corner { opacity:0; }
.reading-gallery-caption { position:absolute; left:7%; bottom:22%; display:flex; flex-direction:column; gap:12px; color:#333852; }
.reading-gallery-title { font:400 24px/1.2 'Segoe UI','Microsoft YaHei',sans-serif; letter-spacing:.42em; }
.reading-gallery-index { color:#8b8ba1; font:10px/1.2 var(--font); letter-spacing:2px; }
.reading-gallery-nav { position:absolute; right:7%; bottom:22%; z-index:3; display:flex; flex-direction:column; align-items:center; gap:9px; }
.reading-turn-action { display:flex; align-items:center; gap:9px; padding:10px 13px; border-radius:22px; border:0; color:#555d91; background:transparent; font:11px/1.4 var(--font); letter-spacing:1.5px; transition:background .25s,color .25s; }
.reading-turn-action>svg { width:20px; height:20px; stroke:currentColor; stroke-width:1; stroke-linecap:round; stroke-linejoin:round; }
.reading-turn-action:hover,.reading-turn-action:focus-visible { color:var(--gallery-blue); background:#3449eb09; }
.reading-chapter-dots { display:flex; align-items:center; gap:0; }
.reading-chapter-dots>button { width:30px; height:30px; display:grid; place-items:center; padding:0; border:0; border-radius:50%; background:transparent; }
.reading-chapter-dots i { width:4px; height:4px; border-radius:50%; background:#bfc2d1; transition:background .25s,box-shadow .25s; }
.reading-chapter-dots [aria-pressed=true] i { background:var(--gallery-blue); box-shadow:0 0 0 4px #6476ea12; }
.reading-chapter-dots>button:hover i { box-shadow:0 0 0 5px #6476ea18; }
.reading-gallery-nav button:focus-visible { outline:1px solid var(--gallery-blue); outline-offset:2px; }
.reading-gallery.is-turning .reading-turn-action { opacity:.55; }
.home-reading .utility-search,.home-reading .scroll-invitation { color:#7b7d94; text-shadow:none; }
.home-reading .utility-search button,.home-reading .utility-search button>span,.home-reading .utility-search kbd { color:inherit; }
body[data-theme=reading][data-view=home] .dock-trigger { color:#747caa; }
body[data-theme=reading][data-view=home] .dock-label,body[data-theme=reading][data-view=home] .reading-dock-book { color:inherit; }
body[data-theme=reading][data-view=home][data-dark=true] { --bg:#202333!important; --ink:#e0e3fa!important; --muted:#999db9!important; }
body[data-theme=reading][data-dark=true] .reading-gallery { background:radial-gradient(ellipse at 60% 37%,#38394d,transparent 70%),#202333; }
body[data-theme=reading][data-dark=true] .reading-page-left,body[data-theme=reading][data-dark=true] .reading-flip-back { color:#8d9afb; background:linear-gradient(90deg,#3b4058 0,#393e55 65%,#32374d 95%,#24293d); }
body[data-theme=reading][data-dark=true] .reading-page-right,body[data-theme=reading][data-dark=true] .reading-flip-front { background:linear-gradient(90deg,#252a40,#42485f 7%); }
body[data-theme=reading][data-dark=true] .reading-book-edges { background:repeating-linear-gradient(#30364c 0 1px,#525a73 1px 2px); }
body[data-theme=reading][data-dark=true] .reading-page-number { color:#9ca9e5; }
body[data-theme=reading][data-dark=true] .reading-page-right::after { background:linear-gradient(135deg,#3b425b 48%,#30374f 52%,#555e7b); }
body[data-theme=reading][data-dark=true] .reading-book-shadow { background:#10132380; }
body[data-theme=reading][data-dark=true] .reading-gallery-caption { color:#e1e4fa; }
body[data-theme=reading][data-dark=true] .reading-gallery-index,body[data-theme=reading][data-dark=true] .reading-turn-action { color:#a5abcf; }
body[data-theme=reading][data-dark=true] .reading-chapter-dots i { background:#747a98; }
body[data-theme=reading][data-dark=true] .reading-chapter-dots [aria-pressed=true] i { background:#c0c9ff; }
body[data-theme=reading][data-view=home][data-dark=true] .dock-trigger,body[data-theme=reading][data-dark=true] .home-reading .utility-search,body[data-theme=reading][data-dark=true] .home-reading .scroll-invitation { color:#aeb4d9; }
@media(max-height:800px) and (min-width:761px) { .home.home-reading { height:calc(100svh - 70px); }.reading-gallery-caption,.reading-gallery-nav { bottom:23%; }.reading-gallery-title { font-size:20px; } }
@media(max-width:760px) { .home.home-reading { height:calc(100svh - 76px); }.reading-artwork,.reading-turn-hit { width:112vw; max-width:660px; top:41%; }.reading-book-stage { transform:rotateX(18deg) rotateY(-11deg) rotateZ(-12deg); }.reading-gallery-caption { left:8%; bottom:25%; }.reading-gallery-nav { right:8%; bottom:24%; }.reading-gallery-title { font-size:20px; }.reading-chapter-dots>button { width:36px; height:36px; }.reading-turn-action { min-height:44px; }.reading-gallery-index { font-size:9px; }.reading-page-number { font-size:7px; } }
@media(max-width:760px) and (max-height:650px) { .reading-artwork,.reading-turn-hit { width:min(92vw,calc(100svh * .9)); top:38%; }.reading-gallery-caption { bottom:29%; }.reading-gallery-nav { bottom:27%; } }
@media(prefers-reduced-motion:reduce) { .reading-artwork,.reading-book-cover,.reading-bookmark-ribbon,.reading-page-left,.reading-page-right::after,.reading-turn-corner,.reading-turn-action,.reading-chapter-dots i { transition:none; } }

/* Quick visual study: one floating page, with the existing page-turn interaction. */
.reading-gallery { --quick-page-width:min(360px,64vw,calc((100svh - 420px)*.78)); }
.reading-artwork,.reading-turn-hit { width:var(--quick-page-width); max-width:none; aspect-ratio:.78; top:41%; }
.reading-book-stage { inset:0; transform:rotateX(4deg) rotateY(-8deg) rotateZ(-7deg); }
.reading-page-left,.reading-binding,.reading-bookmark-ribbon { display:none; }
.reading-page-right,.reading-flip-sheet { left:0; right:auto; width:100%; }
.reading-book-cover { inset:3px -4px -5px 2px; transform:translateZ(-5px); }
.reading-book-edges { inset:0 0 -2px; transform:translateZ(-2px); }
.reading-book-shadow { left:6%; right:0; bottom:-4%; height:5%; filter:blur(18px); opacity:.65; }
.reading-gallery-caption { left:50%; top:13%; bottom:auto; transform:translateX(-50%); }
.reading-gallery-title { font-size:18px; letter-spacing:.45em; }
.reading-gallery-index { display:none; }
.reading-gallery-nav { left:50%; right:auto; top:calc(41% + var(--quick-page-width) / .78 / 2 + 14px); bottom:auto; transform:translateX(-50%); gap:0; }
.reading-turn-corner { right:0; bottom:0; }
