/*
 * Ma ligne on the design system (docs/DESIGN_SYSTEM.md): the theme's fonts, --fz-* tokens and fz-ui components.
 * Map: a hero with progress, the lines as chips, the chosen line as a path of stations, a side column with where to
 * start and the members card. Stations open as a full-screen panel (.ml-panel) with a stepper.
 * Everything is scoped to #ml, .ml-panel and .ml-toast; --lc is the colour of the line being shown.
 */
#ml, .ml-panel { --ml-gap: clamp(16px, 2.5vw, 24px); }
/* The map adapts to the box it sits in (a wide page, a narrow page, a lesson), so its layout uses container queries. */
#ml { container: ml / inline-size; }
#ml [hidden], .ml-panel [hidden] { display: none !important; }

/* ---------- map ---------- */
#ml .ml-wrap { max-width: 1240px; margin: 0 auto; padding: clamp(8px, 2vw, 24px) 0 48px; }
#ml .ml-wait { padding: 40px; text-align: center; color: var(--fz-muted); }
#ml .ml-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--ml-gap); align-items: end; margin-bottom: 28px; }
#ml .ml-h1 { margin: .25rem 0 .5rem; font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem); }
#ml .ml-stats { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
#ml .ml-stats small { font-size: .55em; color: var(--fz-muted); }
#ml .ml-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--ml-gap); align-items: start; }
#ml .ml-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#ml .ml-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--fz-header-h, 122px) + 16px); }
#ml .ml-lock { background: var(--fz-surface-soft); }
#ml .ml-lock__ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--fz-surface); color: var(--fz-action); }
#ml .ml-note { display: flex; gap: 8px; margin: 0; font-size: .875rem; color: var(--fz-muted); }
#ml .ml-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
@media (hover: hover) { #ml .ml-chips { cursor: grab; } }
#ml .ml-chips.is-dragging, #ml .ml-chips.is-dragging .ml-chip { cursor: grabbing; user-select: none; }
#ml .ml-chip { flex: none; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px 6px 6px; border: var(--fz-border) solid var(--fz-line);
  border-radius: var(--fz-radius-pill); background: var(--fz-surface); color: var(--fz-ink); font: inherit; text-align: left; cursor: pointer; }
#ml .ml-chip b { display: block; font-size: .9375rem; line-height: 1.2; }
#ml .ml-chip small { display: block; font-size: .75rem; color: var(--fz-muted); }
#ml .ml-chip__dot, #ml .ml-num, .ml-panel .ml-num { display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--lc); color: var(--fz-ink); font-weight: 700; }
#ml .ml-chip__dot { width: 34px; height: 34px; }
#ml .ml-chip__dot .fz-icon { width: 16px; height: 16px; }
#ml .ml-chip:hover { border-color: var(--fz-ink); }
#ml .ml-chip.is-on { border-color: var(--fz-action); box-shadow: 0 0 0 2px var(--fz-action-soft); }
#ml .ml-chip.is-soon { opacity: .6; }
#ml .ml-line { padding: clamp(16px, 2.5vw, 28px); gap: 18px; min-width: 0; }
#ml .ml-line__head { display: flex; gap: 14px; align-items: flex-start; }
#ml .ml-line__head .fz-badge { vertical-align: middle; }
#ml .ml-num { width: 48px; height: 48px; font: 700 1.25rem/1 var(--fz-font-heading); }
#ml .ml-locknote { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#ml .ml-locknote > span { flex: 1; min-width: 180px; }
#ml .ml-path .fz-path__stop { padding: 10px 12px 10px 0; border-radius: var(--fz-radius-md); min-width: 0; }
#ml .ml-path .fz-path__stop[role="button"] { cursor: pointer; }
#ml .ml-path .fz-path__stop[role="button"]:hover { background: var(--fz-surface-soft); }
#ml .ml-path .fz-path__stop.is-current { background: var(--fz-action-soft); }
#ml .ml-path .fz-path__text { flex: 1; min-width: 0; }
#ml .ml-path .fz-path__title, #ml .ml-path .fz-path__meta { overflow-wrap: anywhere; }
#ml .ml-path .fz-path__dot .fz-icon { width: 18px; height: 18px; }
#ml .ml-path .fz-badge { margin-left: auto; }
#ml .ml-go { margin-left: auto; min-height: 40px; }
#ml .ml-known { margin-left: auto; padding: 8px; border: 0; background: none; color: var(--fz-muted); font: 600 .8125rem/1 var(--fz-font-body); cursor: pointer; white-space: nowrap; }
#ml .ml-known:hover { color: var(--fz-action-strong); }

