/* ========================================
   Settings in the Classlings look (js/classlings-settings.js), and what it shares with the points
   history (js/classlings-history.js): a title of its own in the top strip, and a bar with Back, the
   page's own toolbar and Menu.
   For classes with Classlings on, body.classlings-app: the reviewed design (design-directions,
   directions/mix/settings.html). A side list of sections, each saying what it's set to now, and the
   chosen section on a light plate: every setting is a name, one plain line, and a control that can't
   be got wrong. Every rule here is scoped to body.classlings-app, so classes without Classlings keep
   today's Settings.
   ======================================== */

body.classlings-app {
    /* The design's colours this look hadn't needed yet. */
    --cla-paper: #fbf9f4;
    --cla-lime-tint: #e5f8da;
    --cla-tangerine: #ff8a3d;
    --cla-card-minus-ink: #b32139;
    --cla-card-plus: #dcf4dd;
    --cla-card-plus-ink: #15803d;
    --cla-line-soft: rgba(30, 27, 58, 0.3);
    --cla-scrim: rgba(30, 27, 58, 0.45);
    --cla-r-xl: 44px;
}

/* ---------------------------------------------------------------- the page's title in the bar */

/* The page's title is in the lettering (classlings-app.js), where the class's name goes on the board;
   beside it, the class and a line about it, only when there's room for both. */
body.classlings-app .cla-name .cla-when {
    display: grid;
    flex: 0 1 auto;
    gap: 2px;
    min-width: 0;
    margin: 0;
    font: 600 20px / 1.1 var(--cla-display);
    color: var(--cla-ink);
    white-space: nowrap;
}

body.classlings-app .cla-name .cla-when > * {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.classlings-app .cla-name .cla-when b {
    font-weight: 600;
}

body.classlings-app .cla-name .cla-when:is([hidden], .is-squeezed) {
    display: none;
}

body.classlings-app .cla-name .cla-when span {
    font: 400 16px / 1.2 var(--cla-ui);
    color: var(--cla-ink-2);
}

body.classlings-app.cla-sky .cla-name .cla-when span {
    color: var(--cla-ink);
}

/* On a row of its own the bar has one line to give it: the class's name, without the note. */
body.classlings-app.cla-name-row .cla-name .cla-when span {
    display: none;
}

@media (max-width: 640px) {
    body.classlings-app .cla-name .cla-when span {
        display: none;
    }
}

/* A save that can't get through: the notice, and Try again beside it. */
body.classlings-app .cla-page-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

body.classlings-app .cla-page-notice[hidden] {
    display: none;
}

body.classlings-app .cla-page-retry {
    appearance: none;
    flex: none;
    min-height: 40px;
    padding: 0 14px;
    font: 600 18px / 1 var(--cla-display);
    color: var(--cla-ink);
    background: var(--cla-page);
    border: 2px solid var(--cla-ink);
    border-radius: 8px;
    cursor: pointer;
}

body.classlings-app .cla-page-retry:hover {
    background: var(--cla-wash);
}

/* In the sky, a page's clouds float clear of its title and the line beside it (as the design places
   them for Settings; the points history moves them a little further). */
body.classlings-app.cla-sky:has(#settingsScreen:not(.hidden), #historyScreen:not(.hidden)) {
    background:
        var(--cla-art-cloud) left var(--cla-cloud-a, 63.8%) top 14px / calc(var(--cla-px) * 32) calc(var(--cla-px) * 9) no-repeat,
        var(--cla-art-puff) left var(--cla-cloud-b, 78%) top 50px / calc(var(--cla-px) * 20) calc(var(--cla-px) * 5) no-repeat,
        var(--cla-art-edge) left 0 bottom var(--cla-soil) / calc(var(--cla-px) * 16) calc(var(--cla-px) * 2) repeat-x,
        linear-gradient(var(--cla-soil-colour), var(--cla-soil-colour)) left 0 bottom 0 / 100% var(--cla-soil) no-repeat,
        var(--cla-art-tufts) left 0 bottom var(--cla-ground) / calc(var(--cla-px) * 16) calc(var(--cla-px) * 3) repeat-x,
        linear-gradient(var(--cla-grass), var(--cla-grass)) left 0 bottom 0 / 100% var(--cla-ground) no-repeat,
        var(--cla-world);
}

body.classlings-app.cla-sky:has(#historyScreen:not(.hidden)) {
    --cla-cloud-a: 66.2%;
    --cla-cloud-b: 78.5%;
}

/* ---------------------------------------------------------------- the bar on a page of its own */

/* Settings and the points history: Back where Home usually is, the page's own toolbar in the middle,
   and Menu at the end. */
body.classlings-app:has(#claPageBar:not([hidden])) .app-header .cla-home {
    display: none;
}

body.classlings-app:has(#claPageBar:not([hidden])) .app-header .header-left:has(> .back-btn:not([style*="display: none"])) {
    order: -1;
    margin: 0;
}

body.classlings-app .app-header .cla-page-bar {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: var(--cla-tool-gap);
    min-width: 0;
    margin: 0 auto var(--cla-lift);
    padding: var(--cla-pad);
    background: var(--cla-page);
    border: var(--cla-edge) solid var(--cla-ink);
    border-radius: var(--cla-r-l);
    box-shadow: var(--cla-float);
}

body.classlings-app .app-header .cla-page-bar[hidden] {
    display: none;
}

/* A short line between a page toolbar's groups. */
body.classlings-app .app-header .cla-page-bar .cla-gap {
    flex: none;
    align-self: stretch;
    width: var(--cla-edge);
    margin: 8px 4px;
    background: var(--cla-wash-2);
    border-radius: var(--cla-edge);
}

/* Back wears the design's arrow in this look. */
body.classlings-app .app-header .back-btn > svg:not(.cla-only) {
    display: none;
}

body.classlings-app .app-header .back-btn > svg.cla-only {
    display: block;
}

/* Settings' toolbar: the last change, and Undo. */
body.classlings-app .cla-set-last {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0 4px 0 12px;
    font: 600 20px / 1 var(--cla-display);
    color: var(--cla-ink);
    white-space: nowrap;
}

body.classlings-app .cla-set-said {
    min-width: 0;
    max-width: 640px;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.classlings-app .cla-set-none {
    color: var(--cla-ink-2);
}

body.classlings-app .cla-set-mark {
    display: inline-grid;
    flex: none;
    place-items: center;
    min-width: 44px;
    height: 34px;
    padding: 0 8px;
    font: 700 20px / 1 var(--cla-display);
    background: var(--cla-lime);
    border: 2px solid var(--cla-lime-deep);
    border-radius: var(--cla-r-s);
}

body.classlings-app .cla-set-mark.is-saving {
    background: var(--cla-wash);
    border-color: var(--cla-wash-2);
}

body.classlings-app .cla-set-mark.is-failed {
    background: var(--cla-tangerine-tint);
    border-color: var(--cla-tangerine-deep);
}

/* ---------------------------------------------------------------- the page */

/* Today's Settings form gives way to the side list and the plate. */
body.classlings-app #settingsScreen .settings-content {
    display: none;
}

body.classlings-app #settingsScreen:not(.hidden) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px var(--cla-gutter) 32px;
    overflow: hidden;
}

