/* Scoped Markdown: never inherit the board's task-list/card rules in nested lists. */
.markup-body { white-space: normal; overflow-wrap: anywhere; line-height: inherit; }
.paste-rendered .homework-text.markup-body { white-space: normal; }
.markup-body > :first-child { margin-top: 0; }
.markup-body > :last-child { margin-bottom: 0; }
.markup-body p { margin: .35em 0; }
.markup-body h1, .markup-body h2, .markup-body h3, .markup-body h4, .markup-body h5, .markup-body h6 { margin: .45em 0 .25em; font-size: 1.08em; line-height: inherit; color: inherit; }
.markup-body ul, .markup-body ol { display: block; margin: .3em 0; padding: 0 0 0 1.7em; overflow: visible; list-style: disc; }
.markup-body ol { list-style: decimal; }
.markup-body li { display: list-item; margin: .15em 0; padding: 0; }
.markup-body li > p { margin: 0; }
.markup-body li.markdown-task { list-style: none; position: relative; }
.markup-body .markdown-task > input, .markup-body .markdown-task > p > input { margin-left: -1.5em !important; margin-right: .4em !important; opacity: 1 !important; }
.markup-body a { color: #047857; text-decoration: underline; text-underline-offset: .18em; }
.markup-body code { padding: .1em .3em; border-radius: 5px; background: #edf1ef; color: inherit; font: .9em/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.markup-body pre { margin: .4em 0; padding: .6em .75em; border-radius: 8px; background: #edf1ef; white-space: pre-wrap; }
.markup-body pre code { padding: 0; background: none; }
.markup-body blockquote { margin: .4em 0; padding: .2em .7em; border-left: 3px solid #9baea4; }
.markup-body table { border-collapse: collapse; width: 100%; table-layout: fixed; margin: .4em 0; font-size: .95em; }
.markup-body th, .markup-body td { border: 1px solid var(--border-color); padding: .3em .45em; overflow-wrap: anywhere; }
.markup-body th { background: #edf1ef; font-weight: 650; }
.markup-body hr { border: 0; border-top: 1px solid var(--border-color); margin: .6em 0; }
.markup-body .markdown-alert { border: 1px solid #bfdbfe; border-left: 3px solid #60a5fa; background: #eff6ff; border-radius: 10px; margin: .25em 0 .1em; padding: .35em .65em; }
.markup-body .markdown-alert-title { display: inline; margin-right: .55em; color: #1d4ed8; font-size: .85em; }
.markup-body .markdown-alert > p { margin: 0; }
#export-area .homework-text.rich-text .markdown-alert { margin-left: 1.4em; }
/* Keep notes attached to their task without spending several characters on chrome. */
#export-area.flow-submission-tags .markup-body :is(blockquote, pre, table, .math-block, ul, ol, hr) { clear: right; }
#export-area.flow-submission-tags .homework-text.rich-text .markdown-alert {
  margin-left: .45em; padding: .2em .45em;
}
.markup-body .alert-tip { border-color: #10b981; background: #ecfdf5; }
.markup-body .alert-tip .markdown-alert-title { color: #047857; }
.markup-body .alert-important { border-color: #8b5cf6; background: #f5f3ff; }
.markup-body .alert-important .markdown-alert-title { color: #6d28d9; }
.markup-body .alert-warning, .markup-body .alert-caution { border-color: #d97706; background: #fffbeb; }
.markup-body .alert-warning .markdown-alert-title, .markup-body .alert-caution .markdown-alert-title { color: #92400e; }
.markup-body .math-block { display: block; margin: .25em 0; max-width: 100%; }
.markup-body .katex-display { margin: .25em 0; }
.markup-body .katex-display > .katex, .markup-body .katex-html { white-space: normal; }
.markup-body .katex { font-size: 1.08em; }
.markup-body .math-fallback { color: inherit; }
#export-area .homework-text.rich-text { display: block; white-space: normal; min-width: 0; flex: 1; }
.homework-text.rich-text > .markup-body, .homework-text.rich-text > .markup-body > p:first-child { display: inline; }
#export-area.notebook-view .homework-text.rich-text { display: inline; }
/* Whole formulas/tables/code occupy ruled rows, without rules through the block. */
.markup-block-slot { display: contents; }
#export-area.notebook-view { --notebook-paper: #fffcf2; }
body.dark-mode #export-area.notebook-view { --notebook-paper: #181818; }
#export-area.notebook-view .markup-body p,
#export-area.notebook-view .markup-body ul,
#export-area.notebook-view .markup-body ol,
#export-area.notebook-view .markup-body li { margin-top: 0; margin-bottom: 0; }
#export-area.notebook-view .notebook-unruled {
  display: flow-root; position: relative; isolation: isolate;
  min-height: var(--notebook-block-height, 0px); box-sizing: border-box;
}
#export-area.notebook-view .notebook-unruled::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  inset: 0 0 0 calc(-1 * var(--notebook-block-indent, 2em));
  background: var(--notebook-paper);
  box-shadow: inset 0 -1px var(--notebook-rule);
}
#export-area.notebook-view .homework-item { padding-bottom: var(--notebook-row-remainder, 0px); }
.editor-item-content { flex: 1; min-width: 0; }
.editor-item-content .editor-item-input { width: 100%; box-sizing: border-box; }
.editor-markup-preview { margin-top: 6px; padding: 8px 10px; border-left: 2px solid var(--primary-color); color: var(--text-color); font-size: 14px; line-height: 1.7; }
.text-markup-preview { margin-top: 12px; }
.text-markup-preview summary, .markup-help summary { cursor: pointer; color: var(--text-light-color); font-size: 12px; }
.markup-help { margin: 6px 0 12px; }
.markup-help p { margin: 6px 0; font-size: 12px; line-height: 1.7; color: var(--text-light-color); }
.syntax-group + .syntax-group { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border-color); }
.syntax-group h4 { margin: 0 0 7px; font-size: 11px; font-weight: 600; color: var(--text-light-color); }
.syntax-group .quick-btn + .quick-btn { margin-top: 5px; }
.syntax-panel .syntax-note { border-left: 3px solid #3b82f6; }
.syntax-panel .syntax-tip { border-left: 3px solid #10b981; }
.syntax-panel .syntax-important { border-left: 3px solid #8b5cf6; }
.syntax-panel .syntax-warning, .syntax-panel .syntax-caution { border-left: 3px solid #d97706; }
body.dark-mode .markup-body a { color: #6ee7b7; }
body.dark-mode .markup-body code, body.dark-mode .markup-body pre, body.dark-mode .markup-body th { background: #303632; }
body.dark-mode .markup-body pre code { background: none; }
body.dark-mode .markup-body .markdown-alert { background: #192c43; }
body.dark-mode .markup-body .markdown-alert-title { color: #a8d0ff; }
body.dark-mode .markup-body .alert-tip { background: #183c2c; }
body.dark-mode .markup-body .alert-tip .markdown-alert-title { color: #8de8ba; }
body.dark-mode .markup-body .alert-important { background: #302342; }
body.dark-mode .markup-body .alert-important .markdown-alert-title { color: #d8b4fe; }
body.dark-mode .markup-body .alert-warning, body.dark-mode .markup-body .alert-caution { background: #382b19; }
body.dark-mode .markup-body .alert-warning .markdown-alert-title, body.dark-mode .markup-body .alert-caution .markdown-alert-title { color: #fde68a; }

/* Editing uses regular UI sizes, independent of the board's reading font. */
.editor-modal .editor-homework-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 5px 8px; padding: 10px; margin: 6px 0; font-size: 14px; line-height: 1.5; font-weight: 400; }
.editor-modal .editor-item-order { grid-column: 1; grid-row: 1 / 3; align-self: stretch; }
.editor-modal .order-handle { display: grid; place-items: center; padding: 0; line-height: 1; }
.editor-modal .order-handle svg { display: block; width: 16px; height: 22px; fill: currentColor; pointer-events: none; }
.editor-rich-host { min-width: 0; }
.editor-rich-host > small { display: block; font-size: 12px; color: var(--text-light-color); margin-bottom: 6px; }
.editor-rich-host .rich-editor-retry { padding: 5px 9px; font-size: 12px; margin-top: 5px; }
.editor-download-status { position: fixed; z-index: 10002; bottom: 18px; left: 18px; max-width: calc(100vw - 36px); padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 12px; color: var(--text-color); background: var(--card-background-color); box-shadow: 0 4px 16px #0002; font-size: 12px; }
.editor-download-status progress { display: block; width: 220px; max-width: 100%; height: 5px; margin-top: 7px; accent-color: var(--primary-color); }
.editor-download-status button { padding: 5px 8px; margin-left: 8px; font-size: 12px; }
body { --keyboard-zindex: 1200; }
.ML__keyboard .homework-keyboard-actions { display: flex; gap: 4px; margin-left: auto; padding-right: 6px; flex-shrink: 0; }
.ML__keyboard .homework-keyboard-actions button { display: grid; place-items: center; width: 34px; height: 32px; padding: 5px; border: 0; border-radius: 7px; color: var(--text-color); background: var(--card-background-color); cursor: pointer; }
.ML__keyboard .homework-keyboard-actions button:hover { background: var(--primary-light); }
.ML__keyboard .homework-keyboard-actions svg { width: 20px; height: 20px; }
.ML__keyboard .MLK__toolbar > .left { min-width: 0; overflow-x: auto; }
.ML__keyboard #homework-formula-layer { --keycap-width: min(76px, 15cqw); }
.ML__keyboard #homework-formula-layer .MLK__keycap { font-size: 13px; padding: 4px; }
body.formula-keyboard-open .modal-overlay:has(.editor-modal) { padding-bottom: calc(var(--formula-keyboard-height, 0px) + 12px); box-sizing: border-box; }
body.formula-keyboard-open .editor-modal { max-height: calc(100dvh - var(--formula-keyboard-height, 0px) - 40px); }
.editor-modal .rich-homework-input { height: auto; min-height: 38px; max-height: 240px; overflow-y: auto; white-space: pre-wrap; outline: none; cursor: text; }
.rich-homework-input > p { margin: 0; min-height: 1.5em; }
.rich-homework-input > p:only-child:empty::before { content: '请输入作业内容'; color: var(--text-light-color); pointer-events: none; }
.rich-homework-input .ProseMirror-selectednode { outline: 2px solid var(--primary-color); border-radius: 6px; }
.rich-homework-input .rich-formula { display: inline-block; max-width: 100%; vertical-align: middle; }
.rich-homework-input .rich-formula-block { display: block; }
.rich-formula math-field { display: inline-block; max-width: 100%; padding: 1px 3px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; font-size: 1.15em; --caret-color: var(--primary-color); --selection-background-color: #10b98133; }
.rich-formula math-field:focus-within { border-color: var(--primary-color); background: #10b9810d; }
.rich-formula math-field::part(menu-toggle) { display: none; }
.rich-formula math-field::part(virtual-keyboard-toggle) { color: var(--primary-color); }
.rich-homework-input .markdown-alert > div { display: inline-block; min-width: 4em; max-width: 100%; vertical-align: top; }
.rich-homework-input .markdown-alert > div > p:first-child { display: inline; }
.rich-homework-input ul[data-type="taskList"] { list-style: none; padding-left: .25em; }
.rich-homework-input li[data-type="taskItem"] { display: flex; flex-direction: row; align-items: flex-start; gap: .45em; }
.rich-homework-input li[data-type="taskItem"] > label { flex: 0 0 auto; padding-top: .1em; }
.rich-homework-input li[data-type="taskItem"] > div { min-width: 0; flex: 1; }
.rich-homework-input li[data-type="taskItem"] p { margin: 0; }
.rich-homework-input .selectedCell { background: #10b98122; }
body.dark-mode math-field { color-scheme: dark; --contains-highlight-background-color: #174b38; }
.editor-modal .editor-item-content { grid-column: 2; grid-row: 1; }
.editor-modal .editor-item-input { min-height: 38px; padding: 7px 10px; border-radius: 9px; font-size: 14px; line-height: 1.5; font-weight: 400; transition: border-color .2s ease, box-shadow .2s ease; }
.editor-modal .editor-item-footer { display: contents; }
.editor-modal .editor-item-tags { grid-column: 2; grid-row: 2; flex-direction: row; flex-wrap: wrap; gap: 3px 6px; padding: 0; }
.editor-modal .editor-item-tags .editor-item-check { min-height: 28px; padding: 2px 6px; font-size: 12px; font-weight: 500; border-radius: 7px; }
.editor-modal .editor-item-actions { grid-column: 3; grid-row: 1 / 3; align-self: start; flex-direction: row; gap: 5px; padding: 0; }
.editor-modal .editor-item-actions button { min-width: 34px; width: 34px; height: 36px; padding: 7px; border-radius: 9px; }
.editor-modal .visual-editor-card { border: 0; background: transparent; box-shadow: none; }
.editor-modal .editor-homework-list { padding: 4px; }
.editor-modal .editor-homework-item,
.editor-modal .editor-homework-item:hover { background: transparent; color: var(--text-color); border: 0; border-radius: 0; box-shadow: none; transform: none; }
.editor-modal .editor-homework-item + .editor-homework-item { border-top: 1px solid var(--border-color); }
.editor-modal .editor-homework-item::before, .editor-modal .editor-homework-item::after { content: none; }
.editor-modal .editor-item-tags .editor-item-check,
.editor-modal .editor-item-tags .editor-item-check:has(input:checked) { background: transparent; border-color: transparent; }
.editor-modal .editor-markup-preview { padding: 5px 8px; margin-top: 4px; border-left-width: 2px; border-radius: 0 6px 6px 0; background: #f3f7f5; font-size: 13px; line-height: 1.5; max-height: 180px; overflow: auto; }
body.dark-mode .editor-modal .editor-markup-preview { background: #202623; }
body.dark-mode .editor-modal .editor-homework-list .homework-item.editor-homework-item { background: transparent; color: var(--text-color); box-shadow: none; border-left: 0; }
body.dark-mode .editor-modal .editor-item-tags .editor-item-check:has(input:checked) { background: transparent; border-color: transparent; }
@media (min-width: 1100px) {
  .editor-modal .editor-item-content:has(.editor-markup-preview) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
  .editor-modal .editor-item-content .editor-markup-preview { margin: 0; min-height: 38px; box-sizing: border-box; max-height: 160px; }
}
.editor-modal .editor-textarea-single { font-size: 14px; line-height: 1.6; }
.syntax-context { margin: 0 0 10px; font-size: 11px; color: var(--primary-color); font-weight: 650; }
.editor-modal .editor-titlebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding-bottom: 12px; margin-bottom: 14px; }
.editor-titlebar > div:first-child { grid-column: 1; grid-row: 1 / 3; }
.editor-titlebar .editor-title-meta { grid-column: 2; grid-row: 1; justify-self: end; }
.editor-titlebar .editor-toolbar { grid-column: 2; grid-row: 2; display: flex; gap: 6px; margin: 0; align-self: end; flex-wrap: nowrap; }
.editor-titlebar .editor-mode-switch { gap: 2px; padding: 2px; flex-wrap: nowrap; }
.editor-titlebar .editor-mode-btn, .editor-titlebar .quick-tools-toggle { font-size: 12px; padding: 6px 8px; min-height: 32px; white-space: nowrap; }
.editor-scroll-content { grid-template-rows: 1fr; }
.editor-scroll-content > .editor-panel, .editor-scroll-content > .editor-quick-panel { grid-row: 1; }
.syntax-panel .markup-help { overflow-wrap: anywhere; margin: 0 0 12px; }
@media (min-width: 769px) { .editor-modal .visual-editor-panel .editor-panel-tip { display: none; } }
body.dark-mode .syntax-panel .button.quick-btn { --syntax-accent: #93c5fd; background: #222927; color: #f0f8f4; border-color: #43574d; transition: transform .2s ease, box-shadow .2s ease; }
body.dark-mode .syntax-panel .button.quick-btn:hover { background: #304339; color: #f0f8f4; }
body.dark-mode .syntax-panel .button.syntax-tip { --syntax-accent: #6ee7b7; }
body.dark-mode .syntax-panel .button.syntax-important { --syntax-accent: #c4b5fd; }
body.dark-mode .syntax-panel .button.syntax-warning { --syntax-accent: #fcd34d; }
body.dark-mode .syntax-panel .button.syntax-caution { --syntax-accent: #fda4af; }
body.dark-mode .syntax-panel .button[class*="syntax-"] { color: var(--syntax-accent); border-left: 3px solid var(--syntax-accent); background: #222927; }
body.dark-mode .syntax-panel .button[class*="syntax-"]:hover { color: var(--syntax-accent); border-color: var(--syntax-accent); background: #303934; }
@media (max-width: 768px) {
  .editor-scroll-content.quick-tools-open { grid-template-rows: auto minmax(0, 1fr); }
  .editor-scroll-content > .editor-quick-panel { grid-row: 1; display: flex; gap: 8px; overflow-x: auto; max-height: 130px; padding: 8px; }
  .editor-scroll-content.quick-tools-open > .editor-panel { grid-row: 2; }
  .editor-quick-panel .syntax-context { display: none; }
  .editor-quick-panel .syntax-group { flex: 0 0 auto; max-width: 260px; margin: 0; padding: 0 8px 0 0; border: 0; border-right: 1px solid var(--border-color); }
  .editor-quick-panel .quick-btn { display: inline-block; min-height: 36px; margin: 2px; }
  .editor-modal .editor-homework-item { grid-template-columns: 36px minmax(0, 1fr); padding: 8px; gap: 5px 6px; }
  .editor-modal .editor-item-input, .editor-modal .editor-textarea-single { font-size: 16px; }
  .editor-modal .editor-item-footer { display: flex; grid-column: 1 / -1; grid-row: 2; gap: 4px; align-items: center; flex-wrap: wrap; }
  .editor-modal .editor-item-order { grid-row: 1; }
  .editor-modal .editor-item-tags { flex: 1 1 140px; }
  .editor-modal .editor-item-tags .editor-item-check { min-height: 34px; }
  .editor-modal .editor-item-actions { margin-left: auto; align-self: center; }
  .editor-modal .editor-item-actions button { min-width: 40px; width: 40px; height: 40px; }
}
