/* MskProd interactive tools bundle. Generated by build.py. */
/* ---- _common ---- */
/* Chrome shared by every interactive tool.
 *
 * The tool scripts have always emitted .tool, .tool-head, .tool-btn,
 * .tool-field and friends, but only the per tool files were ever written, so
 * none of these had a single rule: every tool rendered as unstyled browser
 * default buttons and inputs on a bare white page. This file is the missing
 * half, and because it lives in the tools bundle it is only served to pages
 * that actually mount a tool.
 */
.tool {
  margin: var(--sp-5) 0;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
}
.tool-head {
  display: flex; align-items: center; gap: .55rem;
  flex-wrap: wrap; min-width: 0;
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.tool-head .icon { width: 1.15rem; height: 1.15rem; color: var(--teal); flex: none; }
.tool-head h4 {
  margin: 0; min-width: 0; font-size: 1rem; font-weight: 650; color: var(--ink);
}
.tool-fallback { margin: 0; color: var(--ink-3); font-size: .92rem; line-height: 1.6; }

/* Controls ---------------------------------------------------------------- */
.tool-row {
  display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end;
  margin-bottom: .9rem;
}
.tool-field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.tool-field label, .tool-label {
  font-size: .75rem; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
}
.tool input[type="text"], .tool input[type="number"],
.tool select, .tool textarea {
  font: inherit; font-size: .92rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-s); padding: .45rem .6rem; min-width: 0; max-width: 100%;
}
.tool textarea { font-family: var(--font-mono); font-size: .85rem; line-height: 1.7; }
/* A dropdown has to be able to show its longest option: in "24 bit, 16.7
   million colours" the part that matters is at the end. Browsers without :has
   simply keep the field's own flex basis. */