body.classlings-app .cla-set {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    color: var(--cla-ink);
}

body.classlings-app .cla-set-body {
    display: grid;
    flex: 1;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    min-height: 0;
}

/* ---------------------------------------------------------------- the side list */

body.classlings-app .cla-set-secs {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 0;
    overflow-y: auto;
}

body.classlings-app .cla-set-sec {
    appearance: none;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 22px;
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 12px;
    min-height: 70px;
    margin: 0;
    padding: 6px 12px 6px 16px;
    color: var(--cla-ink);
    text-align: left;
    background: var(--cla-wash);
    border: var(--cla-edge) solid transparent;
    border-radius: var(--cla-r-m);
    cursor: pointer;
}

body.classlings-app .cla-set-sec:hover {
    border-color: var(--cla-wash-2);
}

body.classlings-app .cla-set-sec b {
    font: 600 20px / 1.2 var(--cla-display);
}

body.classlings-app .cla-set-sec small {
    grid-column: 2;
    font: 400 16px / 1.3 var(--cla-ui);
    color: var(--cla-ink-2);
}

body.classlings-app .cla-set-sec .cla-set-go {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    width: 22px;
    height: 22px;
    visibility: hidden;
}

body.classlings-app .cla-set-sec.is-on {
    background: var(--cla-grape-tint);
    border-color: var(--cla-grape-deep);
    box-shadow: inset 0 0 0 var(--cla-edge) var(--cla-grape-deep);
}

body.classlings-app .cla-set-sec.is-on .cla-set-go {
    visibility: visible;
}

/* In the sky, the pale panels turn white with a soft ink line, so they still read. */
body.classlings-app.cla-sky .cla-set-sec:not(.is-on),
body.classlings-app.cla-sky .cla-set-groups {
    background: var(--cla-page);
    box-shadow: inset 0 0 0 var(--cla-edge) var(--cla-line-soft);
}

/* Each section's pixel icon (the design's, made by its settings_shots.py icons). */
body.classlings-app .cla-set-si {
    display: block;
    grid-row: 1 / span 2;
    align-self: center;
    width: 32px;
    height: 32px;
    background: var(--si) 0 0 / 100% 100% no-repeat;
    image-rendering: pixelated;
}

