.learning-editor { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--paper, #fff); overflow: hidden; }
.learning-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent); }
.math-toolbar { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--bg); }
.math-toolbar button { width: auto; min-width: 44px; min-height: 44px; padding: 6px 10px; font-size: 14px; line-height: 1.3; color: var(--ink, #213547); border: 1px solid var(--line); border-radius: 8px; background: var(--paper, #fff); cursor: pointer; box-shadow: none; }
.math-toolbar button:focus-visible, .math-source-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.learning-editor .ProseMirror { outline: none; min-height: 145px; padding: 14px; font-size: 16px; line-height: 2; overflow-wrap: anywhere; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: none; scroll-margin-bottom: calc(var(--math-keyboard-height, 0px) + 30px); }
.learning-editor .ProseMirror p { margin: 0 0 .4em; line-height: inherit; }
.learning-editor .ProseMirror p:last-child { margin-bottom: 0; }
.learning-editor .ProseMirror:has(> p:only-child > br:only-child)::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; position: absolute; max-width: calc(100% - 28px); }
.learning-editor .ProseMirror { position: relative; }
.math-inline-editor { display: inline-block; vertical-align: middle; max-width: 100%; border-radius: 5px; border: 1px solid transparent; }
.math-inline-editor:focus-within { border-color: var(--accent); background: #f5f9ff; }
.math-inline-editor math-field { display: inline-block; max-width: 100%; min-width: 24px; padding: 3px; margin: 0; border: none; border-radius: 5px; background: transparent; color: inherit; font-size: 1.12em; --caret-color: var(--accent); --selection-background-color: #c6ddff; scroll-margin-bottom: calc(var(--math-keyboard-height, 0px) + 30px); }
.math-inline-editor math-field::part(menu-toggle), .math-inline-editor math-field::part(virtual-keyboard-toggle) { display: none; }
.math-input-message { display: block; padding: 5px 12px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.math-source-toggle { display: block; width: auto; min-height: 38px; margin: 0 6px 5px auto; padding: 5px 8px; border: none; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; box-shadow: none; cursor: pointer; }
.learning-editor.has-error { border-color: #b42318; }
.learning-editor.has-error .math-input-message { color: #b42318; }
.ProseMirror-selectednode { outline: 2px solid var(--accent); }
.math-toolbar[hidden], .learning-editor-host[hidden] { display: none; }
html { scroll-padding-bottom: calc(var(--math-keyboard-height, 0px) + 25px); }
body { padding-bottom: var(--math-keyboard-height, 0px); }
.math-typeset { font-size: 1.1em; }
@media (max-width: 450px) { .math-toolbar { gap: 4px; padding: 6px; } .math-toolbar button { padding: 6px 8px; font-size: 13px; } }
