/* ══ One lesson in the Playground look ══
 * views/look/lesson.ejs, on top of the kit (public/css/look.css). Every selector starts with .lk-lesson, the page's
 * body class, so nothing reaches another page. The markup and its classes are today's (views/lesson.ejs), and
 * public/js/lesson-page.js builds the step, the questions, the checks, the hints and I'm stuck with today's ls-*
 * classes: they are all painted here, with the kit's tokens.
 * The layout is today's: the lesson's own bar (sticky from 1,024 px), then from 1,024 px the step on the left and the
 * code window on the right, on the bench's lilac, where it stays on screen; below that one column in the page's order.
 * The look is the site's: ink outlines, offset shadows, heavy Outfit headings, the yellow for Run and the hints, and a
 * pupil's home's steps (done in green with a tick, the one you're on in ink, locked dashed with a padlock).
 * Pupils are 11 and up: every target is 44 px or more, a state is always in words, and light only, as today. */

/* ── Tokens: the page's own, beside the kit's ── */

.lk-lesson {
    --ls-top-h: 60px;
    --ls-gap: 18px;
    --ls-pad: clamp(16px, 2.6vw, 40px);
    --ls-guide-w: clamp(380px, 41vw, 660px);
    /* The code window: the ink of the kit, a little deeper under the output. */
    --ls-night: #17131f;
    --ls-night-deep: #0e0b14;
    --ls-night-line: rgba(255, 255, 255, 0.14);
    --ls-night-ink: #f3f0fa;
    --ls-night-muted: rgba(243, 240, 250, 0.74);
    --ls-night-faint: rgba(243, 240, 250, 0.58);
    /* Focus on the dark window is the highlighter's yellow, as on the site's dark grounds. */
    --ls-night-focus: #ffe234;
    --ls-code-size: 16px;
    --ls-code-line: 24px;
    /* Done is green with dark words, as a pupil's home draws it. */
    --ls-done: #15803d;
    --ls-done-bg: #dcfce7;
    --ls-done-ink: #14532d;
    --ls-bad-ink: #991b1b;
    /* The program's colours on the dark window: keywords, names before a bracket, strings, numbers, comments. */
    --ls-t-kw: #c4b5fd;
    --ls-t-fn: #93c5fd;
    --ls-t-str: #86efac;
    --ls-t-num: #fcd34d;
    --ls-t-com: rgba(243, 240, 250, 0.64);
    --ls-run-ok: #4ade80;
    --ls-run-bad: #ff8a80;
    --ls-run-stop: #fbbf24;
    --ls-bench: var(--lk-dots), var(--lk-lilac);
    /* The rest of the window's colours: its dots, white words, an error's words, the sticker's edge, the scrollbars,
       the bands behind a line, a selection, and Run's call. */
    --ls-dot-1: #ff8fa3;
    --ls-dot-3: #7ee2a8;
    --ls-white: #ffffff;
    --ls-err-ink: #ffb4ab;
    --ls-sticker-edge: #a78bfa;
    --ls-idle: rgba(255, 255, 255, 0.4);
    --ls-scroll: rgba(255, 255, 255, 0.3);
    --ls-field-line: rgba(255, 255, 255, 0.3);
    --ls-band: rgba(255, 255, 255, 0.07);
    --ls-band-bad: rgba(255, 99, 88, 0.2);
    --ls-select: rgba(124, 58, 237, 0.6);
    --ls-call: rgba(255, 226, 52, 0.85);
    --ls-call-end: rgba(255, 226, 52, 0);
    background: var(--lk-bg);
    color: var(--lk-ink);
}

@media (min-width: 1024px) {
    .lk-lesson {
        --ls-top-h: 68px;
    }
}

/* Words for a screen reader only (the script's own spans use this name). */
.lk-lesson .sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.lk-lesson .ls-icon {
    flex: none;
    width: 1.15em;
    height: 1.15em;
}

/* ── Buttons: the kit's, on the classes the script gives them ── */

.lk-lesson .ls-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 0 20px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--lk-surface);
    box-shadow: var(--lk-sh);
    color: var(--lk-ink);
    font: 700 15.5px/1.2 var(--lk-body);
    text-align: center;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.lk-lesson .ls-btn:hover {
    color: var(--lk-ink);
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--lk-shadow);
}

.lk-lesson .ls-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--lk-shadow);
}

.lk-lesson .ls-btn .ls-icon {
    width: 18px;
    height: 18px;
}

.lk-lesson .ls-btn--primary,
.lk-lesson .ls-btn--primary:hover {
    background: var(--lk-brand);
    color: var(--lk-on-brand);
}

.lk-lesson .ls-btn--ghost,
.lk-lesson .ls-btn--ghost:hover {
    background: var(--lk-surface);
    color: var(--lk-ink);
}

.lk-lesson .ls-btn--small {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    box-shadow: var(--lk-sh-sm);
    font-size: 14.5px;
}

.lk-lesson .ls-btn--small:hover {
    box-shadow: 4px 4px 0 var(--lk-shadow);
}

.lk-lesson .ls-btn.ls-next {
    min-height: 52px;
    padding: 0 22px 0 24px;
    font-size: 16.5px;
}

/* Off: flat grey with words that still read (the kit's), never see-through. A hint that isn't ready yet is one: its
   press says why. */
.lk-lesson .ls-btn:disabled,
.lk-lesson .ls-btn[aria-disabled="true"] {
    border-color: var(--lk-faint);
    background: var(--lk-surface-2);
    box-shadow: none;
    color: var(--lk-faint);
    transform: none;
    cursor: not-allowed;
}

.lk-lesson .ls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.lk-lesson .ls-muted {
    color: var(--lk-muted);
}

.lk-lesson .ls-note {
    margin: 0;
    padding: 12px 16px;
    border: var(--lk-bw) solid var(--lk-line-soft);
    border-radius: var(--lk-r);
    background: var(--lk-surface-2);
}

.lk-lesson .ls-note--good {
    display: flex;
    align-items: center;
    gap: 10px;
    border-color: var(--lk-line);
    background: var(--ls-done-bg);
    box-shadow: var(--lk-sh-sm);
    color: var(--ls-done-ink);
    font-weight: 700;
}

.lk-lesson .ls-note--good .ls-icon {
    width: 20px;
    height: 20px;
}

/* ── The bar: back to the lessons, which lesson this is, and its six steps ── */

.lk-lesson .ls-top {
    position: relative;
    z-index: 40;
    border-bottom: var(--lk-bw) solid var(--lk-line);
    background: var(--lk-surface);
}

.lk-lesson .ls-top-in {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 14px;
    min-height: var(--ls-top-h);
    padding: 6px var(--ls-pad) 10px;
}

.lk-lesson .ls-crumbs {
    flex: 1 0 100%;
    min-width: 0;
}