body.classlings-app .cla-set-si.si-points { --si: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%232d3436' d='M3 0h3v1h-3zM9 0h3v1h-3zM2 1h1v1h-1zM6 1h1v1h-1zM8 1h1v1h-1zM12 1h1v1h-1zM1 2h1v1h-1zM7 2h1v1h-1zM13 2h1v1h-1zM0 3h1v1h-1zM14 3h1v1h-1zM0 4h1v1h-1zM14 4h1v1h-1zM0 5h1v1h-1zM14 5h1v1h-1zM0 6h1v1h-1zM14 6h1v1h-1zM0 7h1v1h-1zM14 7h1v1h-1zM1 8h1v1h-1zM13 8h1v1h-1zM2 9h1v1h-1zM12 9h1v1h-1zM3 10h1v1h-1zM11 10h1v1h-1zM4 11h1v1h-1zM10 11h1v1h-1zM5 12h1v1h-1zM9 12h1v1h-1zM6 13h1v1h-1zM8 13h1v1h-1zM7 14h1v1h-1z'/%3E%3Cpath fill='%23ef4444' d='M3 1h3v1h-3zM9 1h3v1h-3zM2 2h1v1h-1zM5 2h2v1h-2zM8 2h5v1h-5zM1 3h2v1h-2zM4 3h10v1h-10zM1 4h13v1h-13zM1 5h13v1h-13zM1 6h13v1h-13zM1 7h13v1h-13zM2 8h11v1h-11zM3 9h9v1h-9zM4 10h7v1h-7zM5 11h5v1h-5zM6 12h3v1h-3zM7 13h1v1h-1z'/%3E%3Cpath fill='%23ff9fb5' d='M3 2h2v1h-2zM3 3h1v1h-1z'/%3E%3C/svg%3E"); }
body.classlings-app .cla-set-si.si-reasons { --si: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%232d3436' d='M6 1h4v1h-4zM2 2h4v1h-4zM10 2h4v1h-4zM1 3h1v1h-1zM14 3h1v1h-1zM1 4h1v1h-1zM14 4h1v1h-1zM1 5h1v1h-1zM14 5h1v1h-1zM1 6h1v1h-1zM14 6h1v1h-1zM1 7h1v1h-1zM14 7h1v1h-1zM1 8h1v1h-1zM14 8h1v1h-1zM1 9h1v1h-1zM14 9h1v1h-1zM1 10h1v1h-1zM14 10h1v1h-1zM1 11h1v1h-1zM14 11h1v1h-1zM1 12h1v1h-1zM14 12h1v1h-1zM1 13h1v1h-1zM14 13h1v1h-1zM2 14h12v1h-12z'/%3E%3Cpath fill='%235f6b6f' d='M6 2h4v1h-4zM5 3h6v1h-6zM8 6h4v1h-4zM8 10h4v1h-4z'/%3E%3Cpath fill='%23c98b52' d='M2 3h3v1h-3zM11 3h3v1h-3zM2 4h1v1h-1zM13 4h1v1h-1zM2 5h1v1h-1zM13 5h1v1h-1zM2 6h1v1h-1zM13 6h1v1h-1zM2 7h1v1h-1zM13 7h1v1h-1zM2 8h1v1h-1zM13 8h1v1h-1zM2 9h1v1h-1zM13 9h1v1h-1zM2 10h1v1h-1zM13 10h1v1h-1zM2 11h1v1h-1zM13 11h1v1h-1zM2 12h1v1h-1zM13 12h1v1h-1zM2 13h12v1h-12z'/%3E%3Cpath fill='%23ffffff' d='M3 4h10v1h-10zM3 5h2v1h-2zM6 5h7v1h-7zM3 6h1v1h-1zM7 6h1v1h-1zM12 6h1v1h-1zM3 7h2v1h-2zM6 7h7v1h-7zM3 8h10v1h-10zM3 9h10v1h-10zM3 10h1v1h-1zM7 10h1v1h-1zM12 10h1v1h-1zM3 11h10v1h-10zM3 12h10v1h-10z'/%3E%3Cpath fill='%2322c55e' d='M5 5h1v1h-1zM4 6h3v1h-3zM5 7h1v1h-1z'/%3E%3Cpath fill='%23ef4444' d='M4 10h3v1h-3z'/%3E%3C/svg%3E"); }
body.classlings-app .cla-set-si.si-showdown { --si: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%232d3436' d='M3 1h10v1h-10zM1 2h2v1h-2zM13 2h2v1h-2zM0 3h1v1h-1zM15 3h1v1h-1zM0 4h1v1h-1zM2 4h1v1h-1zM13 4h1v1h-1zM15 4h1v1h-1zM0 5h1v1h-1zM2 5h1v1h-1zM13 5h1v1h-1zM15 5h1v1h-1zM1 6h1v1h-1zM14 6h1v1h-1zM2 7h2v1h-2zM12 7h2v1h-2zM4 8h1v1h-1zM11 8h1v1h-1zM5 9h2v1h-2zM9 9h2v1h-2zM5 10h2v1h-2zM9 10h2v1h-2zM4 11h1v1h-1zM11 11h1v1h-1zM3 12h1v1h-1zM12 12h1v1h-1zM4 13h8v1h-8z'/%3E%3Cpath fill='%23f7c230' d='M3 2h10v1h-10zM1 3h3v1h-3zM5 3h7v1h-7zM13 3h2v1h-2zM1 4h1v1h-1zM3 4h1v1h-1zM5 4h7v1h-7zM14 4h1v1h-1zM1 5h1v1h-1zM3 5h1v1h-1zM5 5h7v1h-7zM14 5h1v1h-1zM2 6h2v1h-2zM5 6h7v1h-7zM13 6h1v1h-1zM4 7h1v1h-1zM6 7h5v1h-5zM5 8h5v1h-5zM7 9h2v1h-2zM7 10h2v1h-2z'/%3E%3Cpath fill='%23ffe08a' d='M4 3h1v1h-1zM4 4h1v1h-1zM4 5h1v1h-1zM4 6h1v1h-1zM5 7h1v1h-1z'/%3E%3Cpath fill='%23c98a12' d='M12 3h1v1h-1zM12 4h1v1h-1zM12 5h1v1h-1zM12 6h1v1h-1zM11 7h1v1h-1zM10 8h1v1h-1zM5 11h6v1h-6zM4 12h8v1h-8z'/%3E%3C/svg%3E"); }
body.classlings-app .cla-set-si.si-board { --si: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%232d3436' d='M1 1h14v1h-14zM0 2h1v1h-1zM15 2h1v1h-1zM0 3h1v1h-1zM15 3h1v1h-1zM0 4h1v1h-1zM15 4h1v1h-1zM0 5h1v1h-1zM15 5h1v1h-1zM0 6h1v1h-1zM15 6h1v1h-1zM0 7h1v1h-1zM15 7h1v1h-1zM0 8h1v1h-1zM15 8h1v1h-1zM0 9h1v1h-1zM15 9h1v1h-1zM0 10h1v1h-1zM15 10h1v1h-1zM1 11h6v1h-6zM9 11h6v1h-6zM4 12h1v1h-1zM11 12h1v1h-1zM5 13h6v1h-6z'/%3E%3Cpath fill='%23d9dee2' d='M1 2h14v1h-14zM1 3h1v1h-1zM14 3h1v1h-1zM1 4h1v1h-1zM14 4h1v1h-1zM1 5h1v1h-1zM14 5h1v1h-1zM1 6h1v1h-1zM14 6h1v1h-1zM1 7h1v1h-1zM14 7h1v1h-1zM1 8h1v1h-1zM14 8h1v1h-1zM1 9h1v1h-1zM14 9h1v1h-1zM1 10h14v1h-14z'/%3E%3Cpath fill='%237cc6f2' d='M2 3h12v1h-12zM2 4h2v1h-2zM7 4h7v1h-7zM2 5h1v1h-1zM8 5h6v1h-6zM2 6h12v1h-12zM2 7h12v1h-12z'/%3E%3Cpath fill='%23ffffff' d='M4 4h3v1h-3zM3 5h5v1h-5z'/%3E%3Cpath fill='%235fbf5a' d='M2 8h12v1h-12z'/%3E%3Cpath fill='%237a4a26' d='M2 9h12v1h-12z'/%3E%3Cpath fill='%235f6b6f' d='M7 11h2v1h-2zM5 12h6v1h-6z'/%3E%3C/svg%3E"); }
body.classlings-app .cla-set-si.si-tables { --si: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%232d3436' d='M2 1h1v1h-1zM6 1h1v1h-1zM9 1h1v1h-1zM13 1h1v1h-1zM1 2h1v1h-1zM3 2h1v1h-1zM5 2h1v1h-1zM7 2h2v1h-2zM10 2h1v1h-1zM12 2h1v1h-1zM14 2h1v1h-1zM1 3h1v1h-1zM4 3h1v1h-1zM7 3h2v1h-2zM11 3h1v1h-1zM14 3h1v1h-1zM1 4h1v1h-1zM7 4h2v1h-2zM14 4h1v1h-1zM1 5h1v1h-1zM3 5h1v1h-1zM5 5h1v1h-1zM7 5h2v1h-2zM10 5h1v1h-1zM12 5h1v1h-1zM14 5h1v1h-1zM1 6h1v1h-1zM7 6h2v1h-2zM14 6h1v1h-1zM1 7h14v1h-14zM0 8h1v1h-1zM15 8h1v1h-1zM0 9h1v1h-1zM15 9h1v1h-1zM1 10h1v1h-1zM4 10h8v1h-8zM14 10h1v1h-1zM1 11h1v1h-1zM4 11h1v1h-1zM11 11h1v1h-1zM14 11h1v1h-1zM1 12h1v1h-1zM4 12h1v1h-1zM11 12h1v1h-1zM14 12h1v1h-1zM2 13h2v1h-2zM12 13h2v1h-2z'/%3E%3Cpath fill='%23a855f7' d='M2 2h1v1h-1zM6 2h1v1h-1zM2 3h2v1h-2zM5 3h2v1h-2zM2 4h5v1h-5zM2 5h1v1h-1zM4 5h1v1h-1zM6 5h1v1h-1zM2 6h5v1h-5z'/%3E%3Cpath fill='%23f97316' d='M9 2h1v1h-1zM13 2h1v1h-1zM9 3h2v1h-2zM12 3h2v1h-2zM9 4h5v1h-5zM9 5h1v1h-1zM11 5h1v1h-1zM13 5h1v1h-1zM9 6h5v1h-5z'/%3E%3Cpath fill='%23c98b52' d='M1 8h14v1h-14z'/%3E%3Cpath fill='%238a5a2b' d='M1 9h14v1h-14zM2 10h2v1h-2zM12 10h2v1h-2zM2 11h2v1h-2zM12 11h2v1h-2zM2 12h2v1h-2zM12 12h2v1h-2z'/%3E%3C/svg%3E"); }
body.classlings-app .cla-set-si.si-termstarts { --si: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%232d3436' d='M4 0h2v1h-2zM10 0h2v1h-2zM4 1h2v1h-2zM10 1h2v1h-2zM1 2h14v1h-14zM1 3h1v1h-1zM14 3h1v1h-1zM1 4h1v1h-1zM14 4h1v1h-1zM1 5h1v1h-1zM14 5h1v1h-1zM1 6h1v1h-1zM14 6h1v1h-1zM1 7h1v1h-1zM14 7h1v1h-1zM1 8h1v1h-1zM14 8h1v1h-1zM1 9h1v1h-1zM14 9h1v1h-1zM1 10h1v1h-1zM14 10h1v1h-1zM1 11h1v1h-1zM14 11h1v1h-1zM1 12h1v1h-1zM14 12h1v1h-1zM1 13h1v1h-1zM14 13h1v1h-1zM1 14h14v1h-14z'/%3E%3Cpath fill='%23ef4444' d='M2 3h12v1h-12zM2 4h12v1h-12zM2 5h12v1h-12z'/%3E%3Cpath fill='%23ffffff' d='M2 6h12v1h-12zM2 7h1v1h-1zM5 7h2v1h-2zM9 7h2v1h-2zM13 7h1v1h-1zM2 8h1v1h-1zM5 8h2v1h-2zM9 8h2v1h-2zM13 8h1v1h-1zM2 9h12v1h-12zM2 10h12v1h-12zM2 11h1v1h-1zM5 11h2v1h-2zM9 11h2v1h-2zM13 11h1v1h-1zM2 12h1v1h-1zM5 12h2v1h-2zM9 12h2v1h-2zM13 12h1v1h-1zM2 13h12v1h-12z'/%3E%3Cpath fill='%235f6b6f' d='M3 7h2v1h-2zM7 7h2v1h-2zM11 7h2v1h-2zM3 8h2v1h-2zM7 8h2v1h-2zM11 8h2v1h-2zM3 11h2v1h-2zM11 11h2v1h-2zM3 12h2v1h-2zM11 12h2v1h-2z'/%3E%3Cpath fill='%233aa0ff' d='M7 11h2v1h-2zM7 12h2v1h-2z'/%3E%3C/svg%3E"); }

/* ---------------------------------------------------------------- a section, on its plate */

body.classlings-app .cla-set-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 32px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--cla-page);
    border: var(--cla-edge) solid var(--cla-wash-2);
    border-radius: var(--cla-r-l);
}

body.classlings-app .cla-set-top {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 4px 0 12px;
}

body.classlings-app .cla-set-top h2 {
    margin: 0;
    font: 700 28px / 1.1 var(--cla-display);
    white-space: nowrap;
}

body.classlings-app .cla-set-row {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    align-items: center;
    column-gap: 24px;
    min-height: 84px;
    padding: 12px 0;
    border-top: 2px solid var(--cla-wash-2);
}

body.classlings-app .cla-set-row h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    margin: 0;
    font: 600 24px / 1.2 var(--cla-display);
}

body.classlings-app .cla-set-line {
    margin: 2px 0 0;
    font: 400 18px / 1.4 var(--cla-ui);
    color: var(--cla-ink-2);
}

/* A control that's wider than its column (the reasons' icons and Edit reasons) reaches left, into the
   room beside a short name, as in the design. */
body.classlings-app .cla-set-ctl {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-width: 0;
}

body.classlings-app .cla-set-quiet {
    font: 400 18px / 1.3 var(--cla-ui);
    color: var(--cla-ink-2);
}

/* Saved, on the setting that just changed, until the next change; and the other words a row can say. */
body.classlings-app .cla-set-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 6px;
    font: 600 16px / 1.1 var(--cla-display);
    color: var(--cla-ink);
    white-space: nowrap;
    background: var(--cla-lime-tint);
    border: 2px solid var(--cla-lime-deep);
    border-radius: var(--cla-r-s);
}

body.classlings-app .cla-set-chip.is-saving {
    padding-left: 10px;
    color: var(--cla-ink-2);
    background: var(--cla-wash);
    border-color: var(--cla-wash-2);
}

body.classlings-app .cla-set-chip.is-failed {
    padding-left: 10px;
    white-space: normal;
    background: var(--cla-tangerine-tint);
    border-color: var(--cla-tangerine-deep);
}

/* ---------------------------------------------------------------- the controls */

/* Choices: one shape, the chosen one in purple with a tick as well as its colour. */
body.classlings-app .cla-set-seg {
    display: flex;
    flex: none;
    gap: 4px;
    padding: 4px;
    background: var(--cla-wash);
    border-radius: calc(var(--cla-r-m) + 4px);
}

body.classlings-app .cla-set-tool {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--ctl-tab-h);
    margin: 0;
    padding: 0 16px;
    font: 600 20px / 1 var(--cla-display);
    color: var(--cla-ink);
    white-space: nowrap;
    background: transparent;
    border: var(--cla-edge) solid transparent;
    border-radius: var(--cla-r-m);
    cursor: pointer;
}

body.classlings-app .cla-set-tool:hover:not(:disabled, .is-on) {
    background: var(--cla-page);
}

body.classlings-app .cla-set-tool.is-on {
    background: var(--cla-grape);
    border-color: var(--cla-grape-deep);
}

body.classlings-app .cla-set-tool:disabled {
    color: var(--cla-ink-2);
    cursor: default;
    opacity: 0.6;
}

/* A stepper: minus, the number, plus. The standard's plus and minus (48 px squares on a 4 px ink base,
   the kit's pixel signs, claIcons.js), and the number in a text box of the standard's (a pale edge that
   turns ink while it's typed in). */
body.classlings-app .cla-set-stepper {
    display: grid;
    grid-template-columns: var(--ctl-small-h) 60px var(--ctl-small-h);
    align-items: start;
    gap: 4px;
}

body.classlings-app .cla-set-stepper button {
    appearance: none;
    display: grid;
    place-items: center;
    width: var(--ctl-small-h);
    height: var(--ctl-small-h);
    margin: 0 0 var(--ctl-small-lift);
    padding: 0;
    color: var(--cla-ink);
    background: var(--cla-page);
    border: var(--ctl-edge) solid var(--cla-ink);
    border-radius: var(--ctl-small-r);
    box-shadow: 0 var(--ctl-small-lift) 0 var(--cla-ink);
    cursor: pointer;
    transition: transform var(--ctl-settle) var(--ctl-spring), box-shadow var(--ctl-settle) var(--ctl-spring);
}

body.classlings-app .cla-set-stepper button:active:not(:disabled) {
    transform: translateY(var(--ctl-small-lift));
    box-shadow: 0 0 0 var(--cla-ink);
    transition-duration: var(--ctl-press);
}

body.classlings-app .cla-set-stepper button:disabled {
    cursor: default;
    opacity: 0.45;
}

body.classlings-app .cla-set-stepper output,
body.classlings-app .cla-set-stepper .cla-set-num {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: var(--ctl-edge) solid transparent;
    color: var(--cla-ink);
    text-align: center;
    height: var(--ctl-field-h);
    font: 700 24px / 1 var(--cla-display);
    font-variant-numeric: tabular-nums;
    background: var(--cla-wash);
    border-radius: var(--ctl-field-r);
}

body.classlings-app .cla-set-stepper .cla-set-num {
    background: var(--cla-page);
    border-color: var(--ctl-wash-2);
}

/* A typed number: the box shows it's being typed in. */
body.classlings-app .cla-set-stepper .cla-set-num:focus {
    outline: none;
    border-color: var(--cla-ink);
}

/* A button: a white cap on an ink base that sinks when pressed. The main action is gold. */
body.classlings-app .cla-set-btn {
    --btn: var(--cla-page);
    --btn-deep: var(--cla-ink);
    --btn-lift: var(--cla-lift);
    appearance: none;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--ctl-h);
    margin: 0 0 var(--btn-lift);
    padding: var(--ctl-pad);
    font: var(--ctl-font);
    color: var(--cla-ink);
    white-space: nowrap;
    background: var(--btn);
    border: var(--cla-edge) solid var(--btn-deep);
    border-radius: var(--ctl-r);
    box-shadow: 0 var(--btn-lift) 0 var(--btn-deep);
    cursor: pointer;
    transition: transform 460ms cubic-bezier(0.28, 1.9, 0.5, 1), box-shadow 460ms cubic-bezier(0.28, 1.9, 0.5, 1);
}