.tool-field:has(select) { flex-basis: auto; }
.tool input[type="range"] { accent-color: var(--teal); }
.tool input:focus-visible, .tool select:focus-visible, .tool textarea:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 1px;
}
.tool-btns { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 .9rem; }
.tool-btn {
  font: inherit; font-size: .85rem; font-weight: 600; padding: .4rem 1rem;
  border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tool-btn:hover { background: var(--accent-quiet); color: var(--accent); border-color: transparent; }
.tool-btn.is-primary { background: var(--grad-brand); color: #fff; border-color: transparent; }
.tool-btn.is-primary:hover { color: #fff; filter: brightness(1.08); }
.tool-btn:disabled { opacity: .5; cursor: not-allowed; }
.tool-btn:disabled:hover { background: var(--surface); color: var(--ink-2); border-color: var(--border-strong); }

/* Output ------------------------------------------------------------------ */
.tool-note { margin: .6rem 0 0; font-size: .88rem; color: var(--ink-3); line-height: 1.6; }
.tool-status { margin: .5rem 0 0; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.tool-status.is-good { color: var(--ok); }
.tool-status.is-bad { color: var(--bad); }
.tool-working {
  font-family: var(--font-mono); font-size: .84rem; line-height: 1.75;
  color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-s);
  padding: .65rem .8rem; margin: .5rem 0 0;
}
.tool .muted { color: var(--ink-3); }
.tool table { width: 100%; border-collapse: collapse; font-size: .9rem; }
/* No text-transform here: a column header is often a variable name, and an
   uppercased i is a different variable. */
.tool th {
  text-align: left; font-size: .82rem; font-weight: 700; color: var(--ink-2);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  padding: .45rem .5rem;
}
.tool td { border-bottom: 1px solid var(--border); }

[data-theme="dark"] .tool-btn.is-primary,
[data-theme="dark"] .tool-btn.is-primary:hover { color: #06231F; }
/* ---- base-converter ---- */
/* The working keeps its binary columns aligned with white-space: pre, so it
   cannot wrap and must scroll inside its own box instead of widening the page. */
.tool[data-tool="base-converter"] .tool-working {
  min-height: 2.4rem; white-space: pre; overflow-x: auto; max-width: 100%;
}
.tool[data-tool="base-converter"] input.tool-mono { letter-spacing: .05em; }
/* ---- file-size ---- */
.tool[data-tool="file-size"] .tool-field { flex: 1 1 10rem; }
.tool[data-tool="file-size"] .tool-working { line-height: 1.9; white-space: normal; }
.tool[data-tool="file-size"] .tool-working div { display: flex; gap: .4rem; flex-wrap: wrap; }
/* ---- logic-simulator ---- */
.tool[data-tool="logic-simulator"] .ls-canvas {
  display: block; width: 100%; height: auto; touch-action: none;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-s);
}
.tool[data-tool="logic-simulator"] .ls-gate {
  fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.6; cursor: grab;
}
.tool[data-tool="logic-simulator"] .ls-gate-label {
  fill: var(--ink-muted); font-size: 10px; font-weight: 700; text-anchor: middle;
  pointer-events: none;
}
.tool[data-tool="logic-simulator"] .ls-del {
  fill: var(--ink-muted); font-size: 12px; font-weight: 700; cursor: pointer;
  text-anchor: middle;
}
.tool[data-tool="logic-simulator"] .ls-del:hover { fill: var(--bad); }
.tool[data-tool="logic-simulator"] .ls-input,
.tool[data-tool="logic-simulator"] .ls-output {
  fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.6; cursor: pointer;
}
.tool[data-tool="logic-simulator"] .ls-input.is-on,
.tool[data-tool="logic-simulator"] .ls-output.is-on {
  fill: var(--accent-quiet); stroke: var(--accent);
}
.tool[data-tool="logic-simulator"] .ls-label {
  fill: var(--ink); font-size: 14px; font-weight: 700; text-anchor: middle;
  pointer-events: none;
}
.tool[data-tool="logic-simulator"] .ls-value {
  fill: var(--ink-muted); font-size: 11px; font-weight: 600; text-anchor: middle;
  pointer-events: none;
}
.tool[data-tool="logic-simulator"] .ls-port {
  fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.5; cursor: crosshair;
}
.tool[data-tool="logic-simulator"] .ls-port:hover { fill: var(--accent); stroke: var(--accent); }
.tool[data-tool="logic-simulator"] .ls-wire {
  fill: none; stroke: var(--ink-3); stroke-width: 2; pointer-events: none;
}
.tool[data-tool="logic-simulator"] .ls-wire.is-on { stroke: var(--accent); stroke-width: 2.6; }
.tool[data-tool="logic-simulator"] .ls-wire.is-temp { stroke-dasharray: 5 4; }
.tool[data-tool="logic-simulator"] .ls-wire-hit {
  fill: none; stroke: transparent; stroke-width: 12; cursor: pointer;
}
.tool[data-tool="logic-simulator"] .ls-q.is-on { color: var(--accent-strong); font-weight: 700; }
.tool[data-tool="logic-simulator"] table { max-width: 26rem; }
/* ---- sort-visualiser ---- */
.tool[data-tool="sort-visualiser"] .sv-grid {
  display: grid; gap: .8rem; margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}
.tool[data-tool="sort-visualiser"] .sv-card {
  border: 1px solid var(--border); border-radius: var(--r-s);
  padding: .7rem .8rem; background: var(--surface-2); min-width: 0;
}
.tool[data-tool="sort-visualiser"] .sv-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: .5rem; flex-wrap: wrap;
}
.tool[data-tool="sort-visualiser"] .sv-head h5 {
  margin: 0; font-size: .88rem; font-weight: 660; color: var(--ink);
}
.tool[data-tool="sort-visualiser"] .sv-counts {
  font-size: .74rem; color: var(--ink-muted); font-variant-numeric: tabular-nums;
}
.tool[data-tool="sort-visualiser"] .sv-note {
  margin: .2rem 0 .5rem; font-size: .75rem; color: var(--ink-muted);
}
.tool[data-tool="sort-visualiser"] .sv-bars {
  display: flex; align-items: flex-end; gap: 2px; height: 110px;
  background: var(--surface); border-radius: 6px; padding: 4px;
  border: 1px solid var(--border);
}
.tool[data-tool="sort-visualiser"] .sv-bar {
  flex: 1 1 0; min-width: 0; background: var(--ink-muted); border-radius: 2px 2px 0 0;
}
.tool[data-tool="sort-visualiser"] .sv-bar.is-active { background: var(--bad); }
.tool[data-tool="sort-visualiser"] .sv-bar.is-done { background: var(--accent); }
.tool[data-tool="sort-visualiser"] .sv-foot {
  margin: .45rem 0 0; font-size: .74rem; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.tool[data-tool="sort-visualiser"] .sv-foot.is-done { color: var(--ok); font-weight: 620; }
@media (prefers-reduced-motion: reduce) {
  .tool[data-tool="sort-visualiser"] .sv-bar { transition: none; }
}
/* ---- trace-table ---- */
.tool[data-tool="trace-table"] .tt-split {
  display: grid; gap: 1rem; margin-top: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}
.tool[data-tool="trace-table"] .tt-left,
.tool[data-tool="trace-table"] .tt-right { min-width: 0; }
/* The code sits in a normal <pre>, which the site styles as a dark block with
   light text. This panel used to give itself a light background and set the
   code colour to dark ink, which left near black text on the dark pre at a
   contrast ratio of 1.02. It now inherits the ordinary code block look. */
.tool[data-tool="trace-table"] .tt-code { border-radius: var(--r-s); }
.tool[data-tool="trace-table"] .tt-code pre { margin: 0; }
.tool[data-tool="trace-table"] .tt-code code {
  font-family: var(--font-mono); font-size: .84rem; line-height: 1.85;
  color: inherit; background: none; padding: 0; border: 0; white-space: pre;
}
.tool[data-tool="trace-table"] .tt-num {
  display: inline-block; width: 2.2em; color: #9FC4C2; user-select: none;
}
/* An empty cell has to look like somewhere you can type, or the table reads as
   a finished thing rather than a blank to fill in. */
.tool[data-tool="trace-table"] .tt-cell {
  width: 100%; min-width: 3.4rem; text-align: center;
  border: 1px solid var(--border); background: var(--surface);
  padding: .3rem .2rem; font-size: .88rem; color: var(--ink); border-radius: 4px;
}
.tool[data-tool="trace-table"] .tt-cell:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 1px;
}
.tool[data-tool="trace-table"] .tt-cell.is-good { background: var(--ok-bg); color: var(--ok); font-weight: 640; }
.tool[data-tool="trace-table"] .tt-cell.is-bad { background: var(--bad-bg); color: var(--bad); font-weight: 640; }
.tool[data-tool="trace-table"] td { padding: 0; }
.tool[data-tool="trace-table"] .tt-given td {
  background: var(--surface-2); color: var(--ink-muted); font-family: var(--font-mono);
  font-size: .85rem; padding: .35rem .4rem;
}
/* ---- lmc ---- */
.tool[data-tool="lmc"] .lmc-side { flex: 1 1 14rem; min-width: 0; display: flex;
  flex-direction: column; gap: .7rem; }
.tool[data-tool="lmc"] textarea { min-height: 15rem; }
.tool[data-tool="lmc"] .lmc-regs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr)); gap: .4rem;
}
.tool[data-tool="lmc"] .lmc-reg {
  border: 1px solid var(--border); border-radius: var(--r-s);
  background: var(--surface-2); padding: .4rem .55rem; display: flex;
  flex-direction: column; gap: .1rem; min-width: 0;
}
.tool[data-tool="lmc"] .lmc-reg-name {
  font-size: .64rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 640;
}
.tool[data-tool="lmc"] .lmc-reg-val {
  font-family: var(--font-mono); font-size: 1rem; color: var(--accent-strong);
}
.tool[data-tool="lmc"] .lmc-out {
  font-family: var(--font-mono); font-size: .92rem; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-s); padding: .55rem .7rem; min-height: 2.4rem;
  overflow-x: auto; white-space: nowrap;
}
.tool[data-tool="lmc"] .lmc-boxes {
  display: grid; grid-template-columns: repeat(10, minmax(3.1rem, 1fr));
  gap: 3px; margin-top: .9rem; min-width: 32rem;
}
.tool[data-tool="lmc"] .lmc-box {
  border: 1px solid var(--border); border-radius: 5px; background: var(--surface);
  padding: .25rem .1rem; text-align: center; display: flex; flex-direction: column;
}
.tool[data-tool="lmc"] .lmc-box.is-used { background: var(--surface-2); }
.tool[data-tool="lmc"] .lmc-box.is-pc {
  border-color: var(--accent); background: var(--accent-quiet); box-shadow: 0 0 0 1px var(--accent);
}
.tool[data-tool="lmc"] .lmc-addr { font-size: .6rem; color: var(--ink-muted); }
.tool[data-tool="lmc"] .lmc-val {
  font-family: var(--font-mono); font-size: .8rem; color: var(--ink-2); font-weight: 500;
}
.tool[data-tool="lmc"] .lmc-box.is-pc .lmc-val { color: var(--accent-strong); font-weight: 700; }
/* ---- confusion-matrix ---- */
/* Classifier scorer. The two score distributions have to be legible when they
   overlap, so the flagged class is drawn solid and the other translucent
   rather than relying on hue alone. */