/* ---------- station panel ---------- */
.ml-panel { position: fixed; inset: 0; z-index: 100000; display: flex; flex-direction: column; overflow: auto; background: var(--fz-bg); font-size: 1.0625rem; }
.ml-panel .pbar { position: sticky; top: 0; z-index: 2; background: var(--fz-surface); border-bottom: var(--fz-border) solid var(--fz-line); padding-top: env(safe-area-inset-top, 0px); }
.ml-panel .pbar .in, .ml-panel .tabs, .ml-panel .pbody { max-width: 860px; width: 100%; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.ml-panel .pbar .in { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.ml-panel .ml-num--sm { width: 32px; height: 32px; font: 700 .9375rem/1 var(--fz-font-heading); }
.ml-panel .ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml-panel .ttl b { font: var(--fz-heading-weight) 1.125rem/1.25 var(--fz-font-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-panel .ttl small { color: var(--fz-muted); font-size: .8125rem; }
.ml-panel .tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; }
.ml-panel .ml-step { flex: none; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 6px; border: var(--fz-border) solid var(--fz-line);
  border-radius: var(--fz-radius-pill); background: var(--fz-surface); color: var(--fz-muted); font: 600 .875rem/1 var(--fz-font-body); cursor: pointer; }
.ml-panel .ml-step__n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--fz-surface-soft); color: var(--fz-ink); }
.ml-panel .ml-step__n .fz-icon { width: 16px; height: 16px; }
.ml-panel .ml-step.is-seen .ml-step__n { background: var(--fz-success-soft); color: var(--fz-success); }
.ml-panel .ml-step.is-on { border-color: var(--fz-action); color: var(--fz-ink); }
.ml-panel .ml-step.is-on .ml-step__n { background: var(--fz-action); color: var(--fz-on-action); }
.ml-panel .pbody { flex: 1; padding-top: 22px; padding-bottom: 32px; display: flex; flex-direction: column; gap: 16px; }
.ml-panel .pfoot { position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: 10px; padding: 14px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--fz-bg) 70%, transparent); }
.ml-panel .goal { margin: 0; color: var(--fz-muted); }
.ml-panel .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ml-panel .muted, .ml-panel .note-ft, .ml-panel .hint { color: var(--fz-muted); font-size: .9375rem; }
.ml-panel .note-ft { margin: 12px 0 0; }
.ml-panel .block, .ml-panel .q, .ml-panel .res { display: flex; flex-direction: column; gap: 10px; padding: clamp(16px, 2.5vw, 24px); background: var(--fz-surface);
  border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-lg); box-shadow: var(--fz-shadow-soft); }
.ml-panel h2, .ml-panel h3 { margin: 0; font-family: var(--fz-font-heading); font-weight: var(--fz-heading-weight); line-height: 1.25; color: var(--fz-ink); }
.ml-panel h3 { font-size: 1.25rem; display: flex; flex-direction: column; gap: 4px; }
.ml-panel h3 .k { font: 600 .75rem/1.3 var(--fz-font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--fz-action-strong); }
.ml-panel .spk { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; border: 0; border-radius: 50%; background: var(--fz-action-soft); color: var(--fz-action); cursor: pointer; }
.ml-panel .spk .fz-icon { width: 22px; height: 22px; }
.ml-panel .listenbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 4px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-pill);
  background: var(--fz-surface); color: var(--fz-ink); font: 600 .9375rem/1 var(--fz-font-body); cursor: pointer; }