body.classlings-app .cla-set-btn:active:not(:disabled) {
    transform: translateY(var(--btn-lift));
    box-shadow: 0 0 0 var(--btn-deep);
    transition-duration: 70ms;
    transition-timing-function: ease-out;
}

body.classlings-app .cla-set-btn:disabled {
    color: var(--cla-ink-2);
    opacity: 0.55;
    cursor: default;
}

body.classlings-app .cla-set-btn.is-small {
    --btn-lift: var(--ctl-small-lift);
    min-height: var(--ctl-small-h);
    padding: 0 16px;
    font: var(--ctl-small-font);
    border-radius: var(--ctl-small-r);
}

body.classlings-app .cla-set-btn.is-small.is-open {
    background: var(--cla-grape-tint);
}

body.classlings-app .cla-set-btn.is-big {
    --btn-lift: var(--ctl-big-lift);
    min-height: var(--ctl-big-h);
    padding: 0 32px;
    font: var(--ctl-big-font);
    border-radius: var(--ctl-big-r);
}

body.classlings-app .cla-set-btn.is-go {
    --btn: var(--cla-gold);
    --btn-deep: var(--cla-gold-deep);
}

body.classlings-app .cla-set-link {
    appearance: none;
    align-self: center;
    margin: 0 auto 0 0;
    padding: 8px 4px;
    font: 600 18px / 1.2 var(--cla-display);
    color: var(--cla-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    background: none;
    border: 0;
    cursor: pointer;
}

/* ---------------------------------------------------------------- little point cards */

/* As on the board, in the card's own colours: a Classling on the colour of its points, a name and the
   points. */
body.classlings-app .cla-set-mini {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    width: 148px;
    height: 60px;
    overflow: hidden;
    background: var(--cla-paper);
    border: 2px solid var(--cla-ink);
    border-radius: 12px;
    box-shadow: inset 0 0 0 3px var(--card-edge, transparent), 2px 2px 0 var(--cla-wash-2);
}

body.classlings-app .cla-set-mini canvas {
    width: 56px;
    height: 56px;
    border-right: 2px solid var(--cla-ink);
    image-rendering: pixelated;
}

body.classlings-app .cla-set-who {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 1px;
    font: 600 16px / 1.1 var(--cla-display);
}

body.classlings-app .cla-set-who b {
    display: flex;
    align-items: center;
    gap: 4px;
    font: 700 28px / 1 var(--cla-display);
}

body.classlings-app .cla-set-heart {
    width: 18px;
    height: auto;
    color: #ef4444;
}

/* The back of a card: minus and plus, with the points in a cutout between. */
body.classlings-app .cla-set-mini.is-back {
    position: relative;
    grid-template-columns: 1fr 1fr;
    width: 104px;
}

body.classlings-app .cla-set-mini.is-back > span {
    display: grid;
    place-items: center;
    font: 700 36px / 1 var(--cla-display);
}

/* Drawn as the card's own minus and plus are (classlings-board.css .cl-sign). */
body.classlings-app .cla-set-mini.is-back > span .cla-ic {
    width: 0.8em;
    height: 0.8em;
}

body.classlings-app .cla-set-mini.is-back > span .cla-ic path {
    stroke-width: 3.6;
}

body.classlings-app .cla-set-minus {
    padding-right: 14px;
    color: var(--cla-card-minus-ink);
    background: var(--cla-minus);
    border-right: 2px solid var(--cla-ink);
}

body.classlings-app .cla-set-plus {
    padding-left: 14px;
    color: var(--cla-card-plus-ink);
    background: var(--cla-card-plus);
}

body.classlings-app .cla-set-mini.is-back .cla-set-cut {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    font: 700 14px / 1 var(--cla-display);
    color: var(--cla-ink);
    background: var(--cla-lime-tint);
    border: 2px solid var(--cla-ink);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--cla-paper);
}

