/* IBM Plex Sans, bundled in fonts/ (SIL Open Font License 1.1, see fonts/OFL.txt) */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --accent: #001e62;
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --canvas: #ffffff;
  --soft: #f6f7f9;
  --good: #1f7a4d;
  --good-soft: #e7f3eb;
  --blue: #2a78d6;
  --orange: #eb6834;
  --bad: #b8322f;
  --bad-soft: #f9e8e7;
  --font: "IBM Plex Sans", Aptos, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font);
       font-size: 15px; line-height: 1.5; }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 16px; }
h4 { font-size: 14px; margin-top: 14px; color: var(--accent); }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 14px; }
.hidden { display: none !important; }

.topbar { padding: 18px 28px 6px; }
.topbar h1 { font-size: 22px; color: var(--accent); margin: 0; }
.subtitle { color: var(--muted); font-size: 14px; }

.tabs { display: flex; padding: 0 28px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border: none; background: transparent; padding: 10px 18px; color: var(--muted);
       font-family: var(--font); font-size: 15px; font-weight: 500; cursor: pointer;
       border-bottom: 3px solid transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 20px 28px;
          align-items: start; }
.sidebar { position: sticky; top: 12px; }
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px;
        min-width: 0; }
.card.note { background: var(--soft); }
.card.inner { border: none; background: var(--soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
                gap: 8px 28px; margin: 12px 0 16px; }

.ctl { margin: 12px 0; }
.ctl-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.ctl-help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.radios label { display: inline-flex; align-items: center; margin: 0 12px 4px 0; font-size: 14px; cursor: pointer; }
.radios.stack label { display: flex; }
.ctl input[type=radio], .ctl input[type=checkbox] { accent-color: var(--accent); margin: 0 5px 0 0; }
.ctl select { width: 100%; padding: 7px 10px; border: 1px solid #cfcfcf; border-radius: 6px;
              font-family: var(--font); font-size: 14px; background: #fff; color: var(--ink); }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.slider-row output { min-width: 48px; text-align: center; border: 1px solid #cfcfcf; border-radius: 6px;
                     padding: 3px 6px; font-size: 14px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn { background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 8px;
       padding: 8px 14px; font-family: var(--font); font-size: 14px; cursor: pointer; }
.btn:hover { opacity: 0.9; }
.btn-ghost { background: #fff; color: var(--accent); }
.btn:disabled { opacity: 0.35; cursor: default; }

.banner { color: var(--muted); font-size: 14px; }
.kpi-row, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.kpi-grid.kpi-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
.kpi { border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 8px;
       padding: 10px 12px; background: #fff; }
.kpi-title { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 20px; font-weight: 600; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.diff-working { font-size: 17px; }
.diff-working > span { white-space: nowrap; }
.verdict { margin: 12px 0 6px; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.pill-yes { background: #e6f2ea; color: var(--good); }
.pill-no { background: #f1f1f1; color: var(--ink); }

.steps p { margin: 10px 0; }
mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.qtable { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.qtable th, .qtable td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.qtable th { background: var(--soft); }
.qtable.formula td { padding: 8px 10px; }

.design-strip { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-top: 10px; }
.arm { border: 2px solid var(--line); border-radius: 8px; padding: 8px 14px; background: #fff; font-size: 14px; }
.arm-mid { align-self: center; color: var(--muted); font-size: 13px; }

details > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.hint { margin: 10px 0; }
.q-meta { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.q-text { font-size: 16px; }
.options { margin: 12px 0; }
.options label { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 6px 0;
                 border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.options label:hover { background: var(--soft); }
.options label.locked { cursor: default; color: var(--muted); }
.options label.locked:hover { background: #fff; }
.options input { accent-color: var(--accent); margin: 0; }
.score { margin-top: 14px; font-weight: 600; color: var(--accent); }
.fb-head { font-weight: 600; padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; }
.fb-right { background: #e6f2ea; color: var(--good); }
.fb-wrong { background: #fbeaea; color: var(--bad); }
.why { padding-left: 18px; }
.why li { margin: 6px 0; }
.why-right b { color: var(--good); }
.why-wrong b { color: var(--bad); }
.why-note { margin: 2px 0 0; }

.footer { text-align: center; color: var(--muted); font-size: 14px; padding: 24px 0 30px;
          border-top: 1px solid var(--line); margin-top: 20px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .sidebar { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar, .tabs { padding-left: 16px; padding-right: 16px; }
  .tab { padding: 10px 6px; font-size: 14px; }
}
.formula-words { margin: 4px 0 10px; line-height: 1.55; }

/* quiz: practice-set card and numbered question navigator */
.quiz-page { display: block; max-width: 1100px; margin: 0 auto; padding: 18px 28px; }
.quiz-page > .card { margin-bottom: 14px; }
.q-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.q-nav .dot { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 34px;
  padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; font-size: 14px;
  color: var(--muted); cursor: pointer; }
.q-nav .dot:hover { background: var(--soft); }
.q-nav .dot.right { background: #e7f3eb; border-color: var(--good); color: var(--good); }
.q-nav .dot.wrong { background: #f9e8e7; border-color: var(--bad); color: var(--bad); }
.q-nav .dot.current { outline: 2px solid var(--accent); outline-offset: 1px; font-weight: 700; color: var(--ink); }
@media (max-width: 700px) { .quiz-page { padding: 16px; } }

/* ---------------------------------------------------------------- Regression Lab additions */
.tab { flex: 0 1 auto; }
.page-intro { padding: 16px 28px 0; max-width: 1200px; }
.page-intro p { color: var(--muted); margin: 0; }
.kpi-row.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi.pass { border-top-color: var(--good); background: var(--good-soft); }
.kpi.fail { border-top-color: var(--bad); background: var(--bad-soft); }
.kpi.pass .test-colour { color: var(--good); }
.kpi.fail .test-colour { color: var(--bad); }
.kpi-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 4px; }
.trio-value { font-size: 20px; font-weight: 600; }
.test-verdict { font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.ht-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.ht-row .span2 { grid-column: span 2; }

.sse-bar { margin-top: 12px; }
.sse-bar .track { position: relative; height: 18px; border-radius: 9px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.sse-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bad); opacity: 0.75; transition: width 0.08s; }
.sse-bar .fill.over { background: #7a1d19; }
.sse-bar .legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

.num-in { width: 84px; padding: 3px 6px; border: 1px solid #cfcfcf; border-radius: 6px; font-family: var(--font); font-size: 14px; text-align: right; }
.slider-row label.name { min-width: 26px; font-weight: 600; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.eq { font-size: 16px; margin: 6px 0; }
.eq .b0 { color: var(--accent); font-weight: 600; }
.eq .b1 { color: var(--blue); font-weight: 600; }
.eq .b2 { color: var(--orange); font-weight: 600; }
.callout { border-left: 4px solid var(--accent); background: var(--soft); padding: 10px 14px; border-radius: 6px; margin: 10px 0; }
.callout.good { border-left-color: var(--good); background: var(--good-soft); }
.callout.warn { border-left-color: var(--bad); background: var(--bad-soft); }
.small { font-size: 13px; }

.coef-table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; }
.coef-table th, .coef-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.coef-table th:first-child, .coef-table td:first-child { text-align: left; white-space: normal; }
.coef-table th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--soft); }
.coef-table td.sig { color: var(--good); font-weight: 600; }
.coef-table td.nsig { color: var(--bad); font-weight: 600; }
.coef-table tr.hl td { background: #fff7e8; }
.table-scroll { overflow-x: auto; }

.checks label { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 4px 0; cursor: pointer; }
.checks input { accent-color: var(--accent); }
.checks .lv { color: var(--muted); font-size: 12px; }
.inline-select { display: flex; align-items: center; gap: 8px; margin: 4px 0 4px 22px; font-size: 13px; color: var(--muted); }
.inline-select select { width: auto; padding: 3px 6px; font-size: 13px; }
.pred-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 14px; }
.pred-grid label { font-size: 12.5px; color: var(--muted); display: block; }
.pred-grid input, .pred-grid select { width: 100%; padding: 5px 8px; border: 1px solid #cfcfcf; border-radius: 6px; font-family: var(--font); font-size: 14px; }
.plot { width: 100%; min-height: 300px; }
.plot.tall { min-height: 440px; }
.step-tag { display: inline-block; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 2px 9px; margin-right: 8px; }
.compare-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.compare-strip .kpi { flex: 1 1 160px; }
.model-a { color: var(--blue); font-weight: 600; }
.model-b { color: var(--orange); font-weight: 600; }
.design-table td.on { background: #eef3fb; font-weight: 600; }

@media (max-width: 900px) {
  .kpi-row.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ht-row { grid-template-columns: 1fr; }
  .ht-row .span2 { grid-column: auto; }
  .page-intro { padding: 12px 16px 0; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}
/* keep wide tables inside the screen on phones */
@media (max-width: 700px) {
  .qtable, #qz-question .coef-table, #qz-feedback .coef-table, .card .coef-table { display: block; overflow-x: auto; max-width: 100%; }
  mjx-container[display="true"] { overflow-x: auto; }
}
.grid-2 > *, .main > *, .quiz-page > * { min-width: 0; }
mjx-container[display="true"] { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.card { overflow-x: auto; }

/* form controls take the page font; numbers line up in tables and KPI boxes */
button, input, select, textarea { font-family: inherit; }
table, .kpi-value, .trio-value, .num { font-variant-numeric: tabular-nums; }

/* footer credit: the name links to LinkedIn, quietly */
.footer a, .credit a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.footer a:hover, .credit a:hover { color: var(--accent, #001e62); border-bottom-style: solid; }