.ml-panel .listenbtn .spk { width: 36px; height: 36px; }

/* reading: dialogue lines */
.ml-panel .dlg .ln { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 10px 12px; border-radius: var(--fz-radius-md); background: var(--fz-surface-soft); }
.ml-panel .dlg .ln:nth-child(even) { background: var(--fz-action-soft); }
.ml-panel .dlg .ln.on { outline: 2px solid var(--fz-action); }
.ml-panel .dlg .ln + .ln { margin-top: 8px; }
.ml-panel .dlg .who { font-weight: 700; font-size: .8125rem; color: var(--fz-muted); }
.ml-panel .dlg .fr { padding: 0; border: 0; background: none; color: var(--fz-ink); font: 600 1.125rem/1.4 var(--fz-font-body); text-align: left; cursor: pointer; }
.ml-panel .dlg .fr:hover { text-decoration: underline; text-underline-offset: 3px; }
.ml-panel .dlg .en { grid-column: 2; color: var(--fz-muted); font-size: .9375rem; }
.ml-panel .dlg div.fr { cursor: auto; }
.ml-panel .dlg div.fr:hover { text-decoration: none; }
.ml-panel .fr { font-weight: 600; }

/* lesson: tables, vocabulary cards, transforms, helpers */
.ml-panel .tbl { width: 100%; border-collapse: collapse; }
.ml-panel .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--fz-line); }
.ml-panel .tbl td:first-child { width: 36%; color: var(--fz-muted); }
.ml-panel .tbl td:last-child b { color: var(--fz-action-strong); }
.ml-panel .tbl tr:last-child td { border-bottom: 0; }
.ml-panel .tbl tr:hover td { background: var(--fz-surface-soft); }
.ml-panel .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ml-panel .fc { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; padding: 12px; border: var(--fz-border) solid var(--fz-line);
  border-radius: var(--fz-radius-md); background: var(--fz-surface-soft); color: var(--fz-ink); font: inherit; text-align: left; cursor: pointer; }
.ml-panel .fc:hover { border-color: var(--fz-action); }
.ml-panel div.fc { cursor: default; }
.ml-panel div.fc:hover { border-color: var(--fz-line); }
.ml-panel .fc small { color: var(--fz-muted); font-size: .875rem; }
.ml-panel .tf { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--fz-line); }
.ml-panel .tf:last-child { border-bottom: 0; }
.ml-panel .tf .a, .ml-panel .tf .b { font-weight: 600; }
.ml-panel .tf .b { color: var(--fz-action-strong); }
.ml-panel .tf .go { display: grid; place-items: center; width: 44px; height: 44px; border: var(--fz-border) solid var(--fz-line); border-radius: 50%; background: var(--fz-surface); color: var(--fz-action); cursor: pointer; }
.ml-panel .tf small { grid-column: 1 / -1; color: var(--fz-muted); font-size: .875rem; }
.ml-panel .agef { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ml-panel .agef select { min-height: 44px; padding: 8px 12px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-sm); background: var(--fz-surface); color: var(--fz-ink); font: inherit; }
.ml-panel .agef output { font: 700 1.5rem/1.2 var(--fz-font-heading); }
.ml-panel .model { padding: 12px 14px; border-radius: var(--fz-radius-md); background: var(--fz-surface-soft); white-space: pre-line; }
.ml-panel .refblk { line-height: 1.6; }
.ml-panel textarea, .ml-panel .gap input { width: 100%; min-height: 48px; padding: 10px 14px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-md);
  background: var(--fz-surface); color: var(--fz-ink); font: inherit; }
.ml-panel textarea:focus, .ml-panel .gap input:focus { outline: 3px solid var(--fz-action-soft); border-color: var(--fz-action); }

