#digital-worksheet{max-width:920px;margin:20px 0;scroll-margin-top:16px;overflow-wrap:anywhere}
#digital-worksheet[hidden],.layout[hidden]{display:none!important}
.worksheet-toolbar{display:flex;gap:12px;flex-wrap:wrap;margin:16px 0}
#digital-worksheet button,#digital-worksheet select{min-height:52px;touch-action:manipulation;font-size:1.05rem}
#digital-worksheet textarea{width:100%;box-sizing:border-box;font-size:1.25rem;min-height:100px}
.worksheet-choices{display:grid;gap:12px;margin:20px 0}
.worksheet-choices button{text-align:left;white-space:pre-wrap}
.worksheet-choices button[aria-pressed=true]{background:#205e58;color:white;outline:3px solid #d9be49}
#worksheet-question{font-size:clamp(22px,3vw,30px);white-space:pre-wrap;line-height:1.5}
.worksheet-context{white-space:pre-wrap;line-height:1.7;background:#eff6f1;padding:16px;border-radius:12px}
#digital-worksheet img{max-width:100%;height:auto}
#worksheet-feedback{padding:16px;border-radius:12px;background:#eff6f1;font-size:1.1rem}
@media(max-width:600px){#digital-worksheet{padding:18px}.worksheet-toolbar>*{flex:1 1 140px}}

.work-paper canvas{display:block;width:100%;height:auto;aspect-ratio:10/7;touch-action:none;user-select:none;-webkit-user-select:none;border:2px solid #86aaa3;border-radius:12px;background-color:#fff;background-image:linear-gradient(#c8dfeb80 1px,transparent 1px),linear-gradient(90deg,#c8dfeb80 1px,transparent 1px);background-size:5% 7.142857%;cursor:crosshair;box-sizing:border-box}.work-paper{margin:24px 0}.work-paper button[aria-pressed=true]{background:#205e58;color:white}.work-paper p{font-size:1rem}

#paper-cato-help{margin:0 0 14px;background:#205e58;color:white}.work-paper #cato-panel{margin-top:16px;max-width:100%;box-sizing:border-box}.work-paper #cato-messages{max-height:230px;overflow:auto}

.paper-layout{min-width:0}.paper-layout>*{min-width:0}.paper-layout #cato-panel{margin:24px 0;padding:16px;box-sizing:border-box}.paper-layout #cato-messages{max-height:180px;overflow:auto}.paper-layout #cato-panel .eyebrow{display:none}.paper-layout #cato-panel h2{margin:4px 0}.paper-layout #cato-panel textarea{min-height:60px}.paper-layout #cato-panel button{font-size:1rem;padding:10px}.paper-layout #cato-practice{display:none}
@media(min-width:760px){#digital-worksheet{max-width:1200px}.paper-layout.with-cato{display:grid;grid-template-columns:minmax(0,3fr) minmax(290px,2fr);gap:16px;align-items:start}}

.paper-viewport{overflow:auto;max-height:75vh;overscroll-behavior:contain}.paper-viewport canvas{max-width:none}.worksheet-source{margin:16px 0}.worksheet-source img{display:block;max-height:70vh;object-fit:contain;object-position:left}.work-paper input{max-width:100%;box-sizing:border-box}

.work-paper select,.work-paper input{min-height:48px;font-size:1rem}.work-paper button:focus-visible{outline:3px solid #6052db;outline-offset:2px}
/* Paper-first worksheet: all secondary controls float over the writing surface. */
body:has(#digital-worksheet.paper-focus:not([hidden])){overflow:hidden}
#digital-worksheet.paper-focus{position:fixed;inset:0;z-index:500;margin:0;padding:0;max-width:none;border:0;border-radius:0;background:white;color:#213f43;display:flex;flex-direction:column;height:100dvh;overflow:hidden;outline:none}
.paper-focus .paper-focus-header{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:8px 16px;background:white;border-bottom:1px solid #dce9eb;flex:none;z-index:3}
.paper-focus .paper-focus-header button{min-height:44px;font-size:.9rem;padding:8px 12px}
.paper-focus .paper-focus-header .worksheet-toolbar{margin:0;gap:6px;align-items:center}
.paper-focus .paper-layout,.paper-focus .paper-layout.with-cato{position:relative;display:block;flex:1;min-height:0;width:100%}
.paper-focus .work-paper{margin:0;width:100%;height:100%}
.paper-focus .paper-viewport{height:100%;max-height:none;padding-bottom:90px;background:white;overscroll-behavior:contain}
.paper-focus .work-paper canvas{border:0;border-radius:0;background-color:white;background-image:linear-gradient(#e0edf5 1px,transparent 1px),linear-gradient(90deg,#e0edf5 1px,transparent 1px);background-size:32px 32px;min-height:0;aspect-ratio:10/7}
.paper-focus .paper-focus-dock{position:absolute;bottom:max(14px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);display:flex;gap:6px;flex-wrap:wrap;justify-content:center;width:max-content;max-width:calc(100% - 20px);padding:8px;background:#fff;border:1px solid #b6cfca;border-radius:18px;box-shadow:0 5px 24px #0002;z-index:4}
.paper-focus .paper-focus-dock button{min-height:44px;font-size:1rem;padding:9px 12px}.paper-focus button[aria-pressed=true]{background:#205e58;color:white}
.paper-focus .paper-popup,.paper-focus .paper-layout #cato-panel.paper-cato-popup{position:absolute;top:12px;right:16px;width:400px;max-width:calc(100% - 32px);max-height:calc(100% - 115px);overflow:auto;padding:18px;margin:0;box-sizing:border-box;border:1px solid #86aaa3;border-radius:18px;background:#fff;box-shadow:0 12px 36px #0003;z-index:5}
.paper-focus .paper-popup[hidden],.paper-focus #cato-panel[hidden]{display:none!important}
.paper-focus .paper-popup-title{display:flex;justify-content:space-between;gap:12px;align-items:center}
.paper-focus .paper-popup button{min-height:44px;font-size:1rem}.paper-focus #worksheet-question{font-size:1.25rem}.paper-focus .paper-cato-close{float:right}.paper-focus #cato-messages{max-height:210px}.paper-focus .paper-tools-popup .worksheet-toolbar{gap:8px}.paper-focus .paper-tools-popup select{width:100%}
body:has(#digital-worksheet.paper-focus:not([hidden])) #cato-companion{z-index:501}
@media(max-width:600px){.paper-focus .paper-focus-header{padding:6px;gap:4px}.paper-focus .paper-focus-header strong{font-size:.85rem}.paper-focus .paper-focus-header .worksheet-toolbar{width:100%;justify-content:space-between}.paper-focus .paper-focus-header .worksheet-toolbar>*{flex:0 1 auto}.paper-focus .paper-focus-dock{width:calc(100% - 20px)}.paper-focus .paper-focus-dock button{font-size:.85rem;padding:8px}.paper-focus .paper-popup,.paper-focus .paper-layout #cato-panel.paper-cato-popup{max-height:calc(100% - 140px)}.paper-focus .paper-viewport{padding-bottom:135px}.paper-focus .work-paper canvas{min-height:0}}
/* The model paper is separate from student ink and never saves as their answer. */
.paper-example{position:absolute;inset:0;z-index:6;background:#fff;overflow:auto;padding:16px 20px 24px;color:#213f43;overscroll-behavior:contain}
.paper-example header,.paper-example footer{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap}.paper-example footer{justify-content:flex-start;margin-top:12px}.paper-example button{min-height:46px}.paper-example header strong{max-width:70%}
.paper-example .example-paper{min-height:180px;padding:18px 12px;background-color:white;background-image:linear-gradient(#e0edf5 1px,transparent 1px),linear-gradient(90deg,#e0edf5 1px,transparent 1px);background-size:28px 28px;border:1px solid #c0d8de;border-radius:12px}
.paper-example .example-line{font:clamp(16px,2.4vw,24px)/1.65 ui-monospace,Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere;min-height:1.65em;color:#2563eb;padding:0 6px}.paper-example .example-focus{background:#fff0b8;border-left:3px solid #947311}
.paper-example .example-coach{background:#edf5f1;border-radius:14px;padding:14px 18px;margin-top:12px}.paper-example .example-coach p{margin:8px 0}.paper-example .example-sound{font-size:14px}.paper-example textarea{width:100%;font-size:16px}.paper-example [hidden]{display:none!important}
.paper-layout:has(.paper-example) #cato-panel.paper-cato-popup{z-index:8}.paper-layout:has(.paper-example) .paper-focus-dock{visibility:hidden}
@media(max-width:520px){.paper-example{padding:12px}.paper-example header strong{max-width:100%}.paper-example footer button{flex:1 1 140px}}
