/* =====================================================================
   MyLab-style inputs — the answer box, math palette and graphing tool, with
   colors sampled from Pearson's help-center screenshots (answer box border
   #737672, template boxes #bfe0ff, cursor #3a44ff, palette tiles #e1e3df).
   The box, palette and grapher stay light like the originals.
   ===================================================================== */
:root {
  --p-teal: #047a9c; --p-head: #007899; --p-quiz: #b00a4b; --p-ink: #333333; --p-ink2: #505759;
  --p-line: #c0c9c1; --p-hr: #d9d9d9; --p-box: #737672; --p-slot: #bfe0ff; --p-cursor: #3a44ff;
  --p-bad: #910b08; --p-good: #118943; --p-gray: #d6d7da; --p-btn: #e1e3df; --p-fb: #f8f9fa; --p-foot: #f6f8f8;
  --p-sans: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --p-math: "Times New Roman", "STIX Two Math", "Cambria Math", Times, serif;
}

/* ------------------------------------------------------------------ answer parts (inside the app's own pages) */
:root { --p-inst: #047a9c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --p-inst: #5bb8d4; } }
:root[data-theme="dark"] { --p-inst: #5bb8d4; }
.mlp-part { padding-top: 12px; }
.mlp-part + .mlp-part { margin-top: 6px; }
.mlp-q { margin: 0 0 10px; line-height: 1.6; }
.mlp-line { line-height: 2.1; }
.mlp-lab p, .mlp-q p { display: inline; margin: 0; }
.mlp-prefix { margin-right: 6px; }
.mlp-inst { color: var(--p-inst); font-size: 14.5px; margin-top: 4px; }
.mlp-inst.inline { display: inline; margin: 0 0 0 8px; }
.mlp-choices { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.mlp-choices.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.mlp-choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.6; }
.mlp-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mlp-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-3); flex: none; margin-top: 2px; background: var(--card); box-sizing: border-box; }
.mlp-choice:hover .mlp-radio { border-color: var(--p-inst); }
.mlp-choice input:checked + .mlp-radio { border: 2px solid var(--p-inst); box-shadow: inset 0 0 0 3px var(--card); background: var(--p-inst); }
.mlp-choice input:focus-visible + .mlp-radio { outline: 2px solid var(--p-inst); outline-offset: 2px; }
.mlp-choice input:disabled ~ * { cursor: default; }
.mlp-letter { min-width: 1.6em; }
.mlp-cbody { flex: 1; }
/* a compound choice's radio and letter line up with the middle of its answer box */
.mlp-compound > .mlp-radio { margin-top: 14px; }
.mlp-compound > .mlp-letter { margin-top: 11px; }
.mlp-choices.figs .mlp-choice { flex-wrap: wrap; }
.mlp-fig { display: block; width: 100%; order: 3; } .mlp-fig svg { width: 100%; max-width: 240px; height: auto; }

/* ------------------------------------------------------------------ answer box */
.mlb { display: inline-flex; align-items: center; vertical-align: middle; background: #fff; border: 1px solid #8d918d; border-radius: 4px;
  min-width: min(288px, 100%); min-height: 46px; padding: 4px 5px 4px 10px; box-sizing: border-box; cursor: text; margin: 3px 2px; position: relative; line-height: normal;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07); transition: border-color .12s, box-shadow .12s; }
