/* Kwantum Maths: area colours, the algebra answer box, maths explorers. Load after fresh.css and higher.css. */
:root[data-area="numerical"]   { --acc-strong: #1D4FA8; --acc: #2763C9; --acc-ink: #1D4FA8; --acc-soft: #E1EAFA; --acc-tint: #F4F7FE; }
:root[data-area="algebraic"]   { --acc-strong: #A3245C; --acc: #B0255D; --acc-ink: #8E1D4B; --acc-soft: #FBE3EE; --acc-tint: #FFF4F8; }
:root[data-area="geometric"]   { --acc-strong: #0A6B5E; --acc: #0E8F7E; --acc-ink: #0A6B5E; --acc-soft: #DDF3EF; --acc-tint: #F2FBF9; }
:root[data-area="trig"]        { --acc-strong: #A8370B; --acc: #C2410F; --acc-ink: #93300A; --acc-soft: #FBE7DC; --acc-tint: #FFF5EF; }
:root[data-area="statistical"] { --acc-strong: #5B21B6; --acc: #6D28D9; --acc-ink: #5B21B6; --acc-soft: #EDE5FB; --acc-tint: #F8F5FE; }
:root[data-area="expressions"]   { --acc-strong: #0B5C8A; --acc: #0E73AD; --acc-ink: #0B5C8A; --acc-soft: #DDEFF9; --acc-tint: #F2F9FD; }
:root[data-area="relationships"] { --acc-strong: #9A2C1C; --acc: #B83A26; --acc-ink: #8E2818; --acc-soft: #F9E3DF; --acc-tint: #FEF5F3; }
:root[data-area="applications"]  { --acc-strong: #2F6B12; --acc: #3D8A18; --acc-ink: #2F6B12; --acc-soft: #E3F2DA; --acc-tint: #F5FBF1; }
:root[data-area="numeracy"]      { --acc-strong: #3730A3; --acc: #4338CA; --acc-ink: #3730A3; --acc-soft: #E4E3FA; --acc-tint: #F5F5FE; }
:root[data-area="money"]         { --acc-strong: #8A4B08; --acc: #A55A0B; --acc-ink: #7C4207; --acc-soft: #F8E8D4; --acc-tint: #FEF8F0; }
:root[data-area="shape"]         { --acc-strong: #075985; --acc: #0369A1; --acc-ink: #075985; --acc-soft: #DDEFFA; --acc-tint: #F2F9FE; }
:root[data-area="number"]        { --acc-strong: #1D4FA8; --acc: #2763C9; --acc-ink: #1D4FA8; --acc-soft: #E1EAFA; --acc-tint: #F4F7FE; }
:root[data-area="information"]   { --acc-strong: #5B21B6; --acc: #6D28D9; --acc-ink: #5B21B6; --acc-soft: #EDE5FB; --acc-tint: #F8F5FE; }
:root[data-area="calculus"]      { --acc-strong: #7A2E8E; --acc: #8E38A6; --acc-ink: #6E2880; --acc-soft: #F1E1F6; --acc-tint: #FBF4FD; }
:root[data-area="proof"]         { --acc-strong: #8A5A00; --acc: #A86E00; --acc-ink: #7A5000; --acc-soft: #F8ECD2; --acc-tint: #FEF9EF; }
:root[data-area="mvc"]           { --acc-strong: #0F5F73; --acc: #157A93; --acc-ink: #0F5F73; --acc-soft: #DBF0F5; --acc-tint: #F1FAFC; }
:root[data-theme="dark"][data-area] {
  --acc-ink: color-mix(in srgb, var(--acc) 62%, #fff);
  --acc-soft: color-mix(in srgb, var(--acc) 26%, #1B1D23);
  --acc-tint: color-mix(in srgb, var(--acc) 12%, #121318);
  --accent: var(--acc-ink); --accent-soft: var(--acc-soft);
}
.tb-brand { min-width: 0; flex-shrink: 1; }
.tb-brand > span:last-child { min-width: 0; overflow: hidden; }
.tb-brand b, .tb-brand small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .tb-brand { max-width: calc(100% - 150px); } }
.fgrid > .blk:only-child { grid-column: 1 / -1; }
.fgrid .fm, .blk .fm { overflow-x: auto; max-width: 100%; }
.bench .seg { flex-wrap: wrap; }

/* maths in text: a little larger, serif italics for letters */
.fm { font-family: var(--math); font-size: 1.08em; }
.fm .frac { vertical-align: middle; }
.working .wl span .fm, .ex .fm { font-size: 1.1em; }

/* ---------- algebra answer box ---------- */
.mxin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 6px 0 4px; }
.mx-pre, .mx-post { font-family: var(--math); font-size: 1.15rem; }
.mx-box { display: inline-flex; flex-direction: column; gap: 4px; min-width: min(18rem, 100%); flex: 0 1 22rem; }
.mxv { width: 100%; padding: 10px 12px; border: 1.5px solid var(--rule); border-radius: var(--r); background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 1.05rem; }
.mxin.num .mx-box { min-width: 8rem; flex: 0 1 10rem; }
.mxv:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mx-prev { min-height: 1.6em; font-size: 1.05rem; color: var(--ink); padding: 0 2px; display: none; }
.mx-prev.on { display: block; }
.mx-prev.on::before { content: "You typed  "; font-family: var(--font); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
.mx-prev.err { color: var(--muted); font-size: .85rem; font-family: var(--font); }
.mx-prev.err::before { content: "Not finished yet: "; }
.mx-keys { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.mxk { min-width: 44px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); font-family: var(--math); font-size: 1rem; cursor: pointer; }
.mxk:hover { border-color: var(--accent); }
.mx-multi { display: grid; gap: 10px; }
.mx-row { border-left: 3px solid transparent; padding-left: 8px; }
.mx-row.good { border-left-color: var(--ok); }
.mx-row.badr { border-left-color: var(--no); }
.qnc { font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--no-soft); color: var(--no); white-space: nowrap; }
.mxin[data-done] { display: none; }

/* ---------- maths explorers (graphs, shapes) ---------- */
.mgraph { width: 100%; height: auto; display: block; touch-action: none; }
.mgraph .gl { stroke: var(--bench-line); stroke-width: 1; }
.mgraph .gl.major { stroke: color-mix(in srgb, var(--bench-dim) 45%, transparent); }
.mgraph .ax { stroke: var(--bench-ink); stroke-width: 1.6; }
.mgraph .tk { fill: var(--bench-dim); font: 500 11px var(--mono); }
.mgraph .cv { fill: none; stroke: var(--trace); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mgraph .cv2 { fill: none; stroke: var(--amber); stroke-width: 3; stroke-linecap: round; }
.mgraph .cv3 { fill: none; stroke: #F472B6; stroke-width: 3; stroke-linecap: round; }
.mgraph .dash { stroke-dasharray: 6 5; }
.mgraph .pt { fill: var(--amber); stroke: var(--bench); stroke-width: 2; }
.mgraph .pt2 { fill: var(--trace); stroke: var(--bench); stroke-width: 2; }
.mgraph .drag { cursor: grab; }
.mgraph .lab { fill: var(--bench-ink); font: 600 13px var(--font); }
.mgraph .lab.dim { fill: var(--bench-dim); font-weight: 500; }
.mgraph .shape { fill: color-mix(in srgb, var(--trace) 18%, transparent); stroke: var(--trace); stroke-width: 2.4; stroke-linejoin: round; }
.mgraph .shape2 { fill: color-mix(in srgb, var(--amber) 18%, transparent); stroke: var(--amber); stroke-width: 2.4; stroke-linejoin: round; }
.mgraph .ink { stroke: var(--bench-ink); stroke-width: 2; fill: none; }
.mgraph .bar { fill: var(--trace); opacity: .85; }
.mgraph .bar2 { fill: var(--amber); opacity: .9; }
.bench .fm { color: var(--bench-ink); }
.bench-eq { font-family: var(--math); font-size: 1.35rem; color: var(--bench-ink); text-align: center; padding: 8px 6px 2px; min-height: 2em; }
.bench-eq .sub { display: block; font-family: var(--font); font-size: .8rem; color: var(--bench-dim); margin-top: 2px; }

/* static maths figures in notes and questions */
.mfig { max-width: 100%; height: auto; color: var(--ink); font-family: var(--font); }
.mfig text { fill: currentColor; font-size: 14px; }
.mfig text.it { font-family: var(--math); font-style: italic; font-size: 16px; }
.mfig text.sm { font-size: 12px; }
.mfig .ln { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mfig .thin { fill: none; stroke: currentColor; stroke-width: 1; opacity: .5; }
.mfig .fillA { fill: var(--acc-soft); stroke: var(--acc); stroke-width: 2; }
.mfig .acc { fill: none; stroke: var(--acc); stroke-width: 2.6; }
.mfig .dash { stroke-dasharray: 5 4; }
.mfig .dot { fill: currentColor; }
.mfig .grid { stroke: currentColor; stroke-width: .5; opacity: .2; }
.fm .rt-i { font-size: .6em; margin-right: -.35em; vertical-align: .9em; font-style: normal; }
.colv { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; padding: 1px 6px; margin: 0 2px; border-left: 1.5px solid currentColor; border-right: 1.5px solid currentColor; border-radius: 7px; line-height: 1.15; font-family: var(--math); font-size: .95em; }
.colv > span { display: block; }
.vb { font-weight: 700; font-style: normal; text-decoration: underline; text-underline-offset: 3px; }

/* revision hub */
.bh { font-size: 1.15rem; margin: 0 0 12px; }
.rv-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.rv-last { margin: 0; padding-left: 1.2em; line-height: 1.8; }
.rv-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rv-top li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r, 10px); background: var(--surface, var(--paper)); }
.rv-top li span { color: var(--muted); font-size: .9rem; }
.rv-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.rv-f { border: 1px solid var(--rule); border-radius: var(--r, 10px); padding: 12px 14px; background: var(--surface, var(--paper)); }
.rv-fm { font-size: 1.2rem; margin-bottom: 6px; overflow-x: auto; }
.rv-f p { margin: 4px 0; }
.rv-sum { margin-top: 18px; }
.rv-foot { margin-top: 24px; color: var(--muted); }
.kw-nocalc .tb-calc, .kw-nocalc .kwcalc, .kw-nocalc #kw-calc { display: none !important; }
.mat { display: inline-grid; vertical-align: middle; column-gap: .7em; row-gap: .05em; padding: 1px 6px; margin: 0 2px; border-left: 1.5px solid currentColor; border-right: 1.5px solid currentColor; border-radius: 7px; line-height: 1.2; font-family: var(--math); font-size: .95em; text-align: center; }
.mat.det { border-radius: 0; }
.mat > .aug { border-left: 1px solid currentColor; padding-left: .5em; }

/* 2026-12-01: answer box and keys styled like the science answer line and chip buttons */
.mxv { border: 0 !important; border-bottom: 1.5px solid var(--ink) !important; border-radius: 0 !important; background: transparent !important; }
.mxv:focus { box-shadow: 0 2px 0 var(--accent) !important; }
.mxk { min-width: 44px; min-height: 36px; padding: 4px 14px; border: 1px solid var(--rule); border-radius: 999px; background: transparent; font-size: .98rem; font-weight: 500; }
.mxk:hover { border-color: var(--accent); background: var(--accent-soft); }
.mx-prev.on::before { font-family: var(--mono); }