/* grammar diagrams that come with the lessons (.sch-*): a soft tint per category instead of coloured borders */
.ml-panel .sch { display: grid; gap: 10px; }
.ml-panel .c1 { --sc: var(--fz-sky); } .ml-panel .c2 { --sc: var(--fz-mint); } .ml-panel .c3 { --sc: var(--fz-spotlight); }
.ml-panel .c4 { --sc: var(--fz-coral); } .ml-panel .c5 { --sc: var(--fz-line); }
.ml-panel .sch .c, .ml-panel .sch .col, .ml-panel .sch .grp { padding: 12px 14px; border-radius: var(--fz-radius-md); background: color-mix(in srgb, var(--sc, var(--fz-line)) 18%, var(--fz-surface)); }
.ml-panel .sch .c b { display: block; font: 700 1.125rem/1.3 var(--fz-font-heading); }
.ml-panel .sch .c small, .ml-panel .sch .col small, .ml-panel .sch .grp small { display: block; color: var(--fz-muted); font-size: .875rem; line-height: 1.35; }
.ml-panel .sch h4 { margin: 0 0 4px; font: 700 1.125rem/1.3 var(--fz-font-heading); }
.ml-panel .sch ul { margin: 4px 0 0; padding-left: 18px; }
.ml-panel .sch p { margin: 6px 0 0; font-size: .9375rem; }
.ml-panel .sch-day, .ml-panel .sch-4, .ml-panel .sch-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ml-panel .sch-3, .ml-panel .sch-scale { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ml-panel .sch-abc { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.ml-panel .sch-abc b { font-size: 1.25rem !important; }
.ml-panel .sch-week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ml-panel .sch-week span, .ml-panel .sch-have span, .ml-panel .sch-end .ends span { padding: 8px 10px; border-radius: var(--fz-radius-sm); background: color-mix(in srgb, var(--sc, var(--fz-line)) 18%, var(--fz-surface)); }
.ml-panel .sch-week span { text-align: center; font-weight: 600; font-size: .875rem; }
.ml-panel .sch-week small, .ml-panel .sch-have small { display: block; color: var(--fz-muted); font-weight: 400; font-size: .75rem; }
.ml-panel .sch-date { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ml-panel .sch-date span { padding: 10px 16px; border-radius: var(--fz-radius-sm); background: color-mix(in srgb, var(--sc, var(--fz-line)) 18%, var(--fz-surface)); font: 700 1.375rem/1.2 var(--fz-font-heading); }
.ml-panel .sch-num { grid-template-columns: 1fr; }
.ml-panel .sch-num .nums { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ml-panel .sch-num .nums span { padding: 4px 10px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-sm); background: var(--fz-surface); font-weight: 600; font-size: .9375rem; }
.ml-panel .sch-pro { grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: stretch; }
.ml-panel .sch-pro .hd { padding: 0 4px 2px; color: var(--fz-muted); font: 600 .75rem/1.3 var(--fz-font-body); letter-spacing: .08em; text-transform: uppercase; }
.ml-panel .sch-pro .lab { align-self: center; max-width: 110px; padding-right: 6px; background: none; color: var(--fz-muted); font-size: .8125rem; font-weight: 600; }
.ml-panel .sch-fem { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.ml-panel .sch-fem div { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--fz-line); }
.ml-panel .sch-fem .m, .ml-panel .sch-fem .f { font-weight: 700; }
.ml-panel .sch-fem .m { color: var(--fz-action-strong); }
.ml-panel .sch-fem .f { color: var(--fz-warning); }
.ml-panel .sch-fem .arr { color: var(--fz-muted); }
.ml-panel .sch-have { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ml-panel .sch-have b { display: block; }
.ml-panel .sch-inf { display: flex; flex-wrap: wrap; gap: 8px; }
.ml-panel .sch-inf span { padding: 6px 14px; border-radius: var(--fz-radius-pill); background: var(--fz-surface-soft); font-weight: 600; }
.ml-panel .sch-inf span b { color: var(--fz-action-strong); border-bottom: 2px solid currentColor; }
.ml-panel .sch-end { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.ml-panel .sch-end .stem { padding: 14px 18px; border-radius: var(--fz-radius-md); background: var(--fz-surface-soft); font: 700 2rem/1 var(--fz-font-heading); }
.ml-panel .sch-end .ends { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ml-panel .sch-end .ends b { color: var(--fz-action-strong); }

/* practice: exercise list, questions, answers, results */
.ml-panel .setlist { display: flex; flex-direction: column; gap: 8px; }
.ml-panel .setrow { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-md);
  background: var(--fz-surface); color: var(--fz-ink); font: inherit; text-align: left; cursor: pointer; }
.ml-panel .setrow:hover { border-color: var(--fz-action); }
.ml-panel .setrow .n { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--fz-surface-soft); font-weight: 700; }
.ml-panel .setrow .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml-panel .setrow .t small { color: var(--fz-muted); font-size: .875rem; }
.ml-panel .setrow .sc { font-weight: 700; font-variant-numeric: tabular-nums; }
.ml-panel .setrow.test { border-color: var(--fz-action); }
.ml-panel .setrow.test .n { background: var(--fz-action); color: var(--fz-on-action); }
.ml-panel .setrow.ok .n { background: var(--fz-success); color: var(--fz-on-action); }
.ml-panel .qhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--fz-muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.ml-panel .qdots { display: flex; gap: 4px; flex-wrap: wrap; }
.ml-panel .qdots i { width: 10px; height: 10px; border-radius: 50%; background: var(--fz-line); }
.ml-panel .qdots i.cur { background: var(--fz-action); }
.ml-panel .qdots i.ok { background: var(--fz-success); }
.ml-panel .qdots i.ko { background: var(--fz-danger); }
.ml-panel .qt { margin: 0; font: var(--fz-heading-weight) 1.25rem/1.35 var(--fz-font-heading); }
.ml-panel .opts { display: grid; gap: 8px; }
.ml-panel .opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px 8px 8px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-md);
  background: var(--fz-surface); color: var(--fz-ink); font: inherit; text-align: left; cursor: pointer; }
.ml-panel .opt .l { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--fz-radius-sm); background: var(--fz-surface-soft); font-weight: 700; font-size: .875rem; }
.ml-panel .opt:hover:not(:disabled) { border-color: var(--fz-action); }
.ml-panel .opt.sel { border-color: var(--fz-action); background: var(--fz-action-soft); }
.ml-panel .opt.right { border-color: var(--fz-success); background: var(--fz-success-soft); }
.ml-panel .opt.wrong { border-color: var(--fz-danger); background: var(--fz-danger-soft); }
.ml-panel .opt:disabled { cursor: default; }
.ml-panel .fb { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--fz-radius-md); }
.ml-panel .fb.ok { background: var(--fz-success-soft); color: var(--fz-ink); }
.ml-panel .fb.ok > .fz-icon { color: var(--fz-success); }
.ml-panel .fb.ko { background: var(--fz-danger-soft); color: var(--fz-ink); }
.ml-panel .fb.ko > .fz-icon { color: var(--fz-danger); }
.ml-panel .tiles { display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px; padding: 8px; border: 2px dashed var(--fz-line); border-radius: var(--fz-radius-md); }
.ml-panel .tiles.bank { border-style: solid; background: var(--fz-surface-soft); }
.ml-panel .tile { min-height: 44px; padding: 6px 14px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-sm); background: var(--fz-surface); color: var(--fz-ink); font: 600 1rem/1.2 var(--fz-font-body); cursor: pointer; }
.ml-panel .mt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ml-panel .m { min-height: 48px; padding: 8px 12px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-md); background: var(--fz-surface); color: var(--fz-ink); font: inherit; text-align: left; cursor: pointer; }
.ml-panel .m.sel { border-color: var(--fz-action); background: var(--fz-action-soft); }
.ml-panel .m.paired { border-color: var(--fz-success); background: var(--fz-success-soft); color: var(--fz-muted); cursor: default; }
.ml-panel .m.shake { border-color: var(--fz-danger); animation: ml-shake .4s; }
@keyframes ml-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .ml-panel .m.shake { animation: none; } }
.ml-panel .sortitem { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: var(--fz-radius-md); background: var(--fz-surface-soft); font: 700 1.375rem/1.3 var(--fz-font-heading); }
.ml-panel .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.ml-panel .cols button { min-height: 52px; border: var(--fz-border) solid var(--fz-line); border-radius: var(--fz-radius-md); background: var(--fz-surface); color: var(--fz-ink); font: 600 1rem/1.2 var(--fz-font-body); cursor: pointer; }
.ml-panel .cols button.right { border-color: var(--fz-success); background: var(--fz-success-soft); }
.ml-panel .cols button.wrong { border-color: var(--fz-danger); background: var(--fz-danger-soft); }
.ml-panel .sortdone { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.ml-panel .sortdone h4 { margin: 0 0 6px; font-family: var(--fz-font-heading); }
.ml-panel .sortdone span { display: inline-block; margin: 0 6px 6px 0; padding: 4px 10px; border-radius: var(--fz-radius-pill); background: var(--fz-success-soft); }
.ml-panel .sortdone span.ko { background: var(--fz-danger-soft); }
.ml-panel .res { align-items: center; text-align: center; }
.ml-panel .res .big { font: 700 3rem/1 var(--fz-font-heading); font-variant-numeric: tabular-nums; }
.ml-panel .res .big small { font-size: .45em; color: var(--fz-muted); }
.ml-panel .res p { margin: 0; color: var(--fz-muted); max-width: 52ch; }
.ml-panel .stamp { display: inline-flex; padding: .3em .9em; border-radius: var(--fz-radius-pill); background: var(--fz-success-soft); color: var(--fz-success); font: 700 .875rem/1.3 var(--fz-font-body); }
.ml-panel .stamp.ko { background: var(--fz-warning-soft); color: var(--fz-warning); }
.ml-panel .blk { color: var(--fz-action-strong); font-weight: 600; font-size: .9375rem; }

/* toast */
.ml-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 100001; transform: translateX(-50%); transition: opacity .3s; }

