.typed-exercise{display:grid;gap:12px;margin:20px 0}.exercise-type-chip{justify-self:start;padding:6px 10px;border-radius:999px;background:#e8f0ea;color:#315746;font:700 10px/1 var(--font-text);letter-spacing:.04em;text-transform:uppercase}.typed-answer-row{display:grid;grid-template-columns:34px minmax(0,1fr);gap:10px 14px;align-items:start;padding:14px 15px;border:1px solid #e2e9e4;border-radius:10px;background:#fbfcfb}.typed-answer-row.correct{border-color:#97c3aa;background:#f1f8f3}.typed-answer-row.wrong{border-color:#dc9a98;background:#fff5f4}.typed-answer-row.review{border-color:#d9c695;background:#fffaf0}.typed-answer-main{min-width:0;display:grid;gap:10px}.typed-answer-row>.bank-field-feedback{grid-column:2}.bank-work-number{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:#e7efe9;color:#0b4434;font:700 12px/1 var(--font-text)}.inline-exercise-sentence{display:flex;flex-wrap:wrap;gap:7px;align-items:center;color:#24342d;font:400 14px/1.65 var(--font-text)}.inline-exercise-sentence input,.sentence-answer input{min-width:150px;height:38px;padding:7px 10px;border:1px solid #cbd7cf;border-radius:7px;background:#fff;color:#143f31;font:500 14px/1 var(--font-text)}.inline-exercise-sentence input::placeholder{color:#7c8d84;opacity:.55;font-style:italic}.inline-exercise-sentence input:focus,.sentence-answer input:focus{outline:2px solid #8cb29d;outline-offset:1px}.sentence-answer input{width:100%;min-width:0}.bank-work-prompt{color:#35473f;font:400 13px/1.55 var(--font-text)}.option-groups{display:flex;flex-wrap:wrap;gap:9px}.option-set{display:flex;flex-wrap:wrap;gap:7px;padding:5px;border-radius:9px;background:#f2f5f3}.option-set button,.sortable-words button,.drag-word-bank button{padding:9px 13px;border:1px solid #cbd8d0;border-radius:8px;background:#fff;color:#174536;font:600 12px/1.2 var(--font-text);cursor:pointer;transition:background .15s,border-color .15s,transform .15s}.option-set button:hover,.sortable-words button:hover,.drag-word-bank button:hover{border-color:#7fa48f;transform:translateY(-1px)}.option-set button[aria-pressed=true]{border-color:#174c3a;background:#174c3a;color:#fff}.sortable-words{display:flex;flex-wrap:wrap;gap:8px;min-height:48px;padding:8px;border:1px dashed #a9bbb0;border-radius:10px;background:#f6f9f7}.sortable-words button{cursor:grab}.drag-word-bank{display:flex;flex-wrap:wrap;gap:8px;padding:13px;border-radius:11px;background:#edf3ef}.drag-word-bank button.selected{border-color:#174c3a;box-shadow:0 0 0 2px #9dbbaa}.word-dropzone{display:flex;align-items:center;min-height:46px;padding:7px 10px;border:1px dashed #8ea79a;border-radius:9px;background:#f8fbf9;color:#74857c;cursor:pointer}.word-dropzone [data-drag-word]{width:auto}.matching-help{color:#61736a;font-size:12px}.matching-board{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:48px;position:relative}.matching-column{display:flex;flex-direction:column;gap:9px}.match-left-row{position:relative;display:grid;gap:6px}.match-left-row.is-paired::after{content:'';position:absolute;right:-48px;top:50%;width:48px;border-top:2px solid #759985}.match-choice{display:grid;grid-template-columns:28px 1fr;gap:8px;align-items:center;width:100%;min-height:52px;padding:10px 12px;border:1px solid #d7e1da;border-radius:9px;background:#fff;color:#2a3d34;text-align:left;cursor:pointer}.match-choice b{display:grid;place-items:center;width:27px;height:27px;border-radius:7px;background:#e7efe9;color:#174c3a}.match-choice:disabled{opacity:.42;cursor:not-allowed}.match-choice.is-paired{border-color:#82a994;background:#eef6f1}.match-left-row .answer-progress-line,.match-left-row .answer-reveal,.match-left-row .answer-history-panel,.match-left-row .bank-field-feedback{margin-left:0}.typed-crossword{display:grid;grid-template-columns:minmax(260px,1fr) minmax(190px,.45fr);gap:24px;align-items:start}.typed-cross-grid{display:grid;grid-template-columns:repeat(var(--cross-cols),minmax(24px,36px));grid-template-rows:repeat(var(--cross-rows),minmax(24px,36px));gap:2px;justify-content:center;padding:18px;border-radius:12px;background:#e4ebe7;overflow:auto}.typed-cross-cell{position:relative;background:#fff}.typed-cross-cell small{position:absolute;z-index:1;left:2px;top:1px;color:#63776c;font-size:7px;pointer-events:none}.typed-cross-cell input{width:100%;height:100%;padding:7px 2px 2px;border:1px solid #b5c6bc;background:#fff;color:#173f32;text-align:center;text-transform:uppercase;font:700 14px/1 var(--font-text)}.typed-cross-cell input:focus{z-index:2;outline:2px solid #315f4d}.crossword-block{background:#22372f}.crossword-word-status{display:grid;gap:7px}.crossword-answer-row{padding:8px 10px;border:1px solid #dfe7e2;border-radius:8px;background:#fff;color:#607169;font-size:11px}.crossword-answer-row.correct{border-color:#85b79b;background:#edf7f0}.crossword-answer-row.wrong{border-color:#d8918e;background:#fff1f0}.crossword-answer-row .answer-progress-line{margin-top:7px}.type-checkboxes .option-set button{border-radius:6px;padding-left:35px;position:relative}.type-checkboxes .option-set button::before{content:'';position:absolute;left:11px;width:13px;height:13px;border:1px solid #789084;border-radius:3px;background:#fff}.type-checkboxes .option-set button[aria-pressed=true]::before{background:#174c3a;box-shadow:inset 0 0 0 3px #fff}.typed-exercise input[type=hidden]+.answer-progress-line{margin-top:2px}@media(max-width:760px){.typed-crossword{grid-template-columns:1fr}.matching-board{gap:24px}.match-left-row.is-paired::after{right:-24px;width:24px}.typed-answer-row{grid-template-columns:30px minmax(0,1fr);padding:12px}.option-set button,.sortable-words button,.drag-word-bank button{padding:8px 10px}}
.exercise-subtasks{display:grid;gap:26px}.exercise-subtask{border:1px solid rgba(14,67,50,.13);border-radius:18px;padding:22px;background:#fff}.exercise-subtask>header{display:flex;gap:14px;align-items:flex-start;margin-bottom:18px;padding-bottom:16px;border-bottom:1px solid rgba(14,67,50,.1)}.exercise-subtask>header>span{display:grid;place-items:center;min-width:48px;height:48px;border-radius:12px;background:#e9f1ec;color:#0e4332;font-weight:800;font-size:16px}.exercise-subtask>header small{display:block;color:#78877f;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;margin-bottom:4px}.exercise-subtask>header h3{margin:0;color:#173e32;font-size:18px;line-height:1.35}.exercise-subtask .exercise-type-chip{margin-bottom:16px}@media(max-width:600px){.exercise-subtask{padding:16px;border-radius:14px}.exercise-subtask>header>span{min-width:42px;height:42px}}

/* Workbook source illustrations */
.exercise-picture{margin:0;min-width:0;max-width:100%}
.exercise-picture img{display:block;width:auto;height:auto;max-width:100%;object-fit:contain;border-radius:10px}
.exercise-picture-item{justify-self:start;position:relative}
.exercise-picture-item img{max-width:min(100%,320px);max-height:240px;background:#fff}
.exercise-picture figcaption{font:700 11px/1.4 var(--font-text);color:#426252;margin-top:6px}
.exercise-context-pictures{display:flex;flex-wrap:wrap;gap:16px;align-items:start;margin:4px 0 16px}
.exercise-picture-context img{max-width:min(100%,380px);max-height:280px}
.crossword-answer-row .exercise-picture{margin-bottom:8px}
.crossword-answer-row .exercise-picture img{max-height:150px;max-width:100%}
.crossword-answer-row:has(.exercise-picture){display:grid;gap:6px}
@media(max-width:600px){.exercise-picture-item img{max-height:200px;max-width:100%}.exercise-context-pictures{gap:10px}.exercise-picture-context img{max-width:100%;max-height:250px}}



/* Matching card alignment */
.matching-board{--match-gap:48px;gap:var(--match-gap);align-items:start}
.matching-board .matching-column{gap:10px;min-width:0}
.matching-board .match-left-row,.matching-board .match-right-row{box-sizing:border-box;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;position:relative;gap:0;min-width:0;width:100%;height:var(--match-row-height,auto);padding:0;border:0;border-radius:0;background:transparent;order:100000}
.matching-board .match-choice{box-sizing:border-box;display:grid;grid-template-columns:28px minmax(0,1fr);align-items:center;gap:10px;align-self:stretch;flex:none;width:100%;min-width:0;max-width:100%;min-height:52px;height:var(--match-choice-height,auto);padding:12px;border:1px solid #d7e1da;border-radius:9px;background:#fff;color:#2a3d34;font:500 13px/1.45 var(--font-text);text-align:left;cursor:pointer}
.matching-board .match-choice>span{min-width:0;overflow-wrap:anywhere}
.matching-board .match-choice:hover:enabled,.matching-board .match-choice[aria-pressed=true]{border-color:#759985;background:#eef5f0}
.matching-board .match-choice:focus-visible{outline:2px solid #315f4d;outline-offset:3px}
.matching-board .match-choice:disabled{cursor:default;opacity:.45}
.matching-board .match-choice.is-paired:disabled{opacity:1;border-color:#82a994;background:#eef6f1;color:#2a3d34}
.matching-board .match-left-row.is-paired>.match-choice{opacity:1;border-color:#82a994;background:#eef6f1}
.matching-board .match-left-row.correct>.match-choice{border-color:#97c3aa;background:#f1f8f3}
.matching-board .match-left-row.wrong>.match-choice{border-color:#dc9a98;background:#fff5f4}
.matching-board .match-left-row.is-paired::after{content:'';position:absolute;right:calc(-1 * var(--match-gap));top:calc(var(--match-choice-height,52px) / 2);width:var(--match-gap);border-top:2px solid #759985;pointer-events:none}
.matching-board .bank-field-feedback{grid-column:auto;min-height:0;margin:0;padding-top:6px}
.matching-board .bank-field-feedback:empty{display:none}
.matching-board .answer-progress-line{margin-top:6px}
.matching-board .answer-history-panel,.matching-board .answer-reveal{flex:none}
@media(max-width:760px){.matching-board{--match-gap:24px}}




/* Compact inline gap fields */
.typed-exercise[data-gap-fields]{--gap-field-width:10ch}
[data-gap-fields] .inline-passage-row{display:grid;grid-template-columns:minmax(0,1fr);gap:10px 14px;align-items:start;padding:14px 15px;border:1px solid #e2e9e4;border-radius:10px;background:#fbfcfb}
[data-gap-fields] .inline-passage-row.with-number{grid-template-columns:30px minmax(0,1fr)}
[data-gap-fields] .inline-passage-row.with-number>.inline-passage-media,[data-gap-fields] .inline-passage-row.with-number>.inline-exercise-sentence{grid-column:2}
[data-gap-fields] .inline-passage-row.with-number>.bank-work-number{grid-row:1}
[data-gap-fields] .inline-passage-media{display:flex;flex-wrap:wrap;gap:12px}
[data-gap-fields] .inline-exercise-sentence{display:block;color:#24342d;font:400 14px/1.8 var(--font-text);overflow-wrap:break-word}
[data-gap-fields] .inline-gap-answer{box-sizing:border-box;display:inline-flex;flex-direction:column;align-items:stretch;vertical-align:middle;position:relative;width:auto;max-width:100%;margin:1px 4px;padding:0;border:0;border-radius:0;background:transparent;gap:0}
[data-gap-fields] .inline-gap-controls{display:block;width:auto;min-width:0;line-height:1}
[data-gap-fields] .inline-gap-controls input{box-sizing:border-box;display:inline-block;flex:none;width:var(--gap-field-width);min-width:var(--gap-field-width);max-width:var(--gap-field-width);height:38px;padding:7px 9px;font:500 14px/1.3 var(--font-text);vertical-align:middle}
[data-gap-fields] .field-question-control{display:inline-flex;align-items:stretch;width:auto;gap:6px;vertical-align:middle}
[data-gap-fields] .field-comment-button{width:30px;min-height:38px;flex-basis:30px}
[data-gap-fields] .inline-gap-answer .bank-field-feedback{display:block;min-height:0;margin-top:3px;padding:0;font:500 10px/1.4 var(--font-text)}
[data-gap-fields] .inline-gap-answer .bank-field-feedback:empty{display:none}
[data-gap-fields] .inline-gap-answer .answer-progress-line{display:flex;align-items:center;justify-content:space-between;gap:6px;width:var(--gap-field-width);margin-top:5px;line-height:1}
[data-gap-fields] .inline-gap-answer .answer-attempts{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;width:70px}
[data-gap-fields] .answer-attempt-step{height:6px;border-radius:99px;background:#d9dfdc}
[data-gap-fields] .answer-attempt-step.is-correct{background:#7db697}
[data-gap-fields] .answer-attempt-step.is-wrong{background:#dc7d78}
[data-gap-fields] .answer-attempt-step.is-review{background:#c9b46f}
[data-gap-fields] .inline-gap-answer .answer-history-toggle{margin:0;padding:4px 2px}
[data-gap-fields] .answer-history-toggle span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
[data-gap-fields] .inline-gap-answer .answer-history-panel{width:240px;max-width:calc(100vw - 100px);line-height:1.4}
[data-gap-fields] .inline-gap-answer .answer-reveal{max-width:160px;margin-top:5px;color:#a3403a;font:700 10px/1.4 var(--font-text)}

/* Matching answer feedback */
.matching-board .match-choice{background:#f6f8f5;transition:background-color .12s,border-color .12s}
.matching-board .match-choice:hover:enabled:not(.is-paired){background:#eef1ef;border-color:#aabbb0}
.matching-board .match-choice.is-rejected:disabled{opacity:1;background:#fce9e7;border-color:#d87871;color:#a3403a;animation:match-reject-shake .4s ease-in-out;cursor:default}
.matching-board .match-choice.is-rejected b{background:#f2ceca;color:#a3403a}
@keyframes match-reject-shake{0%,100%{transform:translateX(0)}20%,60%{transform:translateX(-4px)}40%,80%{transform:translateX(4px)}}
@media(prefers-reduced-motion:reduce){.matching-board .match-choice.is-rejected{animation:none}}

/* Original workbook crossword layout */
.compiled-answer-row .compiled-sentence{font-size:14px;line-height:2.8;color:#24342d}
.compiled-input-slot{display:inline-flex;vertical-align:middle;margin:3px 4px}
.compiled-answer-row .compiled-input-slot input{box-sizing:border-box;width:var(--answer-field-width,10ch);min-width:0;max-width:100%;height:38px;padding:7px 9px}
.compiled-option-set{display:inline-flex;flex-wrap:wrap;vertical-align:middle;gap:5px;margin:4px;padding:5px;border-radius:9px;background:#edf3ef;line-height:1.4}
.compiled-option-set button{padding:8px 11px;border:1px solid #ccdcd2;background:white;color:var(--forest);font-size:12px}
.compiled-option-set button[aria-pressed="true"]{background:var(--forest);border-color:var(--forest);color:white}
.compiled-option-set button:disabled{opacity:1;cursor:default}
.compiled-input-slot input::placeholder{color:#7c8c82;opacity:.6}
.compiled-answer-row.correct .compiled-input-slot input{border-color:#83b693;background:#f0f8f1}
.compiled-answer-row.wrong .compiled-input-slot input{border-color:#d48686;background:#fff4f3}
.typed-crossword[data-original-layout]{grid-template-columns:minmax(0,1fr);gap:24px}
[data-original-layout] .typed-cross-grid{width:min(100%,520px);max-width:100%;min-width:0;aspect-ratio:var(--cross-cols) / var(--cross-rows);grid-template-columns:repeat(var(--cross-cols),minmax(0,1fr));grid-template-rows:repeat(var(--cross-rows),minmax(0,1fr));gap:2px;padding:0;margin:0 auto;border-radius:0;background:transparent;overflow:visible}
[data-original-layout] .typed-cross-cell{min-width:0;min-height:0;background:transparent}
[data-original-layout] .typed-cross-cell input{box-sizing:border-box;display:block;min-width:0;min-height:0;border:1px solid #c7d1ca;border-radius:3px;background:#f3f5ee;padding:7px 1px 1px;font-size:clamp(12px,2vw,17px)}
[data-original-layout] .typed-cross-cell small{font-size:8px;line-height:1}
[data-original-layout] .typed-cross-cell input.is-given{background:#edf4fd;color:#2766ad;cursor:default}
[data-original-layout] .crossword-word-status{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
[data-original-layout] .crossword-answer-row{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;padding:12px 8px;text-align:center}
[data-original-layout] .crossword-answer-row .exercise-picture{margin:0;width:100%}
[data-original-layout] .crossword-answer-row .exercise-picture img{width:auto;height:95px;max-width:100%;object-fit:contain;margin:auto}
[data-original-layout] .crossword-answer-row>.bank-field-feedback{align-self:stretch;grid-column:auto}
@media(max-width:600px){[data-original-layout] .crossword-word-status{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Written and picture clues stay beside their own word feedback/history. */
.crossword-word-status.has-clue-groups{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}
.crossword-clue-section{min-width:0}
.crossword-clue-section h3{margin:0 0 12px;color:#174536;font-size:18px;line-height:1.3}
.crossword-clue-list{display:grid;gap:10px}
[data-original-layout] .crossword-clue-list .crossword-answer-row{align-items:stretch;gap:8px;padding:12px;text-align:left}
.crossword-clue-heading{display:grid;grid-template-columns:25px minmax(0,1fr);gap:8px;align-items:start;color:#304c3c;font-size:16px;line-height:1.5}
.crossword-clue-heading p{margin:0;font-size:16px;line-height:1.5}
.crossword-clue-number{display:grid;place-items:center;min-height:25px;border-radius:6px;background:#e7efe9;color:#174536;font-size:14px}
.crossword-answer-length{padding-left:33px;font-size:12px;line-height:1.4;letter-spacing:.04em;overflow-wrap:anywhere}
[data-original-layout] .crossword-clue-list .exercise-picture img{height:auto;max-height:160px;max-width:100%;margin:auto}
@media(max-width:600px){.crossword-word-status.has-clue-groups{grid-template-columns:1fr}}

.exercise-reading-context{white-space:pre-line;border-left:3px solid #acc9b8;padding:12px 16px;margin:0 0 18px;color:#304c3c;font-size:14px;line-height:1.8;overflow-wrap:anywhere}.compiled-word-bank{display:flex;flex-wrap:wrap;gap:7px;padding:14px;background:#f0f5f1;border-radius:10px;margin:0 0 18px}.compiled-word-bank button{background:white;padding:8px 11px;font-size:12px;cursor:grab}.compiled-word-bank button.selected{background:var(--forest);color:white}.compiled-answer-row .compiled-sentence:has(.sentence-answer){line-height:1.7}.compiled-answer-row .sentence-answer input{width:100%}

.compiled-answer-row .compiled-input-slot.is-wide{display:flex;width:100%;margin:9px 0}.compiled-answer-row .compiled-input-slot.is-wide input{width:100%;min-width:0;max-width:100%}.compiled-option-set .option-set{display:flex;flex-wrap:wrap;gap:5px}

.compiled-option-set{max-width:100%}.compiled-option-set button{max-width:100%;overflow-wrap:anywhere}.matching-board .match-choice input[data-match-text]{box-sizing:border-box;display:inline-block;width:var(--answer-field-width,10ch);min-width:0;max-width:100%;height:38px;margin:3px;padding:7px 9px}.matching-board .match-choice[aria-disabled=true]{cursor:default}

.matching-board .match-picture{display:block;width:100%;max-height:150px;object-fit:contain;margin:0 0 5px;border-radius:6px}.matching-board .match-choice>span{min-width:0}

/* Word gaps contain movable chips; answer inputs remain hidden for grading/history. */
.inline-word-slot{box-sizing:border-box;display:inline-flex;vertical-align:middle;align-items:stretch;justify-content:center;flex:0 1 var(--answer-field-width,10ch);width:var(--answer-field-width,10ch);min-width:0;max-width:100%;height:var(--drag-control-height,32px);min-height:var(--drag-control-height,32px);padding:0;margin:2px 3px;border:1px dashed #a4b9ac;border-radius:9px;background:#f0f4f1;cursor:default}
.inline-word-slot.is-filled{border-color:transparent;background:transparent}
.inline-word-slot [data-word-slot-button]{box-sizing:border-box;width:100%;min-width:0;min-height:0;height:100%;padding:3px 6px;border:0;background:transparent;color:#7c9184;font:600 14px var(--font-text)}
.inline-word-slot [data-word-slot-button][hidden]{display:none}
.inline-word-slot [data-compiled-word],.inline-word-slot [data-drag-word]{box-sizing:border-box;flex:1 1 0;width:100%;min-width:0;max-width:100%;height:100%;min-height:0;margin:0;padding:2px 5px;border:1px solid #c5d5ca;border-radius:8px;background:#fff;color:#174536;font:600 13px/1.3 var(--font-text);cursor:grab;white-space:normal;overflow-wrap:anywhere;overflow:auto;transition:background .15s,border-color .15s}
.inline-word-slot button.is-correct{background:#e3f2e8;border-color:#7eae91;color:#195638}
.inline-word-slot button.is-wrong{background:#fbe8e5;border-color:#d18f88;color:#9b3e36}
.inline-word-slot button.selected{box-shadow:0 0 0 2px #749985}
.inline-word-slot button:disabled{opacity:.9;cursor:default}
.inline-word-slot>.field-question-control{display:contents}
.compiled-word-bank,.drag-word-bank{min-height:54px}
.bank-field-feedback:empty,.feedback:empty{display:none}
.compiled-answer-row .compiled-input-slot input.typed-field-correct{border-color:#7eae91;background:#e3f2e8;color:#195638}
.compiled-answer-row .compiled-input-slot input.typed-field-wrong{border-color:#d18f88;background:#fbe8e5;color:#9b3e36}

.english-resource-note{padding:14px 18px;margin:0 0 22px;border:1px solid #dce7e0;border-radius:12px;background:#f3f7f4;color:#526b60;font-size:14px;line-height:1.6}.english-resource-note p{margin:0 0 8px}.english-resource-note summary{cursor:pointer;color:#073d30;font-weight:600}.english-resource-note img{display:block;max-width:100%;height:auto;margin-top:16px}.mark-unchanged{margin-top:8px;padding:6px 12px;color:#073d30;background:#e7efea;border:1px solid #cadbd1;border-radius:8px}

.order-bank-widget{display:grid;gap:12px}.order-word-pool,.order-answer{display:flex;flex-wrap:wrap;gap:7px;min-height:42px;padding:9px;border-radius:9px;background:#edf3ef}.order-answer{min-width:140px;flex:1;border:1px dashed #9bb4a5;background:#fff}.order-bank-widget button{padding:9px 12px;border:1px solid #cbd8d0;border-radius:8px;background:white;color:#174536;cursor:grab;font:600 13px/1.3 var(--font-text)}.order-bank-widget button:focus-visible{outline:2px solid #33755a;outline-offset:2px}.order-bank-widget button:disabled{cursor:default;opacity:.7}.order-sentence{display:flex;flex-wrap:wrap;gap:8px;align-items:center}

/* Shared exercise row and answer-control borders. */
.matching-board .match-choice input[data-match-text]{border:2px solid #d6dfd7;border-radius:5px;background:#f3f5f2;color:#193b28;font:500 12px/1.45 var(--font-text)}
.matching-board .match-choice input[data-match-text]:focus{outline:2px solid #8cb29d;outline-offset:1px}
.matching-board input[data-match-text].typed-field-correct{background:#e3f2e8;border-color:#7eae91;color:#195638}
.matching-board input[data-match-text].typed-field-wrong{background:#fbe8e7;border-color:#cd8580;color:#9f3532}
.typed-exercise .sortable-words button[data-order-start],
.typed-exercise .order-bank-widget button[data-order-start]{color:#276da5}
.typed-exercise .exercise-source-color[data-source-color="green"]{color:#238050}
.typed-exercise .exercise-source-color[data-source-color="blue"]{color:#2766ad}

.typed-exercise .bank-answer-row,
.typed-exercise input:not([type="hidden"]),
.typed-exercise select,
.typed-exercise textarea,
.typed-exercise .match-choice,
.typed-exercise .option-set button,
.typed-exercise .compiled-option-set button,
.typed-exercise .word-dropzone,
.typed-exercise .word-dropzone button,
.typed-exercise .order-answer{border-width:2px}

/* Grade only the selected option; other choices keep their neutral appearance. */
.typed-exercise button[aria-pressed="true"][data-choice-result="wrong"]{
  background:#923b3b;border-color:#923b3b;color:#fff;
}

/* Original gap categories. Marking colors take precedence once an answer is checked. */
.typed-exercise [data-gap-color="blue"]{--gap-tint:#f3f9fd;--gap-border:#c8dce9}
.typed-exercise [data-gap-color="pink"]{--gap-tint:#fff7fb;--gap-border:#e4d0dd}
.typed-exercise [data-gap-color="green"]{--gap-tint:#f4faf5;--gap-border:#c7ddcd}
.typed-exercise .bank-answer-row:not(.correct):not(.wrong) [data-gap-color] input:not([type="hidden"]):not(.typed-field-correct):not(.typed-field-wrong),
.typed-exercise .bank-answer-row:not(.correct):not(.wrong) [data-gap-color] .word-dropzone:not(.is-filled){
  background:var(--gap-tint);border-color:var(--gap-border);
}
.typed-exercise [data-gap-color] .word-dropzone:not(.is-filled)>button{background:transparent}
.typed-exercise .bank-answer-row:not(.correct):not(.wrong) [data-gap-color] input:not([type="hidden"]):not(.typed-field-correct):not(.typed-field-wrong),
.typed-exercise .bank-answer-row:not(.correct):not(.wrong) [data-gap-color] .word-dropzone:not(.is-filled){border-style:dashed}

/* Explicit PDF lines are separate rows within one numbered item. */
.exercise-item-line{display:block;flex:0 0 100%;width:100%;min-width:0;max-width:100%}
.exercise-source-arrow{display:inline-block;margin:0 .25em;color:#bb608e;font-size:1.2em;font-weight:800;line-height:1;white-space:nowrap}

/* Compact text fields for missing-word tasks in every workbook and lesson. */
.typed-exercise[data-exercise-type="insert-words"] input:not([type="hidden"]){
  height:30px;min-height:30px;padding:3px 9px;line-height:1.3;
}
.typed-exercise[data-exercise-type="insert-words"] .field-comment-button{
  height:30px;min-height:30px;
}

/* Tighter spacing inside multiline items; controls retain their own dimensions. */
.compiled-sentence>.exercise-item-line,
.inline-exercise-sentence>.exercise-item-line{line-height:1.8}
.bank-work-prompt>.exercise-item-line{line-height:1.45}
.inline-exercise-sentence:has(>.exercise-item-line){row-gap:2px}
.exercise-item-line .compiled-input-slot{margin-top:1px;margin-bottom:1px}
.exercise-item-line .inline-gap-answer{margin-top:1px;margin-bottom:1px}

/* Option padding follows the sentence feedback rather than keeping a green fill. */
.typed-exercise[data-exercise-type="choose-option"] .compiled-option-set,
.typed-exercise[data-exercise-type="choose-option"] .option-set{background:transparent}
[data-gap-fields] .inline-gap-controls .compiled-option-set{margin:0;padding:0}
[data-gap-fields] .inline-gap-controls .option-set{padding:0}

/* Word-bank chips and their destinations use the same stable outer height. */
.typed-exercise[data-exercise-type="drag-words"]{--drag-control-height:32px}
.typed-exercise[data-exercise-type="drag-words"] .compiled-word-bank button,
.typed-exercise[data-exercise-type="drag-words"] .drag-word-bank button{
  box-sizing:border-box;height:var(--drag-control-height);min-height:var(--drag-control-height);
  padding:4px 10px;line-height:1.3;white-space:nowrap;max-width:100%;overflow:auto;
}
.typed-exercise[data-exercise-type="drag-words"] .inline-word-slot{
  height:var(--drag-control-height);min-height:var(--drag-control-height);max-height:var(--drag-control-height);
  margin-top:0;margin-bottom:0;line-height:1;
}
.typed-exercise[data-exercise-type="drag-words"] .inline-word-slot [data-compiled-word],
.typed-exercise[data-exercise-type="drag-words"] .inline-word-slot [data-drag-word]{
  font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.typed-exercise[data-exercise-type="drag-words"] .inline-gap-controls>input:not([type="hidden"]){
  height:30px;min-height:30px;padding:3px 9px;line-height:1.3;
}
.typed-exercise .inline-word-slot.is-filled{border-width:0}

/* Phrase gaps have a stable answer-based width, capped by the available line. */
.typed-exercise .compiled-input-slot[data-answer-size],
.typed-exercise .inline-gap-answer[data-answer-size]{width:var(--answer-field-width);max-width:100%;min-width:0}
.typed-exercise input[data-answer-size]{box-sizing:border-box;width:var(--answer-field-width);max-width:100%;min-width:0}
.typed-exercise [data-answer-size] input{width:100%;min-width:0;max-width:100%}
.typed-exercise [data-answer-size] .field-question-control{display:flex;width:100%;min-width:0}
.typed-exercise [data-answer-size] .field-question-control input{flex:1;min-width:0;width:0}
.typed-exercise .inline-gap-answer[data-answer-size] .answer-progress-line{width:100%}

/* Source-defined banks keep separate word lists and their original categories. */
.compiled-word-bank.has-word-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:0;background:transparent}
.compiled-word-bank.has-word-groups:has(>.word-bank-group:only-child){grid-template-columns:1fr}
.word-bank-group{min-width:0;padding:12px;border:2px solid var(--gap-border);border-radius:10px;background:var(--gap-tint)}
.word-bank-group h4{margin:0 0 9px;font-size:12px;font-weight:700}
.word-bank-group-chips{display:flex;flex-wrap:wrap;align-content:start;gap:7px;min-height:32px}
.word-bank-group[data-gap-color="blue"]{color:#23628f}
.word-bank-group[data-gap-color="pink"]{color:#9c3858}
.word-bank-group-chips button{border:2px solid var(--gap-border);color:inherit}
@media(max-width:600px){.compiled-word-bank.has-word-groups{grid-template-columns:1fr}}

/* Several replies can belong to one source dialogue while keeping separate histories. */
.exercise-item-group{min-width:0;padding:16px;border:2px solid #d6dfd7;border-radius:10px;background:#fbfcfb}
.exercise-item-group>h3{margin:0 0 10px;color:#174536;font-size:15px;line-height:1.4}
.exercise-item-group-answers{display:grid;gap:0}
.exercise-item-group-answers>.bank-answer-row{display:block;margin:0;padding:0;border:0;border-radius:0;background:transparent}
.exercise-item-group-answers>.bank-answer-row>.bank-work-number{display:none}
.exercise-item-group-answers>.bank-answer-row.correct{background:#f1f8f3}
.exercise-item-group-answers>.bank-answer-row.wrong{background:#fff5f4}
.exercise-item-group .compiled-input-slot.is-wide{display:inline-flex;width:calc(100% - 1.5em);margin:3px 0;vertical-align:middle}

/* Numbered source photos and their editable monument/city entries share one row. */
.exercise-table-wrap{max-width:100%;overflow-x:auto}
.exercise-table{width:100%;min-width:540px;table-layout:fixed;border-collapse:separate;border-spacing:0 10px}
.exercise-table th{padding:4px 12px;color:#174536;text-align:left;font-size:14px}
.exercise-table th:first-child{width:26%}.exercise-table th:nth-child(2){width:42%}.exercise-table th:last-child{width:32%}
.exercise-table .exercise-table-row{display:table-row;padding:0;border:0;background:#fbfcfb}
.exercise-table td{padding:12px;vertical-align:middle;border-top:2px solid #d6dfd7;border-bottom:2px solid #d6dfd7}
.exercise-table td:first-child{border-left:2px solid #d6dfd7;border-radius:10px 0 0 10px}
.exercise-table td:last-child{border-right:2px solid #d6dfd7;border-radius:0 10px 10px 0}
.exercise-table .exercise-picture img{width:auto;height:auto;max-height:115px;max-width:100%;margin:auto}
.exercise-table .compiled-input-slot{max-width:100%;margin:0;box-sizing:border-box}
.exercise-table .compiled-sentence{font-size:14px;line-height:1.5}
.exercise-table .exercise-table-row.correct{background:#f1f8f3}.exercise-table .exercise-table-row.wrong{background:#fff5f4}

/* Transpose multi-select choices while keeping each person's saved answer scope. */
.choice-matrix{display:grid;gap:12px}
.choice-matrix-item .option-set{justify-content:flex-start}
.matrix-answer-history{border:2px solid #d6dfd7;border-radius:10px;padding:12px}
.matrix-answer-history>summary{cursor:pointer;color:#174536;font-size:13px;font-weight:600}
.matrix-person-status{display:block;margin-top:12px;padding:12px;border:2px solid #d6dfd7;border-radius:8px}
.matrix-person-status h4{margin:0 0 8px;font-size:13px;color:#174536}

.typed-exercise[data-option-layout="vertical"] .compiled-option-set,.typed-exercise[data-option-layout="vertical"] .option-set{display:flex;flex-direction:column;align-items:stretch;width:100%;box-sizing:border-box;margin:0}
.typed-exercise[data-option-layout="vertical"] .compiled-option-set button,.typed-exercise[data-option-layout="vertical"] .option-set button{width:100%;box-sizing:border-box;text-align:left;white-space:normal}

.option-set.has-option-pictures{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:12px;width:100%;box-sizing:border-box}
.type-checkboxes .option-set.has-option-pictures button{display:flex;flex-direction:column;align-items:center;justify-content:space-between;gap:10px;min-width:0;padding:16px 12px 12px;font-size:14px}
.type-checkboxes .option-set.has-option-pictures button::before{left:10px;top:10px}
.option-set.has-option-pictures .option-picture{display:block;box-sizing:border-box;width:100%;height:145px;object-fit:contain;background:#fff;border-radius:5px;pointer-events:none}

[data-gap-fields] .inline-passage-heading .inline-exercise-sentence{font-size:20px;font-weight:700;line-height:1.5;text-align:center}

.typed-exercise [data-word-color="yellow"]{background:#fff0c2;border-color:#ddc68c;color:#174536}
.typed-exercise [data-word-color="purple"]{background:#eee9f7;border-color:#cec2e3;color:#174536}
.typed-exercise [data-word-color="pink"]{background:#fde5e9;border-color:#e8bdc7;color:#174536}
.typed-exercise [data-word-color="blue"]{background:#e2f0fc;border-color:#b8d5eb;color:#174536}

.matching-board[data-match-density="compact"] .match-choice{padding:8px 12px}
.matching-board[data-match-density="compact"] .match-picture{max-height:60px;margin:0}

[data-gap-fields] .inline-passage-row.with-right-media{grid-template-columns:minmax(0,1fr) 160px;gap:18px}
[data-gap-fields] .inline-passage-row.with-right-media .inline-passage-media{min-width:0}
[data-gap-fields] .inline-passage-row.with-right-media .exercise-picture{margin:0;width:100%}
[data-gap-fields] .inline-passage-row.with-right-media .exercise-picture img{width:100%;max-width:100%;height:auto;max-height:none}
@media(max-width:600px){[data-gap-fields] .inline-passage-row.with-right-media{grid-template-columns:minmax(0,1fr)}[data-gap-fields] .inline-passage-row.with-right-media .inline-passage-media{width:160px;justify-self:end}}

[data-original-layout] .typed-cross-cell input[data-cross-color="green"]{background:#b6d9bd;border-color:#6c9d78;color:#173f32}
[data-original-layout] .typed-cross-cell input[data-cross-color="purple"]{background:#c8b5d9;border-color:#9275ad;color:#392650}
.crossword-word-status.has-clue-groups:has(>.crossword-clue-section:only-child){grid-template-columns:minmax(0,1fr)}

.crossword-letter-blanks{display:inline-flex;flex-wrap:wrap;gap:4px;vertical-align:middle;max-width:100%}
.crossword-letter-blank{display:block;box-sizing:border-box;flex:0 0 16px;width:16px;height:16px;border:2px solid currentColor;border-radius:4px;opacity:.45}

.matching-connections{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;color:#759985}
.matching-connections path{fill:none;stroke:currentColor;stroke-width:2;vector-effect:non-scaling-stroke}
.matching-board[data-match-lines] .match-left-row.is-paired::after{display:none}
.matching-board[data-match-lines] .match-right-choice.has-connections{border-color:#82a994;background:#eef6f1}

.compiled-answer-row .exercise-item-heading{display:block;margin-bottom:5px;white-space:pre-line;font-weight:700;line-height:1.5}

[data-gap-fields] .inline-passage-row.with-speaker{grid-template-columns:36px minmax(0,1fr);gap:12px}
.inline-speaker-photo{display:block;width:36px;height:36px;border-radius:50%;object-fit:cover}
.inline-speaker-name{font-weight:700}

.sortable-words[data-order-layout="vertical"]{flex-direction:column;align-items:stretch}
.sortable-words[data-order-layout="vertical"] button{box-sizing:border-box;width:100%;text-align:left;white-space:normal}

[data-gap-fields] .inline-passage-row.with-left-media{grid-template-columns:32px minmax(0,1fr);gap:12px}
[data-gap-fields] .inline-passage-row.with-left-media .inline-passage-media{min-width:0}
[data-gap-fields] .inline-passage-row.with-left-media .exercise-picture{margin:0;width:32px}
[data-gap-fields] .inline-passage-row.with-left-media .exercise-picture img{display:block;width:32px;height:32px;max-width:100%;object-fit:contain;border-radius:50%}

.typed-exercise[data-drag-layout="vertical-phrases"] .compiled-word-bank{flex-direction:column;align-items:stretch}
.typed-exercise[data-drag-layout="vertical-phrases"] .compiled-word-bank button,
.typed-exercise[data-drag-layout="vertical-phrases"] .inline-word-slot [data-compiled-word]{box-sizing:border-box;width:100%;height:auto;min-height:40px;max-height:none;white-space:normal;overflow:visible;text-overflow:clip;text-align:left;line-height:1.5;padding:8px 12px}
.typed-exercise[data-drag-layout="vertical-phrases"] .inline-word-slot{flex:0 1 var(--answer-field-width);width:var(--answer-field-width);min-width:0;max-width:100%;height:auto;min-height:40px;max-height:none;margin:2px 0}

.typed-exercise .drawing-answer-row{display:block;padding:0;border:0;background:transparent}
.drawing-tools{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.drawing-tools button{display:inline-flex;align-items:center;gap:7px;padding:8px 12px;border:2px solid #cbd8d0;border-radius:8px;background:#fff;color:#174536;font:600 13px/1.3 var(--font-text);cursor:pointer}
.drawing-tools button[aria-pressed="true"]{border-color:#174536;background:#e8f0ea}
.drawing-tools button:disabled{cursor:default;opacity:.55}
.drawing-tools svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.drawing-surface{position:relative;width:100%;overflow:hidden;border-radius:8px;background:#fff}
.drawing-surface>img{display:block;width:100%;max-width:100%;height:auto;pointer-events:none;user-select:none}
.drawing-surface canvas{position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none;cursor:crosshair}
.drawing-surface canvas[data-drawing-tool="eraser"]{cursor:cell}
.drawing-surface canvas[aria-disabled="true"]{cursor:default}
.typed-exercise[data-exercise-type="drawing"]+.bank-checkbar{display:none}

/* Every word/phrase field uses ceil(1.1 × answer characters / 10) × 10 ch. */
.typed-exercise input[data-answer-size="computed"],
.workbook input[data-answer-size="computed"],
.bank-work-control input[data-answer-size="computed"]{box-sizing:border-box;width:var(--answer-field-width);min-width:0;max-width:100%;flex:none}
.typed-exercise .compiled-input-slot[data-answer-size="computed"]>input,
.typed-exercise .inline-gap-answer[data-answer-size="computed"] .inline-gap-controls>input{box-sizing:border-box;width:100%;min-width:0;max-width:100%}
.typed-exercise .inline-word-slot[data-answer-size="computed"]{flex:0 1 var(--answer-field-width);width:var(--answer-field-width);min-width:0;max-width:100%}
.workbook .response:has(input[data-answer-size="computed"]){flex:0 1 auto;min-width:0;max-width:100%}
.typed-exercise .inline-passage-heading .inline-exercise-sentence,.typed-exercise .exercise-context-heading{font-size:20px;font-weight:700;line-height:1.5}
.typed-exercise .exercise-context-heading{margin:18px 0 8px}
