/* Chess Extract: document first; tools appear in the step that needs them. */
/* Local correction: a8 and h1 are light. A 180-degree view keeps this pattern. */
.silicio-board-native silicio-board-surface.silicio-board-native__board{background-image:conic-gradient(from 90deg,var(--silicio-board-light) 25%,var(--silicio-board-dark) 0 50%,var(--silicio-board-light) 0 75%,var(--silicio-board-dark) 0)}
:root{--ink:#292538;--muted:#6e687d;--accent:#6946df;--line:#dfdbe8;color-scheme:light}
html,body{height:100%;overflow:hidden}body{height:100dvh;display:flex;flex-direction:column;background:#f4f3f9;color:var(--ink)}
header{flex:none;padding:10px 18px;min-height:58px;background:#1b172b;gap:10px;border-bottom:1px solid #33294b}
.brand{gap:0}#home{border:0;background:transparent;color:#fff;padding:0;min-height:38px;font-size:22px;font-weight:760;letter-spacing:-.7px;border-radius:3px}.local{font-size:9px;letter-spacing:.12em;color:#c8b9ed;max-width:110px;text-align:right}
.workspace-nav{display:flex;gap:4px;flex:none;background:#fff;border-bottom:1px solid var(--line);padding:4px 12px}
.workspace-nav button{border:0;background:transparent;color:#71697e;border-radius:8px;flex:1;padding:8px 6px;min-height:42px;font-size:13px}
.workspace-nav button[aria-current=true]{color:#5b36bd;background:#eee8fc}.workspace-nav button:disabled{opacity:.45}
#review-count:empty{display:none}#review-count{display:inline-block;border-radius:4px;background:#6b46df;color:#fff;padding:1px 5px;margin-left:2px;font-size:11px}
main{flex:1;width:100%;max-width:1440px;padding:18px;overflow:auto;min-height:0;overscroll-behavior:contain}
footer{display:none}h1{font-family:inherit;font-size:clamp(36px,7vw,64px);font-weight:760;letter-spacing:-1.8px;line-height:1.07}
.welcome{padding:32px 0;max-width:620px}.eyebrow{letter-spacing:.13em;color:#6b4ca4}.welcome .quiet{font-size:12px}
body[data-view=home] .workspace-nav{display:none}body[data-view=home] .library,body[data-view=home] #library-intro{display:none}
body:not([data-view=library]) .library,body:not([data-view=library]) #library-intro{display:none}
body[data-view=library] main{display:flex;flex-direction:column}#library-intro{order:-2;max-width:640px}#library-intro h1{font-size:34px;margin:12px 0}#library-search{width:100%;margin-top:8px}#recent-jobs{order:-1}#recent-jobs button{display:block;width:100%;background:#fff;border-radius:10px;padding:14px;margin-bottom:8px}
body[data-view=document] main{padding:0;display:flex;flex-direction:column;overflow:hidden;max-width:none}
body[data-view=document] #workspace{display:flex;flex:1;min-height:0;flex-direction:column}
.document-bar{flex:none;margin:0;padding:8px 16px;background:#f4f3f9;min-height:48px;gap:10px}.document-bar>div{min-width:0}.document-bar strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:85vw}.document-bar small{font-size:10px}.document-bar button{padding:5px 10px;min-height:36px;font-size:11px;flex-shrink:0}
.notice{flex:none;padding:6px 16px;font-size:12px;line-height:1.35;background:#ece7f7;margin:0}progress{flex:none;height:4px;margin:0}
body[data-view=document] .desk{display:flex;flex:1;min-height:0;gap:0;align-items:stretch}
body[data-view=document] .review-panel{display:none}
.paper-panel{border:0;border-radius:0;box-shadow:none;padding:0;position:static!important;min-width:0}
body[data-view=document] .paper-panel{display:flex;flex-direction:column;flex:1;min-height:0}
.paper-panel>.quiet,.paper-panel>.diagram-actions{display:none}
.paper-panel .toolbar{flex:none;min-height:50px;padding:3px 8px;margin:0;background:#fff;gap:4px;flex-wrap:nowrap}
.paper-panel .toolbar button{font-size:21px;min-height:44px;min-width:38px;padding:4px 9px;border-color:transparent;border-radius:6px}
.paper-panel .toolbar label{font-size:0;gap:0}.paper-panel .toolbar label input{font-size:14px;width:46px;height:40px;min-height:40px;padding:4px;text-align:center}
.paper-panel .toolbar span{font-size:11px;white-space:nowrap}.paper-panel #fit-page{font-size:11px;min-width:52px;padding:5px}
body[data-view=document] #paper-scroll{height:auto;min-height:0;flex:1;width:100%;border-radius:0;background:#dedce7;padding:3px 0;box-shadow:inset 0 3px 9px #21152e12;touch-action:pan-x pan-y}
#paper{margin:auto}
#paper .diagram-choice{box-sizing:border-box;min-width:0;min-height:0;padding:1px;font-size:10px;line-height:1.1;overflow:hidden}#pdf-canvas{box-shadow:0 3px 16px #21152e24}#highlight{border-color:#c25748;background:#fd87672e}
.document-tools{display:flex;flex:none;gap:8px;background:#fff;border-top:1px solid var(--line);padding:9px 12px}.document-tools button{font-size:13px;min-height:46px;flex:1;border-radius:9px;padding:8px}.document-tools .primary{flex:1.2}#range-summary{font-size:11px;opacity:.85;display:block;font-weight:450}
#range-dialog{width:min(520px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:20px;border:1px solid var(--line);border-radius:20px;background:#fff;color:var(--ink);box-shadow:0 15px 60px #1a102c55;overflow:auto}
#range-dialog::backdrop{background:#19102699}.dialog-heading{display:flex;gap:12px;align-items:start}.dialog-heading h2{margin:0 0 8px;font-size:22px}.dialog-heading p{font-size:13px;line-height:1.5;color:var(--muted);margin:0}.dialog-heading button{padding:8px;font-size:12px;min-height:40px;border:0;background:#f0ecf7}
.range-card{padding:16px 0 0;border:0;border-radius:0;gap:12px}.range-fields{width:100%;gap:12px}.range-fields label{flex:1}.range-fields input{width:100%;margin-top:8px;font-size:22px}#range-current{font-size:12px;min-height:40px}#extract{width:100%;min-height:48px}#cancel{font-size:13px}
body[data-view=review] main{padding:12px}body[data-view=review] .document-bar{padding:0 0 10px;background:transparent}body[data-view=review] .desk{display:block;max-width:960px;margin:12px auto}body[data-view=review] .paper-panel{display:none}
.review-panel{padding:16px;border-radius:14px;border-color:var(--line);min-width:0}#return-to-pdf{font-size:12px;min-height:40px;margin-bottom:14px;background:#f1ecfa;border-color:transparent}
#board{width:calc(100% - 28px);max-width:310px;margin:18px auto 28px}.board-controls{max-width:430px;margin:0 auto 12px;gap:4px}.board-controls button{min-width:40px;min-height:44px;padding:5px 9px}#move-label{font-size:13px}
#moves{max-height:112px;gap:4px}#moves button{min-height:40px}#moves button.doubt{border-bottom-color:#cb6a55}#moves button.selected{background:#e8dfff;border-color:#926bd6}
#next-doubt{width:100%;background:#f3edff;border-color:#dccbf7;color:#593a93}#review-card{padding:14px;margin-top:14px;background:#f5f1fb}#review-title{display:block;font-size:14px;margin:10px 0}#source-text{font-family:inherit;font-size:12px;color:var(--muted);line-height:1.4;max-height:48px;overflow:auto;margin:8px 0 12px}
.source-preview{margin:0 -4px 12px}.source-preview>div:first-child{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px}.source-preview strong{font-size:12px;color:#6b4aa5}.source-preview button{min-height:38px;padding:6px 8px;font-size:11px}.source-image{overflow:auto;background:#fff;border:1px solid #e2dbea;border-radius:5px;padding:5px}#source-preview{display:block;width:100%;height:auto;min-height:25px}.source-preview p{font-size:12px;color:#913c35}
#correction{font-size:20px}.actions button{font-size:12px;flex:1;padding:10px 7px}#correction-pieces{gap:4px}#correction-pieces button{flex:1;min-width:32px;font-size:22px;padding:4px}#correction-pieces button:last-child{font-size:11px}
#diagram-reference{padding:10px;background:#f3eefb;border-radius:10px;display:flex;gap:12px;align-items:center;margin:8px 0}#diagram-reference img{width:40%;max-width:165px;aspect-ratio:1;object-fit:contain;background:#fff}#diagram-reference strong{font-size:13px}#diagram-reference p{font-size:12px;line-height:1.45;color:var(--muted)}#diagram-reference button{font-size:11px;min-height:40px;padding:7px}
#diagram-board{max-width:300px;width:calc(100% - 28px)}#piece-palette button{min-height:44px}#piece-palette .selected{background:#e7dcff;border-color:#7855c5}#diagram-review .section-title{align-items:start}#diagram-review h2{margin:0;font-size:20px}#close-diagram{font-size:15px;padding:5px 12px}
#error{font-size:13px;margin:8px 12px}#continue-job{margin:8px 12px;align-self:start;font-size:12px;min-height:40px}
@media(min-width:700px){header{padding-left:28px;padding-right:28px}.workspace-nav{justify-content:center}.workspace-nav button{max-width:220px}.review-panel #results{display:grid;grid-template-columns:minmax(240px,300px) minmax(240px,1fr);gap:12px 18px;align-items:start}.review-panel #results>label,.review-panel #results>.badge,.review-panel #board,.review-panel .board-controls{grid-column:1}.review-panel #results>.badge{margin:0}.review-panel #board{grid-row:3/6;width:290px}.review-panel .board-controls{grid-row:6;width:100%}.review-panel #moves{grid-column:2;grid-row:1/3;max-height:140px;margin:0}.review-panel #next-doubt{grid-column:2;grid-row:3}.review-panel #review-card{grid-column:2;grid-row:4/7;margin:0}.review-panel .export-card{grid-column:1/-1;margin-top:4px}#diagram-review{max-width:720px;margin:auto}#diagram-reference img{max-width:180px}#diagram-board{max-width:330px}}
@media(max-height:500px){header{min-height:42px;padding-top:3px;padding-bottom:3px}#home{font-size:18px;min-height:34px}.workspace-nav{padding-top:1px;padding-bottom:1px}.workspace-nav button{min-height:36px}.document-bar{min-height:34px;padding-top:3px;padding-bottom:3px}.document-bar small{display:none}.notice{font-size:11px;padding-top:3px;padding-bottom:3px}.paper-panel .toolbar{min-height:44px}.document-tools{padding:5px 12px}.document-tools button{min-height:42px}#range-summary{display:inline;margin-left:6px}#board{max-width:230px}#diagram-board{max-width:240px}}
@media(max-width:400px){header{padding-left:12px;padding-right:12px}.local{display:block;font-size:8px;max-width:85px}#home{font-size:20px}.paper-panel .toolbar{gap:2px;padding-left:5px;padding-right:5px}.paper-panel .toolbar button{min-width:35px;padding:4px 7px}.paper-panel .toolbar label input{width:42px}.review-panel{padding:12px}.document-tools button{font-size:12px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

body[data-view=home] footer{display:block;flex:none;padding:8px;font-size:10px;background:#eeebf5}
body[data-view=document] .notice{display:none;position:fixed;bottom:84px;left:12px;right:12px;max-width:580px;margin:auto;border:1px solid #cbbde4;border-radius:10px;padding:10px 12px;box-shadow:0 4px 18px #20143524;z-index:12;pointer-events:none}
body[data-view=document].message-visible .notice{display:block}body[data-view=document] #error{position:fixed;bottom:80px;left:0;right:0;z-index:15}
.document-bar>div{flex:1}#focus-pdf{white-space:nowrap;border-color:#c4b5e2;color:#5a34a0}body[data-view=review] #focus-pdf{display:none}
#restore-tools{display:none}.pdf-focus header,.pdf-focus .workspace-nav,.pdf-focus .document-bar,.pdf-focus .document-tools,.pdf-focus .notice{display:none!important}.pdf-focus #restore-tools{display:block;position:fixed;bottom:14px;right:14px;font-size:12px;min-height:44px;border-color:#8d74bf;box-shadow:0 3px 16px #24123828;z-index:10}.pdf-focus #paper-scroll{padding-bottom:50px}

#cancel{align-self:flex-start;margin:8px 12px;min-height:44px;background:#fff1eb;border-color:#d68470;color:#873c30}#normal-start{font-size:12px;min-height:40px;margin:0 0 14px 8px}

@media(min-width:700px){#source-preview{max-height:125px;object-fit:contain}.review-panel #board{max-width:100%}}

#extraction-blocker{padding:12px;border:1px solid #d8b1a1;background:#fff5ef;border-radius:10px;margin:6px 0 12px;color:#633c32}#blocker-title{font-size:14px}#blocker-detail{font-size:12px;line-height:1.5;margin:8px 0}#review-blocker{width:100%;min-height:44px;font-size:13px;background:#fff;border-color:#ba7864}
@media(min-width:700px){.review-panel #extraction-blocker{grid-column:1/-1;grid-row:1}.review-panel #results>label{grid-row:2}.review-panel #results>.badge{grid-row:3}.review-panel #board{grid-row:4/7}.review-panel .board-controls{grid-row:7}.review-panel #moves{grid-row:2/4}.review-panel #next-doubt{grid-row:4}.review-panel #review-card{grid-row:5/8}}
/* Page selection: one decision at a time, with bounded previews and inline errors. */
#range-dialog .range-card{display:flex;flex-direction:column;align-items:stretch;flex-wrap:nowrap;gap:10px;padding:10px 0 0}
#range-dialog .dialog-heading button{flex-shrink:0;min-height:44px}
#range-help{font-size:12px;line-height:1.45;color:var(--muted);margin:0}
.range-shortcuts{display:flex;flex-wrap:wrap;gap:6px}.range-shortcuts button{flex:1;padding:7px 9px;font-size:12px;min-height:44px;white-space:nowrap}#range-current{flex:1.5;min-height:44px}
#range-dialog .range-fields{flex:none}#range-dialog .range-fields label{min-width:0}#range-dialog .range-fields input{margin-top:5px;padding:7px 10px;font-size:20px}
#range-selection{margin:0;font-size:13px;font-weight:650}#range-error{margin:0;padding:9px 11px;border:1px solid #bd7771;border-radius:8px;background:#fff3ef;color:#8d2525;font-size:13px;line-height:1.4}
#range-dialog input[aria-invalid=true]{border:2px solid #ab433d}
#range-preview{display:flex;justify-content:center;gap:18px;padding:9px;background:#f5f3fa;border-radius:10px;min-height:127px}#range-preview figure{margin:0;flex:1;text-align:center;min-width:0}#range-preview canvas{display:block;margin:auto;height:98px;width:auto;max-width:100%;object-fit:contain;box-shadow:0 1px 5px #21152e1c}#range-preview figcaption{font-size:11px;color:var(--muted);margin-top:5px}#range-dialog details{padding-top:10px}#range-dialog details summary{min-height:32px;line-height:32px}
@media(max-height:500px){#range-dialog{padding:16px;max-height:calc(100dvh - 20px)}#range-preview canvas{height:78px}#range-preview{min-height:107px}}
/* Keep confirmation reachable even with the keyboard or on a small landscape screen. */
#range-dialog[open]{display:flex;flex-direction:column;overflow:hidden}
#range-dialog .dialog-heading{flex:none}#range-dialog .dialog-heading h2{font-size:20px}#range-dialog .dialog-heading p{font-size:12px}
#range-dialog .range-card{flex:1 1 auto;min-height:0;overflow:auto;padding-right:3px;margin:0;overscroll-behavior:contain}
#range-dialog .range-shortcuts{flex-wrap:nowrap}#range-dialog .range-shortcuts button{flex:0 0 44px;min-width:44px}#range-dialog #range-current{flex:1 1 auto;min-width:0}
#range-footer{flex:none;padding-top:10px;margin-top:8px;border-top:1px solid var(--line);background:#fff}

/* Book prose review stays inside the existing source/review workspace. */
.book-comments{margin:18px 0;padding:16px;border:1px solid var(--line,#ccd2de);border-radius:16px;background:var(--surface,#fff)}
.book-comments .comment-switch{display:flex;align-items:center;gap:10px;font-weight:700}.comment-switch input{width:22px;height:22px;flex:0 0 22px}
.book-comments textarea,.book-comments select{width:100%;max-width:100%;box-sizing:border-box}.book-comments textarea{font:inherit;padding:12px;border:1px solid #aab3c3;border-radius:10px;resize:vertical;line-height:1.5}.comment-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.book-comments .actions{display:flex;flex-wrap:wrap;gap:8px}.book-comments label{margin:12px 0}.book-comments p{overflow-wrap:anywhere}

.review-panel #book-comments{grid-column:1/-1;min-width:0}

/* Keep the primary action visible with the new brand mark on compact screens. */
@media(max-width:420px){body[data-view=home] .welcome{padding:8px 0}body[data-view=home] .welcome-icon{width:64px;height:64px;border-radius:16px}body[data-view=home] h1{margin:10px 0 14px}body[data-view=home] .eyebrow{margin:8px 0}}
@media(max-height:540px) and (min-width:480px){body[data-view=home] main{padding:12px 20px}body[data-view=home] .welcome{padding:0;max-width:800px;width:100%}body[data-view=home] .welcome-icon{float:right;width:76px;height:76px;border-radius:18px;margin:0 0 8px 18px}body[data-view=home] .eyebrow{margin:0 0 6px}body[data-view=home] h1{font-size:28px;margin:6px 0 8px}body[data-view=home] .welcome>p:not(.eyebrow){font-size:13px;line-height:1.4;margin:6px 0}body[data-view=home] .welcome button{margin:4px 6px 6px 0}body[data-view=home] footer{display:none}body[data-view=home] .language-setting{clear:both;margin-top:12px}}