/* ---------- breakpoints (the standard set: 960, 600, 480) ---------- */
@container ml (max-width: 960px) {
  #ml .ml-hero { grid-template-columns: 1fr; }
  #ml .ml-grid { display: flex; flex-direction: column; align-items: stretch; }
  #ml .ml-side { display: contents; }
  #ml .ml-start { order: -1; }
  #ml .ml-lock, #ml .ml-note { order: 3; }
}
@container ml (max-width: 600px) {
  #ml .ml-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #ml .ml-line { padding: 16px; }
  #ml .ml-known { display: none; }
  #ml .ml-go { padding: 0 12px; }
}
@media (max-width: 600px) {
  .ml-panel .ml-stepof { display: none; }
  .ml-panel .sch-3, .ml-panel .sch-scale { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ml-panel .sch-2, .ml-panel .sch-day, .ml-panel .sch-4, .ml-panel .sch-fem { grid-template-columns: 1fr; }
  .ml-panel .sch-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ml-panel .sch-pro { grid-template-columns: 1fr 1fr; }
  .ml-panel .sch-pro .hd:first-child { display: none; }
  .ml-panel .sch-pro .lab { grid-column: 1 / -1; max-width: none; padding-top: 6px; }
  .ml-panel .sch-end, .ml-panel .sch-end .ends { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .ml-panel .tf { grid-template-columns: 1fr auto; }
  .ml-panel .tf .b { grid-column: 1 / -1; }
  .ml-panel .mt { gap: 6px; }
}
