/* Shared production components, including embedded readers. */
.material-download { display:grid; grid-template-columns:36px minmax(0,1fr); gap:10px 12px; padding:18px; border:1px solid #d9e2d3; border-radius:10px; background:#fff; color:#173d2c; text-decoration:none; }
.material-download:hover { border-color:#6d947a; background:#fbfdf8; }
.material-download-icon { display:grid; place-items:center; width:36px; height:42px; background:#edf3e7; border-radius:6px; }
.material-download-icon svg { width:21px; height:21px; }
.material-download-name { min-width:0; }
.material-download-name strong { display:block; overflow-wrap:anywhere; font-size:.86rem; line-height:1.5; font-weight:600; }
.material-download-name small { display:block; margin-top:5px; color:#61705d; font-size:.73rem; }
.material-download-action { grid-column:1/-1; display:flex; justify-content:space-between; align-items:center; gap:12px; padding-top:12px; border-top:1px solid #e2e9dd; color:#226847; font-size:.79rem; font-weight:600; }
.material-download-action svg { width:18px; height:18px; }
.material-attachments h2 { margin-bottom:20px; }
.next-ui .exam-player-sidebar { padding:0; overflow:hidden; min-width:0; }
.next-ui .exam-player-sidebar-heading { padding:22px 20px; background:#eef4e8; border-bottom:1px solid #d9e2d1; }
.next-ui .exam-player-sidebar-heading .eyebrow { font-size:.65rem !important; letter-spacing:.08em; overflow-wrap:normal; }
.next-ui .exam-player-sidebar-heading h2 { font-size:1.35rem; margin:8px 0; }
.next-ui .exam-player-sidebar-heading p { font-size:.77rem; line-height:1.6; }
.next-ui .exam-question-navigation { display:grid; gap:6px; padding:10px; }
.next-ui .exam-question-navigation button { width:100%; min-width:0; display:grid; grid-template-columns:28px minmax(0,1fr) 7px; gap:10px; padding:13px 10px; align-items:start; border-radius:8px; }
.next-ui .exam-question-navigation button > span:first-child { width:28px; height:28px; font-size:.8rem; font-weight:600; }
.next-ui .exam-question-navigation button > span:nth-child(2) { display:grid; gap:5px; }
.next-ui .exam-question-navigation strong,.next-ui .exam-question-navigation small { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; line-height:1.5; }
.next-ui .exam-question-navigation strong { font-size:.8rem; font-weight:600; }
.next-ui .exam-question-navigation small { font-size:.7rem; }
.next-ui .exam-question-navigation button > i { margin-top:10px; width:7px; height:7px; }
.next-ui .exam-question-navigation button.is-current { background:#eaf3e5; border-color:#619275; }
.next-ui .import-review-save-state strong { color:#fff; }
.next-ui .import-review-save-state small { color:#deeadc; font-size:.76rem; line-height:1.5; }
.exercise-dialog-preview-shell .required-marker { display:none; }
.proposal-ui .contact-hero { overflow:visible; }
.proposal-ui .contact-hero .eyebrow { display:inline-block; padding:2px 3px; margin-left:-3px; line-height:1.6; transform:none; }
.next-ui .panel.course-code-access { padding:0; }
.next-ui .course-code-access > summary { display:grid; grid-template-columns:42px minmax(0,1fr) 30px; padding:22px; gap:14px; }
.next-ui .course-code-access > summary::after,.next-ui .course-code-access[open] > summary::after { content:none; }
.course-code-toggle { display:grid; place-items:center; width:30px; height:30px; border:1px solid #c7d6bc; border-radius:7px; font-size:1.2rem; font-weight:400; }
.course-code-toggle::before { content:'+'; }
.course-code-access[open] .course-code-toggle::before { content:'−'; }
.scroll-to-top { width:46px; min-width:46px; height:46px; padding:0; border-radius:12px; background:#214e3b; border:1px solid #426a55; color:#fff; box-shadow:0 5px 18px #173d2c25; backdrop-filter:none; }
.scroll-to-top-icon { width:22px; height:22px; }
.scroll-to-top-label { display:none; }
.scroll-to-top:hover { background:#326248; border-color:#326248; transform:translateY(-2px); }
.scroll-to-top:focus-visible { outline:3px solid #90b37b; outline-offset:3px; box-shadow:none; }
body:has(.context-tour-help) .scroll-to-top { bottom:var(--scroll-top-offset,88px); }
body:has(dialog[open]) .scroll-to-top { display:none; }
/* Calcoria dialogs retain native focus trapping, Escape and existing actions. */
dialog:is(.course-dialog,.calcoria-dialog,.confirm-dialog,.community-rights-dialog,.rich-link-dialog,.import-upload-dialog) { border:1px solid #cbd9c3; border-radius:16px; background:#fff; color:#1b392c; box-shadow:0 24px 90px #10271f40; max-width:calc(100vw - 32px); max-height:calc(100dvh - 40px); }
dialog.import-upload-dialog { position:fixed; inset:0; margin:auto; overflow:auto; }
.course-reader-footer-container { margin-top:1.5rem; margin-bottom:3rem; }
.course-reader-footer { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:stretch; gap:1.25rem; padding:1.25rem; border:1px solid var(--line); border-radius:18px; background:#fff; }
.reader-footer-link { display:flex; align-items:center; gap:1rem; padding:1rem; border-radius:12px; color:var(--ink); text-decoration:none; min-width:0; }
.reader-footer-link span { min-width:0; }
.reader-footer-link small { display:block; color:var(--muted); font-size:.8rem; margin-bottom:.4rem; }
.reader-footer-link strong { display:block; font-size:1rem; line-height:1.5; overflow-wrap:anywhere; }
.reader-footer-link.is-next { justify-content:space-between; background:#eef5ef; }
.reader-footer-link:hover { background:#e1ede5; }
.reader-footer-link:focus-visible,.reader-footer-overview:focus-visible { outline:2px solid #397350; outline-offset:3px; }
.reader-footer-overview { display:flex; flex-direction:column; justify-content:center; gap:.4rem; text-align:center; font-size:.85rem; padding:.5rem; }
.reader-footer-overview span,.reader-footer-start { color:var(--muted); font-size:.8rem; }
.reader-footer-start { align-self:center; padding:1rem; }
@media (max-width:650px) { .course-reader-footer { grid-template-columns:minmax(0,1fr); gap:.5rem; padding:.75rem; } .reader-footer-overview { grid-row:1; } .reader-footer-start { display:none; } }
dialog::backdrop { background:rgba(14,32,25,.52); backdrop-filter:blur(3px); }
dialog .course-dialog-header { padding:28px 30px; background:#f1f6ec; border-bottom:1px solid #dce5d5; gap:22px; }
dialog .course-dialog-header > div { min-width:0; }
dialog .course-dialog-header :is(h2,h3) { font:clamp(1.5rem,2.7vw,2rem)/1.2 Georgia,serif; letter-spacing:-.02em; margin:9px 0; overflow-wrap:anywhere; }
dialog .course-dialog-header .eyebrow { font-size:.67rem; letter-spacing:.1em; color:#426947; }
dialog .course-dialog-header p { max-width:620px; color:#5c6e57; line-height:1.7; font-size:.87rem; margin:10px 0 0; }
dialog .course-dialog-close { flex:0 0 34px; width:34px; height:34px; border-radius:9px; background:#fff; color:#3e5e47; border:1px solid #ccd9c2; font-size:1.25rem; }
dialog .course-dialog-body { padding:28px 30px; }
dialog .course-dialog-field { gap:9px; }
dialog .course-dialog-field > span { font-size:.88rem; font-weight:600; }
dialog .course-dialog-field small { color:#65745f; font-size:.78rem; line-height:1.6; }
dialog .course-dialog-actions { padding:20px 30px; background:#f8faf5; border-top:1px solid #dbe5d4; gap:10px; }
dialog .course-dialog-actions .button { min-height:44px; border-radius:8px; }
dialog :is(.course-timing-options,.course-notify-audiences) { gap:12px; }
dialog :is(.course-timing-options,.course-notify-audiences) label { border-radius:9px; }
dialog .course-grant-steps > fieldset { border:0; border-top:1px solid #e0e7da; padding-top:22px; margin-top:8px; }
dialog.confirm-dialog { padding:30px; width:min(540px,calc(100vw - 32px)); }
dialog.confirm-dialog h2 { font-size:1.7rem; line-height:1.25; }
dialog.confirm-dialog p { color:#5d6d57; font-size:.9rem; line-height:1.75; }
dialog :is(button,a,input,textarea,select):focus-visible { outline:2px solid #397350; outline-offset:3px; }
@media(max-width:800px) {
 .next-ui .exam-question-navigation { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .next-ui .exam-player-sidebar-heading { padding:18px; }
}
@media(max-width:480px) {
 .next-ui .exam-question-navigation { grid-template-columns:minmax(0,1fr); max-height:280px; overflow:auto; }
 .next-ui .course-code-access > summary { padding:18px; grid-template-columns:32px minmax(0,1fr) 28px; gap:10px; }
 .next-ui .course-code-access-icon { width:32px; height:36px; }
 dialog .course-dialog-header,dialog .course-dialog-body { padding:22px; }
 dialog .course-dialog-actions { padding:18px 22px; flex-wrap:wrap; }
 .scroll-to-top { width:44px; height:44px; min-width:44px; border-radius:11px; }
}
/* Course descriptions are complete in the markup and expandable in place. */
.expandable-copy, .expandable-copy-text { display: block; min-width: 0; }
.expandable-copy.is-collapsible:not(.is-expanded) > .expandable-copy-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.course-module-summary-copy .expandable-copy.is-collapsible:not(.is-expanded) > .expandable-copy-text { -webkit-line-clamp: 2; }
.expandable-copy-toggle { display: inline-block; padding: .25rem 0; margin-top: .2rem; border: 0; background: transparent; color: var(--green-dark); font: inherit; font-size: .85rem; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.expandable-copy-toggle[hidden] { display: none; }
.course-module-summary-copy .course-module-description { white-space: normal; overflow: visible; text-overflow: clip; }
.course-learning-step-list:not(:has([data-course-unit-item]))::before { content: none; }
.content-workspace .course-module-card > summary:has(> .course-unit-actions) {
  grid-template-columns: 2.8rem minmax(0, 1fr) auto 2.1rem; align-items: start;
}
.course-module-card > summary > .course-unit-actions { margin: 0; border: 0; padding: 0; align-self: start; }
.content-workspace [data-workspace-current="learn"] .course-module-card > summary:has(> .course-unit-actions) { grid-template-columns: 2.8rem minmax(0, 1fr) 2.1rem; }
.course-module-card:has(.course-unit-menu[open]) { position: relative; z-index: 150; overflow: visible; }
/* Card menus may cover sibling cards, but never the page navigation or toolbars. */
.course-module-list { isolation: isolate; }
.course-unit-menu-panel a, .course-unit-menu-panel button { font-family: inherit; font-weight: 500; line-height: 1.45; }
[data-preview-prompt], [data-mc-preview-prompt], [data-text-preview-prompt], [data-structured-preview-prompt] { min-width: 0; overflow-wrap: anywhere; }
.exercise-editor .rich-content, .exercise-editor-layout .rich-content { min-width: 0; }
.exercise-live-prompt { font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-weight: 400; line-height: 1.65; }
.exercise-live-prompt .rich-content-text h2 { font-size: 1.45rem; }
.exercise-live-prompt .rich-content-text h3 { font-size: 1.25rem; }
.exercise-live-prompt .rich-content-text h4 { font-size: 1.1rem; }
[data-preview-prompt] .rich-content, [data-mc-preview-prompt] .rich-content, [data-text-preview-prompt] .rich-content, [data-structured-preview-prompt] .rich-content { font-size: .9rem; }
[data-preview-prompt] img, [data-mc-preview-prompt] img, [data-text-preview-prompt] img, [data-structured-preview-prompt] img { max-width: 100%; height: auto; }
@media (max-width: 640px) {
  .content-workspace .course-module-card > summary:has(> .course-unit-actions) { grid-template-columns: 1.8rem minmax(0, 1fr) auto; gap: .6rem; }
  .course-module-card > summary:has(> .course-unit-actions) > .course-module-toggle { display: none; }
}
/* Module controls share the same alignment and type as learning-step controls. */
.content-workspace .course-module-card > summary:has(> .course-module-header-actions) { grid-template-columns:2.8rem minmax(0,1fr) auto 2.1rem; align-items:start; }
.course-module-header-actions { display:flex; align-items:center; gap:.5rem; }
.course-module-header-actions > .course-unit-actions { padding:0; margin:0; border:0; }
.course-unit-menu .course-unit-menu-panel :is(a,button) { display:grid; grid-template-columns:22px minmax(0,1fr); gap:8px; align-items:center; min-height:40px; padding:8px 10px; font:500 .85rem/1.45 Inter,ui-sans-serif,system-ui,sans-serif; text-decoration:none; }
.course-module-editor-dialog { width:min(620px,calc(100vw - 32px)); }
.course-module-editor-dialog .course-dialog-body { display:grid; grid-template-columns:minmax(0,1fr); gap:20px; }
.course-module-editor-dialog .course-dialog-field { display:grid; gap:8px; min-width:0; }
.course-linked-editor-settings { margin:24px 0 0; width:100%; max-width:100%; min-width:0; }
.course-linked-editor-settings .check-card { display:flex; align-items:flex-start; gap:12px; padding:18px 20px; width:100%; box-sizing:border-box; }
.course-linked-editor-settings .check-card > span { min-width:0; }
.course-linked-editor-settings .check-card input { flex:0 0 auto; margin-top:5px; }
/* Let the active block's toolbar stick to the viewport throughout a long text. */
.rich-editor-block.is-text { overflow:visible; }
/* Stay below both block insertion menus (layers 16 and 20). */
.rich-editor-block.is-text .rich-text-toolbar { display:flex; position:sticky; top:var(--rich-toolbar-top,5.5rem); z-index:8; width:100%; box-sizing:border-box; margin:0; animation:none; background:#fff; }
.rich-editor-block.is-text .rich-text-surface { scroll-margin-top:calc(var(--rich-toolbar-top,5.5rem) + 8rem); }
.answer-preview-matching-wrap { container-type:inline-size; container-name:matching-preview; }
@media (min-width:1100px) {
 [data-structured-editor="matching"] .structured-editor-layout { grid-template-columns:minmax(0,1fr) minmax(410px,.8fr); }
}
.answer-preview-matching.matching-attempt-board { grid-template-columns:minmax(0,1fr) 12px minmax(0,1fr); gap:8px 5px; margin:0; }
.answer-preview-matching > .matching-board-column { display:grid; grid-template-rows:subgrid; align-content:stretch; padding:10px 7px; min-width:0; border-radius:10px; }
.answer-preview-matching .matching-board-title { margin:0 0 3px; gap:5px; font-family:inherit; font-size:.8rem; line-height:1.4; }
.answer-preview-matching .matching-board-title > span { flex-shrink:0; width:23px; height:23px; border-radius:6px; font-size:.8rem; }
.answer-preview-matching .matching-board-title strong { overflow-wrap:anywhere; }
.answer-preview-matching :is(.matching-target,.matching-option) { min-width:0; min-height:76px; padding:9px 7px; gap:5px; border-radius:7px; font-size:.82rem; line-height:1.5; cursor:default; }
.answer-preview-matching .matching-target { grid-template-columns:auto minmax(0,1fr); }
.answer-preview-matching :is(.matching-target,.matching-option) strong { overflow-wrap:anywhere; white-space:pre-wrap; }
.answer-preview-matching .matching-target-number { width:22px; height:22px; font-size:.75rem; align-self:start; }
.answer-preview-matching .matching-option { align-content:center; }
.answer-preview-matching :is(.answer-preview-match-state,.matching-option small) { color:var(--muted); font-size:.65rem; line-height:1.45; }
.answer-preview-matching .visual-drag-handle { font-size:.65rem; width:auto; }
.answer-preview-matching .matching-board-flow { font-size:1rem; transform:none; }
.answer-preview-matching .is-placeholder { border-style:dashed; }
@container matching-preview (max-width:360px) {
 .answer-preview-matching.matching-attempt-board { grid-template-columns:minmax(0,1fr); }
 .answer-preview-matching > .matching-board-column { grid-row:auto !important; grid-template-rows:none; gap:8px; }
 .answer-preview-matching > .matching-board-flow { grid-row:auto !important; transform:rotate(90deg); }
}
.answer-preview-item { padding:12px; background:#f0f5ed; border:1px solid var(--line); border-radius:8px; font-size:.85rem; overflow-wrap:anywhere; white-space:pre-wrap; }
.answer-preview-order.ordering-attempt { margin:0; min-width:0; }
.answer-preview-order .ordering-attempt-head { display:grid; gap:5px; padding:12px; }
.answer-preview-order .ordering-attempt-head strong { font-size:.85rem; line-height:1.45; }
.answer-preview-order .ordering-attempt-head > span { font-size:.7rem; }
.answer-preview-order-items { display:grid; gap:8px; padding:10px; margin:0; list-style:none; background:#f8faf9; }
.answer-preview-order .ordering-attempt-card { grid-template-columns:10px 18px minmax(0,1fr) auto; gap:7px; min-width:0; margin:0; padding:10px 8px; cursor:default; }
.answer-preview-order .ordering-attempt-card > strong { font-size:.82rem; line-height:1.5; overflow-wrap:anywhere; white-space:pre-wrap; }
.answer-preview-order .visual-drag-handle { width:auto; font-size:.65rem; cursor:default; }
.answer-preview-order .order-position { font-size:.75rem; }
.answer-preview-order-arrows { display:flex; gap:4px; }
.answer-preview-order-arrows > span { display:grid; place-items:center; width:24px; height:24px; border-radius:6px; background:#ecf4f0; color:var(--green-dark); font-size:.8rem; }
.answer-preview-note { display:block; margin-top:12px; color:var(--muted); font-weight:400; line-height:1.6; }
.answer-preview-cloze { white-space:pre-wrap; font-size:.95rem; line-height:2.6; overflow-wrap:anywhere; }
.answer-preview-cloze .answer-preview-blank { display:inline-block; width:7.5em; max-width:100%; padding:.35em .5em; margin:0 .2em; border:1px solid #a8c0b0; border-bottom:2px solid var(--green); border-radius:5px; background:#fff; font:inherit; line-height:1.4; }
.answer-preview-table-scroll { overflow:auto; max-width:100%; border:1px solid var(--line); border-radius:8px; }
.answer-preview-table { width:100%; margin:0; font-size:.82rem; }
.answer-preview-table :is(th,td) { padding:10px 12px; min-width:5rem; overflow-wrap:anywhere; }
@media(max-width:640px) {
 .content-workspace .course-module-card > summary:has(> .course-module-header-actions) { grid-template-columns:2rem minmax(0,1fr) auto; gap:10px; }
 .course-module-header-actions { grid-column:2/-1; justify-content:flex-end; }
 .course-module-card > summary:has(> .course-module-header-actions) > .course-module-toggle { grid-column:3; grid-row:1; }
 .rich-editor-block.is-text .rich-text-toolbar { gap:2px; padding:5px; }
 .rich-text-toolbar .rich-toolbar-divider { display:none; }
}

.text-evaluation-options .is-disabled{opacity:.58;cursor:not-allowed}.ai-disabled-import{filter:grayscale(.65);pointer-events:none}

/* Continue long lessons at their end, using the same block choices as at the top. */
.rich-editor-end-controls { padding: 0 1.2rem 1.2rem; }
.rich-editor-end-controls:has([hidden]) { display: none; }
.rich-editor-end-controls .rich-block-picker { width: 100%; }
.rich-block-picker-end > summary { border-style: dashed; background: var(--surface); }
.rich-block-picker-end .rich-block-picker-menu { top: auto; bottom: calc(100% + .45rem); }
:is(.field, .course-dialog-field) .subject-suggestion { display: block; padding: .55rem .7rem; border-left: 2px solid var(--green); border-radius: .2rem; background: #edf6f1; color: var(--green-dark); font-size: .78rem; line-height: 1.5; }
:is(.field, .course-dialog-field) .subject-suggestion[hidden] { display: none; }
@media (max-width: 700px) {
  .rich-editor-end-controls { padding: 0 .75rem .75rem; }
  .rich-block-picker-end .rich-block-picker-menu { position: absolute; width: 100%; max-height: 60vh; overflow-y: auto; margin-top: 0; }
}

.matrix-mode-choice { display:flex; align-items:flex-start; gap:.75rem; padding:1rem; border:1px solid var(--line); border-radius:.75rem; margin-bottom:1rem; }
.matrix-mode-choice > span { display:grid; gap:.3rem; }
.matrix-mode-choice small, .matrix-editor-help, .matrix-answer-help { color:var(--muted); font-size:.85rem; }
.matrix-cell-choice { position:relative; display:grid; place-items:center; min-height:3rem; min-width:3rem; margin:0; cursor:pointer; }
.matrix-cell-choice input[type="checkbox"] { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.matrix-cell-choice span { display:grid; place-items:center; width:2rem; height:2rem; border:1px solid var(--line-strong); border-radius:.4rem; color:transparent; background:var(--surface); pointer-events:none; }
.matrix-cell-choice:has(input:checked) { background:#e5f2ea; border-radius:.45rem; }
.matrix-cell-choice input:checked + span { color:#fff; background:var(--green); border-color:var(--green); }
.matrix-cell-choice input:focus-visible + span { outline:2px solid var(--green); outline-offset:3px; }
.matrix-preview-choice { text-align:center; color:var(--green); font-weight:700; }
.course-plan-end-actions { grid-column:2; padding-top:1.25rem; }
.course-plan-end-actions .button { width:100%; padding:1.1rem; border-style:dashed; }
@media(max-width:900px) { .course-plan-end-actions { grid-column:1 / -1; } }

.answer-preview-matrix { width:max-content; min-width:100%; }
.answer-preview-matrix :is(th,td) { min-width:8.5rem; max-width:14rem; overflow-wrap:break-word; }

/* The active import provider is context in the page heading, not a warning. */
.import-hero-meta { display:flex; align-items:center; flex-wrap:wrap; gap:.75rem 1.25rem; margin-bottom:.7rem; }
.import-ai-indicator { display:inline-flex; align-items:center; flex-wrap:wrap; gap:.35rem .55rem; max-width:100%; padding:.4rem .75rem .4rem .45rem; border:1px solid #c9ddd2; border-radius:.65rem; background:#edf5f0; color:var(--green-dark); font-size:.8rem; line-height:1.45; }
.import-ai-icon { display:grid; place-items:center; flex:0 0 1.6rem; height:1.6rem; border-radius:.4rem; background:#dcece2; color:var(--green); }
.import-ai-label { color:var(--muted); white-space:nowrap; }
.import-ai-indicator strong { min-width:0; overflow-wrap:anywhere; font-weight:700; }

/* Matrix feedback preserves the task's coordinates; symbols and text explain
   status without relying on color, while wide tables scroll inside the panel. */
/* Keep the result in its original grid; correctness also has text and symbols. */
.matrix-result-page .exercise-reader-container { max-width:1120px; }
.matrix-result-page .exercise-reader-container > :is(.result-section,.result-actions) { width:100%; }
.matrix-result-hero { display:flex; align-items:center; justify-content:space-between; gap:28px; padding:30px 0 34px; }
.matrix-result-hero h1 { margin:8px 0 10px; font-size:clamp(2.3rem,4vw,3.5rem); line-height:1.08; }
.matrix-result-hero p { margin:0; color:var(--muted); }
.matrix-result-score { flex-shrink:0; display:grid; gap:2px; padding:8px 0 8px 28px; border-left:1px solid var(--line); color:var(--green-dark); }
.matrix-result-score strong { font:700 2.8rem/1.1 Georgia,serif; }
.matrix-result-score strong span { font-size:1.3rem; }
.matrix-result-score > span { color:var(--muted); font-size:.8rem; }
.matrix-result .matrix-result-heading { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:12px; }
.matrix-result .matrix-result-heading h2 { margin:6px 0 0; font-size:clamp(1.5rem,2.3vw,2rem); }
.matrix-result-count { flex-shrink:0; border:1px solid #c7d9ce; background:#eff6f1; color:#18563f; border-radius:99px; padding:8px 13px; font-size:.8rem; font-weight:650; }
.matrix-result .matrix-result-intro { margin:0; color:var(--muted); font-size:.9rem; max-width:70ch; }
.matrix-result-legend { display:flex; flex-wrap:wrap; gap:12px 22px; padding:20px 0; font-size:.78rem; color:#52645b; }
.matrix-result-legend > span { display:flex; align-items:center; gap:7px; }
.matrix-key { display:grid; place-items:center; width:23px; height:23px; border-radius:50%; font-style:normal; font-weight:750; }
.matrix-key.correct { background:#e1f1e8; color:#165c41; }
.matrix-key.correction { background:#fff0d9; color:#80530a; }
.matrix-key.empty { background:#f1f4f1; color:#66766c; }
.matrix-result-scroll { overflow:auto; border:1px solid #d4dfd6; border-radius:12px; }
.matrix-result .matrix-result-scroll-hint { display:none; }
.matrix-result-scroll:focus-visible { outline:3px solid var(--green); outline-offset:3px; }
.matrix-result .matrix-result-table { width:100%; min-width:720px; margin:0; border-collapse:separate; border-spacing:0; }
.matrix-result .matrix-result-table th, .matrix-result .matrix-result-table td { padding:10px; border:0; border-bottom:1px solid #e0e7e1; vertical-align:middle; white-space:normal; overflow-wrap:anywhere; }
.matrix-result .matrix-result-table thead th { background:#edf3e9; color:#284b38; font-size:.78rem; font-weight:700; text-transform:none; letter-spacing:0; min-width:160px; padding:16px 18px; text-align:left; }
.matrix-result .matrix-result-table tr > th:first-child { min-width:195px; width:27%; }
.matrix-result .matrix-result-table tbody th { background:#f7f9f5; color:#253d31; font-size:.85rem; font-weight:650; text-transform:none; letter-spacing:0; line-height:1.5; padding:14px 18px; }
.matrix-result .matrix-result-table tbody td { background:#fff; }
.matrix-result .matrix-result-table tbody tr:last-child > * { border-bottom:0; }
.matrix-result-cell { display:flex; gap:9px; align-items:center; min-height:60px; padding:10px; border-radius:8px; border:1px solid transparent; }
.matrix-result-cell.is-correct { background:#edf7f0; border-color:#c5dfce; color:#175639; }
.matrix-result-cell.needs-correction { background:#fff7e9; border-color:#e9cf9c; color:#755014; }
.matrix-result-cell.is-empty { color:#77857b; }
.matrix-cell-symbol { display:grid; place-items:center; flex-shrink:0; width:23px; height:23px; font-weight:800; font-size:14px; }
.matrix-cell-feedback { min-width:0; font-size:.79rem; line-height:1.45; }
.matrix-cell-feedback strong { display:block; font-weight:650; }
.matrix-result-cell.is-empty .matrix-cell-feedback strong { font-weight:400; font-size:.73rem; }
.matrix-cell-solution { display:block; margin-top:3px; font-size:.75rem; color:#755014; }
.matrix-cell-solution b { font-weight:700; }
.matrix-no-cell { display:block; text-align:center; color:#89938b; }
@media(max-width:700px) {
 .matrix-result-hero { gap:16px; align-items:flex-start; padding-block:22px; }
 .matrix-result-hero h1 { font-size:2.1rem; }
 .matrix-result-score { padding-left:14px; }
 .matrix-result-score strong { font-size:2rem; }
 .matrix-result-score > span { font-size:.68rem; }
 .matrix-result .matrix-result-heading { align-items:flex-start; flex-direction:column; gap:12px; }
 .matrix-result-scroll { margin-inline:-4px; }
 .matrix-result .matrix-result-scroll-hint { display:block; font-size:.75rem; color:var(--muted); margin:0 0 12px; }
 .matrix-result-legend { gap:10px 14px; }
}
.rich-content .rich-content-text :is(p, ul, ol),
.rich-editor .rich-text-surface p { max-width:none; }

/* The grid scrolls within a bounded workspace, keeping controls close to cells. */
.rich-table-workspace { min-width:0; }
.rich-table-viewbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:0 0 12px; }
.rich-table-viewbar > span { color:var(--muted); font-size:.8rem; }
.rich-table-cell-editor { display:grid; gap:6px; padding:10px 12px; border:1px solid #b9c9c0; border-top:0; background:#f4f8f5; }
.rich-table-cell-editor > span { font-size:.75rem; color:var(--muted); }
.rich-table-cell-editor textarea { width:100%; min-height:62px; max-height:130px; padding:10px 12px; resize:vertical; border:1px solid #c5d6cb; border-radius:8px; background:#fff; font:inherit; font-weight:400; line-height:1.5; }
.rich-table-workspace .rich-table-editor-grid { max-height:420px; overflow:auto; scrollbar-gutter:stable; margin-top:0; }
.rich-table-workspace .rich-table-sheet { margin:0; }
.rich-table-workspace .rich-table-sheet thead th { z-index:3; }
.rich-table-workspace .rich-table-sheet tbody th { z-index:2; }
.rich-table-workspace .rich-table-sheet .rich-table-corner { left:0; z-index:4; }
.rich-table-workspace .rich-table-sheet textarea { min-height:68px; padding:10px 12px; }
.rich-table-dialog { width:calc(100vw - 48px); max-width:1500px; max-height:calc(100dvh - 48px); padding:22px; border:1px solid #b9c9c0; border-radius:16px; background:var(--surface, #fff); color:var(--ink); box-shadow:0 24px 100px #102c3440; }
.rich-table-dialog::backdrop { background:#102c34a6; }
.rich-table-dialog[open] { display:flex; flex-direction:column; height:calc(100dvh - 48px); overflow:hidden; }
.rich-table-dialog > .rich-table-workspace { display:flex; flex-direction:column; flex:1; min-height:0; }
.rich-table-dialog :is(.rich-table-toolbar,.rich-table-cell-editor,.rich-table-footer) { flex-shrink:0; }
.rich-table-dialog > header { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-bottom:18px; }
.rich-table-dialog > header strong { font-size:1.3rem; }
.rich-table-dialog > header button { flex-shrink:0; white-space:nowrap; }
.rich-table-dialog > header small { display:block; color:var(--muted); margin-top:4px; }
.rich-table-dialog .rich-table-viewbar { display:none; }
.rich-table-dialog .rich-table-editor-grid { flex:1; max-height:none; min-height:80px; }
@media(max-width:700px) {
 .rich-table-viewbar { align-items:flex-start; flex-direction:column; }
 .rich-table-dialog { width:calc(100vw - 16px); max-height:calc(100dvh - 16px); padding:12px; }
 .rich-table-dialog .rich-table-toolbar { grid-template-columns:minmax(0,1fr) auto; }
 .rich-table-dialog .rich-table-selection { grid-column:1/-1; border:0; }
 .rich-table-dialog .rich-table-properties { gap:6px; }
 .rich-table-dialog > header { gap:10px; margin-bottom:12px; }
 .rich-table-dialog > header small { font-size:.7rem; }
 .rich-table-footer { flex-wrap:wrap; }
}
/* Content typography must not inherit the smaller form-section headings. */
.rich-editor .rich-text-surface :is(h2,h3,h4),
.rich-content .rich-content-text :is(h2,h3,h4) {
  font-family:inherit; font-weight:700; letter-spacing:normal; text-transform:none;
  line-height:1.3; margin:.9em 0 .4em;
}
.next-ui .rich-editor .rich-text-surface h2, .rich-editor .rich-text-surface h2,
.rich-content .rich-content-text h2 { font-size:1.8rem; }
.next-ui .rich-editor .rich-text-surface h3, .rich-editor .rich-text-surface h3,
.rich-content .rich-content-text h3 { font-size:1.4rem; }
.next-ui .rich-editor .rich-text-surface h4, .rich-editor .rich-text-surface h4,
.rich-content .rich-content-text h4 { font-size:1.15rem; }
/* Fixed rem sizes avoid multiplying nested size spans after repeated editing. */
:is(.rich-text-surface,.rich-content) :is(.text-size-1,font[size="1"]) { font-size:.75rem; }
:is(.rich-text-surface,.rich-content) :is(.text-size-2,font[size="2"]) { font-size:.875rem; }
:is(.rich-text-surface,.rich-content) :is(.text-size-3,font[size="3"]) { font-size:1rem; }
:is(.rich-text-surface,.rich-content) :is(.text-size-4,font[size="4"]) { font-size:1.25rem; }
:is(.rich-text-surface,.rich-content) :is(.text-size-5,font[size="5"]) { font-size:1.5rem; }
:is(.rich-text-surface,.rich-content) :is(.text-size-6,font[size="6"]) { font-size:2rem; }
:is(.rich-text-surface,.rich-content) :is(.text-size-7,font[size="7"]) { font-size:2.5rem; }
.rich-text-toolbar .rich-toolbar-size select { min-width:100px; width:110px; }

/* Exam cards: one reading direction, then a shared control bar for every task type. */
.next-ui .exam-task-builder { overflow:visible; }
.next-ui .exam-task-card { grid-template-columns:minmax(0,1fr); gap:12px; padding:16px; }
.next-ui .exam-task-card.is-selected { background:#fff; border-color:#bed4c7; box-shadow:none; }
.next-ui .exam-task-choice { padding:0; border:0; background:transparent; border-radius:0; }
.next-ui .exam-task-choice:has(input:checked) { background:transparent; }
.next-ui .exam-task-choice strong { font-size:.88rem; white-space:normal; overflow-wrap:anywhere; line-height:1.45; }
.next-ui .exam-task-choice small { font-size:.62rem; }
.next-ui .exam-task-choice em { font-size:.7rem; }
.next-ui .exam-task-card.is-selected .exam-task-facts { padding:0; gap:8px; }
.next-ui .exam-text-task-note { margin:0; padding:12px 14px; border-left:3px solid #a8cdbb; }
.next-ui .exam-text-task-note strong { font-size:.74rem; }
.next-ui .exam-text-task-note span, .next-ui .exam-text-task-note a { font-size:.72rem; line-height:1.5; }
.next-ui .exam-task-settings { margin:0; padding:12px 0 0; border-top:1px solid var(--line); background:transparent; border-radius:0; gap:12px; }
.next-ui .exam-task-card.is-selected .exam-task-settings { display:flex; flex-wrap:wrap; align-items:center; }
.exam-task-points { display:flex; gap:10px; align-items:center; margin-right:auto; }
.exam-task-points .field-label-row { margin:0; gap:6px; font-size:.72rem; }
.exam-task-points .input { width:88px; }
.exam-task-order-actions { align-items:center; gap:4px; }
.exam-task-position { min-width:38px; margin-right:4px; color:var(--muted); font-size:.7rem; text-align:center; font-variant-numeric:tabular-nums; }
.next-ui .exam-task-order-actions button { width:36px; min-height:36px; padding:0; font-size:.9rem; }
.next-ui .exam-task-order-actions button:disabled { opacity:.35; cursor:default; background:var(--surface-soft); outline:0; }
.next-ui .exam-task-remove { display:inline-flex; align-items:center; gap:6px; width:auto; min-height:36px; padding:6px 9px; border-color:transparent; font-size:.72rem; font-weight:600; }
.exam-task-remove > span { font-size:1.1rem; line-height:1; }
.exam-task-edit { flex-basis:100%; font-size:.72rem; }
/* Form controls and instructional copy use the UI face; only page/preview titles are serif. */
.exam-editor-page :is(input,select,textarea,button,label,summary,.exam-task-choice,.exam-text-task-note,.preview-context) { font-family:inherit; }
.exam-editor-page .exercise-skeleton :is(h2,h3) { font-family:inherit; }
.next-ui .exam-task-selection > header h3,
.next-ui .exam-task-library-heading h3 { margin:0 0 5px; font-size:1.05rem; line-height:1.35; }
.next-ui .exam-task-library-heading { padding:16px; border-left:3px solid var(--green); background:#edf5f0; border-radius:0 8px 8px 0; }
.exam-timing-fields { align-items:start; }
.exam-timing-fields > .field { grid-template-rows:26px 48px auto; gap:7px; }
.exam-timing-fields .field-label-row { min-height:26px; margin:0; }
.exam-timing-fields .input, .exam-timing-fields .exam-attempts-input { height:48px; min-height:48px; margin:0; }
.exam-text-assessment { margin:0; padding:12px 14px; border:1px solid var(--line); border-radius:8px; background:#f7faf8; }
.exam-text-assessment > summary { display:flex; flex-wrap:wrap; gap:6px 16px; justify-content:space-between; cursor:pointer; font-size:.78rem; font-weight:650; }
.exam-text-assessment > summary::after { content:'+'; margin-left:auto; }
.exam-text-assessment[open] > summary::after { content:'−'; }
.exam-text-assessment > summary > span { color:var(--muted); font-size:.7rem; font-weight:400; }
.exam-text-assessment-body { padding-top:14px; }
.exam-text-assessment-body > p { font-size:.74rem; color:var(--muted); margin:0 0 14px; }
.exam-text-assessment textarea { font-size:.82rem; line-height:1.55; resize:vertical; }
.exam-text-assessment .field > label { font-size:.75rem; }
.exam-text-task-note[hidden], [data-exam-text-fields][hidden], .is-library-list .exam-text-assessment { display:none; }
.next-ui .exam-task-selection, .next-ui .exam-task-library { padding:0; border:0; border-radius:0; background:transparent; }
.next-ui .exam-task-library { margin-top:28px; padding-top:24px; border-top:2px solid var(--line); }
.next-ui .exam-task-list { gap:0; }
.next-ui .exam-task-card, .next-ui .exam-task-card.is-selected { border:0; border-bottom:1px solid var(--line); border-radius:0; padding:18px 0; background:transparent; box-shadow:none; }
.next-ui .exam-task-settings { border-top:0; padding-top:0; }
.exam-selection-totals { display:grid; gap:3px; text-align:right; flex-shrink:0; }
.exam-selection-totals > strong { font-size:.8rem; color:var(--green-dark); }
.exam-selection-totals > small { max-width:210px; font-size:.68rem; color:var(--muted); }
.exam-task-summary { display:grid; gap:7px; padding-left:41px; }
.exam-task-summary > p { margin:0; color:var(--muted); font-size:.75rem; line-height:1.5; }
.exam-task-identity { display:flex; align-items:center; gap:12px; justify-content:space-between; }
.exam-task-identity > span { min-width:0; overflow-wrap:anywhere; font-size:.65rem; color:var(--muted); }
.exam-task-identity > a { flex-shrink:0; font-size:.73rem; font-weight:700; padding:6px 0; }
.exam-attempts-input { position:relative; }
.exam-attempts-input .input { width:100%; }
.exam-attempts-input > span { display:none; pointer-events:none; position:absolute; inset:0; align-items:center; padding:0 15px; }
.exam-attempts-input.is-unlimited:not(:focus-within) > span { display:flex; }
.exam-attempts-input.is-unlimited:not(:focus-within) > input { color:transparent; }
.next-ui .exam-live-preview .preview-sheet { background:#fff; padding:22px; }
@media (min-width:1081px) {
 .next-ui .exam-live-preview { position:sticky; top:90px; display:flex; flex-direction:column; max-height:calc(100dvh - 205px); }
 .exam-live-preview .preview-toolbar { flex-shrink:0; }
 .next-ui .exam-live-preview .preview-sheet { overflow:auto; min-height:0; }
}
.next-ui .exam-live-preview .preview-sheet h2 { font-size:1.4rem; line-height:1.25; margin:14px 0; overflow-wrap:anywhere; }
.exam-live-preview .preview-meta { flex-wrap:wrap; gap:8px; }
.exam-live-preview .preview-meta > span:last-child { font-size:.64rem; color:var(--muted); }
.exam-preview-description { margin-bottom:18px; }
.exam-preview-description summary { cursor:pointer; color:var(--green-dark); font-size:.75rem; }
.exam-preview-description p { font-size:.78rem; line-height:1.6; white-space:pre-line; }
.exam-preview-point-total { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px; padding:14px 0; border-block:1px solid var(--line); }
.exam-preview-point-total > strong { font-size:2rem; line-height:1.15; color:var(--green-dark); font-variant-numeric:tabular-nums; }
.exam-preview-point-total > span { font-size:.72rem; color:var(--muted); }
.exam-live-preview .preview-context { margin:16px 0; gap:14px; }
.exam-live-preview .preview-context > div { padding:0; border:0; background:transparent; }
.exam-live-preview .preview-context dt { font-size:.6rem; }
.exam-live-preview .preview-context dd { margin:3px 0 0; font-family:inherit; font-size:.78rem; }
.exam-preview-outline { border-top:1px solid var(--line); padding-top:14px; }
.exam-preview-outline h3 { margin:0; font-family:inherit; font-size:.85rem; font-weight:700; line-height:1.4; }
.exam-preview-outline > p { margin:4px 0 10px; font-size:.68rem; line-height:1.5; color:var(--muted); text-transform:none; }
.exam-preview-outline ol { margin:0 0 12px; padding:0; list-style:none; max-height:240px; overflow:auto; counter-reset:exam-preview-task; }
.exam-preview-outline li { display:grid; grid-template-columns:18px minmax(0,1fr) auto; align-items:baseline; gap:7px; padding:9px 0; border-bottom:1px solid var(--line); font-size:.72rem; line-height:1.4; }
.exam-preview-outline li::before { counter-increment:exam-preview-task; content:counter(exam-preview-task); color:var(--muted); }
.exam-preview-outline li > strong { font-size:.65rem; white-space:nowrap; }
.exam-live-preview .exam-preview-release { font-size:.7rem; color:var(--muted); line-height:1.5; }
.exam-preview-start { padding:12px; text-align:center; border-radius:8px; color:#fff; background:var(--green-dark); font-size:.8rem; font-weight:700; }
.exam-preview-caption { display:block; text-align:center; margin-top:8px; font-size:.62rem; color:var(--muted); }
[data-exam-task-dialog] { width:min(1180px,calc(100vw - 32px)); }
[data-exam-task-dialog] header small { color:var(--muted); font-size:.72rem; }
@media (max-width:600px) {
 .exam-task-summary { padding-left:0; }
 .exam-selection-totals { text-align:left; }
 .exam-task-identity { flex-wrap:wrap; gap:4px; }
}
/* Start the points help at its trigger instead of centering it outside the panel. */
@media (min-width:761px) {
 .exam-task-points .tooltip-trigger::after { left:0; transform:translateY(4px); }
 .exam-task-points .tooltip-trigger:hover::after,
 .exam-task-points .tooltip-trigger:focus-visible::after { transform:translateY(0); }
}
@media (max-width:600px) {
 .next-ui .exam-task-card { padding:12px; }
 .next-ui .exam-task-settings { gap:8px; }
 .exam-task-points { flex-basis:100%; }
 .next-ui .exam-task-remove { margin-left:auto; }
 .next-ui .exam-task-order-actions button { width:40px; min-height:40px; }
}
