:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;color:#343a40;background:#f5f6f8;font-synthesis:none;--border:#dee2e6;--accent:#2879b9;--muted:#727b84}
*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button,select{cursor:pointer}button{border:1px solid var(--border);border-radius:4px;background:white;color:inherit;padding:6px 11px;font-size:13px;line-height:1.5}button:hover{background:#f0f4f8;border-color:#b5c4d1}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #8fc2ed;outline-offset:2px}button:disabled{opacity:.5;cursor:wait}[hidden]{display:none!important}
.app-header{min-block-size:56px;display:flex;align-items:center;gap:16px;padding:10px 24px;border-bottom:1px solid var(--border);background:#fff}.brand{display:flex;align-items:center;gap:10px;color:#343a40;text-decoration:none}.brand-icon{font:28px/1 Georgia;color:var(--accent)}.brand strong{font:700 24px Georgia}.brand>span:last-child{font-size:14px;color:#656d75}#layout-toggle{margin-inline-start:auto;font-size:12px}#layout-toggle[aria-pressed=true]{background:#eaf3fb;border-color:#86b3d6;color:#2069a0}
main{padding:20px 24px;max-inline-size:1600px;margin-inline:auto}.workspace{display:grid;gap:18px;grid-template-columns:minmax(0,1fr)}.input-panel,.output-panel{min-inline-size:0;background:#fff;border:1px solid var(--border);border-radius:5px;display:flex;flex-direction:column}.panel-heading{display:flex;align-items:center;flex-wrap:wrap;gap:10px;min-block-size:49px;padding:9px 14px;border-bottom:1px solid var(--border);background:#fafbfc;border-radius:5px 5px 0 0}h1,h2{font-size:18px;font-weight:500;margin:0}h1 small,h2 small{font-size:12px;color:var(--muted);font-weight:400;margin-inline-start:7px}.heading-actions{margin-inline-start:auto;display:flex;gap:6px}.heading-actions button{font-size:12px;padding:4px 10px}.live-label{margin-inline-start:auto;color:var(--muted);font-size:12px}
.symbol-tools{position:relative;border-bottom:1px solid var(--border)}#categories{display:flex;flex-wrap:wrap;gap:4px;padding:9px 12px}#categories button{font-size:13px;border-color:transparent;padding:5px 10px;background:transparent}#categories button::after{content:'▾';margin-inline-start:6px;font-size:10px;color:#87929c}#categories button[aria-pressed=true]{background:#eaf3fb;color:#2069a0;border-color:#b8d4e9}#symbol-panel{position:absolute;inset-inline:12px;inset-block-start:100%;z-index:20;background:#fff;border:1px solid #bdcbd8;border-radius:4px;box-shadow:0 8px 20px #19375420;max-inline-size:900px}.symbols-head{display:flex;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid #edf0f3;font-size:12px}.symbols-head strong{margin-inline-end:auto}.symbols-head label{display:flex;align-items:center;gap:5px}.symbols-head input{inline-size:48px;border:1px solid var(--border);border-radius:3px;padding:3px}#close-symbols{padding:0 7px;border:0;font-size:21px;color:var(--muted)}#symbols{display:flex;flex-wrap:wrap;align-content:flex-start;gap:5px;max-block-size:min(340px,48dvh);overflow:auto;overscroll-behavior:contain;padding:8px 12px 14px;scrollbar-gutter:stable}#symbols button{display:flex;align-items:center;justify-content:center;min-inline-size:40px;block-size:37px;padding:5px 7px}#symbols svg{display:block;inline-size:54px;block-size:25px}#symbols .divider{inline-size:100%;font-size:11px;color:var(--muted);padding-block:5px 2px}
.editor-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 14px;border-bottom:1px solid #edf0f3}.tabs{display:flex;gap:4px}.tabs button{border-color:transparent;font-size:12px;padding:4px 10px;color:#737e88}.tabs button[aria-pressed=true]{color:#2069a0;background:#edf5fc}.input-hint{font-size:11px;color:#89939d}#source{display:block;inline-size:100%;block-size:clamp(210px,28dvh,360px);min-block-size:150px;resize:vertical;padding:18px;border:0;border-radius:0;outline:none;font:15px/1.8 "SFMono-Regular",Consolas,"Liberation Mono",monospace;color:#263e55;background:#fff;tab-size:2}#source:focus{box-shadow:inset 3px 0 #8dbce0}#visual-wrap{padding:16px;min-block-size:210px}math-field{display:block;inline-size:100%;min-block-size:170px;padding:12px;border:1px solid var(--border);border-radius:4px;font-size:24px}.editor-foot{display:flex;justify-content:space-between;gap:8px;padding:7px 14px;border-top:1px solid #f0f2f4;font-size:11px;color:#87919b;margin-block-start:auto}
#preview{display:flex;align-items:safe center;justify-content:safe center;min-inline-size:0;min-block-size:clamp(170px,25dvh,300px);padding:24px;overflow:auto;font-size:24px;flex:1}#preview mjx-container{flex:0 0 auto;min-inline-size:min-content}#preview .empty{font-size:14px;color:#89939d}.export-bar{display:flex;align-items:center;flex-wrap:wrap;gap:7px;padding:11px 14px;border-top:1px solid var(--border)}select{max-inline-size:100%;padding:7px 9px;border:1px solid var(--border);border-radius:4px;color:inherit;background:white;font-size:12px}.primary{background:var(--accent);border-color:var(--accent);color:#fff}.primary:hover{background:#22679c;border-color:#22679c}.export-label{margin-inline-start:auto;color:var(--muted);font-size:12px}.export-bar button{font-size:12px}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:clip;clip-path:inset(50%)}#status{position:fixed;inset-block-end:24px;inset-inline-start:50%;transform:translateX(-50%);padding:11px 20px;max-inline-size:90%;border-radius:5px;background:#34485a;color:#fff;font-size:13px;z-index:200}#status:empty{display:none}
@media(min-width:1200px){.workspace[data-layout=horizontal]{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}.workspace[data-layout=horizontal] #source{block-size:clamp(330px,56dvh,720px)}.workspace[data-layout=horizontal] #preview{min-block-size:360px;max-block-size:75dvh}.workspace[data-layout=horizontal] #visual-wrap{min-block-size:410px}.workspace[data-layout=horizontal] math-field{min-block-size:360px}}
@media(max-width:1199px){#layout-toggle{display:none}}
@media(max-width:600px){.app-header{padding:10px 14px;min-block-size:50px}.brand>span:last-child{font-size:12px}main{padding:12px 10px}.workspace{gap:12px}.panel-heading{padding:8px 10px}h1,h2{font-size:14px}h1 small,h2 small{display:none}.heading-actions{gap:4px}.heading-actions button{padding:4px 7px}#categories{padding:6px;gap:2px}#categories button{font-size:12px;padding:5px 7px}.input-hint{display:none}#source{padding:14px;font-size:14px}.editor-heading{padding:6px 10px}.export-bar{padding:10px;gap:6px}.export-label{margin-inline-start:8px}#symbol-panel{inset-inline:5px}}
.source-autocomplete{position:fixed;z-index:150;max-height:min(290px,40dvh);width:min(440px,calc(100vw - 16px));overflow:auto;overscroll-behavior:contain;border:1px solid #cedbcd;border-radius:8px;background:white;box-shadow:0 12px 32px #18332325;padding:5px}.source-autocomplete [role=option]{padding:9px 11px;border-radius:4px;cursor:pointer;display:flex;gap:16px;align-items:center;font:12px/1.5 "SFMono-Regular",Consolas,monospace}.source-autocomplete [role=option][aria-selected=true]{background:#e8f0e6;color:#285b3a}.source-autocomplete [role=option]:hover{background:#f0f4ed}.source-autocomplete strong{flex:0 0 40%;overflow:hidden;text-overflow:ellipsis}.source-autocomplete span{color:#869080;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
/* Single-character palettes use a denser scale than formula templates. */
#symbol-panel:is([data-category="symbol"],[data-category="greek"]){max-inline-size:520px}
#symbol-panel:is([data-category="symbol"],[data-category="greek"]) #symbols{display:grid;grid-template-columns:repeat(auto-fill,minmax(32px,1fr));gap:4px;padding:8px 12px 12px}
#symbol-panel:is([data-category="symbol"],[data-category="greek"]) #symbols .divider{grid-column:1 / -1;padding-block:7px 3px;color:#6f7b86;font-size:11px}
#symbol-panel:is([data-category="symbol"],[data-category="greek"]) #symbols button{min-inline-size:0;inline-size:100%;block-size:32px;padding:6px;border-color:#e7ebef;border-radius:3px}
#symbol-panel:is([data-category="symbol"],[data-category="greek"]) #symbols svg{inline-size:18px;block-size:18px}
@media(pointer:coarse){#symbol-panel:is([data-category="symbol"],[data-category="greek"]) #symbols{grid-template-columns:repeat(auto-fill,minmax(40px,1fr))}#symbol-panel:is([data-category="symbol"],[data-category="greek"]) #symbols button{block-size:40px}}
.format-picker{position:relative}.format-picker>button{min-inline-size:132px;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:7px 10px;border-color:#cfd6dc;background:#fff;color:#39434c;font-size:12px;text-align:start}.format-picker>button:hover,.format-picker>button[aria-expanded=true]{border-color:#8caec9;background:#f6faff}.format-chevron{font-size:10px;color:#748390;transition:transform .15s}.format-picker>button[aria-expanded=true] .format-chevron{transform:rotate(180deg)}#format-menu{position:absolute;inset-inline-start:0;inset-block-end:calc(100% + 6px);z-index:30;min-inline-size:100%;padding:4px;border:1px solid #cfd8df;border-radius:5px;background:white;box-shadow:0 6px 18px #23394a20}#format-menu[hidden]{display:none}#format-menu [role=option]{display:block;width:100%;padding:8px 10px;border:0;border-radius:3px;background:transparent;text-align:start;white-space:nowrap;font-size:12px;color:#39434c}#format-menu [role=option]:hover,#format-menu [role=option]:focus-visible{background:#eef5fa;color:#216b9d;outline:none}#format-menu [role=option][aria-selected=true]::after{content:'✓';float:right;color:#2879b9}
.source-editor{position:relative;min-inline-size:0;block-size:clamp(210px,28dvh,360px);min-block-size:150px;resize:vertical;overflow:hidden;background:#fff}.source-editor #source,.source-editor #source-mirror{position:absolute;inset:0;inline-size:100%;block-size:100%;margin:0;padding:18px;border:0;font:15px/1.8 "SFMono-Regular",Consolas,"Liberation Mono",monospace;letter-spacing:normal;tab-size:2;white-space:pre-wrap;overflow-wrap:break-word}.source-editor #source{z-index:1;resize:none;overflow:auto;color:transparent;background:transparent;caret-color:#263e55}.source-editor #source::selection{background:#8dbce055;color:transparent}.source-editor #source-mirror{z-index:0;pointer-events:none;overflow:hidden;color:#263e55}.source-editor #source-mirror mark{background:#ffdc78;border-radius:2px;box-shadow:0 0 0 1px #e8b936;color:inherit}.source-editor:focus-within{box-shadow:inset 3px 0 #8dbce0}.source-editor #source:focus{box-shadow:none}.source-editor #source:placeholder-shown:empty+#source-mirror{color:transparent}.source-editor #source:placeholder-shown:empty{color:transparent}.source-editor #source::placeholder{color:#85919b}.workspace[data-layout=horizontal] .source-editor{block-size:clamp(330px,56dvh,720px)}@media(max-width:600px){.source-editor #source,.source-editor #source-mirror{padding:14px;font-size:14px}}
#ocr-open{margin-inline-start:auto;border-color:#a8bfd1;color:#2069a0}#layout-toggle{margin-inline-start:0}#ocr-dialog{width:min(620px,calc(100vw - 28px));max-width:none;max-height:min(780px,calc(100dvh - 32px));padding:0;border:1px solid #cfd8df;border-radius:7px;color:#343a40;box-shadow:0 18px 60px #142d3d38}#ocr-dialog::backdrop{background:#17212b80;backdrop-filter:blur(2px)}.ocr-dialog-form{padding:18px}.ocr-dialog-heading{display:flex;align-items:center;justify-content:space-between}.ocr-dialog-heading h2{font-size:17px}.ocr-close{font-size:22px;border:0;padding:0 8px;color:#71808a}.ocr-help{font-size:12px;line-height:1.6;color:#687681}.ocr-file-label{display:inline-block;padding:7px 13px;border:1px solid #bdcbd6;border-radius:4px;color:#286e9c;font-size:12px;cursor:pointer}.ocr-file-label:hover{background:#f0f7fc}.ocr-image{display:grid;place-items:center;min-height:120px;max-height:230px;margin-top:12px;padding:10px;border:1px dashed #cbd5dc;border-radius:4px;color:#88939c;font-size:12px;overflow:auto}.ocr-image img{max-width:100%;max-height:205px;object-fit:contain}.ocr-progress{min-height:24px;margin-top:10px;color:#60717d;font-size:12px}.ocr-progress:empty{display:none}.ocr-result-label{margin:8px 0 5px;font-size:12px;color:#62717b}.ocr-result{display:block;width:100%;min-height:110px;resize:vertical;padding:10px;border:1px solid #d5dde3;border-radius:4px;font:13px/1.6 "SFMono-Regular",Consolas,monospace}.ocr-actions{display:flex;align-items:center;gap:7px;margin-top:12px}.ocr-actions button{font-size:12px}.ocr-spacer{flex:1}@media(max-width:600px){#ocr-open{margin-inline-start:auto}.ocr-dialog-form{padding:13px}.ocr-actions{flex-wrap:wrap}.ocr-spacer{flex-basis:100%;order:0}}
#language-toggle{font-size:12px;padding:5px 9px;color:#40505d}
#theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:92px;padding:5px 10px;border-color:#c5d2dc;border-radius:999px;background:#eef3f7;color:#304b60;font-size:12px;font-weight:600;white-space:nowrap}#theme-toggle:hover{background:#e3edf4;border-color:#a8bac9}#theme-icon{display:inline-flex;width:16px;height:16px;align-items:center;justify-content:center}#theme-icon svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.theme-chevron{margin-inline-start:1px;color:#788997;font-size:10px}
:root[data-theme="dark"]{color-scheme:dark;color:#dce4ec;background:#111820;--border:#354351;--accent:#68aee3;--muted:#9aa9b7}
:root[data-theme="dark"] body{color:#dce4ec;background:#111820}
:root[data-theme="dark"] .app-header,:root[data-theme="dark"] .input-panel,:root[data-theme="dark"] .output-panel{background:#1b2631;border-color:#354351}
:root[data-theme="dark"] .app-header{border-color:#354351}
:root[data-theme="dark"] .brand{color:#e5edf4}
:root[data-theme="dark"] .brand>span:last-child{color:#aebbc7}
:root[data-theme="dark"] button,:root[data-theme="dark"] select{color:#dce4ec;background:#25323e;border-color:#455563}
:root[data-theme="dark"] button:hover{background:#30404e;border-color:#5b7182}
:root[data-theme="dark"] button:focus-visible,:root[data-theme="dark"] a:focus-visible,:root[data-theme="dark"] input:focus-visible,:root[data-theme="dark"] select:focus-visible{outline-color:#73b8ed}
:root[data-theme="dark"] .panel-heading{background:#202c37;border-color:#354351}
:root[data-theme="dark"] .editor-heading,:root[data-theme="dark"] .editor-foot,:root[data-theme="dark"] .export-bar,:root[data-theme="dark"] .symbol-tools{border-color:#354351}
:root[data-theme="dark"] .editor-foot,:root[data-theme="dark"] .live-label,:root[data-theme="dark"] .input-hint,:root[data-theme="dark"] .export-label{color:#9eacb8}
:root[data-theme="dark"] #categories button{background:transparent;color:#c5d0da}
:root[data-theme="dark"] #categories button[aria-pressed=true]{background:#243a4a;color:#9bd0fa;border-color:#3c607b}
:root[data-theme="dark"] #symbol-panel,:root[data-theme="dark"] #format-menu{background:#202c37;border-color:#455563;box-shadow:0 8px 24px #0008}
:root[data-theme="dark"] #symbols button,:root[data-theme="dark"] #format-menu [role=option]{background:#25323e;color:#dce4ec;border-color:#3b4a57}
:root[data-theme="dark"] #symbols button:hover,:root[data-theme="dark"] #format-menu [role=option]:hover,:root[data-theme="dark"] #format-menu [role=option]:focus-visible{background:#304452;color:#dceeff}
:root[data-theme="dark"] #symbols .divider,:root[data-theme="dark"] .symbols-head{color:#acb9c5;border-color:#354351}
:root[data-theme="dark"] .tabs button{background:transparent;color:#aebbc7}
:root[data-theme="dark"] .tabs button[aria-pressed=true]{background:#243a4a;color:#a9d6fa}
:root[data-theme="dark"] .source-editor,:root[data-theme="dark"] .source-editor #source,:root[data-theme="dark"] #visual-wrap{background:#18222c}
:root[data-theme="dark"] .source-editor #source-mirror{color:#dce4ec}
:root[data-theme="dark"] .source-editor #source{background:transparent;caret-color:#e0eaf2}
:root[data-theme="dark"] .source-editor #source::placeholder{color:#8493a0}
:root[data-theme="dark"] .source-editor #source::selection{background:#68aee355}
:root[data-theme="dark"] math-field{background:#18222c;color:#e3ebf2;border-color:#455563}
:root[data-theme="dark"] #preview .empty{color:#98a6b2}
:root[data-theme="dark"] .format-picker>button{background:#25323e;color:#dce4ec;border-color:#455563}
:root[data-theme="dark"] .format-picker>button:hover,:root[data-theme="dark"] .format-picker>button[aria-expanded=true]{background:#304452;border-color:#6385a0}
:root[data-theme="dark"] #format-menu [role=option][aria-selected=true]::after{color:#81c2f2}
:root[data-theme="dark"] .source-autocomplete{background:#202c37;border-color:#455563;box-shadow:0 12px 32px #0009}
:root[data-theme="dark"] .source-autocomplete [role=option]{color:#dce4ec}
:root[data-theme="dark"] .source-autocomplete [role=option][aria-selected=true],:root[data-theme="dark"] .source-autocomplete [role=option]:hover{background:#304452;color:#dceeff}
:root[data-theme="dark"] .source-autocomplete span{color:#a3b0bb}
:root[data-theme="dark"] #ocr-dialog{background:#1b2631;color:#dce4ec;border-color:#455563}
:root[data-theme="dark"] .ocr-help,:root[data-theme="dark"] .ocr-progress,:root[data-theme="dark"] .ocr-result-label{color:#aebbc7}
:root[data-theme="dark"] .ocr-file-label{color:#9bd0fa;border-color:#455563}
:root[data-theme="dark"] .ocr-file-label:hover{background:#263744}
:root[data-theme="dark"] .ocr-image,:root[data-theme="dark"] .ocr-result{background:#18222c;color:#dce4ec;border-color:#455563}
:root[data-theme="dark"] .ocr-image{color:#9eacb8}
:root[data-theme="dark"] #ocr-open{color:#9bd0fa;border-color:#456078}
:root[data-theme="dark"] #language-toggle{color:#c8d5df}:root[data-theme="dark"] #theme-toggle{background:#293844;border-color:#536878;color:#e2ebf2}:root[data-theme="dark"] #theme-toggle:hover{background:#344956;border-color:#70899a}:root[data-theme="dark"] .theme-chevron{color:#aab9c5}
:root[data-theme="dark"] #status{background:#dce4ec;color:#17212a}
@media(max-width:600px){.app-header{gap:6px}#language-toggle{min-width:0;padding:4px 5px;font-size:11px}#theme-toggle{min-width:0;gap:5px;padding:4px 7px;font-size:11px}#theme-icon,#theme-icon svg{width:14px;height:14px}#ocr-open{padding:4px 6px;font-size:11px}}
.immediate-tools{position:relative;z-index:8;display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:7px 12px;border-bottom:1px solid var(--border)}.immediate-control{position:relative}.immediate-control>button{display:inline-flex;align-items:center;gap:6px;min-width:88px;padding:5px 9px;border-color:#d7e0e7;background:#f8fafc;color:#40515f;font-size:12px;text-align:start}.immediate-control>button[aria-expanded=true]{background:#edf5fb;border-color:#9bb9d0;color:#205f8d}.immediate-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:#3979a6;font-size:15px;font-weight:700}.immediate-icon svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.immediate-icon-size{position:relative;font-size:14px}.immediate-icon-size sup{font-size:8px;margin-inline-start:-2px}.immediate-chevron{margin-inline-start:auto;color:#87939d;font-size:10px}.immediate-menu{position:absolute;inset-block-start:calc(100% + 5px);inset-inline-start:0;z-index:40;display:grid;gap:5px;min-width:230px;padding:8px;border:1px solid #ccd7df;border-radius:5px;background:#fff;box-shadow:0 8px 24px #1d334022}.immediate-menu[hidden]{display:none}.immediate-menu[data-kind=color]{grid-template-columns:repeat(4,minmax(58px,1fr));min-width:276px}.immediate-menu[data-kind=fontfamily]{grid-template-columns:repeat(4,minmax(58px,1fr))}.immediate-menu[data-kind=fontsize]{grid-template-columns:repeat(5,minmax(44px,1fr));min-width:260px}.immediate-option{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:55px;padding:5px 4px;border:1px solid #e4e9ed;border-radius:4px;background:#fff;color:#384a59;cursor:pointer}.immediate-option:hover,.immediate-option:focus-visible{background:#f1f7fb;border-color:#9dbbd1}.color-swatch{display:block;width:20px;height:20px;border:1px solid #0002;border-radius:50%;background:#777}.custom-swatch{background:linear-gradient(135deg,#e33 0 25%,#eb3 25% 50%,#4a7 50% 75%,var(--custom-color) 75%)}.immediate-sample{display:inline-flex;align-items:center;justify-content:center;min-height:27px;font-family:serif;font-size:17px;line-height:1;color:inherit}.immediate-option-label{max-width:100%;overflow:hidden;color:#657481;font-size:10px;line-height:1.25;text-align:center;text-overflow:ellipsis;white-space:nowrap}
:root[data-theme="dark"] .immediate-tools{border-color:#354351}:root[data-theme="dark"] .immediate-control>button{background:#202e39;border-color:#425361;color:#dce4ec}:root[data-theme="dark"] .immediate-control>button:hover,:root[data-theme="dark"] .immediate-control>button[aria-expanded=true]{background:#2b4050;border-color:#5f8098;color:#c5e4fb}:root[data-theme="dark"] .immediate-icon{color:#8ec6ec}:root[data-theme="dark"] .immediate-menu{background:#202c37;border-color:#455563;box-shadow:0 8px 24px #0009}:root[data-theme="dark"] .immediate-option{background:#25323e;border-color:#3b4a57;color:#e0e8ef}:root[data-theme="dark"] .immediate-option:hover,:root[data-theme="dark"] .immediate-option:focus-visible{background:#304452;border-color:#6385a0}:root[data-theme="dark"] .immediate-option-label{color:#afbdc9}
@media(max-width:600px){.immediate-tools{padding:6px 8px;gap:5px}.immediate-control>button{min-width:78px;padding:5px 7px}.immediate-menu[data-kind=color]{grid-template-columns:repeat(4,minmax(50px,1fr));min-width:240px}.immediate-menu[data-kind=fontfamily]{grid-template-columns:repeat(4,minmax(50px,1fr));min-width:230px}}