.lk-lesson .ls-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--lk-muted);
    font: 600 13px/1.3 var(--lk-mono);
}

.lk-lesson .ls-crumbs li + li::before {
    content: "/";
    margin-right: 8px;
    color: var(--lk-faint);
}

.lk-lesson .ls-crumbs a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding-right: 6px;
    border-radius: 12px;
    color: var(--lk-ink);
    font: 800 16px/1.2 var(--lk-disp);
    text-decoration: none;
}

.lk-lesson .ls-crumbs a:hover {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* The bolt from the logo, on the site's purple, in an ink tile. */
.lk-lesson .ls-top-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 10px;
    background: var(--lk-brand);
    box-shadow: 2px 2px 0 var(--lk-shadow);
    color: var(--lk-on-brand);
}

.lk-lesson .ls-top-mark svg {
    width: 18px;
    height: 18px;
}

.lk-lesson .ls-title {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    font: 900 clamp(24px, 1.2rem + 1.4vw, 30px)/1.1 var(--lk-disp);
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.lk-lesson .ls-meta {
    flex: none;
    margin: 0;
    padding: 2px 10px;
    border: 1.5px solid var(--lk-line);
    border-radius: 999px;
    background: var(--lk-sun);
    color: var(--lk-ink);
    font: 700 12.5px/1.3 var(--lk-mono);
    white-space: nowrap;
}

/* The steps: a circle each on a line, as a pupil's home draws a lesson. Where there's room every step has its name;
   where there isn't, only the one you're on. And where even the circles don't fit, the row scrolls sideways. */
.lk-lesson .ls-steps {
    flex: 1 0 100%;
    min-width: 0;
    /* Room inside for the keyboard's ring round a step, which a row that scrolls would cut off. */
    margin-block: 2px -6px;
    padding: 6px 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.lk-lesson .ls-steps::-webkit-scrollbar {
    display: none;
}

.lk-lesson .ls-steps-list {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lk-lesson .ls-step-item {
    display: flex;
    flex: none;
    align-items: center;
}

.lk-lesson .ls-step-item + .ls-step-item {
    flex: 1 0 auto;
}

.lk-lesson .ls-step-item + .ls-step-item::before {
    content: "";
    flex: 1 1 10px;
    min-width: 10px;
    height: 3px;
    margin: 0 -3px;
    border-radius: 2px;
    background: var(--lk-line-soft);
}

.lk-lesson .ls-step-item.is-done + .ls-step-item::before {
    background: var(--ls-done);
}

.lk-lesson .ls-step {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 6px;
    border: var(--lk-bw) solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--lk-muted);
    font: 700 14.5px/1 var(--lk-body);
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.lk-lesson .ls-step-n {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 50%;
    background: var(--lk-surface);
    color: var(--lk-ink);
    font: 800 14px/1 var(--lk-disp);
}

.lk-lesson .ls-step-n .ls-icon {
    width: 16px;
    height: 16px;
}

.lk-lesson .ls-step:hover:not(.is-locked):not(.is-current) {
    border-color: var(--lk-line-soft);
    background: var(--lk-surface-2);
    color: var(--lk-ink);
}

.lk-lesson .ls-step.is-done {
    color: var(--lk-ink);
}

.lk-lesson .ls-step.is-done .ls-step-n {
    border-color: var(--ls-done);
    background: var(--ls-done-bg);
    color: var(--ls-done-ink);
}

/* The one you're on: in the menu's yellow pill, its circle in ink. */
.lk-lesson .ls-step.is-current {
    padding: 0 14px 0 6px;
    border-color: var(--lk-line);
    background: var(--lk-pick);
    color: var(--lk-ink);
}

.lk-lesson .ls-step.is-current .ls-step-n {
    border-color: var(--lk-line);
    background: var(--lk-ink);
    color: var(--lk-bg);
}

.lk-lesson .ls-step.is-locked {
    color: var(--lk-faint);
    cursor: not-allowed;
}

.lk-lesson .ls-step.is-locked .ls-step-n {
    border-style: dashed;
    border-color: var(--lk-faint);
    background: var(--lk-surface-2);
    color: var(--lk-faint);
}

/* A step's name stays in the page for a screen reader where there's no room to show it, as its Done or Locked does. */
.lk-lesson .ls-step-name,
.lk-lesson .ls-step-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.lk-lesson .ls-step.is-current .ls-step-name {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
}

/* Every step's name shows where the row has the room: on a tablet, where the steps have a row of their own, and on a
   wide laptop, where they share the bar. */
@media (min-width: 760px) and (max-width: 1023.98px), (min-width: 1280px) {
    .lk-lesson .ls-step {
        padding: 0 12px 0 6px;
    }

    .lk-lesson .ls-step-name {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
    }
}

/* Staff's preview has a seventh, Teacher notes, so the names need more room: every name shows from 1,600 px. */
@media (min-width: 760px) and (max-width: 899.98px), (min-width: 1280px) and (max-width: 1599.98px) {
    .lk-lesson .ls-steps--notes .ls-step:not(.is-current):not(.ls-step--notes) {
        padding: 0 6px;
    }

    .lk-lesson .ls-steps--notes .ls-step:not(.is-current):not(.ls-step--notes) .ls-step-name {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
}

/* Teacher notes, in staff's preview: after the six, a little apart. */
.lk-lesson .ls-step-item--notes {
    flex: none !important;
    margin-left: 10px;
    padding-left: 10px;
    border-left: var(--lk-bw) solid var(--lk-line-soft);
}

.lk-lesson .ls-step-item--notes::before {
    display: none;
}

.lk-lesson .ls-step--notes .ls-step-n {
    border-style: dashed;
}

.lk-lesson .ls-steps .ls-step--notes .ls-step-name {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
}

/* A step that has just been finished: its tick pops in. */
.lk-lesson .ls-step-item.is-fresh .ls-step-n {
    animation: lk-ls-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes lk-ls-pop {
    from { transform: scale(0.4); }
    to { transform: scale(1); }
}

/* ── The page under the bar ── */

.lk-lesson .ls-main {
    position: relative;
    z-index: 0;
    display: block;
}

.lk-lesson .ls-main noscript {
    display: block;
}

/* What's said above a lesson: that it's a preview, or that the pupil's working is saved. In the left column. */
.lk-lesson .ls-head {
    display: grid;
}

.lk-lesson .ls-head > * {
    margin: 18px var(--ls-pad) 0;
}

.lk-lesson .ls-preview-note {
    padding: 12px 16px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--lk-lilac);
    box-shadow: var(--lk-sh-sm);
    color: var(--lk-ink);
    font-size: 15.5px;
    line-height: 1.5;
}

.lk-lesson .ls-preview-note--pupil {
    background: var(--lk-sun);
}

/* Someone signed out, trying a free lesson: on mint, since nothing's wrong. */
.lk-lesson .ls-preview-note--guest {
    background: var(--lk-mint);
}

/* See it as a pupil, Start again and Back to the preview: plainly links, each with a whole finger's height. */
.lk-lesson .ls-preview-note a {
    display: inline-block;
    margin-block: -11px;
    padding-block: 11px;
    color: var(--lk-ink);
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.lk-lesson .ls-preview-note a:hover {
    text-decoration-color: var(--lk-brand);
}

.lk-lesson .ls-loading {
    margin: 0;
    padding: 40px var(--ls-pad);
    color: var(--lk-muted);
}

/* The app and its inner box draw nothing themselves: the step, the code window and the rest sit straight on the
   page's grid, beside whatever is said above the lesson. */
.lk-lesson .ls-app,
.lk-lesson .ls-work {
    display: contents;
}

.lk-lesson .ls-app[hidden] {
    display: none;
}

.lk-lesson .ls-pane {
    display: grid;
    gap: 16px;
    align-content: start;
    min-width: 0;
    padding: 26px var(--ls-pad) 12px;
    font-size: 16.5px;
    line-height: 1.6;
    /* A word too long for the column breaks, so a check that quotes a long line never widens the page. */
    overflow-wrap: anywhere;
}

.lk-lesson .ls-pane[hidden] {
    display: none;
}

/* Only its opacity changes: moving it would make the page a little taller for a moment, and a scrollbar flicker. */
.lk-lesson .ls-pane.is-in {
    animation: lk-ls-in 0.22s ease-out;
}

@keyframes lk-ls-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lk-lesson .ls-after {
    padding-top: 12px;
    padding-bottom: 56px;
}

.lk-lesson .ls-pane p {
    margin: 0;
}

/* A button in the step (a hint, Back to Modify, Put the program back) is as wide as its words, not the column. */
.lk-lesson .ls-pane > .ls-btn {
    justify-self: start;
}

/* A locked lesson, and the page with no JavaScript: one card on the bench. */
.lk-lesson .ls-locked {
    display: grid;
    gap: 14px;
    justify-items: start;
    width: min(540px, calc(100% - 2 * var(--ls-pad)));
    margin: clamp(28px, 8vh, 96px) auto;
    padding: 28px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r-lg);
    background: var(--lk-surface);
    box-shadow: var(--lk-sh-lg);
    font-size: 16.5px;
    line-height: 1.55;
}

.lk-lesson .ls-locked h2 {
    margin: 0;
    font: 900 clamp(26px, 2.4vw, 32px)/1.1 var(--lk-disp);
    letter-spacing: -0.02em;
}

.lk-lesson .ls-locked p {
    margin: 0;
}

.lk-lesson .ls-locked-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 14px;
    background: var(--lk-sun);
    box-shadow: var(--lk-sh-sm);
    color: var(--lk-ink);
    transform: rotate(-4deg);
}

.lk-lesson .ls-locked-mark svg {
    width: 26px;
    height: 26px;
}

.lk-lesson.ls-page--locked .ls-main {
    min-height: calc(100vh - var(--ls-top-h));
    padding: 1px 0;
    background: var(--ls-bench);
}

/* ── A step: its title, and the words under it ── */

.lk-lesson .ls-step-title {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 16px;
    align-items: center;
    margin: 0;
    scroll-margin-top: calc(var(--ls-top-h) + 16px);
}

.lk-lesson .ls-step-title:focus {
    outline: none;
}

.lk-lesson .ls-step-title:focus-visible {
    outline: 3px solid var(--lk-focus);
    outline-offset: 6px;
    border-radius: 12px;
}

.lk-lesson .ls-step-tile {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 16px;
    background: var(--lk-lilac);
    box-shadow: var(--lk-sh-sm);
    color: var(--lk-brand-deep);
}

.lk-lesson .ls-step-tile .ls-icon {
    width: 26px;
    height: 26px;
}

.lk-lesson .ls-step-of {
    align-self: end;
    color: var(--lk-brand-deep);
    font: 700 12.5px/1.3 var(--lk-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lk-lesson .ls-step-what {
    align-self: start;
    font: 900 clamp(30px, 1.4rem + 1.2vw, 40px)/1.02 var(--lk-disp);
    letter-spacing: -0.025em;
}

.lk-lesson .ls-lead {
    font-size: 17.5px;
    line-height: 1.55;
}

.lk-lesson .ls-h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 -4px;
    font: 800 19px/1.25 var(--lk-disp);
    letter-spacing: -0.01em;
}

.lk-lesson .ls-h3 .ls-icon {
    width: 20px;
    height: 20px;
    color: var(--lk-brand-deep);
}

/* The lines a program should print, under their heading. */
.lk-lesson .ls-expect {
    display: grid;
    gap: 10px;
}

.lk-lesson .ls-expect .ls-h3 {
    margin-bottom: 0;
}

.lk-lesson .ls-pane code,
.lk-lesson .ls-pane pre {
    font-family: var(--lk-mono);
}

.lk-lesson .ls-pane p code,
.lk-lesson .ls-pane li code,
.lk-lesson .ls-pane dd code,
.lk-lesson .ls-q-ask code {
    padding: 1px 6px;
    border: 1px solid var(--lk-line-soft);
    border-radius: 6px;
    background: var(--lk-lilac);
    font-size: 0.9em;
}

/* ── Code in the step: a small dark window with its lines numbered, in the code window's colours ── */

.lk-lesson .ls-snippet {
    margin: 0;
    padding: 12px 0;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--ls-night);
    box-shadow: var(--lk-sh-sm);
    color: var(--ls-night-ink);
    overflow-x: auto;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre;
    tab-size: 4;
    counter-reset: ls-line;
    scrollbar-color: var(--ls-scroll) transparent;
}

.lk-lesson .ls-snippet code {
    display: block;
    min-width: max-content;
}

.lk-lesson .ls-snippet .ls-line {
    display: block;
    min-height: 1.6em;
    padding-right: 16px;
    counter-increment: ls-line;
}

.lk-lesson .ls-snippet .ls-line::before {
    content: counter(ls-line);
    display: inline-block;
    width: 2.5em;
    margin-right: 1em;
    color: var(--ls-night-faint);
    font-size: 0.82em;
    text-align: right;
    user-select: none;
}

.lk-lesson .ls-snippet:focus-visible {
    outline-offset: 3px;
}

.lk-lesson .ls-t-kw { color: var(--ls-t-kw); }
.lk-lesson .ls-t-fn { color: var(--ls-t-fn); }
.lk-lesson .ls-t-str { color: var(--ls-t-str); }
.lk-lesson .ls-t-num { color: var(--ls-t-num); }
.lk-lesson .ls-t-com { color: var(--ls-t-com); }

/* What a program prints isn't code: the lines it should print, and a guess at them, are light, with a band down the
   side: the highlighter's yellow for what it should print, the brand's purple for a guess. */
.lk-lesson .ls-snippet--expect,
.lk-lesson .ls-guess-shown {
    margin: 0;
    padding: 12px 16px 12px 22px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--lk-surface);
    color: var(--lk-ink);
    overflow-x: auto;
    font: 500 15px/1.6 var(--lk-mono);
}

.lk-lesson .ls-snippet--expect {
    box-shadow: inset 8px 0 0 var(--lk-y), var(--lk-sh-sm);
    white-space: pre;
}

.lk-lesson .ls-snippet--expect code {
    font: inherit;
}

.lk-lesson .ls-guess-shown {
    box-shadow: inset 8px 0 0 var(--lk-brand), var(--lk-sh-sm);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ── Forms: the guess, and the questions ── */

.lk-lesson .ls-form {
    display: grid;
    gap: 10px;
    justify-items: start;
}

.lk-lesson .ls-label {
    font: 700 15.5px/1.35 var(--lk-body);
}

.lk-lesson .ls-guess {
    display: block;
    width: 100%;
    min-height: 140px;
    padding: 12px 14px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--lk-surface);
    box-shadow: var(--lk-sh-sm);
    color: var(--lk-ink);
    font: 500 16px/1.55 var(--lk-mono);
    resize: vertical;
}

.lk-lesson .ls-guess:focus {
    outline: 3px solid var(--lk-focus);
    outline-offset: 2px;
}

.lk-lesson .ls-guess[readonly] {
    background: var(--lk-surface-2);
    box-shadow: none;
}

.lk-lesson .ls-form-note {
    min-height: 1.2em;
    color: var(--lk-muted);
    font-size: 15px;
}

.lk-lesson .ls-form-note:empty {
    display: none;
}

/* A question: a card, its number, what it asks, any code, the choices, then Answer. */
.lk-lesson .ls-q {
    display: grid;
    gap: 14px;
    justify-items: start;
    padding: 20px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r-lg);
    background: var(--lk-surface);
    box-shadow: var(--lk-sh);
}

.lk-lesson .ls-fieldset {
    display: grid;
    gap: 12px;
    justify-self: stretch;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.lk-lesson .ls-fieldset > .ls-btn {
    justify-self: start;
}

.lk-lesson .ls-q-legend {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    padding: 0;
    font: 700 17.5px/1.45 var(--lk-body);
}

.lk-lesson .ls-q-n {
    justify-self: start;
    padding: 2px 10px;
    border: 1.5px solid var(--lk-line);
    border-radius: 999px;
    background: var(--lk-lilac);
    font: 700 12px/1.4 var(--lk-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lk-lesson .ls-choices {
    display: grid;
    gap: 10px;
}

.lk-lesson .ls-choice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-height: 52px;
    padding: 13px 14px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--lk-surface);
    cursor: pointer;
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.lk-lesson .ls-choice input {
    flex: none;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 50%;
    background: var(--lk-surface);
    appearance: none;
    cursor: inherit;
}

.lk-lesson .ls-choice input:checked {
    background: radial-gradient(circle, var(--lk-brand) 0 42%, transparent 47%), var(--lk-surface);
}

.lk-lesson .ls-choice input:focus-visible {
    outline: 3px solid var(--lk-focus);
    outline-offset: 2px;
}

.lk-lesson .ls-choice:hover {
    background: var(--lk-surface-2);
}

/* The choice picked, until it's answered: in the menu's yellow, raised. Then the right one is green and a wrong pick
   red, and the words under the question say which is which. */
.lk-lesson .ls-choice:has(input:checked:not(:disabled)) {
    background: var(--lk-pick);
    box-shadow: var(--lk-sh-sm);
}

.lk-lesson .ls-choice:has(input:disabled) {
    cursor: default;
}

.lk-lesson .ls-choice:has(input:disabled):not(.is-answer):not(.is-picked) {
    border-color: var(--lk-line-soft);
    background: var(--lk-surface);
    color: var(--lk-muted);
}

.lk-lesson .ls-choice:has(input:disabled) input {
    border-color: currentColor;
}

.lk-lesson .ls-choice:has(input:disabled) input:checked {
    background: radial-gradient(circle, currentColor 0 42%, transparent 47%), var(--lk-surface);
}

.lk-lesson .ls-choice.is-answer {
    border-color: var(--ls-done);
    background: var(--ls-done-bg);
    color: var(--ls-done-ink);
    font-weight: 700;
}

.lk-lesson .ls-choice.is-picked:not(.is-answer) {
    border-color: var(--lk-danger);
    background: var(--lk-danger-bg);
    color: var(--ls-bad-ink);
}

.lk-lesson .ls-feedback-box {
    justify-self: stretch;
}

.lk-lesson .ls-feedback-box:empty {
    display: none;
}

.lk-lesson .ls-feedback-box:focus {
    outline: none;
}

.lk-lesson .ls-feedback-box:focus-visible .ls-feedback {
    outline: 3px solid var(--lk-focus);
    outline-offset: 2px;
}

.lk-lesson .ls-feedback {
    display: grid;
    gap: 6px;
    padding: 12px 16px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
}

.lk-lesson .ls-feedback-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.lk-lesson .ls-feedback-head .ls-icon {
    width: 20px;
    height: 20px;
}

.lk-lesson .ls-feedback.is-right { background: var(--ls-done-bg); }
.lk-lesson .ls-feedback.is-key { background: var(--lk-lilac); }
.lk-lesson .ls-feedback.is-wrong { background: var(--lk-danger-bg); }

.lk-lesson .ls-feedback.is-right .ls-feedback-head strong,
.lk-lesson .ls-feedback.is-right .ls-feedback-head .ls-icon { color: var(--ls-done-ink); }
.lk-lesson .ls-feedback.is-wrong .ls-feedback-head strong,
.lk-lesson .ls-feedback.is-wrong .ls-feedback-head .ls-icon { color: var(--ls-bad-ink); }

/* ── Checks, hints and I'm stuck ── */

.lk-lesson .ls-checks {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lk-lesson .ls-check {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border: var(--lk-bw) solid var(--lk-line-soft);
    border-radius: var(--lk-r);
    background: var(--lk-surface);
}

.lk-lesson .ls-check-mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 26px;
    height: 26px;
    margin-top: 1px;
    border: var(--lk-bw) dashed var(--lk-faint);
    border-radius: 50%;
}

.lk-lesson .ls-check-mark .ls-icon {
    width: 15px;
    height: 15px;
}

.lk-lesson .ls-check.is-pass {
    border-color: var(--ls-done);
    background: var(--ls-done-bg);
}

.lk-lesson .ls-check.is-fail {
    border-color: var(--lk-danger);
    background: var(--lk-danger-bg);
}

.lk-lesson .ls-check.is-pass .ls-check-mark { border: var(--lk-bw) solid var(--lk-line); background: var(--ls-done); color: var(--ls-white); }
.lk-lesson .ls-check.is-fail .ls-check-mark { border: var(--lk-bw) solid var(--lk-line); background: var(--lk-danger); color: var(--ls-white); }

.lk-lesson .ls-check-body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.lk-lesson .ls-check-name {
    font-weight: 700;
}

.lk-lesson .ls-check-hidden {
    font-weight: 500;
    color: var(--lk-muted);
}

.lk-lesson .ls-check-state {
    color: var(--lk-muted);
    font-size: 15px;
}

.lk-lesson .ls-check.is-fail .ls-check-state { color: var(--ls-bad-ink); }
.lk-lesson .ls-check.is-pass .ls-check-state { color: var(--ls-done-ink); }
.lk-lesson .ls-check.is-pass .ls-check-hidden,
.lk-lesson .ls-check.is-fail .ls-check-hidden { color: inherit; }

.lk-lesson .ls-check-detail {
    color: var(--lk-brand-deep);
    font-size: 14px;
}

/* A hint is a sticky note in the highlighter's yellow, with its number. */
.lk-lesson .ls-hints {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: ls-hint;
}

.lk-lesson .ls-hints:focus {
    outline: none;
}

.lk-lesson .ls-hints:focus-visible {
    outline: 3px solid var(--lk-focus);
    outline-offset: 4px;
    border-radius: var(--lk-r);
}

.lk-lesson .ls-hints li {
    position: relative;
    padding: 12px 16px 12px 54px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--lk-sun);
    box-shadow: var(--lk-sh-sm);
    counter-increment: ls-hint;
}

.lk-lesson .ls-hints li::before {
    content: counter(ls-hint);
    position: absolute;
    top: 11px;
    left: 14px;
    width: 28px;
    height: 28px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 50%;
    background: var(--lk-y);
    color: var(--lk-on-y);
    font: 900 14px/24px var(--lk-disp);
    text-align: center;
}

.lk-lesson .ls-next {
    justify-self: start;
}

/* Your working is saved: the line at the top of the page while a pupil's work is recorded, and what's saved. */
.lk-lesson .ls-recording {
    max-width: 760px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
    background: var(--lk-surface);
    box-shadow: var(--lk-sh-sm);
}

/* The arrow, the tick and the words sit in a row, so words that wrap stay under the words. */
.lk-lesson .ls-recording > summary {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 11px 16px;
    border-radius: 12px;
    font-weight: 700;
    line-height: 1.4;
    list-style: none;
    cursor: pointer;
}

.lk-lesson .ls-recording > summary::-webkit-details-marker {
    display: none;
}

.lk-lesson .ls-recording > summary::before {
    content: "";
    flex: none;
    margin: 0.38em 2px 0;
    border-left: 7px solid currentColor;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    transition: transform 0.12s ease;
}

.lk-lesson .ls-recording[open] > summary::before {
    transform: rotate(90deg);
}

/* A calm tick: the words beside it say what it means. */
.lk-lesson .ls-recording-mark {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 0.05em;
    color: var(--ls-done);
}

.lk-lesson .ls-recording-words {
    display: grid;
    gap: 8px;
    padding: 0 16px 16px 40px;
    color: var(--lk-ink);
    font-size: 15.5px;
    line-height: 1.55;
}

.lk-lesson .ls-recording-words p {
    margin: 0;
}

/* My working: a link in its sentence, with a whole finger's height to press. */
.lk-lesson .ls-recording-words a {
    display: inline-block;
    margin-block: -10px;
    padding-block: 10px;
    color: var(--lk-brand-deep);
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.lk-lesson .ls-recording-words a:hover {
    text-decoration-color: var(--lk-y);
}

/* I'm stuck: the last rung, after the hints. Once it's pressed, the card says the teacher can see it. */
.lk-lesson .ls-stuck {
    display: grid;
    gap: 10px;
    justify-items: start;
    padding: 16px 18px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r-lg);
    background: var(--lk-surface);
    box-shadow: var(--lk-sh);
}

.lk-lesson .ls-stuck .ls-h3 {
    margin: 0;
}

.lk-lesson .ls-stuck p {
    margin: 0;
}

.lk-lesson .ls-stuck.is-up {
    background: var(--lk-lilac);
}

.lk-lesson .ls-stuck.is-up .ls-h3 .ls-icon {
    color: var(--lk-ink);
}

/* The lesson finished: a mint card with a star sticker, and what they can now do. */
.lk-lesson .ls-finished {
    display: grid;
    gap: 12px;
    justify-items: start;
    padding: 24px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r-lg);
    background: var(--lk-mint);
    box-shadow: var(--lk-sh-lg);
}

.lk-lesson .ls-finished .ls-h3 {
    margin: 0;
    font: 900 clamp(24px, 2vw, 30px)/1.1 var(--lk-disp);
    letter-spacing: -0.02em;
}

.lk-lesson .ls-finished-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 16px;
    background: var(--lk-y);
    box-shadow: var(--lk-sh-sm);
    color: var(--lk-on-y);
    transform: rotate(-5deg);
}

