/* Mathster — MathLive answer boxes (number, calculated and expression parts), shared by the homework page and the
   class game. Uses the page's own --accent, --accent-hover, --border-2, --r-md, --ink, --qfs, --success-bg, --m-fast and
   --m-press, which each page defines. Behaviour: public/js/mathster-answer-boxes.js. */
/* MathLive answer boxes (number, calculated and expression parts). The engine's own text box stays
   in the page, hidden, and receives what the pupil types converted to the text the marker expects. */
math-field.ansbox{display:inline-block;vertical-align:middle;min-width:calc(5ch + 22px);max-width:100%;min-height:44px;
  box-sizing:border-box;border:1px solid var(--border-2);border-radius:var(--r-md);padding:4px 8px;margin:2px 4px;
  font-size:calc(var(--qfs,18px) * 1.15);font-weight:400;font-style:normal;background:#fff;color:var(--ink);--caret-color:var(--accent);--selection-background-color:#DBEAFE}
math-field.ansbox:focus-within{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(37,99,235,.16)}
math-field.ansbox.in-brackets{min-width:calc(2ch + 14px);min-height:1.9em;padding:0 4px;margin:0 1px;border-radius:6px}
math-field.ansbox.in-brackets::part(content){padding:0 2px}
math-field.ansbox.is-correct{background:var(--success-bg);border-color:#8ECFAA}
math-field.ansbox.is-wrong{background:#FDECEC;border-color:#F0B4B4}
math-field.ansbox::part(menu-toggle){display:none}
/* MathLive's own keyboard button sits inside the box and takes up room: hidden. Instead a thin
   blue tab is fixed to the right-hand edge of every maths answer box; clicking it opens the keyboard. */
math-field.ansbox::part(virtual-keyboard-toggle){display:none}
.ansgroup{display:inline-flex;align-items:stretch;vertical-align:middle;margin:2px 4px;max-width:100%}
.ansgroup math-field.ansbox{margin:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:0}
.ansgroup .kbtab{flex:0 0 auto;width:16px;padding:0;margin:0;border:1px solid var(--accent);background:var(--accent);color:#fff;
  border-radius:0 var(--r-md) var(--r-md) 0;cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:background-color var(--m-fast) ease,transform var(--m-fast) var(--m-press)}
/* While the keyboard tab is there, the box has the tab's blue border, so box and tab read as one piece.
   (A wrong answer still shows by its pink fill; a finished question has no tab and keeps its state colours.) */
.ansgroup:not(.settled) math-field.ansbox{border-color:var(--accent)}
.ansgroup:not(.settled):hover math-field.ansbox{border-color:var(--accent-hover,#1D4ED8)}
.ansgroup:not(.settled):hover .kbtab{background:var(--accent-hover,#1D4ED8);border-color:var(--accent-hover,#1D4ED8)}
.ansgroup .kbtab:active{transform:scale(.92)}
.ansgroup .kbtab:hover{background:var(--accent-hover,#1D4ED8);border-color:var(--accent-hover,#1D4ED8)}
.ansgroup .kbtab:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.ansgroup .kbtab svg{width:12px;height:12px;display:block}
.ansgroup.in-brackets{margin:0 1px}
.ansgroup.in-brackets .kbtab{width:12px;border-radius:0 6px 6px 0}
.ansgroup.in-brackets .kbtab svg{width:9px;height:9px}
.ansgroup.settled .kbtab{display:none}
.ansgroup.settled math-field.ansbox{border-right:1px solid var(--border-2);border-radius:var(--r-md)}
/* Complex-number parts (22 Nov 2026): an "i" button between the box and the keyboard tab. */
.ansgroup .itab{flex:0 0 auto;min-width:20px;padding:0 4px;margin:0;border:1px solid var(--accent);border-right:0;background:#fff;
  color:var(--accent);font:italic 600 16px/1 "Times New Roman",Times,serif;cursor:pointer;display:flex;align-items:center;justify-content:center}
.ansgroup .itab:hover{background:var(--accent-tint,#EEF4FF)}
.ansgroup .itab:active{transform:scale(.92)}
.ansgroup.settled .itab{display:none}
