/* OmniCalc — offline visual mathematical equation input */
.math-group{min-width:0}.math-field-shell{background:var(--panel-soft);border:1px solid var(--line);border-radius:11px;overflow:hidden;transition:border-color .16s,box-shadow .16s}.math-field-shell:focus-within{border-color:#569d7b;box-shadow:0 0 0 3px #58b48d22}
.math-input{min-height:66px;padding:17px 16px 14px;outline:none;cursor:text;font-family:Cambria,"Cambria Math","STIX Two Math",Georgia,serif;font-size:26px;line-height:1.8;word-break:break-word;white-space:pre-wrap;caret-color:var(--accent);color:var(--text)}
.math-input:empty::before{content:'Введите формулу…';font:13px Inter,system-ui,sans-serif;color:var(--muted);opacity:.75;pointer-events:none}
.math-node{display:inline-flex;vertical-align:middle;align-items:center;margin:0 2px;white-space:nowrap;user-select:text}
.math-node-pow{vertical-align:super;transform:translateY(-.04em);margin:0 2px 0 0;font-size:.7em}
.math-sup{font-size:inherit;line-height:1.35;vertical-align:baseline;position:relative;top:-.09em}
.math-slot{display:inline-block;min-width:20px;padding:0 3px;max-width:100%;min-height:1.22em;border:1px solid transparent;border-radius:3px;outline:0;vertical-align:middle;white-space:pre-wrap;line-height:1.3;box-sizing:content-box;cursor:text;font-family:Cambria,"Cambria Math",Georgia,serif;caret-color:var(--accent)}
.math-slot:empty{border:1px dashed var(--accent);background:var(--accent-soft)}.math-slot:empty::before{content:'□';font-size:.82em;color:var(--accent);opacity:.68;pointer-events:none}
.math-slot:focus{border-color:var(--accent);background:var(--accent-soft);box-shadow:0 0 0 2px #5b9e7d20}
.math-frac{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;font-size:.78em;min-width:28px;line-height:1.3;vertical-align:middle}
.math-frac [data-math-slot=numerator]{text-align:center;width:max-content;max-width:100%;border-bottom:1.7px solid currentColor;border-radius:0;padding:1px 5px 2px;min-width:26px}
.math-frac [data-math-slot=denominator]{text-align:center;min-width:26px;padding:2px 5px 1px}.math-node-frac{margin:0 4px}
.math-node-sqrt{align-items:stretch;gap:0}.math-radical{font-size:1.38em;line-height:1.1}.math-node-sqrt>.math-slot{border-top:2px solid currentColor;border-radius:0;margin-top:3px;padding:1px 4px 0}.math-node-abs{gap:1px}.math-node-paren{gap:1px}
.math-field-footer{border-top:1px solid var(--line);padding:6px 9px 6px 14px;display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--muted);font-size:10px;line-height:1.45}
.math-field-footer kbd{display:inline-block;border:1px solid var(--line);border-radius:4px;padding:0 4px;background:var(--panel);font-family:monospace;font-size:10px;color:var(--secondary)}
.math-switch{background:var(--panel);color:var(--accent);border:1px solid var(--line);border-radius:6px;padding:5px 8px;white-space:nowrap;font-size:10px;font-weight:750}.math-switch:hover{background:var(--accent-soft)}
.math-source-input{display:none!important;width:100%;padding:15px!important;border:0!important;border-bottom:1px solid var(--line)!important;border-radius:0!important;background:transparent!important;color:var(--text)!important;font-size:16px!important;box-shadow:none!important}
.math-field-shell.source-mode .math-input{display:none}.math-field-shell.source-mode .math-source-input{display:block!important}
.math-keyboard-v3{padding:17px;margin-top:2px}.math-keyboard-header{display:flex;align-items:baseline;gap:10px;justify-content:space-between;flex-wrap:wrap}.math-keyboard-header strong{font-size:10px;font-weight:850;letter-spacing:1.2px;color:var(--accent)}.math-keyboard-header span{font-size:10px;color:var(--muted)}
.math-keyboard-list{display:flex;flex-wrap:wrap;gap:7px;margin-top:14px}.math-key-rich{font:600 16px Cambria,Georgia,serif!important;min-height:43px;min-width:43px;padding:7px 12px;border-radius:8px}.math-key-rich:first-child,.math-key-rich:nth-child(3),.math-key-rich:nth-child(4){background:var(--accent-soft);color:var(--accent);border-color:#79b39b55}.math-keyboard-hint{font-size:11px;line-height:1.7;color:var(--muted);padding-top:13px}.math-keyboard-hint b{color:var(--secondary)}
@media(max-width:520px){.math-input{font-size:23px;padding:12px;min-height:56px}.math-field-footer{flex-wrap:wrap}.math-key-rich{flex:1 0 12%;min-width:41px}.math-keyboard-header span{display:none}.math-keyboard-hint{font-size:10px}}
.math-node-sym{font-family:Cambria,"Cambria Math",Georgia,serif;display:inline;color:var(--text);margin:0 2px}

/* v4: a continuous vinculum over the radicand, properly proportioned radical glyph */
.math-node-sqrt,.math-node-nthroot{display:inline-flex;align-items:stretch;vertical-align:-.18em;position:relative;margin:0 5px 0 3px;padding-top:.09em;font-variant-numeric:lining-nums}
.math-node-sqrt>.math-radical,.math-node-nthroot>.math-radical{font:normal 1.86em/.92 "Cambria Math",Cambria,Georgia,serif;display:flex;align-items:flex-end;transform:scaleX(.83);transform-origin:right bottom;margin-right:-.11em;color:var(--text);user-select:none;align-self:stretch}
.math-node-sqrt>[data-math-slot="root"],.math-node-nthroot>[data-math-slot="root"]{min-width:25px;display:inline-block;align-self:flex-start;border-top:2.6px solid currentColor;padding:2px 5px 2px 2px;min-height:1.35em;margin-top:1px;border-radius:0;background:transparent;box-sizing:content-box}
.math-node-sqrt>[data-math-slot="root"]:empty,.math-node-nthroot>[data-math-slot="root"]:empty{background:var(--accent-soft);border-top-color:var(--accent);border-right:1px dashed var(--accent);border-bottom:1px dashed var(--accent)}
.math-node-nthroot>[data-math-slot="index"]{font-size:.52em;min-width:15px;position:relative;align-self:flex-start;top:.06em;margin-right:-.08em;z-index:1;line-height:1.1;text-align:right;padding:0 2px}
.matrix-helper{margin:3px 0 12px;padding:12px;border:1px solid var(--line);border-radius:11px;background:var(--panel-soft)}
.matrix-metrics{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.matrix-metric{display:flex;align-items:center;gap:8px;border-radius:6px;background:var(--panel);border:1px solid var(--line);padding:7px 9px;font-size:11px;color:var(--secondary)}
.matrix-metric b{font-size:13px;color:var(--text)}
.matrix-status{font-size:11px;line-height:1.5;flex:1 0 210px}.matrix-status.ok{color:#267452}.matrix-status.bad{color:#ad5a2a}
#matrix-switch{margin-top:10px;border:1px solid #91bb9a;background:var(--accent-soft);color:var(--accent);border-radius:8px;font-size:11px;font-weight:750;padding:9px 12px;cursor:pointer}
@media(max-width:520px){.math-node-sqrt>.math-radical,.math-node-nthroot>.math-radical{font-size:1.75em}}