.lk-lesson .ls-finished-mark .ls-icon {
    width: 28px;
    height: 28px;
}

.lk-lesson .ls-finished-can {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lk-lesson .ls-finished-can li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 700;
}

.lk-lesson .ls-finished-can .ls-icon {
    width: 20px;
    height: 20px;
    margin-top: 3px;
    color: var(--ls-done-ink);
}

/* ── The teacher's notes, in staff's preview ── */

.lk-lesson .ls-list-plain {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 1.3em;
}

.lk-lesson .ls-list-plain a {
    color: var(--lk-brand-deep);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.lk-lesson .ls-table {
    width: 100%;
    max-width: 440px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r);
}

.lk-lesson .ls-table th,
.lk-lesson .ls-table td {
    padding: 8px 12px;
    border-bottom: 1.5px solid var(--lk-line-soft);
    text-align: left;
}

.lk-lesson .ls-table thead th {
    border-bottom: var(--lk-bw) solid var(--lk-line);
    background: var(--lk-surface-2);
    font: 700 13px/1.3 var(--lk-mono);
}

.lk-lesson .ls-table tbody tr:last-child td {
    border-bottom: 0;
}

.lk-lesson .ls-boards {
    display: grid;
    gap: 4px;
    margin: 0;
}

.lk-lesson .ls-boards dt {
    font: 800 16px/1.3 var(--lk-disp);
}