/* Starting points: lowest, start and highest, each a stepper with the card it gives. The steppers take
   the room they need, and the row's name the rest. */
body.classlings-app .cla-set-row.is-range {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

body.classlings-app .cla-set-lims {
    display: grid;
    grid-template-columns: repeat(3, 164px);
    justify-content: end;
    column-gap: 12px;
}

body.classlings-app .cla-set-lim {
    display: grid;
    grid-template-rows: auto auto auto;
    justify-items: center;
    row-gap: 8px;
}

body.classlings-app .cla-set-cap {
    display: flex;
    align-items: center;
    gap: 8px;
    font: 600 18px / 1.2 var(--cla-display);
    white-space: nowrap;
}

body.classlings-app .cla-set-cap .cla-set-chip {
    padding: 1px 6px 1px 3px;
    font-size: 14px;
}

body.classlings-app .cla-set-lim .cla-set-mini {
    margin-top: 2px;
}

/* The time a new day starts: the button, and the clock it opens above it. */
body.classlings-app .cla-set-time {
    position: relative;
    display: inline-flex;
}

body.classlings-app .cla-set-pop {
    position: absolute;
    z-index: 20;
    right: 0;
    bottom: calc(100% + 12px);
    display: grid;
    justify-items: start;
    gap: 12px;
    padding: 12px 16px 16px;
    background: var(--cla-page);
    border: var(--cla-edge) solid var(--cla-ink);
    border-radius: var(--cla-r-l);
    box-shadow: var(--cla-float);
}

body.classlings-app .cla-set-pop > p {
    margin: 0;
    font: 700 20px / 1.2 var(--cla-display);
    white-space: nowrap;
}

body.classlings-app .cla-set-clock {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.classlings-app .cla-set-clock > b {
    font: 700 28px / 1 var(--cla-display);
}

/* ---------------------------------------------------------------- two pictures to pick between */

body.classlings-app .cla-set-row.is-stack {
    align-items: start;
}

body.classlings-app .cla-set-row.is-stack .cla-set-ctl {
    display: block;
}

body.classlings-app .cla-set-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding-top: 12px;
}

body.classlings-app .cla-set-card {
    appearance: none;
    position: relative;
    display: grid;
    align-content: start;
    gap: 4px;
    margin: 0;
    padding: 8px 8px 12px;
    color: var(--cla-ink);
    text-align: left;
    background: var(--cla-page);
    border: var(--cla-edge) solid var(--cla-wash-2);
    border-radius: var(--cla-r-l);
    cursor: pointer;
}

body.classlings-app .cla-set-card:hover:not(.is-on) {
    border-color: var(--cla-grape);
}

body.classlings-app .cla-set-pic {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 88px;
    margin-bottom: 4px;
    background: var(--cla-wash);
    border-radius: var(--cla-r-m);
}

body.classlings-app .cla-set-card > b {
    padding: 0 8px;
    font: 700 24px / 1.15 var(--cla-display);
}

body.classlings-app .cla-set-cline {
    padding: 0 8px;
    font: 400 17px / 1.4 var(--cla-ui);
    color: var(--cla-ink-2);
}

body.classlings-app .cla-set-on {
    position: absolute;
    top: -14px;
    right: 18px;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 6px;
    font: 600 16px / 1 var(--cla-display);
    background: var(--cla-grape);
    border: 2px solid var(--cla-grape-deep);
    border-radius: var(--cla-r-s);
}

body.classlings-app .cla-set-card.is-on {
    background: var(--cla-grape-tint);
    border-color: var(--cla-grape-deep);
    box-shadow: inset 0 0 0 var(--cla-edge) var(--cla-grape-deep);
}

body.classlings-app .cla-set-card.is-on .cla-set-pic {
    background: var(--cla-page);
}

body.classlings-app .cla-set-card.is-on .cla-set-on {
    display: inline-flex;
}

/* Stacked: each picture beside its name and line (how points are given). */
body.classlings-app .cla-set-cards.is-stack {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

body.classlings-app .cla-set-cards.is-stack .cla-set-card {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    row-gap: 2px;
    padding: 8px;
}

body.classlings-app .cla-set-cards.is-stack .cla-set-pic {
    grid-row: 1 / span 2;
    height: 80px;
    margin: 0;
}

body.classlings-app .cla-set-cards.is-stack .cla-set-card > b {
    align-self: end;
    padding: 0;
}

body.classlings-app .cla-set-cards.is-stack .cla-set-cline {
    align-self: start;
    padding: 0;
}

body.classlings-app .cla-set-card .cla-set-mini {
    grid-template-columns: 48px minmax(0, 1fr);
    width: 116px;
    height: 52px;
}

body.classlings-app .cla-set-card .cla-set-mini canvas {
    width: 48px;
    height: 48px;
}

body.classlings-app .cla-set-card .cla-set-who b {
    font-size: 24px;
}

body.classlings-app .cla-set-card .cla-set-mini.is-back {
    width: 96px;
}

body.classlings-app .cla-set-arrow {
    width: 26px;
    height: 26px;
}

/* Detailed add's picture: two of the class's reasons, as the points menu shows them. */
body.classlings-app .cla-set-menu {
    display: grid;
    gap: 4px;
    width: 226px;
}

body.classlings-app .cla-set-reason {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 2px 6px 2px 4px;
    font: 600 16px / 1.1 var(--cla-display);
    background: var(--rc-tint);
    border: 2px solid var(--rc-deep);
    border-radius: var(--cla-r-s);
    box-shadow: 0 3px 0 var(--rc-deep);
}

body.classlings-app .cla-set-reason svg {
    width: 32px;
    height: 32px;
}

body.classlings-app .cla-set-reason span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

body.classlings-app .cla-set-reason b {
    min-width: 36px;
    padding: 3px 6px;
    font: 700 16px / 1 var(--cla-display);
    text-align: center;
    background: var(--rc);
    border: 2px solid var(--rc-deep);
    border-radius: var(--cla-r-s);
}

/* The background, in little: the class's point cards over the board's bar, on white or in the sky. Laid out in
   proportion, so the bar sits under the cards at any height: one row of cards when the picture is short (52 px on
   the school laptop), two when it's tall enough. */
body.classlings-app .cla-set-thumb {
    container-type: size;
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 24%;
    gap: 3px;
    width: 100%;
    height: 100%;
    padding: 5px 7px;
    overflow: hidden;
    background: var(--cla-page);
    border-radius: var(--cla-r-m);
    box-shadow: inset 0 0 0 2px var(--cla-wash-2);
}

body.classlings-app .cla-set-thumb.is-sky {
    background:
        var(--cla-art-cloud) right 18% top 4px / 48px 14px no-repeat,
        var(--cla-art-tufts) left 0 bottom 30% / 32px 6px repeat-x,
        linear-gradient(var(--cla-grass), var(--cla-grass)) left 0 bottom 0 / 100% 30% no-repeat,
        var(--cla-world);
    box-shadow: none;
}

body.classlings-app .cla-set-tcards {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    grid-auto-rows: 0;
    gap: 3px;
    overflow: hidden;
}

@container (min-height: 70px) {
    body.classlings-app .cla-set-tcards {
        grid-template-rows: repeat(2, minmax(0, 1fr));
    }
}

/* A point card: their Classling on its band, and the white side with a line for the name and one for the points. */
body.classlings-app .cla-set-tcard {
    display: flex;
    min-height: 0;
    overflow: hidden;
    background: var(--cla-page);
    border: 1px solid var(--cla-ink);
    border-radius: 3px;
}

/* The canvas takes the card's height and is as wide as it is tall (it would keep its own 300 px otherwise). */
body.classlings-app .cla-set-tcard canvas {
    flex: none;
    width: auto;
    height: 100%;
    aspect-ratio: 1;
    border-right: 1px solid var(--cla-ink);
    image-rendering: pixelated;
}

body.classlings-app .cla-set-tcard i {
    flex: 1 1 0;
    min-width: 0;
    background:
        linear-gradient(var(--cla-ink-2), var(--cla-ink-2)) center 35% / 60% 2px no-repeat,
        linear-gradient(#e0475b, #e0475b) left 30% top 62% / 3px 3px no-repeat,
        linear-gradient(var(--cla-ink), var(--cla-ink)) center 62% / 25% 3px no-repeat;
}

/* The bar: Home, the Points pill, Choose and Menu, and the gold Showdown sign. */
body.classlings-app .cla-set-tbar {
    display: flex;
    align-items: stretch;
    gap: 3px;
    min-height: 0;
}

body.classlings-app .cla-set-tbar i {
    flex: none;
    aspect-ratio: 1;
    background: var(--cla-page);
    border: 1.5px solid var(--cla-ink);
    border-radius: 3px;
}

body.classlings-app .cla-set-tbar i.is-pill {
    flex: 1 1 auto;
    aspect-ratio: auto;
    margin: 0 8%;
    border-radius: 999px;
}

body.classlings-app .cla-set-tbar i.is-sign {
    width: 24%;
    aspect-ratio: auto;
    background: var(--cla-gold);
    border-color: var(--cla-gold-deep);
    border-radius: 2px;
}

/* ---------------------------------------------------------------- the rest of the sections */

/* Reasons: the icons the points menu shows, in their two groups. */
body.classlings-app .cla-set-groups {
    display: grid;
    gap: 8px;
    padding: 8px 16px;
    background: var(--cla-wash);
    border-radius: var(--cla-r-m);
}

body.classlings-app .cla-set-group {
    display: grid;
    grid-template-columns: 112px auto;
    align-items: center;
    gap: 12px;
}

body.classlings-app .cla-set-group > span {
    font: 600 18px / 1.2 var(--cla-display);
}

body.classlings-app .cla-set-group em {
    font: 400 17px / 1.2 var(--cla-ui);
    font-style: normal;
    color: var(--cla-ink-2);
}

body.classlings-app .cla-set-group ul {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

body.classlings-app .cla-set-group li {
    display: block;
    width: 32px;
    height: 32px;
}

body.classlings-app .cla-set-group li svg {
    display: block;
    width: 32px;
    height: 32px;
}

body.classlings-app .cla-set-group li.cla-set-more {
    width: auto;
    font: 700 16px / 32px var(--cla-display);
    color: var(--cla-ink-2);
}

/* Tables: each table's emblem, its number or its colour, as the Tables menu draws it (.tl-badge), all
   twelve at most; they wrap onto a second line where there isn't room for them on one. */
body.classlings-app .cla-set-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---------------------------------------------------------------- a calm question over the page */

body.classlings-app .cla-set-dlg {
    position: fixed;
    inset: 0;
    z-index: 1150;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--cla-scrim);
}

body.classlings-app .cla-set-dlg-box {
    display: grid;
    justify-items: center;
    gap: 16px;
    width: min(700px, 100%);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 32px 40px;
    color: var(--cla-ink);
    text-align: center;
    background: var(--cla-page);
    border: var(--cla-edge) solid var(--cla-ink);
    border-radius: var(--cla-r-xl);
    box-shadow: var(--cla-float);
}

body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-dlg-box {
    width: min(860px, 100%);
    padding: 28px 40px;
}

body.classlings-app .cla-set-dlg-box h2 {
    margin: 0;
    font: 700 48px / 1.1 var(--cla-display);
}

body.classlings-app .cla-set-dlg-box > p {
    margin: 0;
    font: 400 20px / 1.45 var(--cla-ui);
}

body.classlings-app .cla-set-go-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

/* Term dates: each term's two half terms, a start and an end each. A page 1000 px wide or more has the three terms as three rows,
   "Half term 1" and "Half term 2" over their two columns, so the whole question fits a laptop's page with nothing to scroll; a
   narrower one stacks them: each term's name, then each half term's two days side by side. */
body.classlings-app .cla-set-dlg-box > p.cla-set-dlg-lead {
    max-width: 36em;
    font-size: 18px;
    color: var(--cla-ink-2);
}

body.classlings-app .cla-set-terms {
    display: grid;
    gap: 10px;
    width: 100%;
    text-align: left;
}

body.classlings-app .cla-set-heads {
    display: none;
}

body.classlings-app .cla-set-terms fieldset {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

body.classlings-app .cla-set-terms legend {
    float: left;
    grid-column: 1 / -1;
    padding: 0;
    font: 700 22px / 1.2 var(--cla-display);
}

body.classlings-app .cla-set-half {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2px 10px;
    font: 600 16px / 1.2 var(--cla-display);
}

body.classlings-app .cla-set-half > span:first-child {
    grid-column: 1 / -1;
}

/* (The "to" between the two days is for a page with room for it.) */
body.classlings-app .cla-set-half > span:nth-child(3) {
    display: none;
}

body.classlings-app .cla-set-half input {
    width: 100%;
    min-height: 44px;
    padding: 0 8px;
    font: 600 16px / 1 var(--cla-display);
    color: var(--cla-ink);
    background: var(--cla-page);
    border: 2px solid var(--cla-ink);
    border-radius: var(--cla-r-s);
}

@media (min-width: 1000px) {
    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-dlg-box {
        width: min(960px, 100%);
    }

    body.classlings-app .cla-set-dlg-box > p.cla-set-dlg-lead {
        max-width: none;
    }

    body.classlings-app .cla-set-terms {
        gap: 12px;
    }

    body.classlings-app .cla-set-heads,
    body.classlings-app .cla-set-terms fieldset {
        grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr);
        column-gap: 16px;
        align-items: center;
    }

    body.classlings-app .cla-set-heads {
        display: grid;
        font: 700 18px / 1.2 var(--cla-display);
    }

    body.classlings-app .cla-set-terms legend {
        grid-column: 1;
    }

    body.classlings-app .cla-set-half {
        grid-column: auto;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 8px;
        font-size: 18px;
    }

    body.classlings-app .cla-set-half > span:first-child {
        display: none;
    }

    body.classlings-app .cla-set-half > span:nth-child(3) {
        display: inline;
    }

    body.classlings-app .cla-set-half input {
        min-height: 48px;
        padding: 0 10px;
        font-size: 18px;
    }
}

/* A phone or a narrow window: the dialog has the whole width, and Not now and Use these dates sit side by side with Remove under them,
   so the three terms and their buttons fit a phone's page with nothing to scroll. */
@media (max-width: 700px) {
    body.classlings-app .cla-set-dlg[data-dialog="terms"] {
        padding: 12px;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-dlg-box {
        gap: 10px;
        padding: 14px 14px 16px;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-dlg-box h2 {
        font-size: 28px;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-dlg-box > p.cla-set-dlg-lead {
        font-size: 16px;
        line-height: 1.35;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-half input {
        min-height: 40px;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-go-row {
        width: 100%;
        gap: 8px 10px;
        margin-top: 0;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-go-row .cla-set-btn {
        flex: 0 0 auto;
        min-width: 0;
        padding-inline: 18px;
        font-size: 20px;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-go-row .cla-set-btn.is-go {
        flex: 1 1 0;
        padding-inline: 10px;
    }

    body.classlings-app .cla-set-dlg[data-dialog="terms"] .cla-set-go-row .cla-set-link {
        order: 3;
        flex: 0 0 100%;
        text-align: center;
    }
}

body.classlings-app .cla-set-problem {
    margin: 0;
    padding: 8px 14px;
    font: 600 18px / 1.3 var(--cla-display);
    background: var(--cla-tangerine-tint);
    border: 2px solid var(--cla-tangerine-deep);
    border-radius: 8px;
}

body.classlings-app .cla-set-problem[hidden] {
    display: none;
}

/* ---------------------------------------------------------------- keyboard focus, and calm */

body.classlings-app .cla-set :is(button, input):focus-visible,
body.classlings-app .cla-page-retry:focus-visible {
    outline: 4px solid var(--cla-ink);
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    body.classlings-app .cla-set-btn {
        transition: none;
    }
}

/* ---------------------------------------------------------------- narrower screens */

/* A school laptop: a narrower side list, and each setting's words give way to its control. */
@media (max-width: 1180px) {
    body.classlings-app .cla-set-body {
        grid-template-columns: 250px minmax(0, 1fr);
        gap: 16px;
    }

    body.classlings-app .cla-set-pane {
        padding: 12px 20px;
    }

    body.classlings-app .cla-set-row {
        grid-template-columns: minmax(180px, 1fr) auto;
    }

    body.classlings-app .cla-set-ctl {
        flex-wrap: wrap;
    }

    body.classlings-app .cla-set-row.is-stack,
    body.classlings-app .cla-set-row.is-range {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 8px;
    }

    body.classlings-app .cla-set-row.is-range .cla-set-lims {
        justify-content: start;
    }

    body.classlings-app .cla-set-cards.is-stack .cla-set-card {
        grid-template-columns: 230px minmax(0, 1fr);
    }
}

/* Smaller still: each setting's control goes under its words, and the bar's words fold. */
@media (max-width: 900px) {
    body.classlings-app .cla-set-row {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 8px;
    }

    body.classlings-app .cla-set-ctl {
        justify-content: flex-start;
    }

    body.classlings-app .cla-set-said {
        max-width: 360px;
    }
}

/* Narrower: the page's toolbar takes a row of its own above Back and Menu. */
@media (max-width: 900px) {
    body.classlings-app:has(#claPageBar:not([hidden])) {
        --cla-wrap: wrap;
        --cla-rows-gap: 12px;
        --cla-bar-justify: space-between;
        --cla-dock: calc(var(--cla-soil) + (var(--cla-lift) + var(--cla-bar)) * 2 + var(--cla-rows-gap) + var(--cla-name-extra));
    }

    body.classlings-app .app-header .cla-page-bar {
        flex-basis: 100%;
        order: -2;
        justify-content: safe center;
        margin: 0 0 var(--cla-lift);
        overflow-x: auto;
    }
}

/* Too narrow for the three steppers and their cards: the cards go, and each stepper fits its third,
   its buttons as wide as there's room for. */
@media (max-width: 860px) {
    /* Each stepper on a line of its own beside its name, so its plus and minus keep the standard's 48 px. */
    body.classlings-app .cla-set-lims {
        grid-template-columns: minmax(0, 320px);
        justify-content: start;
        row-gap: 8px;
    }

    body.classlings-app .cla-set-lim {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto;
        align-items: center;
        justify-items: start;
        column-gap: 12px;
    }

    body.classlings-app .cla-set-lim .cla-set-mini {
        display: none;
    }

    /* Every day, Every week and By hand fold onto a second line rather than run past the plate. */
    body.classlings-app .cla-set-seg {
        flex: 0 1 auto;
        flex-wrap: wrap;
        min-width: 0;
    }
}

/* A phone: the sections as a row to scroll along, above the one that's open. */
@media (max-width: 700px) {
    body.classlings-app #settingsScreen:not(.hidden) {
        padding: 8px var(--cla-gutter) 16px;
    }

    body.classlings-app .cla-set-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        gap: 8px;
    }

    /* The sections wrap onto a second line rather than slide sideways, so none is cut off at the edge. */
    body.classlings-app .cla-set-secs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        overflow: visible;
        padding-bottom: 4px;
    }

    body.classlings-app .cla-set-sec {
        flex: 1 1 auto;
        grid-template-columns: 24px auto;
        justify-content: center;
        column-gap: 6px;
        min-height: 44px;
        padding: 2px 8px 2px 6px;
    }

    body.classlings-app .cla-set-sec b {
        font-size: 16px;
    }

    body.classlings-app .cla-set-sec small,
    body.classlings-app .cla-set-sec .cla-set-go {
        display: none;
    }

    body.classlings-app .cla-set-si {
        width: 24px;
        height: 24px;
    }

    body.classlings-app .cla-set-pane {
        padding: 8px 14px;
    }

    body.classlings-app .cla-set-top {
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    /* "Saved" stays in the bar: beside Lowest, Start or Highest it would run into the next stepper. */
    body.classlings-app .cla-set-cap .cla-set-chip {
        display: none;
    }

    /* The reasons' icons fold onto another line rather than run past the plate. */
    body.classlings-app .cla-set-group {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    body.classlings-app .cla-set-group ul {
        flex-wrap: wrap;
    }

    body.classlings-app .cla-set-cards,
    body.classlings-app .cla-set-cards.is-stack .cla-set-card {
        grid-template-columns: minmax(0, 1fr);
    }

    body.classlings-app .cla-set-dlg-box {
        padding: 24px 20px;
    }

    body.classlings-app .cla-set-dlg-box h2 {
        font-size: 34px;
    }

    body.classlings-app .cla-set-said {
        max-width: 180px;
    }
}

/* ---------------------------------------------------------------- shorter and narrower screens */

/* A laptop's height or a narrow window: smaller sections, rows and pictures, so a section fits without
   scrolling (the teacher's note, 5 Oct: the same fix as the points menu and the tables). */
@media (max-height: 820px), (max-width: 760px) {
    body.classlings-app .cla-set-sec {
        min-height: 54px;
    }

    body.classlings-app .cla-set-sec b {
        font-size: 18px;
    }

    body.classlings-app .cla-set-sec small {
        font-size: 14px;
    }

    body.classlings-app .cla-set-pane {
        padding: 6px 20px;
    }

    body.classlings-app .cla-set-top {
        padding: 2px 0 6px;
    }

    body.classlings-app .cla-set-top h2 {
        font-size: 22px;
    }

    body.classlings-app .cla-set-row {
        min-height: 52px;
        padding: 4px 0;
    }

    body.classlings-app .cla-set-row h3 {
        font-size: 19px;
    }

    body.classlings-app .cla-set-line {
        font-size: 16px;
    }

    body.classlings-app .cla-set-cards {
        gap: 12px;
        padding-top: 8px;
    }

    body.classlings-app .cla-set-pic {
        height: 52px;
        margin-bottom: 2px;
    }

    body.classlings-app .cla-set-card {
        padding: 6px 6px 8px;
    }

    body.classlings-app .cla-set-card > b {
        font-size: 19px;
    }

    body.classlings-app .cla-set-cline {
        font-size: 15px;
    }
}

/* A narrow window: the six sections in two even rows of three, not five and one. */
@media (max-width: 700px) and (min-width: 481px) {
    body.classlings-app .cla-set-secs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.classlings-app .cla-set-sec {
        min-height: 40px;
    }

    body.classlings-app .cla-set-sec b {
        font-size: 15px;
    }
}

/* A phone: the same two even rows of three (it was three, two and one, with "Term dates" alone), each section
   with its picture over its name so all six names fit a 320px screen. */
@media (max-width: 480px) {
    body.classlings-app .cla-set-secs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.classlings-app .cla-set-sec {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        justify-items: center;
        row-gap: 0;
        column-gap: 0;
        min-height: 52px;
        padding: 4px 2px;
        text-align: center;
    }

    body.classlings-app .cla-set-sec b {
        font-size: 14px;
        white-space: nowrap;
    }
}

/* Settings in a window under 900 px wide: the last change and Undo stay in the one row between Back and
   Menu, not in a wide box of their own above it (the teacher: "looks a bit messy"). The class and the
   line under it make room; in a narrower window the page's title does too (the section buttons say where
   you are). */
@media (max-width: 900px) {
    body.classlings-app:has(#settingsScreen:not(.hidden)) {
        --cla-wrap: nowrap;
        --cla-rows-gap: 0px;
        --cla-name-flex: 1 1 0;
        --cla-name-order: 0;
        --cla-name-height: var(--cla-square);
        --cla-name-margin: 0 0 var(--cla-lift);
        --cla-name-extra: 0px;
        --cla-dock: calc(var(--cla-soil) + var(--cla-lift) + var(--cla-bar));
    }

    body.classlings-app:has(#settingsScreen:not(.hidden)) #cupWhen {
        display: none;
    }

    body.classlings-app:has(#settingsScreen:not(.hidden)) .app-header .cla-page-bar {
        flex: 0 1 auto;
        order: 0;
        margin: 0 0 var(--cla-lift);
        overflow: hidden;
    }
}

@media (max-width: 700px) {
    body.classlings-app:has(#settingsScreen:not(.hidden)) .app-header > .cla-name {
        display: none;
    }

    body.classlings-app:has(#settingsScreen:not(.hidden)) .app-header .cla-page-bar {
        margin: 0 auto var(--cla-lift);
    }

    body.classlings-app:has(#settingsScreen:not(.hidden)) .cla-set-last {
        padding-left: 4px;
        font-size: 17px;
    }
}
