:root{--board-share:61%;--reader-font:18px}
.sr-only{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap!important;margin:-1px!important;padding:0!important;border:0!important}
html,body{height:100%;overflow:hidden}body{overscroll-behavior:none}.app-header{height:64px;padding:0 18px;gap:18px}.brand{gap:8px}.brand img{width:42px;height:42px}.brand strong{font-size:25px;letter-spacing:4px}.brand small{font-size:9px;margin-top:2px;letter-spacing:2px}.book-switcher{display:flex;align-items:center;gap:12px;min-width:0}.book-switcher>span{font-size:11px;color:var(--muted);letter-spacing:2px}.book-switcher select{max-width:38vw;width:260px;appearance:none;border:1px solid #d0d8c9;border-radius:6px;padding:9px 35px 9px 14px;background:#f1f2e7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7d61' stroke-width='1.5'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") right 9px center/17px no-repeat;font:17px var(--serif);color:var(--ink)}.header-actions{gap:8px}.header-actions .icon-button{width:34px;height:34px}
.workspace{height:calc(100dvh - 64px);min-height:0;grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,var(--board-share)) 6px minmax(0,1fr)}.board-pane{padding:4px 4px 4px 0;display:grid;grid-template-columns:52px minmax(0,1fr);grid-template-rows:minmax(0,1fr);min-height:0;overflow:hidden;background:#e8ecdf}.board-stage{grid-column:2;grid-row:1;padding:0;position:relative;min-height:0;min-width:0}.board-shell{position:absolute;inset:0;width:100%;height:100%;max-height:none;max-width:none;aspect-ratio:auto;filter:drop-shadow(0 6px 8px #3c2d1720)}.board-controls{grid-column:1;grid-row:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-width:0;z-index:2}.board-controls .icon-button{width:38px;height:38px;flex-shrink:0}.board-controls .icon-button svg{width:19px;height:19px}.board-controls .play-button{width:38px;height:38px;margin:4px 0}.control-divider{width:20px;height:1px;background:#cbd4be;margin:6px 0}.turn-status{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:9px;line-height:1.5;color:#75816a;margin-bottom:8px}.turn-status #turn-label{font-size:10px;display:flex;align-items:center;gap:4px;white-space:nowrap}.turn-status #turn-label .side-dot{width:5px;height:5px}#board-state:empty{display:none}#board-state .text-button{font-size:10px}#board{overflow:visible}.reader-tabs{height:48px;padding:0 20px;gap:22px;align-items:center}.reader-tabs>button{height:100%;font-size:12px}.font-controls{display:flex;align-items:center;gap:2px;margin-left:auto;border:1px solid #d5dccb;border-radius:5px;background:#efefe3;padding:0 2px}.font-controls .icon-button{width:28px;height:30px;border-radius:3px}.font-controls .icon-button svg{width:14px;height:14px}.font-controls output{min-width:21px;text-align:center;font-size:11px;font-variant-numeric:tabular-nums;color:#6b7c5c}.reader-scroll{padding:18px 26px 30px;overflow-y:auto;min-height:0}.lesson-nav{margin-bottom:14px}.chapter-eyebrow{font-size:10px;flex-wrap:wrap;gap:5px 10px;line-height:1.6}.chapter-eyebrow span:first-child{border:0;padding:0;color:#788b6c}.lesson-number{display:none}.lesson-heading{margin:15px 0 18px}.lesson-heading h2{font-size:calc(var(--reader-font) + 9px);letter-spacing:1px}.lesson-heading .tiny-label{font-size:10px;letter-spacing:.5px}.opening-block{padding:9px 12px;margin:0 0 16px;border:1px solid #dde2d1;background:#efeede;font-size:12px}.opening-block summary{cursor:pointer;color:#6c7f5c}.opening-block .section-label{margin-top:12px;font-size:11px}.opening-block .section-label span{display:none}.opening-block .move-chip{font-size:var(--reader-font)}.branch-picker{gap:8px;margin-bottom:14px}.branch-card{padding:10px 12px;gap:8px}.branch-card strong{font-size:calc(var(--reader-font) - 2px)}.branch-card small{font-size:9px}.branch-card .branch-symbol{font-size:17px}.author-text,.commentary p,.source-moves,.active-variation .author-text,.author-summary p,#original-text,#preface-text p{font-size:var(--reader-font);line-height:1.95;letter-spacing:.1px}.author-text .move-chip,.source-moves .move-chip,.active-variation .move-chip,.line-moves .move-chip{font-size:var(--reader-font)}.source-moves{line-height:2.3}.source-block{margin:12px 0}.source-line-heading{font-size:calc(var(--reader-font) + 2px);margin:22px 0 12px;padding-top:15px}.source-detail{font-size:11px}.source-detail .author-text{font-size:var(--reader-font)}.reading-source{font-size:10px;margin:22px 0 15px}.source-detail.correction{color:#8a816c}.author-summary{margin-top:24px;padding-top:18px}.panel-heading{margin-bottom:20px}.panel-heading p{font-size:15px}.notes-label{font-size:12px}textarea{font-size:var(--reader-font);min-height:240px}#export-button{margin-bottom:10px}.original-dialog h2{font-size:24px}.original-dialog details img{margin-bottom:20px}#preface-dialog p{font-family:var(--serif);color:#586a4c}#install-dialog{width:540px}#install-dialog p{font-size:13px;line-height:1.9;color:#758568}.offline-book{display:flex;align-items:center;gap:12px;border:1px solid #d4ddc7;border-radius:5px;padding:12px;margin:9px 0}.offline-book strong{font:17px var(--serif)}.offline-book button{margin-left:auto;flex-shrink:0;min-height:36px;padding:7px 12px}.offline-book span{font-size:10px;color:#7e8d70}#offline-status{min-height:22px}.install-help{padding:12px;background:#edf0e3;border-radius:5px}.about-brand img{width:96px;height:96px}.toast{bottom:max(15px,env(safe-area-inset-bottom))}.contents-lesson{min-height:67px}.catalog-search input{font-size:16px}.catalog-filter select{font-size:14px}button,a,select,input,textarea{touch-action:manipulation}
@media(min-width:1550px){.reader-scroll{padding:22px 36px 32px}.board-pane{padding-left:0;padding-right:4px}}
@media(max-width:1100px) and (min-width:761px){.reader-tabs{gap:14px;padding:0 14px}.font-controls .icon-button{width:24px}.reader-scroll{padding:17px 18px 28px}.book-switcher select{width:230px}.board-pane{grid-template-columns:44px minmax(0,1fr)}.board-controls .icon-button{width:34px;height:34px}}
@media(max-width:760px){.app-header{height:58px;padding:0 10px;gap:10px;padding-top:env(safe-area-inset-top)}.brand img{width:35px;height:35px}.brand strong{font-size:21px;letter-spacing:2px}.brand small{display:none}.brand{gap:5px}.book-switcher{margin-left:auto;gap:0}.book-switcher>span{display:none}.book-switcher select{width:168px;max-width:40vw;padding:8px 22px 8px 8px;font-size:15px;background-position:right 3px center;background-size:14px}.header-actions{gap:3px}.header-actions .icon-button{width:30px;height:32px;border-color:transparent}.header-actions .icon-button svg{width:18px;height:18px}.workspace{height:calc(100dvh - 58px - env(safe-area-inset-top));display:flex;flex-direction:column;min-height:0;overflow:hidden}.board-pane{height:min(calc(100vw * 1.132 + 44px),62dvh);flex:none;min-height:0;padding:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 44px}.board-stage{grid-row:1;grid-column:1;padding:0}.board-controls{grid-row:2;grid-column:1;flex-direction:row;gap:4px;justify-content:center;height:44px;background:#edf0e4;border-top:1px solid #d5ddca}.board-controls .icon-button{width:32px;height:34px}.board-controls .play-button{width:34px;height:34px;margin:0 2px}.control-divider{height:16px;width:1px;margin:0 3px}.turn-status{margin:0 4px 0 0;gap:0;font-size:8px}.turn-status #turn-label{font-size:9px}.turn-status #move-label{font-size:8px}.reading-pane{min-height:0;flex:1;overflow:hidden}.reader-tabs{height:44px;flex-shrink:0;position:static;gap:18px;padding:0 14px}.reader-tabs>button{font-size:12px}.font-controls{gap:0}.font-controls .icon-button{width:27px;height:29px}.font-controls output{font-size:10px;min-width:19px}.reader-scroll{min-height:0;padding:16px 18px max(24px,env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain}.lesson-nav{margin-bottom:10px}.lesson-heading{margin:10px 0 15px}.chapter-eyebrow{font-size:9px}.lesson-heading .tiny-label{font-size:9px}.opening-block{margin-bottom:12px}.branch-card{padding:8px 10px}.branch-card small{display:none}.splitter{display:none}.reader-scroll .author-text{margin:9px 0 14px}.contents-dialog{padding:27px 20px}.about-dialog{padding:30px 24px}.about-brand{margin-bottom:22px}dialog{max-width:calc(100vw - 22px);max-height:calc(100dvh - 36px);padding:30px 22px}.about-facts{grid-template-columns:78px 1fr;gap:11px;font-size:11px}.source-facts{font-size:10px}.about-links{gap:12px}.about-brand h2{font-size:30px}.about-brand p{font-size:12px}.analysis-options select{font-size:14px}.source-moves .move-chip{padding:3px 4px}.source-moves{white-space:pre-wrap;overflow-wrap:anywhere}}
@media(max-width:360px){.app-header{gap:6px}.book-switcher select{font-size:13px;width:140px}.brand strong{font-size:19px}.header-actions .icon-button{width:28px}.reader-tabs{gap:12px;padding:0 10px}.font-controls .icon-button{width:24px}.board-controls{gap:2px}.turn-status{margin-right:1px}}
@media(max-height:650px) and (min-width:761px){.board-controls{gap:1px}.board-controls .icon-button{height:31px}.turn-status{margin-bottom:3px}.control-divider{margin:3px 0}}
.notation-issue{border-left:2px solid #b69a70;background:#f1eddf;padding:8px 12px;margin:12px 0;font-size:12px;color:#7c7256}.notation-issue p{margin:3px 0 8px}.notation-issue .outline-button{display:inline-flex;margin:0 8px 5px 0;min-height:34px;padding:6px 10px}

/* Keep the close control outside the scrolling catalog. */
.contents-dialog{padding:0;overflow:hidden}.contents-dialog[open]{display:flex;flex-direction:column}.contents-header{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:24px 28px 18px;border-bottom:1px solid #d5ddc9;flex-shrink:0;background:#f7f5eb}.contents-header h2{font-size:26px;letter-spacing:1px;margin-top:5px}.contents-header .dialog-close{position:static;width:34px;height:34px;flex-shrink:0;margin:0}.contents-body{padding:0 28px 28px;overflow-y:auto;overscroll-behavior:contain;min-height:0;flex:1;scrollbar-width:thin}.contents-body>.muted{margin-top:16px}@media(max-width:760px){.contents-header{padding:17px 20px 14px}.contents-header h2{font-size:23px}.contents-body{padding:0 20px 22px}}

.font-controls .icon-button{min-width:32px;min-height:32px}.header-actions .icon-button{min-width:32px;min-height:32px}.dialog-close{min-width:32px;min-height:32px}

/* Desktop reading desk: the board owns the full screen height. */
:root{--board-size:min(calc(100dvh * 524 / 628),calc(100vw - 386px))}
.device-notice{display:none}
@media(min-width:761px){
 .workspace{position:absolute;inset:0;height:100dvh;grid-template-columns:minmax(380px,1fr) 6px minmax(0,var(--board-size));grid-template-rows:minmax(0,1fr)}
 .app-header{position:absolute;left:0;top:0;width:calc(100% - var(--board-size) - 6px);height:56px;padding:0 12px;gap:10px;z-index:3;justify-content:initial}
 .brand{gap:5px;flex-shrink:0}.brand img{width:34px;height:34px}.brand strong{font-size:21px;letter-spacing:2px}.brand small{display:none}
 .book-switcher{flex:1;min-width:0;gap:0}.book-switcher>span{display:none}.book-switcher select{width:100%;max-width:none;min-width:0;font-size:15px;padding:8px 24px 8px 9px;background-position:right 4px center;background-size:15px}
 .header-actions{gap:2px;flex-shrink:0}.header-actions .icon-button{width:32px;height:32px}
 .board-pane{grid-column:3;grid-row:1;padding:0;display:block;position:relative;background:#e8ecdf;min-width:0}
 .board-stage{position:absolute;inset:0;padding:0}.board-shell{inset:0;filter:none}.splitter{grid-column:2;grid-row:1}
 .reading-pane{grid-column:1;grid-row:1;padding-top:56px;min-height:0}
 .board-controls{position:static;flex-direction:row;justify-content:center;gap:6px;height:44px;min-height:44px;flex-shrink:0;padding:3px 8px;background:#eff0e5;border-bottom:1px solid var(--line)}
 .board-controls .icon-button,.board-controls .play-button{width:32px;height:32px;margin:0;flex-shrink:0}.board-controls .icon-button svg{width:18px;height:18px}
 .control-divider{width:1px;height:19px;margin:0 3px}.turn-status{flex-direction:row;margin:0 auto 0 0;gap:8px;font-size:10px;white-space:nowrap}.turn-status #move-label{font-size:10px}.turn-status #turn-label{font-size:11px}#board-state{margin-left:auto;font-size:10px}#board-state:empty{display:none}
 .reader-tabs{padding:0 18px;gap:20px;height:44px}.reader-scroll{padding:18px 24px 30px}
}
@media(min-width:761px) and (max-width:1100px){.board-controls{gap:3px}.turn-status{flex-direction:column;gap:0;margin-right:auto}.reader-tabs{gap:14px;padding:0 14px}.reader-scroll{padding:16px 18px 28px}}
@media(max-width:760px){.device-notice{display:block;position:fixed;inset:58px 0 auto;z-index:4;padding:15px 18px;background:#f6efdc;border-bottom:1px solid #d0bd8d;color:#654e30}.device-notice strong{font-size:16px}.device-notice p{font-size:13px;line-height:1.7;margin:5px 0 0}.board-controls{display:none}.workspace{padding-top:114px}.board-pane{grid-template-rows:minmax(0,1fr)}}
