/* Machine Learning course widgets */
.mock-curve { width: 100%; height: 56px; color: var(--accent); fill: var(--accent); }
.ml-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: center; }
.ml-side { display: grid; gap: 10px; align-content: start; }
.ml-side .big { display: block; font-size: 26px; color: var(--ink); line-height: 1.2; }
.ml-plot { width: 100%; height: auto; max-height: 340px; }
.ml-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.ml-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ml-card { border: 1px solid var(--line); background: var(--bg-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ml-card p { font-size: 14px; color: var(--ink); }
.ml-card.ok { border-color: var(--ok); background: var(--ok-soft); }
.ml-card.no { border-color: var(--bad); background: var(--bad-soft); }
.ml-opts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.ml-opts button { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.ml-opts button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ml-opts button.right { box-shadow: 0 0 0 2px var(--ok); }

.ml-cm { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px; font-size: 13px; align-items: center; }
.ml-cm b { color: var(--muted); font-size: 12px; text-align: center; }
.ml-cm span { padding: 14px 8px; border-radius: 10px; text-align: center; font-weight: 700; font-family: var(--mono); }
.ml-cm .tp, .ml-cm .tn { background: var(--ok-soft); color: var(--ink); }
.ml-cm .fp, .ml-cm .fn { background: var(--bad-soft); color: var(--ink); }
.ml-pr { width: 100%; max-width: 220px; justify-self: center; }

.ml-conv { display: grid; grid-template-columns: 1.3fr .7fr 1.1fr .7fr; gap: 12px; align-items: start; }
.ml-grid { display: grid; gap: 2px; border-radius: 8px; overflow: hidden; }
.ml-grid i { aspect-ratio: 1; background: var(--bg-soft); display: grid; place-items: center; font-style: normal; font-size: 10px; font-family: var(--mono); color: var(--ink); }
.ml-grid.draw i { cursor: crosshair; border: 1px solid var(--line); touch-action: none; }
.ml-grid.draw i.on { background: var(--ink); }
.ml-grid.kern i { background: var(--accent-soft); font-weight: 700; }

.ml-toks { display: flex; flex-wrap: wrap; gap: 6px; }
.ml-toks button { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px 10px; background: color-mix(in srgb, var(--accent) calc(var(--w) * 140%), var(--panel)); color: var(--ink); }
.ml-toks button span { font-weight: 700; font-size: 14px; }
.ml-toks button small { font-size: 10px; color: var(--ink); opacity: .75; }
.ml-toks button.q { outline: 3px solid var(--ink); outline-offset: 1px; }
.ml-heat td { text-align: center; font-size: 11px; min-width: 30px; color: var(--ink); }
.ml-heat th { font-size: 11px; }
.ml-heat tr.sel th { color: var(--accent); }
.w-table tr.sel td { font-weight: 700; }

.ml-img { display: grid; gap: 0; border-radius: 10px; overflow: hidden; max-width: 260px; width: 100%; justify-self: center; }
.ml-img i { aspect-ratio: 1; }
.ml-snr { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--muted); }

.ml-gw { display: grid; gap: 4px; max-width: 320px; width: 100%; justify-self: center; }
.ml-gw i { position: relative; aspect-ratio: 1; border-radius: 8px; background: color-mix(in srgb, var(--ok) calc(var(--v, 0) * 100%), var(--bg-soft)); border: 1px solid var(--line); display: grid; place-items: center; font-style: normal; }
.ml-gw i span { font-size: 18px; font-weight: 800; color: var(--ink); }
.ml-gw i small { position: absolute; bottom: 2px; right: 4px; font-size: 9px; color: var(--ink); opacity: .7; font-family: var(--mono); }
.ml-gw i b { position: absolute; top: 2px; left: 3px; font-size: 14px; }
.ml-gw i.wall { background: repeating-linear-gradient(45deg, var(--line-strong) 0 6px, var(--line) 6px 12px); }
.ml-gw i.goal { background: var(--ok); font-size: 20px; }
.ml-gw i.pit { background: var(--bad); font-size: 20px; }
.ml-gw i.goal small, .ml-gw i.pit small { color: #fff; opacity: 1; }
.ml-gw i.path { box-shadow: inset 0 0 0 2px var(--accent); }

@media (max-width: 700px) {
  .ml-split { grid-template-columns: 1fr; }
  .ml-conv { grid-template-columns: 1fr 1fr; }
  .ml-grid4 { grid-template-columns: 1fr 1fr; }
}
/* Wrap by available width (lesson columns can be narrow even on wide windows) */
.ml-split { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.ml-grid4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)) !important; }
