/* Portal layout only; the portable exercise renderer and original pages are shared unchanged. */
.reader .km-work-panel[hidden]{display:none!important}
.reader .reader-workspace.has-workbook{align-items:stretch;overflow:hidden}
.reader .km-work-panel{position:relative;inset:auto;display:flex;flex-direction:column;flex:0 0 clamp(350px,38vw,570px);width:auto;min-width:0;min-height:0;max-height:none;margin:0;border:2px solid #b9e6f7;border-radius:20px;padding:0;background:#fff;box-shadow:0 4px 16px #30106812;overflow:hidden}
.reader .km-work-panel>header{display:flex;flex:0 0 auto;flex-wrap:nowrap;justify-content:space-between;align-items:center;gap:8px;padding:14px 16px;border-bottom:2px solid #dceef5;background:#eaf8ff;color:#301068}
.reader .km-work-panel>header small{display:block;font-size:13px;color:#4e5470;margin-bottom:2px}
.reader .km-work-panel h2{font-size:21px;line-height:1.25;margin:0}
.reader .km-work-panel>header button{flex:none;width:44px;padding:0;font-size:26px;background:#fff}
.reader .km-work-panel>.km-source{flex:0 0 auto;padding:9px 16px;margin:0;font-size:13px;line-height:1.4;border-bottom:1px solid #e5e2eb}
.reader .km-work-panel>[data-body]{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-gutter:stable;padding:14px;background:#fff}
.reader .km-work-panel>footer{flex:0 0 auto;padding:10px 12px;border-top:2px solid #dceef5;margin:0;gap:8px;background:#f3faff;justify-content:space-between}
.reader .km-work-panel>footer button{font-size:14px;flex:1 1 150px;padding:8px 10px}
.reader .km-work-panel .km-original-task{padding:12px;border-radius:15px}
.reader .km-work-panel .km-task-prompt{font-size:17px;line-height:1.5}
.reader .km-work-panel .km-task-fields,.reader .km-work-panel .km-task-groups{grid-template-columns:repeat(auto-fit,minmax(185px,1fr));gap:10px;margin:14px 0}
.reader .km-work-panel .km-task-fields label,.reader .km-work-panel .km-task-groups label{padding:10px;font-size:15px}
.reader .km-work-panel .km-task-fields canvas{max-height:190px;cursor:default;touch-action:auto}
.reader .km-work-panel .km-tools{gap:7px;max-width:100%}
.reader .km-work-panel .km-tools button{font-size:14px;padding:8px 9px}
.reader .km-work-panel .km-colors{flex-wrap:wrap;gap:6px}
.reader .km-work-panel .km-canvas-wrap{max-height:450px}
.reader .km-work-launch{width:auto;grid-column:auto;order:initial;padding:0;margin-left:auto}
.reader .km-work-launch button{font-size:14px;padding:8px 12px}
.reader .km-page-tasks{flex:0 0 auto;display:flex;justify-content:space-between;align-items:center;gap:10px 20px;padding:10px 22px;background:#fff6d6;border-top:1px solid #ffdd73;border-bottom:1px solid #ffdd73;min-width:0}
.reader .km-task-invitation{display:flex;flex-direction:column;gap:3px;flex:1 1 300px}
.reader .km-task-invitation strong{font-size:18px;line-height:1.35;color:#301068}
.reader .km-task-invitation span{font-size:14px;color:#5d5074}
.reader .km-task-actions{display:flex;flex:1 1 auto;max-width:100%;gap:9px;overflow-x:auto;padding:3px 2px 6px;scrollbar-width:thin}
.reader .km-task-actions button{flex:none;min-height:46px;padding:10px 15px;background:#301068;color:#fff;border:2px solid #301068;box-shadow:0 3px 0 #cfbee8;font:700 15px Rubik,Arial,sans-serif;white-space:nowrap}
.reader .km-task-actions button:hover{background:#492580;border-color:#492580}
.reader[data-page-tasks=true] .km-reader-coverage .km-coverage:not(.prepared){display:none}
.reader .km-original-target{left:-43px;width:38px;max-width:none;min-height:38px;font-size:13px;padding:4px;background:#ffbf00;color:#301068;border:2px solid #fff;box-shadow:0 2px 6px #30106833}
.reader.km-work-open .page-arrow{width:34px;height:54px}
.reader.km-work-open .page-arrow.previous{left:3px}.reader.km-work-open .page-arrow.next{right:3px}
.reader.km-work-open #paper-area{padding-left:52px;padding-right:42px}
@media(max-width:900px){
 .reader .km-page-tasks{padding:10px 12px;gap:5px}.reader .km-task-invitation{flex-basis:100%}.reader .km-task-invitation strong{font-size:16px}.reader .km-task-actions{flex-basis:100%}.reader .km-task-actions button{font-size:14px}
 .reader .reader-workspace.has-workbook{flex-direction:column;overflow-y:auto;overscroll-behavior:contain;gap:12px;padding-bottom:12px}
 .reader .reader-workspace.has-workbook>.reader-stage{flex:0 0 clamp(310px,52dvh,520px);min-height:310px}
 .reader .km-work-panel{flex:none;width:100%;height:auto;max-height:none;min-height:0}
 .reader .km-work-panel>[data-body]{flex:none;overflow:visible;max-height:none;padding:12px}
 .reader .km-work-panel>header,.reader .km-work-panel>footer{position:static}
}
@media(max-width:430px){.reader .km-work-panel .km-task-fields,.reader .km-work-panel .km-task-groups{grid-template-columns:1fr}.reader .km-work-panel h2{font-size:19px}.reader .km-work-launch{margin-left:0}.reader .km-original-target{left:-36px;width:32px;min-height:34px}.reader.km-work-open #paper-area{padding-left:40px;padding-right:36px}}

/* Regions are independent from the source canvas and never intercept reading or drawing. */
.reader .paper-sheet.km-has-task-regions{overflow:visible}
.reader .km-task-region{position:absolute;z-index:3;box-sizing:border-box;pointer-events:auto;cursor:pointer;touch-action:manipulation;padding:0;min-width:0;min-height:0;border:1.5px dashed #009fdf88;border-radius:8px;background:transparent;transition:background-color .15s,border-color .15s}
.reader .km-task-region.is-selected{border:3px solid #009fdf;background:#ffbf001a;box-shadow:0 0 0 2px #ffbf00b3,inset 0 0 0 1px #fff}
.reader .km-original-target{position:absolute;z-index:6;left:-46px;min-height:40px;width:40px;border:2px solid #009fdf;background:#fff;color:#301068;border-radius:12px;box-shadow:0 2px 0 #b9e6f7;white-space:nowrap;font-weight:800;pointer-events:auto}
.reader .km-original-target[aria-pressed=true]{background:#ffbf00;border-color:#301068;box-shadow:0 3px 0 #c59a21}
.reader .km-task-actions button[aria-pressed=true]{background:#ffbf00;border-color:#301068;color:#301068;box-shadow:0 3px 0 #cfaa39}
.reader .km-has-task-regions>.km-launch{display:none}
.reader .paper-spread.double .km-original-target,.reader .paper-spread.quad .km-original-target{display:none}
.reader .km-original-target:focus-visible{outline:3px solid #301068;outline-offset:3px}
@media(max-width:430px){.reader .km-original-target{left:-36px;width:32px;min-height:36px;font-size:12px}}
@media(prefers-reduced-motion:reduce){.reader .km-task-region{transition:none}}
/* 1.13: task selection and book index are in document flow, never over the page. */
.reader .km-page-tasks{max-height:210px;overflow:auto;flex-wrap:wrap}
.reader .km-select-task{min-height:48px;min-width:48px;font:600 16px Rubik,Arial,sans-serif;border:2px solid #009fdf;border-radius:14px;background:#eaf8ff;color:#301068;padding:10px 14px}
.reader .km-task-empty{flex-basis:100%;font-size:15px;text-align:left}
.reader .km-original-target{left:-54px;min-width:48px;width:48px;min-height:48px;max-width:none}
.reader.km-work-open #paper-area{padding-left:60px;padding-right:48px}
.reader .km-book-task-index{flex:0 0 auto;background:#f4f0fb;border-bottom:1px solid #ded4ed;padding:0 20px;font:16px Rubik,Arial,sans-serif;color:#301068}
.reader .km-book-task-index summary{padding:12px;min-height:48px;cursor:pointer;font-weight:600}
.reader .km-book-task-index>div{max-height:220px;overflow:auto;padding:8px}
.reader .km-book-task-index button{min-width:48px;min-height:48px;padding:9px 12px;margin:4px;border:2px solid #bfdde8;border-radius:12px;background:#fff;color:#301068;font:inherit;touch-action:manipulation}
.reader .km-book-task-index p{margin:4px 0 10px}
.reader .km-book-task-index [hidden]{display:none!important}
.reader .km-book-task-results{display:flex;flex-wrap:wrap}
.reader .km-work-panel>header button{min-width:48px;min-height:48px}
@media(max-width:900px){.reader .km-page-tasks{max-height:185px}.reader .km-book-task-index{padding:0 10px}.reader .km-work-panel .km-tools button{font-size:16px}}
@media(max-width:430px){.reader .km-original-target{left:-54px;min-width:48px;width:48px;min-height:48px}}

/* Task numbers open or switch the panel with a single touch or pen tap. */
.reader .km-original-target,.reader .km-task-actions button{touch-action:manipulation;user-select:none;cursor:pointer}
/* At a small scale, 48px touch markers must not cover each other. All task
   numbers remain in the scrollable toolbar; the selected page marker stays. */
.reader .km-dense-task-markers .km-original-target:not([aria-pressed=true]){visibility:hidden;pointer-events:none}

/* Other exercises stay tappable above the active page drawing layer. */
.reader.km-exercise-open .km-task-region:not(.is-selected){z-index:5}