.tool[data-tool="confusion-matrix"] .cm-thf { flex: 1 1 14rem; }
.tool[data-tool="confusion-matrix"] .cm-thf input[type="range"] { width: 100%; }

.tool[data-tool="confusion-matrix"] .cm-chart {
  margin: .4rem 0 .3rem; color: var(--ink-3);
}
.tool[data-tool="confusion-matrix"] .cm-chart svg { width: 100%; height: auto; }
.tool[data-tool="confusion-matrix"] .cm-pos { fill: var(--teal); fill-opacity: .85; }
.tool[data-tool="confusion-matrix"] .cm-neg { fill: var(--purple); fill-opacity: .45; }
.tool[data-tool="confusion-matrix"] .cm-thresh {
  stroke: var(--bad); stroke-width: 2.5; stroke-dasharray: 5 4;
}
.tool[data-tool="confusion-matrix"] .cm-axis {
  font-size: 10px; font-weight: 600; fill: var(--ink-3);
}
.tool[data-tool="confusion-matrix"] .cm-axis-t { fill: var(--bad); }

.tool[data-tool="confusion-matrix"] .cm-legend {
  margin: 0 0 .9rem; font-size: .84rem; color: var(--ink-3); line-height: 1.6;
}
.tool[data-tool="confusion-matrix"] .cm-key {
  display: inline-block; width: .7rem; height: .7rem; border-radius: 2px;
  vertical-align: -1px;
}
.tool[data-tool="confusion-matrix"] .cm-key-pos { background: var(--teal); }
.tool[data-tool="confusion-matrix"] .cm-key-neg { background: var(--purple); opacity: .55; }