.lk-lesson .ls-boards dd {
    margin: 0 0 8px;
}

/* ── The code window ── */

.lk-lesson .ls-editor {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 6px var(--ls-pad) 14px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: var(--lk-r-lg);
    background: var(--ls-night);
    /* An ink window's offset shadow is the brand's purple, as the kit's ink button's is: an ink one would melt into it. */
    box-shadow: 6px 6px 0 var(--lk-brand);
    color: var(--ls-night-ink);
    /* Clipped, and never scrolled: its bar, with Run on it, can't be moved out of sight. */
    overflow: hidden;
    overflow: clip;
}

.lk-lesson .ls-editor[hidden] {
    display: none;
}

.lk-lesson .ls-editor-bar,
.lk-lesson .ls-editor-help,
.lk-lesson .ls-input {
    flex: none;
}

/* The window's bar is light, as the kit's windows are: its dots, the file, Read only, Saved, then Start again and Run. */
.lk-lesson .ls-editor-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-height: 66px;
    padding: 8px 10px 8px 16px;
    border-bottom: var(--lk-bw) solid var(--lk-line);
    background: var(--lk-surface-2);
    color: var(--lk-ink);
}

.lk-lesson .ls-editor-dots {
    display: inline-flex;
    gap: 6px;
}

.lk-lesson .ls-editor-dots i {
    width: 11px;
    height: 11px;
    border: 1.5px solid var(--lk-line);
    border-radius: 50%;
}

