
/* Mr Nahas — one maths answer field and optional keyboard */
#mr-math-input{display:flex;flex-direction:column;align-items:center;gap:9px;max-width:620px;margin:8px auto 12px}
#mr-math-input.mr-math-inactive{display:none!important}
#mr-math-field{display:none;width:min(320px,90vw);min-height:52px;box-sizing:border-box;background:#fff;border:2px solid #777;border-radius:11px;padding:7px 12px;font-size:29px;text-align:center;--caret-color:#146ac4;--selection-background-color:#dcecff;--selection-color:#111}
#mr-math-input.mr-math-ready #mr-math-field{display:block}
#mr-math-input.mr-math-ready #answer{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:0!important;border:0!important;opacity:0!important;pointer-events:none!important;clip-path:inset(50%)!important}
#mr-math-field:focus-within{border-color:#246bb8;box-shadow:0 0 0 2px #b9d9ff;outline:0}
#mr-math-toggle{font:15px Arial,sans-serif;background:#fff;color:#111;border:2px solid #333;border-bottom:6px solid #b85eaa;border-radius:12px;padding:9px 16px;cursor:url('Jake hovering over.png') 16 16,pointer!important;transition:background .15s,transform .12s}
#mr-math-toggle[aria-expanded="true"]{background:#2164ad;color:#fff}
#mr-math-toggle:active{transform:translateY(3px);border-bottom-width:3px}
#mr-math-keyboard{width:min(100%,560px);box-sizing:border-box;padding:12px;background:#f7fbff;border:1px solid #b8d3ee;border-radius:16px;box-shadow:0 8px 22px #1233;animation:mr-math-open .18s ease-out}
#mr-math-keyboard[hidden]{display:none!important}
@keyframes mr-math-open{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:translateY(0)}}
.mr-math-tabs{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
#mr-math-keyboard button{background:#fff!important;color:#111!important;border:1px solid #b5c7dc!important;border-bottom:5px solid #b85eaa!important;border-radius:10px!important;box-shadow:none!important;transform:none!important;transition:background .14s,color .14s,transform .12s!important;cursor:url('Jake hovering over.png') 16 16,pointer!important}
#mr-math-keyboard button.selected,#mr-math-keyboard button[aria-pressed="true"]{background:#2164ad!important;color:#fff!important;border-color:#2164ad!important}
#mr-math-keyboard button:active{transform:translateY(3px)!important;border-bottom-width:2px!important}
.mr-math-tabs button{flex:1;font:14px Arial,sans-serif!important;padding:9px 5px!important;margin:0!important}
.mr-math-keys{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px}
.mr-math-keys button{font:19px Arial,sans-serif!important;min-height:44px;padding:6px 2px!important;margin:0!important}
.mr-math-footer{display:flex;justify-content:space-between;gap:8px;margin-top:12px}
.mr-math-footer button{font:14px Arial,sans-serif!important;flex:1;margin:0!important;padding:9px 4px!important}
@media(max-width:480px){.mr-math-keys button{font-size:16px!important;min-height:40px}.mr-math-tabs button{font-size:12px!important}}
#mr-math-field::part(virtual-keyboard-toggle),#mr-math-field::part(menu-toggle){display:none!important}
/* MathLive editable slots and cursor */
#mr-math-field::part(content){caret-color:#146ac4}
#mr-math-field::part(placeholder){background:#e4f0ff!important;border:1px dashed #2476cf!important;border-radius:3px!important;min-width:12px!important}
/* Full-screen anti-spam notice; temporarily blocks interaction. */
#mr-math-notice[hidden]{display:none!important}
#mr-math-notice{position:fixed;inset:0;z-index:2147483647;background:rgba(15,30,55,.36);display:flex;align-items:center;justify-content:center;backdrop-filter:blur(3px);animation:mr-math-open .15s ease-out}
#mr-math-notice>div{padding:25px 34px;border:2px solid #246bb8;border-bottom:8px solid #b85eaa;border-radius:18px;background:#fff;color:#163a68;box-shadow:0 18px 55px #0003;font:700 clamp(20px,4vw,30px) Arial,sans-serif;text-align:center}

/* Keep equation text black and prevent dark selection colours */
#mr-math-field {
    color: #111 !important;
    --selection-background-color: #dcecff;
    --selection-color: #111;
    --caret-color: #146ac4;
    caret-color: #146ac4;
}

/* Exponent and fraction placeholder appearance */
#mr-math-field::part(placeholder) {
    background: #e5f1ff !important;
    border: 1px dashed #2476cf !important;
    border-radius: 3px !important;
}

/* Remove MathLive's built-in controls */
#mr-math-field::part(virtual-keyboard-toggle),
#mr-math-field::part(menu-toggle) {
    display: none !important;
}