.tool[data-tool="confusion-matrix"] .cm-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
}
.tool[data-tool="confusion-matrix"] .cm-cell {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .6rem .7rem; border-radius: var(--r-s);
  border: 1px solid var(--border);
}
.tool[data-tool="confusion-matrix"] .cm-cell.is-good {
  background: var(--accent-quiet); border-color: color-mix(in srgb, var(--teal) 35%, transparent);
}
.tool[data-tool="confusion-matrix"] .cm-cell.is-bad {
  background: color-mix(in srgb, var(--bad) 10%, transparent);
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
}
.tool[data-tool="confusion-matrix"] .cm-cell-name {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
}
.tool[data-tool="confusion-matrix"] .cm-cell-n {
  font-size: 1.5rem; font-weight: 750; line-height: 1.1; color: var(--ink);
}
.tool[data-tool="confusion-matrix"] .cm-cell-why {
  font-size: .78rem; color: var(--ink-3);
}

.tool[data-tool="confusion-matrix"] .cm-measures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: .5rem; margin-top: .6rem;
}
.tool[data-tool="confusion-matrix"] .cm-measure {
  padding: .55rem .65rem; border: 1px solid var(--border);
  border-radius: var(--r-s); background: var(--surface-2);
  display: flex; flex-direction: column; gap: .1rem;
}
.tool[data-tool="confusion-matrix"] .cm-measure.is-key {
  border-color: var(--teal); background: var(--accent-quiet);
}
.tool[data-tool="confusion-matrix"] .cm-m-name {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
}
.tool[data-tool="confusion-matrix"] .cm-m-val {
  font-size: 1.25rem; font-weight: 750; color: var(--ink);
}
/* The substitution is the teaching: 186/250 has to be readable, so it wraps
   rather than being clipped by the tile. */
