/* Reading-room theme. Sheet geometry and turn timing live in book-physical.css. */
:root {
 --night:#f5f2eb;
 --cream:#192f49;
 --paper:#fffdf6;
 --print:#283341;
 --blue:#245cb9;
 --muted:#626d79;
 --line:#d4d9d9;
 --book-height:590px;
}
body { background:var(--night); color:var(--print); }
[hidden] { display:none!important; }
footer a { text-underline-offset:3px; }
#plain-reader { font-size:18px; }
#plain-reader h2 { font-weight:400; line-height:1.3; }
#plain-reader .reader-choices { border-top:1px solid #c6cbd0; margin-top:35px; padding-top:15px; }
#plain-reader .reader-choices article { margin-bottom:25px; }
#plain-reader dt { font:600 12px var(--sans); margin-bottom:5px; }
#plain-reader dd { margin:0 0 15px; font-size:16px; line-height:1.7; }
@media(max-width:800px) { footer>span:last-child { display:block; } }
.room-background {
 position:fixed; inset:0; height:auto; z-index:-1;
 background:url('./assets/jiangnan-endpaper.png') center / cover no-repeat;
 opacity:.8; pointer-events:none;
}
.room-background:after {
 background:linear-gradient(#f5f2eb26,#f5f2eb40);
}
.site-header {
 max-width:1320px; min-height:98px; padding:24px 44px;
 border-bottom:1px solid var(--line); gap:24px;
}
.brand { gap:12px; color:#17375d; }
.brand>span { font-size:21px; letter-spacing:-.7px; }
.brand small { color:var(--muted); font-size:9px; letter-spacing:1.5px; margin-top:7px; }
.brand-mascot { width:43px; height:43px; border:0; box-shadow:0 0 0 4px #e5eaf0; }
.site-header nav { gap:28px; margin-right:20px; }
.site-header nav button { color:#4b5a6b; font-size:13px; min-height:44px; padding:10px 2px; }
.site-header nav button:hover { color:var(--blue); }
.site-header nav #beginning { color:var(--blue); }
.site-header nav #text-size { font:20px var(--serif); padding-inline:8px; }
.site-header nav #text-size[aria-pressed=true] { background:#e2eaf7; border-radius:5px; }
.share-button { color:#fff; background:var(--blue); border-color:var(--blue); border-radius:6px; padding:10px 17px; min-height:44px; }
.share-button:hover { background:#184e9e; }
.reading-intro {
 max-width:1190px; padding:44px 36px 42px; margin:auto;
 display:flex; align-items:flex-end; justify-content:space-between; gap:35px; text-align:left;
}
.reading-intro .eyebrow { font-size:9px; letter-spacing:1.5px; color:#506a85; margin-bottom:18px; }
.reading-intro h1 { font-size:clamp(48px,5vw,70px); line-height:1.02; letter-spacing:-3px; margin:0; color:#1e354c; }
.reading-intro h1 br { display:block; }
.reading-intro h1 em { color:var(--blue); }
.intro-aside { padding-bottom:5px; }
.reading-intro .intro-line { font-size:15px; line-height:1.8; color:#4b5b6c; margin:0 0 22px; }
.chapter-meta { font-size:10px; color:#526579; margin:0; display:flex; gap:12px; align-items:center; }
.chapter-meta span { color:#9baaba; }
.reading-desk { max-width:1210px; padding:8px 52px 24px; }
.book-container { max-width:1080px; }
.book-binding {
 background:linear-gradient(90deg,#274c84,#153764 49%,#3463a0 51%,#234b84);
 border:1px solid #183d72; border-radius:5px 8px 10px 7px;
 box-shadow:0 28px 45px #18345325,0 9px 10px #18345318,inset 0 0 0 3px #28558b,inset 0 0 0 4px #6485b2;
}
.page-stack {
 background:repeating-linear-gradient(0deg,#c6c1b4 0px,#eee9db 1px,#f9f5e9 2px,#d8d2c2 3px);
 box-shadow:0 3px 0 #bdb7a6,0 5px 2px #213b4d22;
}
.book-page { padding:29px 42px 18px; }
.left-page { padding-right:48px; background:linear-gradient(90deg,#f0ecdf 0%,#fffdf6 4%,#fffdf6 89%,#f5f1e5 97%,#d8d0bd 100%); }
.right-page { padding-left:48px; background:linear-gradient(90deg,#d8d0bd 0%,#f5f1e5 3%,#fffdf6 11%,#fffdf6 96%,#f0ecdf 100%); }
.book-page:before { opacity:.13; }
.book-spine { background:linear-gradient(90deg,transparent,#77736a16 35%,#56545235 49%,#ffffff40 54%,transparent); }
.ribbon { background:linear-gradient(90deg,#ac6540,#d19162 48%,#b16c44); height:51px; width:20px; }
.running-title { color:#747c84; font-size:8px; letter-spacing:1.2px; margin-bottom:23px; }
.running-title:after { background:#b6c4d0; }
.prose { color:#283341; font-size:17px; line-height:1.82; }
.prose p.opening:first-letter { color:var(--blue); }
.page-number { color:#737e86; }
.title-leaf { padding-top:5px; }
.edition-line { color:#5b7187; font-size:8px; letter-spacing:1.7px; margin-bottom:18px; }
.title-leaf>.title-paw { display:none; }
.title-leaf h2 { color:#17375d; font-size:48px; letter-spacing:-2px; }
.book-subtitle { color:#5f7181; font-size:17px; margin-top:5px; }
.title-leaf .title-rule { background:#b6c5d2; margin:18px 0; width:42px; }
.chapter-kicker { color:#657b90; font-size:8px; letter-spacing:1.7px; }
.title-leaf h3 { color:#243c56; font-size:34px; margin-bottom:20px; }
.cover-art.chapter-art { max-width:330px; max-height:240px; border-radius:5px; min-height:70px; background:transparent; flex:1; }
.title-caption { color:#617387; font:9px/1.6 var(--sans); margin-top:12px; }
.book-controls { margin-top:35px; gap:24px; }
.turn-button { color:#355575; border-color:#b3c3d1; background:#fbfaf6; min-height:46px; border-radius:6px; padding-inline:18px; }
.turn-button span { font-size:12px; }
.turn-button:hover:not(:disabled) { color:var(--blue); border-color:var(--blue); background:#edf2fa; }
.turn-button#next { background:var(--blue); color:#fff; border-color:var(--blue); }
.turn-button#next:hover:not(:disabled) { background:#184e9e; color:#fff; }
.page-position>span { color:#4d6277; font-size:11px; }
.reading-progress { background:#ccd6df; height:3px; }
#progress-fill { background:var(--blue); }
.reading-hint { color:#626d79; font-size:11px; margin-top:16px; }
.feedback { color:#295c98; }
footer { max-width:1230px; margin-top:4px; padding:20px 42px 27px; border-top:1px solid var(--line); color:#626d79; font-size:10px; }
.decision-leaf h2,.closing-leaf h2 { color:#243c56; }
.decision-leaf h2 em,.closing-leaf h2 em { color:var(--blue); }
.decision-leaf>p:not(.chapter-kicker),.closing-leaf>p:not(.chapter-kicker) { color:#556576; }
.decision-leaf .decision-question { color:#2e5276!important; }
.book-choices button { border-color:#c6d2df; background:#f5f7f9; color:#214a78; border-radius:5px; }
.book-choices button:hover { background:#e8f0fb; border-color:#4c79b5; }
.book-choices small { color:#53687e; }
.voting-state { background:#eaf0f7; border-color:#c6d3e3; color:#3b5d83; border-radius:4px; }
.decision-leaf .choice-help { color:#627285!important; }
.closing-note { color:#627285; }
.paper-button { background:var(--blue); border-color:var(--blue); color:#fff; border-radius:5px; }
.paper-button:hover { background:#184e9e; }
dialog { background:#fffdf6; color:var(--print); border:1px solid #bbc9d7; border-radius:12px; box-shadow:0 25px 100px #17314f38; }
dialog::backdrop { background:#18304985; backdrop-filter:blur(4px); }
dialog h2,dialog h2 em { color:#214a78; }
dialog p,dialog .eyebrow { color:#526a80; }
dialog dl { background:#eef3fa; }
.dialog-close { color:#345b86; width:44px; height:44px; top:8px; right:8px; }
.dialog-close:hover { background:#eaf0f7; }
button:focus-visible,a:focus-visible { outline-color:#1670d6; }
.skip-link { background:var(--blue); color:white; }
.no-script,.read-fallback { background:var(--paper); color:var(--print); }
@media(min-height:950px) and (min-width:801px) { :root { --book-height:620px; } }
@media(max-width:1100px) {
 .site-header { padding-inline:30px; }
 .reading-intro { padding-inline:48px; }
 .reading-desk { padding-inline:42px; }
 .book-page { padding-inline:32px; }
 .left-page { padding-right:39px; }
 .right-page { padding-left:39px; }
 .title-leaf h2 { font-size:40px; }
}
@media(max-width:800px) {
 :root { --book-height:550px; }
 .site-header { margin:0 24px; padding:18px 0; min-height:85px; gap:18px; }
 .site-header nav { gap:18px; margin:0 0 0 auto; }
 .site-header nav button { font-size:12px; }
 .brand>span { font-size:18px; }
 .brand small { font-size:7px; letter-spacing:1px; }
 .brand-mascot { width:36px; height:36px; }
 .share-button { width:44px; height:44px; }
 .reading-intro { padding:34px 34px 32px; gap:24px; }
 .reading-intro h1 { font-size:46px; letter-spacing:-2px; }
 .reading-intro .eyebrow { font-size:7px; letter-spacing:1px; }
 .reading-intro .intro-line { font-size:12px; margin-bottom:15px; }
 .chapter-meta { display:block; line-height:1.9; font-size:9px; }
 .chapter-meta span { padding-inline:4px; }
 .reading-desk { padding-inline:26px; }
 .book-page { padding:24px 22px 17px; }
 .left-page { padding-right:27px; }
 .right-page { padding-left:27px; }
 .prose { font-size:16px; line-height:1.78; }
 .running-title { font-size:7px; letter-spacing:.6px; }
 .title-leaf h2 { font-size:34px; }
 .title-leaf h3 { font-size:29px; }
 .book-subtitle { font-size:14px; }
 .cover-art.chapter-art { max-width:250px; max-height:205px; }
 .edition-line { font-size:6px; }
 footer { margin-inline:24px; padding:20px 0; font-size:9px; }
}
@media(max-width:500px) {
 :root { --book-height:510px; }
 .site-header { margin-inline:20px; min-height:82px; gap:12px; }
 .brand { gap:9px; }
 .brand>span { font-size:17px; }
 .brand-mascot { width:33px; height:33px; }
 .site-header nav { gap:12px; }
 .site-header nav #beginning { display:none; }
 .site-header nav button { font-size:11px; }
 .site-header nav #text-size { font-size:19px; padding-inline:2px; }
 .share-button { width:40px; min-height:44px; padding:9px; }
 .reading-intro { display:block; padding:28px 27px 31px; }
 .reading-intro .eyebrow { margin-bottom:14px; font-size:7px; letter-spacing:1px; }
 .reading-intro h1 { font-size:49px; line-height:1.04; letter-spacing:-2px; }
 .intro-aside { padding:17px 0 0; }
 .reading-intro .intro-line { font-size:12px; line-height:1.7; margin-bottom:13px; }
 .reading-intro .intro-line br { display:none; }
 .chapter-meta { font-size:9px; }
 .room-background { background-position:65% center; }
 .reading-desk { padding-inline:20px; }
 .book-page { padding:20px 14px 14px; }
 .left-page { padding-right:18px; }
 .right-page { padding-left:18px; }
 .prose { font-size:15px; line-height:1.7; }
 .running-title { font-size:6px; margin-bottom:13px; }
 .title-leaf h2 { font-size:25px; letter-spacing:-1.2px; }
 .book-subtitle { font-size:12px; }
 .edition-line { font-size:5px; letter-spacing:.6px; margin-bottom:13px; }
 .title-leaf .title-rule { margin:14px 0; width:28px; }
 .title-leaf h3 { font-size:24px; margin-bottom:16px; }
 .chapter-kicker { font-size:6px; letter-spacing:1px; }
 .cover-art.chapter-art { max-width:150px; max-height:175px; }
 .title-caption { font-size:7px; line-height:1.6; margin-top:11px; }
 .ribbon { width:14px; height:37px; right:17px; }
 .book-controls { gap:12px; margin-top:31px; }
 .turn-button { padding-inline:12px; min-width:44px; }
 .turn-button span { font-size:10px; }
 .page-position { width:100px; }
 .page-position>span { font-size:9px; }
 .reading-hint { font-size:10px; max-width:290px; }
 .decision-leaf h2 { font-size:25px; }
 .decision-leaf>p:not(.chapter-kicker) { font-size:11px; }
 .book-choices span { font-size:14px; }
 .book-choices small { font-size:9px; }
 .book-choices button { padding:10px 8px; }
 .decision-leaf .choice-help { font-size:9px!important; }
 body.large-print .title-leaf h2 { font-size:42px; }
 body.large-print .title-leaf h3 { font-size:32px; }
 body.large-print .cover-art.chapter-art { max-width:290px; max-height:230px; }
 body.large-print .title-caption { font-size:10px; }
}

.chapter-art img { object-fit:contain; object-position:center; }
.chapter-art:after { display:none; }

/* Agent handoff within each choice. */
#agent-vote-status { font-size:12px; line-height:1.7; color:#526a80; }
.agent-prompt-preview { margin-top:15px; }
.agent-prompt-preview summary { cursor:pointer; font-size:12px; color:#245cb9; min-height:44px; padding-block:10px; }
.agent-prompt-preview label { display:block; font-size:11px; color:#526a80; margin:8px 0; }
#agent-vote-prompt { width:100%; resize:vertical; min-height:190px; background:#f5f7fa; border:1px solid #c6d2df; border-radius:5px; padding:12px; color:#283341; font:12px/1.65 var(--sans); }
#agent-vote-prompt:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
.vote-secondary { display:block; margin:8px auto 0; min-height:44px; padding:10px 0; border:0; background:transparent; color:#245cb9; font-size:12px; text-decoration:underline; text-underline-offset:4px; }

/* All three choices share the available page height. */
.page-body.decision-body { overflow:hidden; }
.decision-body .decision-leaf {
 height:100%; min-height:0; padding-top:4px;
 display:flex; flex-direction:column;
}
.decision-body .chapter-kicker { margin-bottom:9px; flex:none; }
.decision-body h2 { flex:none; margin-bottom:12px; }
.decision-body .decision-context { flex:none; font-size:13px; line-height:1.5; margin:0 0 15px; }
.decision-body .book-choices {
 flex:1; min-height:0; margin:0;
 display:grid; grid-template-rows:repeat(3,minmax(0,1fr)); gap:10px;
}
.decision-body .book-choices button {
 margin:0; min-height:44px; height:100%; padding:12px 29px 12px 15px;
 display:flex; flex-direction:column; justify-content:center;
}
.decision-body .book-choices span { font-size:20px; line-height:1.25; margin:0 0 5px; }
.decision-body .book-choices small { display:block; font-size:11px; line-height:1.45; }
.decision-body .book-choices .icon { top:50%; transform:translateY(-50%); }
.decision-body .choice-help { flex:none; }
@media(max-width:800px) {
 .decision-body h2 { font-size:30px; line-height:1.1; }
 .decision-body .decision-context { font-size:12px; margin-bottom:12px; }
 .decision-body .book-choices { gap:8px; }
 .decision-body .book-choices button { padding:10px; }
 .decision-body .book-choices span { font-size:17px; }
 .decision-body .book-choices small { font-size:10px; }
 .decision-body .book-choices .icon { display:none; }
}
@media(max-width:500px) {
 .decision-body .chapter-kicker { font-size:6px; margin-bottom:8px; }
 .decision-body h2 { font-size:24px; margin-bottom:10px; }
 .decision-body .decision-context { font-size:11px; line-height:1.5; margin-bottom:11px; }
 .decision-body .book-choices button { padding:9px 8px; }
 .decision-body .book-choices span { font-size:15px; margin-bottom:5px; }
 .decision-body .book-choices small { font-size:10px; line-height:1.4; }
}

/* The opening illustration fills its entire book leaf. */
.book-page[data-kind=title] { padding:0; }
.book-page[data-kind=title]>.page-body { overflow:hidden; height:100%; }
.book-page[data-kind=title]>.page-number {
 position:absolute; bottom:10px; left:0; right:0; z-index:3;
 color:#17375d; text-shadow:0 0 5px #fffdf6;
}
.title-leaf {
 padding:30px 24px 24px;
 isolation:isolate;
}
.title-leaf:before {
 content:''; position:absolute; inset:0; z-index:1; pointer-events:none;
 background:linear-gradient(#fffdf6f5 0%,#fffdf6e0 24%,#fffdf6a6 38%,#fffdf600 58%);
}
.title-leaf>*:not(.chapter-art) { position:relative; z-index:2; flex:none; }
.title-leaf .cover-art.chapter-art,
body.large-print .title-leaf .cover-art.chapter-art {
 position:absolute; inset:0; z-index:0;
 width:100%; height:100%; max-width:none; max-height:none; min-height:0;
 margin:0; border-radius:0; background:transparent;
}
.title-leaf .chapter-art img { width:100%; height:100%; object-fit:cover; object-position:52% 65%; }
.title-leaf .edition-line { margin-bottom:14px; }
.title-leaf .title-rule { margin:15px 0; }
.agent-prompt-preview { margin-bottom:18px; }
@media(max-width:800px) {
 .title-leaf { padding:27px 17px 20px; }
}
@media(max-width:500px) {
 .title-leaf { padding:25px 10px 18px; }
 .title-leaf .edition-line { margin-bottom:13px; }
 .title-leaf .title-rule { margin:13px 0; }
 .title-leaf:before { background:linear-gradient(#fffdf6f5 0%,#fffdf6df 25%,#fffdf680 40%,#fffdf600 57%); }
}

.screen-reader-only {
 position:absolute; width:1px; height:1px; padding:0; margin:-1px;
 overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0;
}
.feedback:empty { display:none; }
.book-page>.page-body { margin-bottom:36px; }
.book-page[data-kind=title]>.page-body { margin-bottom:0; }
.page-corner {
 bottom:10px; width:auto; min-width:96px; height:46px; padding:0 13px;
 display:flex; align-items:center; justify-content:center; gap:7px;
 border:1px solid #fff9; border-radius:6px;
 background:#245cb9; color:#fff; font:600 11px/1 var(--sans);
 box-shadow:0 3px 12px #17375d38;
 transition:background .18s,box-shadow .18s;
}
.corner-previous { left:10px; }
.corner-next { right:10px; }
.page-corner:before { display:none; }
.page-corner span { position:static; transform:none; }
.page-corner .icon { width:18px; height:18px; }
.page-corner:hover:not(:disabled) { background:#16498f; box-shadow:0 4px 15px #17375d50; }
.page-corner:focus-visible { outline:3px solid #17375d; outline-offset:3px; }
@media(max-width:500px) {
 .page-corner { min-width:76px; height:44px; padding-inline:9px; gap:4px; font-size:10px; bottom:8px; }
 .corner-previous { left:8px; }
 .corner-next { right:8px; }
 .page-corner .icon { width:16px; height:16px; }
}