.lk-lesson .ls-editor-dots i:nth-child(1) { background: var(--ls-dot-1); }
.lk-lesson .ls-editor-dots i:nth-child(2) { background: var(--lk-y); }
.lk-lesson .ls-editor-dots i:nth-child(3) { background: var(--ls-dot-3); }

.lk-lesson .ls-file {
    color: var(--lk-ink);
    font: 700 14.5px/1.2 var(--lk-mono);
    overflow-wrap: anywhere;
}

.lk-lesson .ls-file-tag {
    padding: 2px 9px;
    border: 1.5px solid var(--lk-line);
    border-radius: 999px;
    background: var(--lk-surface);
    color: var(--lk-ink);
    font: 700 11px/1.4 var(--lk-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lk-lesson .ls-editor-note {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--lk-muted);
    font: 600 13.5px/1.3 var(--lk-body);
}

.lk-lesson .ls-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
    /* Room for the buttons' shadows inside the bar. */
    padding: 0 4px 4px 0;
}

/* Run is the highlighter's yellow: the one bright thing on the window. */
.lk-lesson .ls-btn--run,
.lk-lesson .ls-btn--run:hover {
    min-width: 108px;
    background: var(--lk-y);
    color: var(--lk-on-y);
    font-weight: 800;
}

/* In the Run step, until the program has run, Run asks to be pressed. */
.lk-lesson .ls-btn--run.is-calling {
    animation: lk-ls-call 1.6s ease-out infinite;
}