.tool[data-tool="confusion-matrix"] .cm-m-sub {
  font-size: .74rem; color: var(--ink-3); background: none; padding: 0;
  overflow-wrap: anywhere; line-height: 1.5;
}
@media (max-width: 30rem) {
  .tool[data-tool="confusion-matrix"] .cm-grid { grid-template-columns: 1fr; }
}
/* ---- correlation-lab ---- */
/* Correlation lab. The plot and the readout sit side by side on a wide screen
   and stack on a phone, because the coefficient has to stay visible while a
   point is being dragged. */
.tool[data-tool="correlation-lab"] .cl-wrap {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start;
}
.tool[data-tool="correlation-lab"] .cl-plot {
  flex: 1 1 18rem; min-width: 0; max-width: 28rem; height: auto;
  touch-action: none; cursor: crosshair;
}
.tool[data-tool="correlation-lab"] .cl-bg { fill: var(--surface-2); }
.tool[data-tool="correlation-lab"] .cl-grid {
  stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 5;
}
.tool[data-tool="correlation-lab"] .cl-axis { stroke: var(--border-strong); stroke-width: 1.6; }
.tool[data-tool="correlation-lab"] .cl-fit { stroke: var(--purple); stroke-width: 2.6; }
.tool[data-tool="correlation-lab"] .cl-pt {
  fill: var(--teal); fill-opacity: .85; stroke: var(--surface); stroke-width: 1.4;
  cursor: grab;
}
.tool[data-tool="correlation-lab"] .cl-pt:hover { fill-opacity: 1; r: 7; }
.tool[data-tool="correlation-lab"] .cl-lab {
  font-size: 10px; font-weight: 650; fill: var(--ink-3);
}

.tool[data-tool="correlation-lab"] .cl-side { flex: 1 1 11rem; min-width: 0; }
.tool[data-tool="correlation-lab"] .cl-r {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .7rem .8rem; border-radius: var(--r-s);
  background: var(--accent-quiet);
  border: 1px solid color-mix(in srgb, var(--teal) 35%, transparent);
}
.tool[data-tool="correlation-lab"] .cl-r-name {
  font-family: var(--font-mono); font-size: .8rem; font-weight: 700;
  color: var(--ink-3);
}
.tool[data-tool="correlation-lab"] .cl-r-val {
  font-size: 2rem; font-weight: 750; line-height: 1.05; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* --accent, not --teal: on the pale accent-quiet panel the raw brand teal
   comes out at about 3:1, which fails AA for text this size. */
.tool[data-tool="correlation-lab"] .cl-r-word {
  font-size: .82rem; font-weight: 650; color: var(--accent);
}
.tool[data-tool="correlation-lab"] .cl-eqn {
  margin: .6rem 0 0; font-size: .84rem; color: var(--ink-3);
}
.tool[data-tool="correlation-lab"] .cl-eqn code { font-size: .84rem; }
.tool[data-tool="correlation-lab"] .cl-count {
  margin: .3rem 0 0; font-size: .78rem; color: var(--ink-3);
}
.tool[data-tool="correlation-lab"] .cl-hint {
  font-size: .82rem;
}
.tool[data-tool="correlation-lab"] .cl-warn {
  margin: .7rem 0 0; padding: .55rem .7rem; font-size: .85rem; line-height: 1.6;
  color: var(--ink-2); background: color-mix(in srgb, var(--bad) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 32%, transparent);
  border-radius: var(--r-s);
}


/* Generated by build.py: the dark rules above, repeated for readers
   whose system asks for dark before any script has run. An explicit
   data-theme="light" still overrides them. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tool-btn.is-primary, :root:not([data-theme="light"]) .tool-btn.is-primary:hover {color: #06231F;}
}
