/* A spacious white workspace, with strong type and quiet, consistent controls. */
:root {
  color: #17191c;
  background: #fff;
  font-size: 16px;
  --green: #176b57;
  --line: #e5e7eb;
  --muted: #626870;
}
body { background: #fff; }
button { font-weight: 600; }
button:focus-visible, a:focus-visible { outline-color: var(--green); }
::selection { background: #d1eee3; color: #111; }
.app-header { height: 84px; padding: 0 40px; gap: 28px; }
.brand { color: #111; font-size: 28px; font-weight: 800; }
.brand-dot { color: var(--green); }
.back-button, .header-section { color: #555b63; font-size: 14px; }
.back-button .icon { width: 18px; height: 18px; }
.save-status { color: #626870; font-size: 12px; }
.save-status > .icon { color: var(--green); }
.button { min-height: 44px; padding: 10px 17px; font-size: 14px; font-weight: 650; border-radius: 9px; }
.button > .icon { width: 18px; height: 18px; }
.button.primary { box-shadow: none; }
.button.primary:hover { background: #115440; }
.button.secondary { color: #24272c; border-color: #dce0e4; background: #fff; }
.button.secondary:hover { background: #f5f6f7; border-color: #bdc4cb; }
.button.quiet { color: #4b525a; font-size: 13px; }
.button.quiet:hover { color: #111; }
.icon-button { color: #606873; width: 34px; height: 34px; }
.icon-button > .icon { width: 17px; height: 17px; }
.icon-button:not(:disabled):hover { color: #111; background: #f0f2f4; }

.editor-main, .editor-main.mode-json { max-width: 1440px; margin: 28px auto 40px; padding: 0 48px; }
.editor-main.mode-split { max-width: 1840px; padding: 0 40px; }
.editor-view-toolbar { margin-bottom: 24px; }
.view-switch { border: 1px solid #e7e9ec; background: #f4f5f6; border-radius: 10px; padding: 4px; gap: 3px; }
.view-switch > button { min-height: 36px; padding: 7px 18px; border-radius: 7px; font-size: 14px; color: #636970; font-weight: 600; }
.view-switch > button.active { color: #17191c; box-shadow: 0 1px 4px #11111112; }
.json-file-actions { gap: 23px; }
.json-file-actions > .button { font-size: 13px; min-height: 38px; }
.json-file-actions > .button .icon { width: 17px; height: 17px; }
.workspace-caption { margin-bottom: 16px; color: #626870; }
.workspace-caption > span:first-child { font-size: 12px; color: #40464d; font-weight: 700; letter-spacing: 1px; }
.workspace-caption > span:last-child { font-size: 13px; }
.paper { padding: 54px 72px 40px; min-height: calc(100dvh - 290px); border: 1px solid #e1e4e8; border-radius: 16px; box-shadow: 0 5px 24px #16191c04; background: #fff; }
.paper.file-hover { background: #f5fcf9; border-color: var(--green); }
.document-heading { padding: 0 14px 30px; margin-bottom: 16px; border-color: #edf0f2; }
.document-label { color: #626870; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; margin-bottom: 18px; }
.document-heading textarea { color: #111; font-size: 48px; font-weight: 800; letter-spacing: -1.6px; line-height: 1.25; min-height: 60px; }
.document-heading textarea::placeholder { color: #555b63; font-weight: 750; }
.block { border-radius: 10px; padding: 16px 14px; }
.block:hover { border-color: #e4e7eb; }
.block.selected:focus-within { border-color: #b8d8cc; background: #fff; box-shadow: 0 0 0 3px #176b5706; }
.block-input { color: #17191c; font-size: 20px; font-weight: 500; line-height: 1.8; min-height: 40px; }
.block-input::placeholder { color: #737981; }
.heading-input { color: #111; font-size: 30px; font-weight: 750; line-height: 1.4; letter-spacing: -.5px; }
.block-rail { left: -40px; top: 19px; }
.drag-handle { color: #747c86; width: 32px; height: 32px; }
.drag-handle:hover { color: #20252a; background: #f0f2f4; }
.block-tools { top: -37px; border-color: #dfe3e8; border-radius: 8px; box-shadow: 0 3px 12px #17191c08; }
.block-tools .icon-button { width: 32px; height: 30px; }
.block-tools .icon-button > .icon { width: 16px; height: 16px; }
.is-dragging { background: #f5faf8; border-color: #9bc5b4; }
.insert-gap { height: 40px; }
.insert-gap:before { background: #dce6e1; }
.insert-plus { width: 26px; height: 26px; border-color: #d5ded9; color: #69766f; opacity: .55; }
.insert-plus .icon { width: 15px; height: 15px; }
.insert-menu { top: 34px; padding: 8px; border-color: #dfe3e8; border-radius: 11px; gap: 4px; }
.insert-menu .type-button { font-size: 13px; min-height: 40px; padding: 8px 11px; }
.insert-menu .type-button > .icon { width: 18px; height: 18px; }
.last-gap { height: 16px; }
.add-block-footer { margin: 24px 14px 0; padding: 27px 0 4px; border-color: #dce1e5; }
.add-block-footer > span { font-size: 16px; color: #272c32; font-weight: 700; margin-bottom: 16px; }
.block-type-buttons { gap: 10px; }
.type-button { font-size: 15px; min-height: 48px; padding: 10px 17px; gap: 9px; border-radius: 9px; border-color: #dce1e5; color: #292e34; font-weight: 650; }
.type-button > .icon { width: 20px; height: 20px; color: #4e685e; stroke-width: 1.9; }
.type-button:hover { background: #f2f8f5; border-color: #9dc6b5; color: #114f3e; }
.more-block-menu { border-color: #dfe3e8; border-radius: 10px; min-width: 180px; box-shadow: 0 6px 24px #17191c12; }
.add-block-footer > p { font-size: 13px; color: #666d76; margin-top: 24px; }
.add-block-footer > p > .icon { width: 17px; height: 17px; }
.add-block-footer kbd { font: inherit; font-size: 11px; border-color: #dce1e5; background: #f7f8f9; color: #535b64; padding: 0 5px; }
.editor-bottom-note { color: #626870; font-size: 12px; padding: 18px 4px; }
.editor-bottom-note .icon { width: 16px; height: 16px; }

/* Authoring inputs stay white, including exercises and media blocks. */
.question-block, .media-editor { background: #fff; border-color: #dfe3e8; border-radius: 12px; padding: 24px; }
.question-topline { margin-bottom: 21px; gap: 12px; flex-wrap: wrap; }
.question-topline > span, .media-editor-label { color: #5e666f; font-size: 12px; font-weight: 700; letter-spacing: .7px; }
.question-topline > span > .icon { width: 17px; height: 17px; }
.question-topline select { font-size: 14px; font-weight: 600; color: #22272d; padding: 9px 12px; border: 1px solid #dce1e5; border-radius: 7px; min-height: 40px; max-width: 100%; }
.question-topline select:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.question-input { font-size: 21px; font-weight: 700; color: #111; }
.question-input::placeholder { font-size: inherit; font-weight: 600; color: #737981; }
.question-block:has(select option[value=cloze]:checked) .question-input { font-weight: 500; }
.choice-options { margin-top: 20px; }
.choice-option { gap: 12px; margin: 10px 0; }
.choice-option > input[data-option] { color: #20252b; font-size: 17px; font-weight: 500; min-height: 46px; padding: 10px 13px; border-color: #dce1e5; border-radius: 7px; }
.choice-option > input[data-option]::placeholder { color: #737981; font-size: inherit; }
.choice-option > input[data-option]:focus { border-color: var(--green); box-shadow: 0 0 0 2px #176b5712; }
.choice-option > input[type=checkbox], .choice-option > input[type=radio] { width: 20px; height: 20px; flex: 0 0 20px; }
.choice-options > small, .cloze-count, .cloze-author-tools > span { color: #626870; font-size: 13px; }
.choice-options .button.quiet { font-size: 14px; }
.answer-placeholder { color: #6a717a; font-size: 13px; border-color: #dce1e5; min-height: 70px; background: #fafbfc; }
.solution-details { color: #555e68; font-size: 13px; margin-top: 20px; }
.solution-details textarea { font-size: 16px; color: #20252b; padding: 13px; border-color: #dce1e5; }
.solution-details textarea::placeholder { font-size: 14px; color: #737981; }
.cloze-author-tools .button { min-height: 40px; font-size: 13px; padding: 8px 12px; }
.media-editor > input { font-size: 17px; padding: 12px 14px; color: #20252b; border-color: #dce1e5; }
.media-editor > input:focus { border-color: var(--green); }
.media-editor > input::placeholder { color: #737981; }
.media-editor > .media-label-input { font-size: 15px; padding-top: 15px; }
.media-validation { font-size: 13px; color: #626870; }
.image-placeholder { min-height: 220px; border-color: #cbd5cf; background: #fafcfb; color: #263e33; border-radius: 11px; }
.image-placeholder:hover { background: #f2f8f5; }
.image-placeholder > .icon { color: var(--green); width: 36px; height: 36px; }
.image-placeholder > strong { font-size: 18px; font-weight: 700; }
.image-placeholder > span { font-size: 14px; color: #5e666f; }
.image-placeholder > small { font-size: 12px; color: #626870; }
.image-source-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 7px 0; }
.image-source-actions .button { min-height: 42px; }
.image-editor { min-width: 0; }
.image-controls { display: flex; gap: 7px; }
.image-url-editor { width: 100%; margin-top: 14px; padding: 16px; border: 1px solid #dfe3e8; border-radius: 9px; background: #fafbfc; color: #20252b; text-align: left; }
.image-url-editor > label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.image-url-editor > div { display: flex; align-items: stretch; gap: 9px; }
.image-url-editor input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #d5dbe0; border-radius: 7px; background: #fff; color: #20252b; font-size: 15px; }
.image-url-editor input:focus { border-color: var(--green); box-shadow: 0 0 0 2px #176b5712; }
.image-url-error { margin: 9px 0 0; color: #9a4f36; font-size: 13px; }
.caption-input { font-size: 15px; color: #505963; }
.caption-input::placeholder { color: #737981; }
.alt-details { font-size: 12px; color: #626870; }
.alt-details input { font-size: 14px; color: #20252b; border-color: #dce1e5; }
.button.image-replace { color: #24292f; font-size: 13px; min-height: 38px; border-color: #dce1e5; }

.mode-split > .editor-layout { grid-template-columns: minmax(0,1.2fr) minmax(360px,1fr); gap: 24px; }
.mode-split .paper { padding: 42px 42px 32px; min-height: 660px; }
.mode-split .document-heading textarea { font-size: 38px; }
.mode-split .type-button { font-size: 14px; padding: 9px 12px; }
.mode-split .block-type-buttons { gap: 8px; }
.json-pane { top: 108px; border-color: #dfe3e8; border-radius: 12px; }
.json-panel-header { padding: 18px 20px; background: #fafbfc; border-color: #e5e7eb; }
.json-panel-header strong { color: #20252b; font-size: 15px; font-weight: 700; }
.json-panel-header span { font-size: 12px; color: #626870; }
.json-panel-header .button { font-size: 12px; color: #505963; min-height: 34px; }
#json-editor { color: #22272d; background: #fff; font-size: 15px; line-height: 1.8; padding: 24px; height: 560px; max-height: calc(100dvh - 350px); scrollbar-color: #cbd0d6 #fff; }
#json-editor:focus { box-shadow: inset 3px 0 0 #6eaa94; }
.mode-json #json-editor { height: 650px; }
.json-validation { font-size: 12px; color: #25644e; border-color: #e5e7eb; padding: 13px 18px; }
.json-validation.invalid { color: #855b20; background: #fffaee; }
.json-validation.invalid .button { color: #855b20; font-size: 12px; }
.json-panel-footer { background: #fafbfc; color: #626870; font-size: 12px; border-color: #e5e7eb; padding: 13px 18px; }
.json-panel-footer a { color: #3b6153; }
.import-file-label, .import-json-label { font-size: 14px; color: #4d555e; }
.import-file-label input { font-size: 14px; }
.import-file-label input::file-selector-button { font-size: 13px; color: #24292f; background: #f5f6f7; border-color: #dce1e5; }
.import-json-label textarea { color: #22272d; background: #fff; font-size: 14px; border-color: #dce1e5; }
.import-json-label textarea::placeholder { color: #737981; }

/* Preview and one-block presentation use the same high-contrast typography. */
dialog { color: #17191c; border-color: #dfe3e8; border-radius: 14px; }
.dialog-header h2 { font-size: 19px; font-weight: 750; }
.dialog-content > p { color: #555e68; font-size: 15px; }
.preview-dialog { width: 1100px; }
.preview-actions > span { font-size: 13px; color: #626870; }
.preview-actions > .button { font-size: 13px; }
.document-preview { color: #17191c; }
.document-preview h1 { font-size: 40px; font-weight: 800; }
.document-preview h2 { color: #111; font-size: 28px; font-weight: 750; }
.document-text { font-size: 19px; font-weight: 500; }
.student-block figcaption { color: #626870; font-size: 14px; }
.student-question { background: #fff; border-color: #dfe3e8; }
.student-question h3 { color: #111; font-size: 22px; font-weight: 750; }
.activity-instruction { color: #626870; font-size: 14px; }
.student-option { color: #22272d; font-size: 18px; font-weight: 550; border-color: #dce1e5; }
.student-option:has(input:checked) { background: #f0f8f4; border-color: #6aa48c; }
.student-option:focus-within { outline-color: var(--green); }
.student-answer { color: #20252b; font-size: 18px; border-color: #dce1e5; }
.student-answer::placeholder { color: #737981; }
.activity-actions .button { font-size: 14px; }
.activity-actions .button.quiet { font-size: 13px; }
.activity-feedback { font-size: 15px; font-weight: 600; }
.activity-feedback.is-correct { color: #24603e; background: #edf8ef; }
.activity-feedback.try-again { color: #805d19; background: #fff7e5; }
.activity-solution { color: #294d3c; background: #f1f8f3; font-size: 16px; border-color: #6eaa87; }
.activity-solution > strong { color: #4d6859; font-size: 12px; }
.activity-solution > p { font-size: 14px; }
.cloze-exercise { color: #17191c; font-size: 20px; font-weight: 500; }
.cloze-exercise input { color: #111; background: #f2f6f4; border-color: #669a83; font-size: 19px; }
.student-placeholder { color: #626870; background: #fafbfc; border-color: #dce1e5; }
.student-link-card { color: #172c23; background: #fafcfb; border-color: #d7e3dc; }
.student-link-card:hover { background: #f0f7f3; }
.student-link-card strong { font-size: 19px; font-weight: 700; }
.student-link-card small { color: #5c6b62; font-size: 13px; }
.student-link-card > span:last-child { font-size: 13px; }
.link-card-icon { color: #28654d; background: #eaf4ee; }
.student-video h3 { color: #111; font-size: 22px; font-weight: 750; }
.video-shell { background: #f3f6f4; border-color: #dce5df; }
.load-video { background: #f3f7f5; color: #223e30; }
.load-video:hover { background: #eaf3ee; }
.video-play-icon { background: var(--green); }
.load-video strong { font-size: 18px; font-weight: 700; }
.load-video small { color: #576a5f; font-size: 13px; }
.video-external { color: #416452; font-size: 13px; }
.presentation-dialog, .presentation-dialog:fullscreen, .presentation-dialog::backdrop { background: #fff; }
.presentation-dialog { border-radius: 0; }
.presentation-dialog > .dialog-header h2 { font-size: 16px; font-weight: 650; color: #373e46; }
.presentation-meta, .presentation-meta .button { color: #626870; font-size: 13px; }
.presentation-stage > .student-block { color: #111; }
.presentation-stage .student-heading { color: #111; font-weight: 800; font-size: 48px; }
.presentation-stage .document-text { font-size: 30px; font-weight: 550; }
.presentation-stage .student-question { box-shadow: none; }
.presentation-stage .student-question h3 { font-size: 29px; font-weight: 750; }
.presentation-stage .student-option { font-size: 22px; }
.presentation-stage .cloze-exercise { font-size: 28px; }
.presentation-stage .activity-actions .button.quiet { font-size: 14px; }
.presentation-controls { border-color: #e5e7eb; }
.presentation-controls > .button { min-height: 46px; font-size: 15px; }
.presentation-hint { color: #626870; font-size: 12px; }

.library-heading h1 { color: #111; font-weight: 800; font-size: 40px; }
.eyebrow { font-size: 12px; font-weight: 700; color: #626870; }
.library-heading > div > p:last-child, .library-note { font-size: 14px; color: #626870; }
.library-search { border-color: #dce1e5; padding: 12px 15px; }
.library-search input { color: #20252b; font-size: 14px; }
.library-search input::placeholder { color: #737981; }
.material-card { border-color: #e1e4e8; border-radius: 12px; }
.material-description h2 { font-size: 18px; color: #20252b; font-weight: 700; }
.material-description p { color: #626870; font-size: 12px; }
.new-material-card { background: #f8fbf9; border-color: #c5d6cd; color: #214e39; }
.new-material-card > strong { font-size: 16px; font-weight: 700; }
.new-material-card > p { color: #626870; font-size: 13px; }
.toast { font-size: 14px; background: #203b2e; border-color: #446653; }
.toast button { font-size: 13px; }
.error-note { font-size: 14px; color: #925637; }

@media (max-width: 1100px) {
  .app-header { padding: 0 28px; gap: 20px; }
  .save-status { margin-right: 0; }
  .save-status > span { max-width: 100px; line-height: 1.4; }
  .editor-main, .editor-main.mode-json, .editor-main.mode-split { padding: 0 28px; }
  .paper { padding: 46px 54px 36px; }
  .mode-split > .editor-layout { grid-template-columns: minmax(0,1fr) minmax(320px,.9fr); gap: 18px; }
  .mode-split .paper { padding: 34px 24px 28px 36px; }
  .mode-split .document-heading textarea { font-size: 34px; }
  .mode-split .block-rail { left: -32px; }
  .mode-split .block-type-buttons { gap: 7px; }
  .mode-split .type-button { font-size: 13px; padding: 8px 11px; }
}
@media (max-width: 800px) {
  .app-header { height: 76px; padding: 0 20px; gap: 12px; }
  .brand { font-size: 25px; }
  .back-button { padding: 4px 0; border: 0; }
  .back-button > span { display: none; }
  .header-right { gap: 8px; }
  .header-right > .button { font-size: 13px; min-height: 42px; padding: 9px 12px; }
  .editor-main, .editor-main.mode-json, .editor-main.mode-split { padding: 0 22px; margin-top: 25px; }
  .paper, .mode-split .paper { padding: 38px 38px 30px; }
  .document-heading textarea, .mode-split .document-heading textarea { font-size: 38px; min-height: 48px; }
  .mode-split > .editor-layout { grid-template-columns: 1fr; }
  .json-pane { position: static; }
  #json-editor { max-height: none; height: 440px; font-size: 14px; padding: 20px; }
  .mode-split .type-button { font-size: 14px; padding: 9px 12px; }
  .block-rail { left: -33px; }
  .workspace-caption > span:last-child { display: none; }
  .question-block, .media-editor { padding: 20px; }
  .block-input { font-size: 19px; }
  .heading-input { font-size: 28px; }
  .editor-bottom-note { font-size: 12px; }
  .presentation-stage .student-heading { font-size: 38px; }
  .presentation-stage .document-text { font-size: 25px; }
  .presentation-stage .student-question h3 { font-size: 25px; }
  .presentation-stage .student-option { font-size: 20px; }
  .presentation-stage .cloze-exercise { font-size: 24px; }
}
@media (max-width: 580px) {
  .app-header { height: auto; min-height: 76px; padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .brand { font-size: 24px; margin-right: auto; }
  .brand > .icon { width: 26px; height: 26px; }
  .back-button { order: 0; margin-left: 0; }
  .header-right { flex-basis: 100%; justify-content: flex-end; gap: 9px; }
  .app-header .header-right .button { min-height: 42px; font-size: 13px; padding: 9px 12px; gap: 6px; }
  .app-header .header-right .button .icon { width: 16px; height: 16px; }
  .save-status { position: static; font-size: 11px; margin-right: auto; gap: 4px; }
  .save-status > span { max-width: 96px; }
  .save-status > .icon { width: 14px; height: 14px; }
  .editor-main, .editor-main.mode-json, .editor-main.mode-split { margin-top: 20px; padding: 0 12px; }
  .editor-view-toolbar { flex-direction: column; align-items: stretch; padding: 0 4px; gap: 10px; margin-bottom: 20px; }
  .view-switch { align-self: flex-start; }
  .view-switch > button { font-size: 13px; min-height: 34px; padding: 6px 14px; }
  .json-file-actions { gap: 24px; padding: 0 2px; }
  .json-file-actions > .button { font-size: 12px; min-height: 34px; }
  .workspace-caption { padding: 0 5px; margin-bottom: 12px; }
  .workspace-caption > span:first-child { font-size: 10px; }
  .paper, .mode-split .paper { border-radius: 12px; padding: 30px 14px 27px 28px; min-height: 500px; }
  .document-heading { padding: 0 8px 24px; }
  .document-label { font-size: 10px; margin-bottom: 15px; }
  .document-heading textarea, .mode-split .document-heading textarea { font-size: 33px; letter-spacing: -1px; line-height: 1.25; min-height: 44px; }
  .block { padding: 14px 8px; }
  .block-input { font-size: 18px; line-height: 1.75; }
  .heading-input { font-size: 25px; line-height: 1.4; }
  .block-rail, .mode-split .block-rail { left: -27px; top: 17px; opacity: .7; }
  .drag-handle { width: 26px; height: 32px; }
  .block-tools { top: -35px; }
  .block-tools .icon-button, .mode-split .block-tools .icon-button { width: 30px; height: 30px; }
  .insert-gap { height: 38px; }
  .insert-menu { flex-wrap: wrap; min-width: 270px; max-width: calc(100vw - 65px); gap: 2px; padding: 7px; }
  .insert-menu .type-button { font-size: 12px; min-height: 40px; padding: 8px 9px; }
  .last-gap { height: 12px; }
  .add-block-footer { margin: 18px 8px 0; padding-top: 24px; }
  .add-block-footer > span { font-size: 15px; }
  .block-type-buttons { gap: 8px; }
  .type-button, .mode-split .type-button { font-size: 14px; min-height: 45px; padding: 9px 12px; gap: 7px; }
  .type-button > .icon, .mode-split .type-button > .icon { width: 18px; height: 18px; }
  .add-block-footer > p { font-size: 12px; line-height: 1.8; flex-wrap: wrap; gap: 4px; }
  .editor-bottom-note { flex-direction: column; gap: 6px; padding: 16px 5px; font-size: 11px; }
  .editor-bottom-note > span:last-child { max-width: none; text-align: left; }
  .question-block, .media-editor { padding: 17px 13px; }
  .question-topline { gap: 10px; }
  .question-topline > span, .media-editor-label { font-size: 10px; }
  .question-topline select { font-size: 13px; padding: 8px 10px; }
  .question-input { font-size: 19px; }
  .choice-option { gap: 8px; }
  .choice-option > input[data-option] { font-size: 16px; min-height: 44px; padding: 8px 10px; }
  .choice-option > input[type=checkbox], .choice-option > input[type=radio] { width: 18px; height: 18px; flex-basis: 18px; }
  .choice-options > small, .cloze-count, .cloze-author-tools > span, .media-validation { font-size: 12px; }
  .solution-details { font-size: 12px; }
  .media-editor > input, .media-editor > .media-label-input { font-size: 16px; }
  .image-placeholder { min-height: 200px; padding: 18px 12px; }
  .image-placeholder > strong { font-size: 17px; }
  .image-placeholder > span { font-size: 13px; }
  .image-placeholder > small { font-size: 11px; }
  .image-source-actions { gap: 8px; }
  .image-source-actions .button { min-height: 40px; font-size: 12px; padding: 8px 10px; }
  .image-url-editor { padding: 13px 11px; }
  .image-url-editor > div { flex-direction: column; }
  .image-url-editor input { font-size: 16px; }
  .caption-input, .alt-details input { font-size: 16px; }
  .json-panel-header { padding: 16px; flex-wrap: wrap; }
  .json-panel-header strong { font-size: 14px; }
  .json-panel-header span { font-size: 11px; }
  #json-editor { font-size: 13px; padding: 16px; }
  .json-validation, .json-panel-footer { font-size: 11px; padding: 12px 15px; }
  .dialog-header h2 { font-size: 17px; }
  .dialog-content > p { font-size: 14px; }
  .document-preview h1 { font-size: 32px; }
  .document-preview h2 { font-size: 25px; }
  .document-text { font-size: 18px; }
  .student-question { padding: 18px 14px; }
  .student-question h3 { font-size: 20px; }
  .student-option, .student-answer { font-size: 16px; }
  .activity-instruction { font-size: 13px; }
  .activity-actions .button { font-size: 13px; }
  .activity-actions .button.quiet { font-size: 12px; }
  .cloze-exercise { font-size: 18px; }
  .cloze-exercise input { font-size: 17px; }
  .student-link-card strong, .load-video strong { font-size: 17px; }
  .presentation-dialog > .dialog-header h2 { font-size: 14px; }
  .presentation-meta, .presentation-meta .button { font-size: 12px; }
  .presentation-stage .student-heading { font-size: 32px; }
  .presentation-stage .document-text { font-size: 22px; }
  .presentation-stage .student-question h3 { font-size: 22px; }
  .presentation-stage .student-option { font-size: 17px; }
  .presentation-stage .cloze-exercise { font-size: 21px; }
  .presentation-stage .activity-actions .button.quiet { font-size: 12px; }
  .presentation-controls > .button { font-size: 14px; min-height: 44px; }
  .material-grid { grid-template-columns: 1fr; }
  .library-heading h1 { font-size: 34px; }
}
@media print {
  .document-preview h1 { font-size: 27px; }
  .document-preview h2 { font-size: 21px; }
  .document-text { font-size: 14px; }
  .student-question { border: 0; padding: 0; }
  .student-option { border: 0; padding: 7px 0; font-size: 14px; }
  .cloze-exercise input { background: #fff; border-bottom: 1px solid #333; }
  .student-link-card { border: 0; padding: 0; }
}

/* Formula blocks keep LaTeX input and rendered math together. */
.formula-editor { padding: 22px 24px; border: 1px solid #dfe3e8; border-radius: 12px; background: #fff; }
.formula-editor-label { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; color: #5e666f; font-size: 12px; font-weight: 700; letter-spacing: .7px; }
.formula-editor-label .icon { width: 18px; height: 18px; }
.formula-input { min-height: 58px; padding: 11px 13px; border: 1px solid #dce1e5; border-radius: 8px; background: #fafbfc; color: #17191c; font: 17px/1.6 Consolas,"SFMono-Regular",monospace; }
.formula-input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 2px #176b5712; }
.formula-live { min-height: 96px; margin-top: 14px; padding: 20px; display: grid; place-items: center; overflow-x: auto; border: 1px solid #edf0f2; border-radius: 8px; background: #fff; }
.formula-help { margin-top: 10px; color: #626870; font-size: 12px; }
.formula-help code { padding: 2px 5px; border-radius: 4px; background: #f1f3f4; color: #384047; }
.rendered-formula { width: 100%; overflow-x: auto; text-align: center; }
.rendered-formula math { display: block; margin: 0 auto; font-size: 1.55em; }
.formula-empty,.formula-error { margin: 0; text-align: center; font-size: 14px; }
.formula-empty { color: #737981; }
.formula-error { color: #9a4f36; }
.document-formula,.student-formula { margin: 24px 0; padding: 18px; overflow-x: auto; }
.document-preview .student-formula .rendered-formula math { font-size: 2em; }
.presentation-stage .student-formula { width: 100%; margin: auto 0; padding: 30px; }
.presentation-stage .student-formula .rendered-formula math { font-size: 2.5em; }
.preview-print .document-formula { break-inside: avoid; }

@media (max-width: 580px) {
  .formula-editor { padding: 17px 13px; }
  .formula-input { font-size: 15px; }
  .formula-live { min-height: 82px; padding: 15px 9px; }
  .rendered-formula math { font-size: 1.35em; }
  .document-preview .student-formula .rendered-formula math { font-size: 1.55em; }
  .presentation-stage .student-formula { padding: 18px 4px; }
  .presentation-stage .student-formula .rendered-formula math { font-size: 1.75em; }
}

@media print {
  .document-formula { break-inside: avoid; }
  .rendered-formula math { font-size: 1.4em; }
  .formula-error,.formula-empty { display: none; }
}

/* Preview grows one block at a time inside a full-width workspace. */
.preview-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; overflow: hidden; box-shadow: none; }
.preview-dialog[open] { display: flex; flex-direction: column; }
.preview-dialog > .dialog-header { flex-shrink: 0; padding: 18px 32px; }
.preview-dialog > .dialog-content { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.preview-dialog .preview-actions { flex-shrink: 0; padding: 12px 32px; gap: 12px; }
.preview-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scroll-padding: 32px; outline: none; }
.preview-dialog .document-preview { width: 100%; max-width: none; padding: 40px clamp(24px, 4vw, 64px) 56px; }
.preview-dialog .student-content { display: grid; gap: 32px; }
.preview-step { min-width: 0; outline: none; }
.preview-step .student-block { margin: 0; }
.preview-controls { display: flex; align-items: center; gap: 24px; flex-shrink: 0; padding: 16px 32px; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; }
#preview-position { color: #505963; font-size: 13px; }
.preview-hint { margin-left: auto; color: #626870; font-size: 13px; }
.preview-next { margin-left: auto; min-width: 132px; min-height: 48px; gap: 15px; }
.preview-hint:not([hidden]) + .preview-next { margin-left: 0; }
.preview-next:not(:disabled) > .icon { transform: rotate(180deg); }
.preview-next:disabled { opacity: .6; }
.preview-print { display: none; }

.heading-level { display: block; max-width: 100%; min-height: 34px; font-size: 12px; font-weight: 600; color: #56616b; background: #fff; border: 1px solid #e1e5e9; border-radius: 6px; padding: 6px 10px; margin-bottom: 12px; }
.heading-level:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.heading-line { display: flex; align-items: flex-start; gap: 10px; }
.heading-line > textarea { flex: 1; min-width: 0; }
.is-subheading .heading-input, .heading-number { font-size: 24px; font-weight: 700; line-height: 1.4; color: #111; letter-spacing: -.3px; }
.heading-number { flex-shrink: 0; }
.document-preview .student-subheading { font-size: 24px; font-weight: 700; line-height: 1.4; }
.presentation-stage .student-subheading { font-size: 34px; font-weight: 700; }
.document-heading-sub { white-space: pre-wrap; }

@media (max-width: 580px) {
  .preview-dialog > .dialog-header { padding: 14px 18px; }
  .preview-dialog .preview-actions { padding: 10px 18px; gap: 8px; }
  .preview-dialog .preview-actions > span { display: none; }
  .preview-dialog .preview-actions > .button { min-height: 40px; font-size: 12px; }
  .preview-dialog .document-preview { padding: 28px 20px 40px; }
  .preview-controls { padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); gap: 12px; }
  #preview-position { font-size: 12px; }
  .preview-hint { display: none; }
  .preview-next, .preview-hint:not([hidden]) + .preview-next { margin-left: auto; min-width: 114px; font-size: 13px; }
  .is-subheading .heading-input, .heading-number, .document-preview .student-subheading { font-size: 22px; }
  .presentation-stage .student-subheading { font-size: 27px; }
}
@media print {
  .preview-dialog[open] { display: block; height: auto; overflow: visible; }
  .preview-dialog > .dialog-content { display: block; overflow: visible; }
  .preview-scroll, .preview-controls { display: none !important; }
  .preview-print { display: block; color: #111; line-height: 1.8; }
  .preview-print h1 { font-size: 27px; margin-bottom: 24px; }
  .preview-print h2 { font-size: 21px; margin: 24px 0 12px; white-space: pre-wrap; }
  .preview-print h3 { font-size: 18px; margin: 20px 0 12px; }
  .preview-print img { max-width: 100%; max-height: 700px; object-fit: contain; }
}

/* Tables stay simple to edit: type into cells, then add or remove whole rows and columns. */
.table-editor { padding: 22px 24px; border: 1px solid #dfe3e8; border-radius: 12px; background: #fff; }
.table-editor-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.table-editor-top > span { display: flex; align-items: center; gap: 8px; color: #5e666f; font-size: 12px; font-weight: 700; letter-spacing: .7px; }
.table-editor-top > span .icon { width: 18px; height: 18px; }
.table-editor-top > label { display: flex; align-items: center; gap: 8px; color: #424950; font-size: 13px; cursor: pointer; }
.table-editor-top input { width: 17px; height: 17px; accent-color: var(--green); }
.table-edit-scroll { width: 100%; overflow-x: auto; border: 1px solid #d9dee3; border-radius: 8px; background: #fff; scrollbar-width: thin; }
.table-edit-grid { width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.table-edit-grid td { min-width: 170px; padding: 0; border-right: 1px solid #d9dee3; border-bottom: 1px solid #d9dee3; vertical-align: top; background: #fff; }
.table-edit-grid tr:last-child td, .table-edit-grid tr:last-child th { border-bottom: 0; }
.table-edit-grid td.is-header-cell { background: #f5f6f7; }
.table-row-number { width: 38px; min-width: 38px; padding: 12px 8px; border-right: 1px solid #d9dee3; border-bottom: 1px solid #d9dee3; background: #fafbfc; color: #7a8189; font-size: 11px; font-weight: 600; text-align: center; vertical-align: top; }
.table-cell-editor { position: relative; min-height: 48px; }
.table-cell-input { display: block; width: 100%; min-height: 48px; padding: 11px 34px 11px 12px; overflow: hidden; resize: none; border: 0; background: transparent; color: #17191c; font-size: 15px; font-weight: 500; line-height: 1.6; }
.is-header-cell .table-cell-input { font-weight: 750; }
.table-cell-input::placeholder { color: #858b92; font-weight: 500; }
.table-cell-input:focus { background: #fbfdfc; box-shadow: inset 0 0 0 2px var(--green); }
.table-remove-column, .table-delete { display: grid; place-items: center; color: #7b8289; border-radius: 5px; }
.table-remove-column { position: absolute; top: 7px; right: 5px; width: 27px; height: 27px; opacity: .45; }
.table-remove-column .icon, .table-delete .icon { width: 14px; height: 14px; }
.table-cell-editor:hover .table-remove-column, .table-remove-column:focus-visible { opacity: 1; }
.table-remove-column:hover, .table-delete:hover { color: #9a4f36; background: #f8efec; }
.table-row-action { width: 42px; min-width: 42px !important; border-right: 0 !important; background: #fafbfc !important; }
.table-delete { width: 34px; height: 34px; margin: 7px auto; }
.table-add-actions { display: flex; gap: 24px; margin-top: 10px; }
.table-add-actions .button { min-height: 36px; font-size: 13px; }

.student-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #cfd5da; border-radius: 7px; background: #fff; }
.student-table { width: 100%; min-width: 420px; border-collapse: collapse; color: #17191c; font-size: 17px; line-height: 1.55; }
.student-table th, .student-table td { padding: 13px 15px; border-right: 1px solid #cfd5da; border-bottom: 1px solid #cfd5da; text-align: left; white-space: pre-wrap; vertical-align: top; }
.student-table th { background: #f1f3f4; color: #111; font-weight: 750; }
.student-table th:last-child, .student-table td:last-child { border-right: 0; }
.student-table tbody tr:last-child td { border-bottom: 0; }
.document-table { margin: 24px 0; break-inside: avoid; }
.presentation-stage .student-table-wrap { margin: auto 0; }
.presentation-stage .student-table { font-size: 23px; }
.presentation-stage .student-table th, .presentation-stage .student-table td { padding: 18px 20px; }

@media (max-width: 580px) {
  .table-editor { padding: 17px 13px; }
  .table-editor-top { align-items: flex-start; flex-direction: column; gap: 10px; }
  .table-editor-top > label { font-size: 12px; }
  .table-edit-grid td { min-width: 145px; }
  .table-cell-input { font-size: 14px; }
  .table-add-actions { gap: 18px; }
  .student-table { min-width: 360px; font-size: 15px; }
  .student-table th, .student-table td { padding: 11px 12px; }
  .presentation-stage .student-table { font-size: 18px; }
  .presentation-stage .student-table th, .presentation-stage .student-table td { padding: 13px 14px; }
}

@media print {
  .student-table-wrap { overflow: visible; }
  .student-table { min-width: 0; font-size: 12px; }
  .student-table th, .student-table td { padding: 7px 9px; }
}