@keyframes lk-ls-call {
    from { box-shadow: var(--lk-sh), 0 0 0 0 var(--ls-call); }
    to { box-shadow: var(--lk-sh), 0 0 0 14px var(--ls-call-end); }
}

/* Start again: a white button on the bar, a little smaller than Run. */
.lk-lesson .ls-btn--quiet,
.lk-lesson .ls-btn--quiet:hover {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    background: var(--lk-surface);
    box-shadow: var(--lk-sh-sm);
    color: var(--lk-ink);
    font-size: 14.5px;
}

.lk-lesson .ls-btn--run:disabled,
.lk-lesson .ls-btn--quiet:disabled {
    border-color: var(--lk-faint);
    background: var(--lk-surface-2);
    box-shadow: none;
    color: var(--lk-faint);
}

/* On the dark parts of the window, the keyboard's ring is the highlighter's yellow, so it shows. */
.lk-lesson .ls-code :focus-visible,
.lk-lesson .ls-input :focus-visible,
.lk-lesson .ls-output :focus-visible {
    outline-color: var(--ls-night-focus);
}

/* The code: line numbers, then the box. On a narrow screen the box is as tall as its code, from 5 lines up to most
   of the screen: the line numbers are what give it its height, with a little under them for a scrollbar. */
.lk-lesson .ls-code {
    position: relative;
    display: flex;
    flex: none;
    min-height: calc(5 * var(--ls-code-line) + 46px);
    max-height: 62vh;
}

.lk-lesson .ls-gutter {
    flex: none;
    min-width: 3.3em;
    padding: 14px 10px 32px 8px;
    overflow: hidden;
    color: var(--ls-night-faint);
    font: 400 13px/var(--ls-code-line) var(--lk-mono);
    text-align: right;
    user-select: none;
}

.lk-lesson .ls-gutter span {
    display: block;
}

.lk-lesson .ls-gutter .is-at {
    color: var(--ls-white);
}

.lk-lesson .ls-gutter .is-error {
    color: var(--ls-run-bad);
    font-weight: 700;
}

