/* Wider course pages on large screens (Nov 2026).
   Screen-only and only from 1200 px wide; phones, tablets, print and worksheets are unchanged.
   Lesson pages keep the reading column (about 900 px) and add an "On this page" side panel;
   course pages use the full width with 3 lesson cards per row. Board mode stays: it hides the
   side panel and goes wider with bigger text for the classroom screen. Remove the link to undo. */
/* Side panel exists only on wide screens */
.mlw-side { display: none; }
@media screen and (min-width: 1200px) {
  body > #app.wrap:has(> header.topbar > nav.tabs) > div > .mlw-side { display: block; }
  body.presenting > #app.wrap:has(> header.topbar > nav.tabs) > div > .mlw-side { display: none; }
  body > #app.wrap, .wrap:has(> main > .ci-hero) { max-width: 1240px; }
  /* one header row fits now, so drop the two-row space ml-cls reserves */
  body > #app.wrap > header.topbar { min-height: 0; }

  /* ---- Course page ---- */
  .wrap > main .ci-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wrap > main > .ci-hero { grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; }
  .wrap > main > .ci-hero .lede { max-width: 68ch; }
  .mlw-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
  .mlw-pair > .ci-box { margin: 0; height: 100%; box-sizing: border-box; }
  .mlw-pair { margin: 16px 0; }

  /* ---- Lesson pages: reading column + side panel ---- */
  body > #app.wrap:has(> header.topbar > nav.tabs) > div { position: relative; padding-right: 360px; }
  .mlw-side { position: absolute; top: 0; right: 0; bottom: 0; width: 276px; }
  .mlw-side-in { position: sticky; top: 20px; display: grid; gap: 14px; }
  .mlw-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 14px; }
  .mlw-box h2 { font: 700 12px/1.3 var(--mono, ui-monospace, monospace); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
  .mlw-toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .mlw-toc a { display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.35; border-left: 3px solid transparent; }
  .mlw-toc a:hover { background: color-mix(in srgb, var(--teal) 10%, transparent); }
  .mlw-toc a[aria-current="true"] { border-left-color: var(--teal); background: color-mix(in srgb, var(--teal) 12%, transparent); font-weight: 600; }
  .mlw-toc .n { font: 600 12px var(--mono, ui-monospace, monospace); color: var(--teal); min-width: 14px; }
  .mlw-toc a:focus-visible, .mlw-next:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
  .mlw-next { display: block; width: 100%; text-align: center; font: 700 15px var(--body, inherit); padding: 11px 14px; border-radius: 10px; border: 0; cursor: pointer; background: var(--teal); color: #fff; text-decoration: none; }
  .mlw-box p { margin: 0 0 10px; font-size: 14px; line-height: 1.45; color: var(--muted); }

  /* Board mode: no side panel, wider and bigger for the class screen */
  body.presenting > #app.wrap { max-width: 1440px; }
  body.presenting > #app.wrap:has(> header.topbar > nav.tabs) > div { padding-right: 0; }
  body.presenting .mlw-side { display: none; }
}
/* Dark theme: teal button text stays dark navy for contrast */
@media screen and (min-width: 1200px) {
  html:not([data-ml-theme=chalk]):not([data-theme=light]) .mlw-next { color: #0E1A2E; }
}
@media print { .mlw-side { display: none !important; } }
/* ml-wide.2 (17 Nov 2026): signed in, the lesson header has two more buttons (Experiments, account) and the account
   button wraps to a second row; keep it at the right end of that row, under Board mode, instead of alone on the left. */
@media screen and (min-width: 1200px) {
  body > #app.wrap > header.topbar > .ml-account-nav { margin-left: auto; }
}
