/* Stats Lab: what OR Lab's styles do not already cover. */

/* A matrix in brackets; a determinant between bars. */
.mx {
  display: inline-grid; grid-template-columns: repeat(var(--n), auto); gap: .15rem .85rem; vertical-align: middle;
  padding: .3rem .6rem; border-inline: 2px solid currentColor; border-radius: .6rem;
  font-variant-numeric: tabular-nums; text-align: right; line-height: 1.5;
}
.mx.is-det { border-radius: 0; }
.mx-line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-variant-numeric: tabular-nums; }
.mx-line + .mx-line { margin-top: .75rem; }
.mx-list { display: grid; gap: .9rem; }

/* A small calculator card, one of several on a page. */
.calc-out { margin-top: 1rem; }
.calc-out p { margin: .3rem 0; }
.calc-out .lab-answer { margin: 0; }

/* Two numbers side by side in the summary of measures. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .6rem; }
.stat-grid div { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem; background: var(--bg); }
.stat-grid dt { color: var(--muted); font-size: .875rem; font-weight: 600; }
.stat-grid dd { margin: .15rem 0 0; font: 700 1.25rem/1.2 var(--font-display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.lab-field.w-l { width: min(100%, 24rem); }
.lab-field textarea {
  font: inherit; font-variant-numeric: tabular-nums; min-height: 6rem; resize: vertical; width: 100%;
  padding: .6rem .75rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink);
}
.lab-field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.g-ink2 { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 7 5; fill: none; }
.g-trend { stroke: var(--ink); stroke-width: 3.5; fill: none; }
.g-series { stroke: var(--muted); stroke-width: 2; fill: none; }
.g-dot-soft { fill: var(--muted); stroke: none; }
.lab-legend i.thick { border-top: 4px solid var(--ink); }
.lab-legend i.ink { border-top: 2px solid var(--ink); }
.lab-legend i.ink-dash { border-top: 2px dashed var(--ink); }
@media (max-width: 600px) { .mx { gap: .1rem .6rem; padding: .25rem .45rem; } .lab-field.w-l { width: 100%; } }
.ov { text-decoration: overline; text-decoration-thickness: .07em; }
/* A matrix wider than the screen scrolls sideways instead of being cut off. */
.mx { max-width: 100%; overflow-x: auto; }
.mx-line > * { min-width: 0; max-width: 100%; }
/* Long exact answers (big fractions, 45-letter words) wrap instead of widening the answer box. */
.lab-answer { min-width: 0; overflow-wrap: anywhere; }
.lab-answer { grid-template-columns: minmax(0, 1fr); }
.lab-answer > * { min-width: 0; }
.mx-list { grid-template-columns: minmax(0, 1fr); }
.mx-line { min-width: 0; overflow-wrap: anywhere; }
/* An entry such as −1931/15335 never breaks across lines; the matrix scrolls instead. */
.mx > span { white-space: nowrap; overflow-wrap: normal; }