.mlb:hover:not(.off):not(.locked) { border-color: #5f6360; }
.mlb:focus-within { border-color: #2f6bd0; box-shadow: 0 0 0 3px rgba(47,107,208,.22); }
.mlb.off { background: var(--p-gray); border-color: var(--p-gray); }
.mlb.off .mlb-pal, .mlb.locked .mlb-pal { visibility: hidden; }
.mlb.locked { cursor: default; }
.mlb-pal { width: 32px; height: 32px; flex: none; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--p-teal); }
.mf + .mlb-pal { margin-left: 8px; }
.mlb-pal svg { width: 28px; height: 28px; }
.mlb-pal .pic-int { font: italic 16px var(--p-math); fill: currentColor; }
.mlb-pal .pic-t { font: 8.5px var(--p-math); fill: currentColor; font-style: italic; }
.mlb-pal:hover { background: #e2f0f4; }
.mlb.pal-open .mlb-pal { background: var(--p-teal); color: #fff; }
.mf { display: inline-flex; align-items: center; position: relative; font-family: var(--p-math); font-size: 20px; color: #000; min-height: 32px; flex: 1 1 auto; }
.mf-ta { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; margin: 0; resize: none; overflow: hidden; pointer-events: none; }
.mf-view { display: inline-flex; align-items: center; min-height: 32px; }
.mf-row { display: inline-flex; align-items: baseline; white-space: nowrap; position: relative; }
.mf-top { min-width: 2px; min-height: 24px; align-items: center; }
.mf-box { background: var(--p-slot); }
.mf-empty { min-width: .62em; min-height: 1.02em; align-self: center; }
.mf-ch { padding: 0 .015em; }
.mf-ch.var.const { font-style: italic; }
.mf-ch.bin { padding: 0 .22em; }
.mf-ch.comma { padding-right: .18em; }
.mf-ch.unary { padding: 0 .04em 0 0; }
.mf-ch.space { width: .3em; display: inline-block; }
.mf-unmatched { color: #e00000; }
.mf-sel { background: #b4d5fe; }
.mf-t.mf-sel, .mf-t.mf-sel .mf-box { background: #9cc6f7; }
.mf-cursor { display: inline-block; width: 0; border-left: 2px solid var(--p-cursor); height: 1.15em; margin: 0 -1px; align-self: center; animation: mf-blink 1.06s steps(1) infinite; position: relative; z-index: 1; }
.mf-cursor.small { height: .82em; border-left-width: 1.6px; }
.mf-top > .mf-cursor { height: 1.3em; border-left-width: 3px; }
@keyframes mf-blink { 50% { opacity: 0; } }
.mf.disabled .mf-cursor { display: none; }
.mf-t { display: inline-flex; }
.mf-frac { flex-direction: column; align-items: stretch; vertical-align: middle; margin: 0 .1em; align-self: center; }
.mf-frac > .mf-num, .mf-frac > .mf-den { justify-content: center; font-size: .9em; padding: 0 .12em; }
.mf-frac > .mf-num { border-bottom: 1px solid currentColor; padding-bottom: 2px; margin-bottom: 1px; }
.mf-frac > .mf-den { padding-top: 1px; }
.mf-frac > .mf-empty { min-width: .7em; }
.mf-mixed { align-items: center; align-self: center; }
.mf-mixed > .mf-whole { margin-right: .08em; }
.mf-pow > .mf-sup { font-size: .7em; align-self: flex-start; position: relative; top: -.35em; margin-left: .03em; }
.mf-sub > .mf-subs, .mf-subsub > .mf-subs { font-size: .7em; align-self: flex-end; position: relative; top: .3em; }
.mf-supsub { align-items: center; align-self: center; }
.mf-stack { display: inline-flex; flex-direction: column; font-size: .7em; margin-left: .04em; gap: 1px; }
.mf-subsub { align-items: center; }
.mf-sqrt, .mf-root { align-items: stretch; align-self: center; }
.mf-radical { font-size: 1.05em; line-height: 1; transform-origin: 50% 100%; display: inline-block; align-self: flex-end; margin-right: -.04em; }
.mf-radicand { border-top: 1px solid currentColor; padding: 2px .1em 0 .06em; margin-top: .12em; }
.mf-index { font-size: .58em; align-self: flex-start; margin-right: -.4em; position: relative; top: .05em; z-index: 1; }
.mf-abs { align-items: center; align-self: center; }
.mf-bar { padding: 0 .06em; display: inline-block; transform-origin: 50% 50%; color: #000; }
.mf-paren { display: inline-block; transform-origin: 50% 55%; }
.mf-accent { display: block; height: .3em; border-top: 1px solid currentColor; margin: 0 .05em; font-size: .7em; line-height: .2; text-align: center; }
.mf-bar.mf-t, .mf-dbar, .mf-hat, .mf-bar { vertical-align: middle; }
.mf-bar.mf-t, .mf-dbar, .mf-hat { flex-direction: column; align-items: center; }
.mf-dbar > .mf-accent { border-top: 3px double currentColor; }
.mf-hat > .mf-accent { border-top: 0; font-size: .8em; line-height: .6; height: .45em; }
.mf-limits { display: inline-flex; flex-direction: column; align-items: center; }
.mf-upper, .mf-lower { font-size: .62em; }
.mf-bigop { font-size: 1.5em; line-height: 1; }
.mf-matrix, .mf-det { align-items: center; align-self: center; }
.mf-grid { display: inline-grid; grid-template-columns: auto auto; gap: 2px 8px; font-size: .9em; padding: 0 3px; }
.mf-delim { display: inline-block; transform-origin: 50% 50%; }

/* ------------------------------------------------------------------ math palette popover */
.mpal { position: absolute; z-index: 60; background: #fff; border: 1px solid #e0e3e0; border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.08);
  font-family: var(--p-sans); padding: 0 12px 12px; max-width: calc(100vw - 16px); box-sizing: border-box; }
.mpal-tabs { display: flex; align-items: center; gap: 0; padding: 0 2px; margin: 0 -2px 8px; }
.mpal-tab { background: none; border: 0; font: 700 13px var(--p-sans); color: #8e8e8e; padding: 13px 14px 10px; cursor: pointer; border-bottom: 3px solid transparent; letter-spacing: .01em; white-space: nowrap; }
.mpal-tab:first-child { padding-left: 14px; }
.mpal-tab.on { color: var(--p-teal); border-bottom-color: var(--p-teal); }
.mpal-tab:hover:not(.on) { color: #5d6061; }
.mpal-kebab { margin-left: auto; width: 22px; height: 26px; background: none; border: 0; cursor: pointer; padding: 0; display: grid; place-items: center; }
.mpal-kebab svg { width: 4px; height: 16px; fill: #555; }
.mpal-menu { position: absolute; right: 8px; top: 40px; background: #fff; border: 1px solid #d9dcd9; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15); padding: 4px 0; z-index: 2; }
.mpal-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 16px; font: 13.5px var(--p-sans); cursor: pointer; white-space: nowrap; }
.mpal-menu button:hover { background: #eef5f7; }
.mpal-grid { display: grid; grid-template-columns: repeat(9, 36px); gap: 4px; }
.mpal-grid.wide { grid-template-columns: repeat(12, 36px); }
.mpal-btn { width: 36px; height: 36px; display: grid; place-items: center; background: var(--p-btn); border: 1px solid var(--p-btn); border-radius: 4px; cursor: pointer; padding: 0; color: #222; }
.mpal-btn:hover { background: #d3d6d1; border-color: #d3d6d1; }
.mpal-btn:active { background: #c6cac4; }
.mpal-btn svg { width: 24px; height: 24px; }
.mpal-btn .pi-slot { fill: none; stroke: #8b8f8b; stroke-width: .9; stroke-dasharray: 1.3 1.1; }
.mpal-btn .pi-ink { stroke: #333; stroke-width: 1.2; fill: none; }
.mpal-btn .pi-txt { font: 11px var(--p-math); fill: #333; }
.mpal-btn .pi-txt.big { font-size: 17px; }
.mpal-sym { font: 17px var(--p-math); line-height: 1; }
.mpal-more { font: 700 10.5px var(--p-sans); color: #333; }
.mpal-more.less { border: 1.5px solid var(--p-teal); background: #eceeea; }
.mpal-tip { position: absolute; z-index: 70; background: #252525; color: #fff; font: 12px var(--p-sans); padding: 5px 9px; border-radius: 3px; pointer-events: none; white-space: pre; }
.mpal-modal-back { position: fixed; inset: 0; background: rgba(20, 24, 28, .45); z-index: 90; display: grid; place-items: center; padding: 16px; }
.mpal-modal { background: #fff; border-radius: 8px; max-width: 640px; width: 100%; max-height: 86vh; overflow: auto; font-family: var(--p-sans); color: var(--p-ink); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.mpal-modal-h { display: flex; align-items: center; justify-content: space-between; font-weight: 700; padding: 16px 20px; border-bottom: 1px solid var(--p-hr); position: sticky; top: 0; background: #fff; }
.mpal-x { background: none; border: 0; font-size: 22px; cursor: pointer; line-height: 1; color: #444; }
.mpal-modal table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.mpal-modal td { padding: 8px 20px; border-bottom: 1px solid #eef0ef; vertical-align: top; }
.mpal-modal td code { font: 13px ui-monospace, Menlo, monospace; color: #1b4f63; }
.gr-help { margin: 0; padding: 14px 20px 18px 38px; line-height: 1.6; font-size: 14px; }

/* ------------------------------------------------------------------ grapher */
.gr-inline { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; margin: 6px 0; font-family: var(--p-sans); }
.gr-enlarge { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; font: 13.5px var(--p-sans); color: #222; text-align: center; line-height: 1.25; cursor: pointer;
  background: linear-gradient(#fdfdfd, #dedede); border: 1px solid #a9a9a9; border-radius: 3px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.gr-enlarge:hover { background: linear-gradient(#fff, #e8e8e8); }
.gr-enlarge-ic svg { width: 34px; height: 34px; }
.gr-enlarge-ic .gi-l { stroke: #e0a132; stroke-width: 1.8; fill: none; }
.gr-enlarge-ic .gi-pt { fill: #3a6fd8; }
.gr-stage { position: relative; display: inline-block; padding-right: 44px; }
.gr-canvas { line-height: 0; outline: none; }
.gr-canvas:focus, .gr-canvas:focus-visible { outline: none; }
.gr-icons { position: absolute; right: 0; top: 0; display: flex; flex-direction: column; gap: 8px; }
.gr-ic { width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid #d8d8d8; display: grid; place-items: center; cursor: pointer; padding: 0; }
.gr-ic svg { width: 18px; height: 18px; stroke: #222; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.gr-ic:hover { border-color: #b9b9b9; }
.gr-coord { font-size: 14px; text-align: right; min-height: 20px; padding-top: 6px; margin-right: -44px; color: var(--ink-2, #222); }
.gr-inline.locked .gr-icons, .gr-inline.locked .gr-enlarge { display: none; }
.gr-inline.locked svg { cursor: default !important; }
.gr-svg { display: block; touch-action: none; cursor: crosshair; user-select: none; background: #fff; }
.gr-svg .gr-bg { fill: #fff; }
.gr-svg .gr-grid line { stroke: #cfcfcf; stroke-width: 1; }
.gr-svg .gr-frame { fill: none; stroke: #bdbdbd; stroke-width: 1; }
.gr-svg .gr-axes line { stroke: #222; stroke-width: 1.2; }
.gr-svg .gr-axhead { fill: #222; }
.gr-svg .gr-tick { fill: #222; font: 10.5px Arial, Helvetica, sans-serif; }
.gr-svg .gr-obj { stroke: #3a6fd8; stroke-width: 2.4; fill: none; pointer-events: none; }
.gr-svg .gr-obj.dashed { stroke-dasharray: 7 5; }
.gr-svg .gr-obj.sel { stroke: #e7a534; }
.gr-svg .gr-obj.ghost { stroke: #3a6fd8; opacity: .55; }
.gr-svg .gr-hit { stroke: transparent; stroke-width: 12; fill: none; pointer-events: stroke; cursor: pointer; }
.gr-svg .gr-asym { stroke: #3a6fd8; stroke-width: 1.4; stroke-dasharray: 6 5; opacity: .8; pointer-events: none; }
.gr-svg .gr-closed { fill: #3a6fd8; stroke: #fff; stroke-width: 1; cursor: pointer; }
.gr-svg .gr-open { fill: #fff; stroke: #3a6fd8; stroke-width: 2.2; cursor: pointer; }
.gr-svg .gr-closed.sel, .gr-svg .gr-open.sel { stroke: #e7a534; }
.gr-svg .gr-def { fill: rgba(106, 160, 232, .55); stroke: #6a9fe0; stroke-width: 1.2; cursor: pointer; }
.gr-svg .gr-def-hit { fill: transparent; cursor: pointer; }
.gr-svg .gr-bull { fill: none; stroke: #3a6fd8; stroke-width: 2; pointer-events: none; }
.gr-svg .gr-handle { fill: #fff; stroke: #3a6fd8; stroke-width: 2; cursor: pointer; }
.gr-thumb { display: inline-block; line-height: 0; border: 1px solid #ddd; }
.gr-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: #d8d8d8; border-top: 1px solid #bdbdbd; min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 6px 48px 6px 22px; font-family: var(--p-sans); flex-wrap: wrap; }
.gr-bar.in-modal { position: absolute; }
.gr-bar-status { width: 118px; font-size: 14px; line-height: 1.25; color: #444; }
.gr-bar-status b { display: block; font-weight: 700; }
.gr-bar-tools { display: flex; gap: 6px; align-items: center; margin: 0 auto 0 0; flex-wrap: wrap; }
.gr-tool { width: 44px; height: 38px; border-radius: 4px; border: 1px solid #a8a8a8; background: linear-gradient(#ffffff, #e2e2e2); display: grid; place-items: center; cursor: pointer; padding: 0; position: relative; box-shadow: 0 1px 0 rgba(255,255,255,.7) inset; }
.gr-tool:hover { background: linear-gradient(#fff, #eeeeee); }
.gr-tool.on { background: linear-gradient(#e6e6e6, #cfcfcf); box-shadow: inset 0 2px 4px rgba(0,0,0,.25); border-color: #8a8a8a; }
.gr-tool svg { width: 26px; height: 26px; }
.gr-tool .gi-l { stroke: #3a3a3a; stroke-width: 1.8; fill: none; }
.gr-tool .gi-pt { fill: #3a6fd8; }
.gr-tool .gi-c { fill: #3a6fd8; } .gr-tool .gi-o { fill: #fff; stroke: #3a6fd8; stroke-width: 1.6; } .gr-tool .gi-f { fill: #3a3a3a; }
.gr-tool .gi-arrow { fill: #111; }
.gr-tri { position: absolute; right: 2px; bottom: 2px; width: 0; height: 0; border-left: 6px solid transparent; border-bottom: 6px solid #555; }
.gr-fly { position: absolute; bottom: calc(100% + 4px); display: flex; gap: 4px; background: #e9e9e9; border: 1px solid #aaa; border-radius: 4px; padding: 4px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.gr-style { display: flex; flex-direction: column; width: 56px; height: 40px; border: 1px solid #a8a8a8; border-radius: 4px; overflow: hidden; }
.gr-style button { flex: 1; border: 0; background: linear-gradient(#fff, #e6e6e6); cursor: pointer; display: grid; place-items: center; padding: 0; }
.gr-style button + button { border-top: 1px solid #a8a8a8; }
.gr-style button.on { background: #cfd8e8; box-shadow: inset 0 0 0 2px #3f8fd6; }
.gr-style i { display: block; width: 30px; height: 0; border-top: 3px solid #666; }
.gr-style-dashed i { border-top-style: dashed; }
.gr-act { height: 38px; min-width: 56px; padding: 0 12px; border-radius: 4px; border: 1px solid #a8a8a8; background: linear-gradient(#fff, #e2e2e2); font: 14px var(--p-sans); color: #111; cursor: pointer; }
.gr-act:disabled { color: #b0b0b0; cursor: default; background: linear-gradient(#f4f4f4, #e6e6e6); }
.gr-act.q { font-weight: 700; color: #3a6fd8; font-size: 17px; min-width: 44px; }
.gr-act.primary { background: var(--p-teal); color: #fff; border-color: var(--p-teal); font-weight: 700; }
.gr-bar-x { position: absolute; right: 12px; top: 6px; background: none; border: 0; font-size: 18px; cursor: pointer; color: #333; }
.gr-modal-back { position: fixed; inset: 0; background: rgba(20, 24, 28, .5); z-index: 65; display: grid; place-items: center; padding: 10px 10px 70px; }
.gr-modal { background: #fff; border-radius: 4px; box-shadow: 0 16px 50px rgba(0,0,0,.35); max-width: 100%; max-height: calc(100vh - 90px); overflow: auto; font-family: var(--p-sans); }
.gr-modal-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #ddd; font-weight: 700; }
.gr-modal-x { background: none; border: 0; font-size: 18px; cursor: pointer; }
.gr-modal-body { padding: 12px 18px; }
.gr-modal-body .gr-svg { width: min(560px, calc(100vw - 60px)); height: auto; }
.gr-modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 14px; border-top: 1px solid #ddd; }
.gr-edit-back { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: rgba(0,0,0,.2); }
.gr-edit { background: #fff; border: 1px solid #999; border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.3); padding: 14px 16px; font: 14px var(--p-sans); min-width: 250px; }
.gr-edit-t { font-weight: 700; margin-bottom: 10px; }
.gr-edit-row { display: flex; gap: 12px; margin-top: 8px; align-items: center; }
.gr-edit-row.end { justify-content: flex-end; }
.gr-edit input { width: 64px; padding: 4px 6px; border: 1px solid var(--p-box); border-radius: 2px; font: 15px var(--p-math); }
.gr-edit-err { color: var(--p-bad); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* Narrow screens: the tabs shrink, and scroll if they still don't fit; the ⋮ menu stays in view. */
@media (max-width: 480px) {
  .mpal { padding: 0 8px 10px; }
  .mpal-tabs { overflow-x: auto; scrollbar-width: none; }
  .mpal-tabs::-webkit-scrollbar { display: none; }
  .mpal-tab, .mpal-tab:first-child { padding: 12px 7px 9px; font-size: 12px; }
  .mpal-kebab { position: sticky; right: 0; flex: none; background: #fff; }
}

/* "Your answer" in feedback: the student's own entry, drawn like the box but read-only and without its frame */
.mf.mf-static { display: inline-flex; min-height: 0; font-size: 18px; vertical-align: middle; flex: none; }
.mf.mf-static .mf-view { min-height: 0; }
.yours-plain { font-size: 15px; }