.lk-lesson .ls-code-area {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

/* The box and the colours under it are set alike, to the pixel, so each letter sits on its own colour. */
.lk-lesson .ls-code-text,
.lk-lesson .ls-code-paint {
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 14px 16px 14px 6px;
    border: 0;
    font: 400 var(--ls-code-size)/var(--ls-code-line) var(--lk-mono);
    letter-spacing: 0;
    white-space: pre;
    tab-size: 4;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.lk-lesson .ls-code-text {
    width: 100%;
    height: 100%;
    border-radius: 0;
    resize: none;
    overflow: auto;
    background: transparent;
    color: var(--ls-night-ink);
    caret-color: var(--lk-y);
    scrollbar-color: var(--ls-scroll) transparent;
}

.lk-lesson .ls-code-text::selection {
    background: var(--ls-select);
}

/* The code and the output fill their part of the window, so their ring goes just inside it, where it shows. The
   code's goes round its line numbers too. */
.lk-lesson .ls-code:focus-within {
    box-shadow: inset 0 0 0 3px var(--ls-night-focus);
}

.lk-lesson .ls-editor .ls-code-text:focus-visible {
    outline: none;
}

.lk-lesson .ls-editor .ls-out:focus-visible {
    outline-offset: -3px;
}

.lk-lesson .ls-code.is-read-only .ls-code-text {
    cursor: default;
}

.lk-lesson .ls-code-paint {
    display: none;
    min-width: 100%;
    width: max-content;
    color: var(--ls-night-ink);
    pointer-events: none;
}

.lk-lesson .ls-code-paint .ls-line {
    display: block;
    height: var(--ls-code-line);
}

.lk-lesson .ls-code.is-painted .ls-code-paint {
    display: block;
}

.lk-lesson .ls-code.is-painted .ls-code-text,
.lk-lesson .ls-code.is-painted .ls-code-text::selection {
    color: transparent;
    -webkit-text-fill-color: transparent;
}

/* The copies paintFits() measures: out of sight, and narrow so their text overflows. */
.lk-lesson .ls-code .ls-code-probe {
    display: block;
    width: 120px;
    min-width: 0;
    height: 60px;
    padding: 0;
    overflow: hidden;
    visibility: hidden;
}

/* The line the cursor is on, and the line an error points at. */
.lk-lesson .ls-code-band {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: var(--ls-code-line);
    background: var(--ls-band);
    pointer-events: none;
}

.lk-lesson .ls-code-band--error {
    background: var(--ls-band-bad);
    box-shadow: inset 4px 0 0 var(--ls-run-bad);
}

.lk-lesson .ls-code-band[hidden] {
    display: none;
}

.lk-lesson .ls-editor-help {
    margin: 0;
    padding: 8px 16px;
    border-top: 1px solid var(--ls-night-line);
    color: var(--ls-night-muted);
    font-size: 13px;
    line-height: 1.45;
}

/* What the program reads: shown once the code asks for input, or the lesson gives some. */
.lk-lesson .ls-input {
    padding: 0 16px;
    border-top: 1px solid var(--ls-night-line);
}

.lk-lesson .ls-input[hidden] {
    display: none;
}

.lk-lesson .ls-input summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.lk-lesson .ls-input summary::-webkit-details-marker {
    display: none;
}

.lk-lesson .ls-input summary::before {
    content: "";
    flex: none;
    margin: 0 2px;
    border-left: 7px solid var(--lk-y);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    transition: transform 0.12s ease;
}

.lk-lesson .ls-input[open] summary::before {
    transform: rotate(90deg);
}

.lk-lesson .ls-input[open] {
    padding-bottom: 14px;
}

.lk-lesson .ls-input .ls-label {
    display: block;
    margin-bottom: 6px;
    color: var(--ls-night-muted);
    font-size: 13.5px;
    font-weight: 500;
}

.lk-lesson .ls-stdin {
    display: block;
    width: 100%;
    min-height: 54px;
    padding: 8px 10px;
    border: var(--lk-bw) solid var(--ls-field-line);
    border-radius: 12px;
    background: var(--ls-night-deep);
    color: var(--ls-white);
    font: 400 16px/1.55 var(--lk-mono);
    resize: vertical;
}

.lk-lesson .ls-stdin:focus {
    border-color: var(--ls-night-focus);
    outline: none;
}

/* What the program printed: a little darker than the code, with a dot beside the words that say how the run went. */
.lk-lesson .ls-output {
    display: flex;
    flex: none;
    flex-direction: column;
    min-height: 0;
    border-top: var(--lk-bw) solid var(--lk-line);
    background: var(--ls-night-deep);
}

.lk-lesson .ls-output-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 14px;
    padding: 12px 16px 8px;
}

.lk-lesson .ls-output-title {
    margin: 0;
    color: var(--ls-night-muted);
    font: 700 12px/1.5 var(--lk-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lk-lesson .ls-run-line {
    position: relative;
    flex: 1 1 240px;
    min-width: 0;
    margin: 0;
    padding-left: 18px;
    color: var(--ls-white);
    font-size: 15px;
    line-height: 1.45;
}

.lk-lesson .ls-run-line::before {
    content: "";
    position: absolute;
    top: 0.4em;
    left: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ls-idle);
}

.lk-lesson .ls-output[data-state="ok"] .ls-run-line::before { background: var(--ls-run-ok); }
.lk-lesson .ls-output[data-state="error"] .ls-run-line::before { background: var(--ls-run-bad); }
.lk-lesson .ls-output[data-state="stopped"] .ls-run-line::before { background: var(--ls-run-stop); }
.lk-lesson .ls-output[data-state="busy"] .ls-run-line::before {
    background: var(--lk-y);
    animation: lk-ls-busy 0.9s ease-in-out infinite alternate;
}

@keyframes lk-ls-busy {
    from { opacity: 1; }
    to { opacity: 0.25; }
}

.lk-lesson .ls-out {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 300px;
    margin: 0;
    padding: 2px 16px 16px;
    overflow: auto;
    color: var(--ls-night-ink);
    font: 400 15px/1.55 var(--lk-mono);
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-color: var(--ls-scroll) transparent;
}

.lk-lesson .ls-out:empty {
    display: none;
}

.lk-lesson .ls-out .ls-err {
    color: var(--ls-err-ink);
}

.lk-lesson .ls-out .ls-quiet {
    color: var(--ls-night-muted);
}

/* With nothing printed yet, the output says what to do. In Predict it stays hidden behind a question mark. */
.lk-lesson .ls-out-blank {
    display: none;
    margin: 0;
    padding: 2px 16px 18px;
    color: var(--ls-night-muted);
    font-size: 15px;
    line-height: 1.5;
}

.lk-lesson .ls-out:empty + .ls-out-blank {
    display: block;
}

.lk-lesson .ls-editor[data-step="predict"] .ls-output-head {
    display: none;
}

.lk-lesson .ls-editor[data-step="predict"] .ls-out:empty + .ls-out-blank {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 16px;
    color: var(--ls-white);
    font-size: 16px;
}

/* The question mark is a sticker: yellow, tilted, with the lilac edge the site's dark grounds give one. */
.lk-lesson .ls-editor[data-step="predict"] .ls-out-blank::before {
    content: "?";
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border: var(--lk-bw) solid var(--lk-line);
    border-radius: 12px;
    background: var(--lk-y);
    box-shadow: 3px 3px 0 var(--ls-sticker-edge);
    color: var(--lk-on-y);
    font: 900 24px/1 var(--lk-disp);
    transform: rotate(-5deg);
}

/* ── Two columns from 1,024px: the step, then the code window, which stays on screen on the bench ── */

@media (min-width: 1024px) {
    .lk-lesson .ls-top {
        position: sticky;
        top: 0;
    }

    .lk-lesson .ls-top-in {
        flex-wrap: nowrap;
        gap: 16px;
        height: var(--ls-top-h);
        padding-block: 0;
    }

    .lk-lesson .ls-crumbs {
        flex: none;
    }

    .lk-lesson .ls-crumbs ol {
        flex-wrap: nowrap;
        white-space: nowrap;
    }

    .lk-lesson .ls-title {
        padding-left: 16px;
        border-left: var(--lk-bw) solid var(--lk-line-soft);
        overflow: hidden;
        font-size: 20px;
        line-height: 1.6;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* The steps keep their room at the bar's right, and a long lesson name gives way to them. */
    .lk-lesson .ls-steps {
        flex: none;
        max-width: 100%;
        margin-block: -6px;
        margin-left: auto;
    }

    .lk-lesson .ls-step-item + .ls-step-item {
        flex: none;
    }

    .lk-lesson .ls-step-item + .ls-step-item::before {
        flex: none;
        width: 14px;
        min-width: 14px;
    }

    .lk-lesson .ls-main {
        display: grid;
        grid-template-columns: var(--ls-guide-w) minmax(0, 1fr);
        grid-template-rows: auto auto 1fr;
        min-height: calc(100vh - var(--ls-top-h));
    }

    /* The right-hand side is a bench for the code window: lilac, with the site's dots, edged in ink. */
    .lk-lesson .ls-main::before {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: var(--ls-guide-w);
        z-index: -1;
        border-left: var(--lk-bw) solid var(--lk-line);
        background: var(--ls-bench);
    }

    .lk-lesson .ls-head {
        grid-column: 1;
        grid-row: 1;
    }

    .lk-lesson .ls-head > * {
        margin-top: 22px;
    }

    .lk-lesson .ls-pane {
        grid-column: 1;
        grid-row: 2;
        padding-top: 30px;
    }

    .lk-lesson .ls-after {
        grid-row: 3;
        padding-top: 12px;
    }

    .lk-lesson .ls-loading,
    .lk-lesson .ls-locked,
    .lk-lesson .ls-main noscript {
        grid-column: 1 / -1;
    }

    .lk-lesson .ls-editor {
        position: sticky;
        top: calc(var(--ls-top-h) + var(--ls-gap));
        grid-column: 2;
        grid-row: 1 / span 3;
        align-self: start;
        justify-self: center;
        width: min(calc(100% - 2 * clamp(20px, 2.2vw, 36px)), 1080px);
        height: calc(100vh - var(--ls-top-h) - 2 * var(--ls-gap));
        height: calc(100dvh - var(--ls-top-h) - 2 * var(--ls-gap));
        margin: var(--ls-gap) 0;
    }

    /* The window's height is the screen's, so its parts share it. The code keeps six lines at least. The output
       takes what it needs, up to nearly half, and gives way first when there's little room: then it scrolls. */
    .lk-lesson .ls-code {
        flex: 1 1 0;
        min-height: calc(6 * var(--ls-code-line) + 28px);
        max-height: none;
    }

    .lk-lesson .ls-output {
        flex: 0 1 auto;
        min-height: 88px;
        max-height: 46%;
    }

    .lk-lesson .ls-out {
        max-height: none;
    }

    /* A step with no code (Check-in, the teacher's notes) and a locked lesson have the page's whole width. */
    .lk-lesson .ls-main--solo,
    .lk-lesson.ls-page--locked .ls-main {
        display: block;
    }

    .lk-lesson .ls-main--solo::before,
    .lk-lesson.ls-page--locked .ls-main::before {
        display: none;
    }
}

/* The step is a card on the bench, in the middle of the page. */
@media (min-width: 720px) {
    .lk-lesson .ls-main--solo {
        min-height: calc(100vh - var(--ls-top-h));
        padding: 1px 0 56px;
        background: var(--ls-bench);
    }

    .lk-lesson .ls-main--solo .ls-pane,
    .lk-lesson .ls-main--solo .ls-head > * {
        width: min(800px, calc(100% - 2 * var(--ls-pad)));
        margin-inline: auto;
    }

    .lk-lesson .ls-main--solo .ls-pane {
        margin-top: 26px;
        padding: 34px clamp(24px, 4vw, 44px) 38px;
        border: var(--lk-bw) solid var(--lk-line);
        border-radius: 24px;
        background: var(--lk-surface);
        box-shadow: var(--lk-sh-lg);
    }

    .lk-lesson .ls-main--solo .ls-recording {
        max-width: none;
    }
}

/* On a small laptop the lesson's length gives its room to the lesson's name: up to 1,343 px, where every step's name
   shows from 1,280 px (a school Chromebook), the name would otherwise be cut to its first word. */
@media (min-width: 1024px) and (max-width: 1343.98px) {
    .lk-lesson .ls-meta {
        display: none;
    }
}

/* A short screen (a laptop with its window made small): the code window's parts wouldn't all fit in the screen's
   height, so it's as tall as it needs and scrolls with the page. */
@media (min-width: 1024px) and (max-height: 599.98px) {
    .lk-lesson .ls-editor {
        position: static;
        height: auto;
    }

    .lk-lesson .ls-code {
        flex: none;
        height: calc(10 * var(--ls-code-line) + 28px);
        min-height: 0;
        max-height: none;
    }

    .lk-lesson .ls-output {
        flex: none;
        max-height: none;
    }

    .lk-lesson .ls-out {
        max-height: 300px;
    }
}

/* Big screens grow a little, as the home does. The code's lines keep their height: lesson-page.js measures it once,
   when the page opens, to place the bands behind the cursor's line and an error's, so a zoom or a resize across this
   width would leave them on the wrong line. */
@media (min-width: 1600px) {
    .lk-lesson .ls-pane {
        font-size: 17px;
    }

    .lk-lesson {
        --ls-code-size: 17px;
    }
}

/* A phone: the steps' lines get shorter, so six steps and the one you're on fit in the row from 360 px. */
@media (max-width: 439.98px) {
    .lk-lesson .ls-step-item + .ls-step-item::before {
        min-width: 6px;
    }

    .lk-lesson .ls-step.is-current {
        padding-right: 12px;
    }
}

/* Phones: the window's bar puts Start again and Run on a row of their own, and the cards are a little tighter. */
@media (max-width: 640px) {
    .lk-lesson .ls-step-tile {
        width: 48px;
        height: 48px;
    }

    .lk-lesson .ls-q,
    .lk-lesson .ls-locked,
    .lk-lesson .ls-stuck,
    .lk-lesson .ls-finished {
        padding: 16px;
    }

    .lk-lesson .ls-editor-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
    }

    /* In Predict there's no Run or Start again: no row for them. */
    .lk-lesson .ls-editor-actions:not(:has(> .ls-btn:not([hidden]))) {
        display: none;
    }
}

/* Windows' high contrast: the box's own text shows, with no colours under it, and its ring is an outline. A choice's
   circle is the system's own, since the dot drawn as a background above would be taken away: the pick still shows. */
@media (forced-colors: active) {
    .lk-lesson .ls-choice input {
        appearance: auto;
    }

    .lk-lesson .ls-code:focus-within {
        outline: 2px solid Highlight;
        outline-offset: -2px;
    }

    .lk-lesson .ls-code.is-painted .ls-code-paint {
        display: none;
    }

    .lk-lesson .ls-code.is-painted .ls-code-text {
        color: CanvasText;
        -webkit-text-fill-color: CanvasText;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lk-lesson *,
    .lk-lesson *::before,
    .lk-lesson *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .lk-lesson .ls-btn:hover,
    .lk-lesson .ls-btn:active {
        transform: none;
    }
}

/* Print: the step and its code as they are, without the stickiness or the shadows. */
@media print {
    .lk-lesson .ls-top,
    .lk-lesson .ls-editor {
        position: static;
        height: auto;
    }

    .lk-lesson .ls-editor,
    .lk-lesson .ls-q,
    .lk-lesson .ls-btn {
        box-shadow: none;
    }

    .lk-lesson .ls-main::before {
        display: none;
    }
}
