/* Classes.
   ─────────────────────────────────────────────────────────────────────────
   Same material as the library: a pale glass card over the animated ground,
   with the primary teal doing all the work that colour does. Nothing here
   introduces a second visual language for what is, from a student's side,
   another shelf of songs.                                                  */

body { min-height: 100vh; display: flex; flex-direction: column; }

/* body is a centring flex column, so a block child shrinks to its content
   instead of filling the line. Every page that lays out in columns has to
   say this. */
.cls-wrap {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin-inline: auto;
    padding: 1.5rem 1rem 3rem;
    text-align: left;
}

/* ── Headings ─────────────────────────────────────────────────────────── */

.cls-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.cls-title {
    font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
    font-weight: 700;
    color: var(--nb-primary-deep);
    margin: 0 0 .2rem;
}
.cls-sub {
    color: var(--nb-ink-muted);
    font-size: .92rem;
}
.cls-head-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

/* The site's back pill, in the flow above the class name. */
.cls-back { margin-bottom: .75rem; }

.cls-detail-head { align-items: flex-start; }
.cls-identity { min-width: 0; }
.cls-meta {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}
.cls-meta-line { font-size: .8rem; color: var(--nb-ink-muted); }

/* ── States ───────────────────────────────────────────────────────────── */

.cls-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    padding: 4rem 1rem;
    color: var(--nb-ink-muted);
    text-align: center;
}
/* Only the state's own icon: the sign-in button's icon inside it was
   coming out as big and faded as the lock above it. */
.cls-state > i { font-size: 1.8rem; opacity: .5; }
/* The same, smaller, inside a card while a set's exercises load. */
.cls-state-inline { padding: 1.5rem 1rem; font-size: .85rem; }
.cls-state-inline > i { font-size: 1.2rem; }

.cls-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--nb-ink-muted);
    background: rgba(255, 255, 255, .55);
    border: 1px dashed var(--nb-border-faint);
    border-radius: 1rem;
}
.cls-empty i { font-size: 2rem; opacity: .4; display: block; margin-bottom: .75rem; }

.cls-note { font-size: .85rem; color: var(--nb-ink-muted); margin: .5rem 0 0; }
.cls-error {
    font-size: .85rem;
    color: var(--nb-destructive);
    background: rgba(176, 42, 55, .08);
    border-radius: .5rem;
    padding: .45rem .7rem;
}

/* ── The grid of classes ──────────────────────────────────────────────── */

.cls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
    gap: 1rem;
}

/* The spine carries the one piece of identity a class has — its own colour,
   drawn from the name — so a teacher with six of them can find the right one
   by shape rather than by reading every card. */
.cls-tile {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem 1rem 1rem 1.4rem;
    border: 1px solid var(--nb-border-faint);
    border-radius: .9rem;
    background: rgba(255, 255, 255, .75);
    backdrop-filter: blur(6px);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: var(--nb-lift);
}
.cls-tile::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: .4rem;
    background: var(--cls-hue, var(--nb-primary));
}
.cls-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
}
.cls-tile:focus-visible { outline: 2px solid var(--nb-primary); outline-offset: 2px; }

.cls-tile-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--nb-ink);
    margin: 0 0 .15rem;
}
.cls-tile-desc {
    font-size: .85rem;
    color: var(--nb-ink-muted);
    margin: 0 0 .6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cls-tile-foot {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .78rem;
    color: var(--nb-ink-muted);
}

/* Grid or list: the same segmented control as the class tabs (.cls-tabs and
   .cls-tab), icons only, so the two pages' switches look alike. */
.cls-tabs.cls-view-toggle { margin-bottom: 0; }
.cls-tab.cls-view-btn { padding: .4rem .85rem; }

/* The list: one row per class, name and description on the left, the facts
   on the right. The colour spine stays, so a class keeps its look. */
.cls-grid.is-list { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.cls-grid.is-list .cls-tile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem 1rem .7rem 1.4rem;
}
.cls-grid.is-list .cls-tile:hover { transform: translateX(2px); }
.cls-tile-body { min-width: 0; }
.cls-grid.is-list .cls-tile-body { flex: 1; }
.cls-grid.is-list .cls-tile-name { margin: 0; }
.cls-grid.is-list .cls-tile-desc { margin: 0; -webkit-line-clamp: 1; }
.cls-grid.is-list .cls-tile-foot { flex: none; }
@media (max-width: 575.98px) {
    .cls-grid.is-list .cls-tile { flex-wrap: wrap; gap: .4rem; }
    .cls-grid.is-list .cls-tile-body { flex-basis: 100%; }
}

/* ── Role badges ──────────────────────────────────────────────────────── */

.cls-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .15rem .5rem;
    border-radius: 50px;
    background: rgba(26, 110, 138, .12);
    color: var(--nb-primary-deep);
}
.cls-badge.is-student {
    background: rgba(99, 110, 114, .14);
    color: var(--nb-ink-muted);
}

/* ── Codes ────────────────────────────────────────────────────────────── */

/* A user code is read off one screen and typed into another, so it is set in
   the one face where 0 and O cannot be confused. */
.cls-code-field,
.cls-code-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .08em;
}
.cls-code-field { max-width: 7rem; }
.cls-code-value {
    font-size: .8rem;
    color: var(--nb-ink-muted);
    white-space: nowrap;
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */

/* An underline rather than a pill: the tab strip sits directly above the
   cards, and a second set of rounded boxes stacked on the first reads as
   clutter. The rule under the strip is what ties the two together. */
/* A segmented control: a translucent track with the open tab lifted out of
   it as a white pill, the way the language and status pickers look. */
.cls-tabs {
    display: inline-flex;
    gap: .25rem;
    padding: .25rem;
    margin-bottom: 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, .4);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
}

.cls-tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem 1rem;
    border: 0;
    border-radius: 3rem;
    background: transparent;
    color: var(--nb-ink-muted);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, color .15s, box-shadow .15s;
}
.cls-tab:hover { color: var(--nb-primary); background: rgba(255, 255, 255, .55); }
.cls-tab:focus-visible { outline: 2px solid var(--nb-primary); outline-offset: 2px; }
.cls-tab.is-active {
    color: var(--nb-primary-deep);
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}
.cls-tab i { opacity: .7; }
.cls-tab.is-active i { opacity: 1; color: var(--nb-primary); }

/* The count is the reason to look at the other tab, so it is on the tab. */
.cls-tab-count {
    font-size: .72rem;
    font-weight: 700;
    min-width: 1.4rem;
    padding: .05rem .4rem;
    border-radius: 50px;
    text-align: center;
    background: rgba(99, 110, 114, .14);
    color: var(--nb-ink-muted);
}
.cls-tab.is-active .cls-tab-count {
    background: var(--nb-primary);
    color: #fff;
}
@media (prefers-reduced-motion: reduce) {
    .cls-tab { transition: none; }
}

/* ── Cards and rows ───────────────────────────────────────────────────── */

.cls-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}
/* display:grid above would otherwise win over the browser's [hidden]. */
.cls-columns[hidden] { display: none; }

.cls-card {
    background: rgba(255, 255, 255, .75);
    backdrop-filter: blur(6px);
    border: 1px solid var(--nb-border-faint);
    border-radius: .9rem;
    padding: .9rem 1rem 1rem;
}
.cls-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .5rem;
}
.cls-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    flex-wrap: wrap;
}
/* The status menu is a pill; the buttons beside it match its height and
   shape so the row reads as one toolbar. */
.cls-card-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    height: 31px;
    padding: 0 .85rem;
    border-radius: 3rem;
    font-size: .85rem;
    white-space: nowrap;
}
.cls-card-actions .btn .fas { font-size: .8em; margin: 0 !important; }
.cls-card-title {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--nb-ink-muted);
    margin: 0;
}

.cls-list { display: flex; flex-direction: column; }
/* The teacher's name; hovering shows their address. */
.cls-owner-name[title] {
    font-weight: 600;
    text-decoration: underline dotted;
    text-underline-offset: .2em;
    cursor: help;
}
/* A row on its way out: dimmed and inert while the request runs. */
.cls-row.is-busy { opacity: .5; pointer-events: none; transition: opacity .15s; }

.cls-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    border-radius: .5rem;
    font-size: .9rem;
    transition: background .15s;
}
.cls-row + .cls-row { border-top: 1px solid rgba(0, 0, 0, .04); }
.cls-row:hover { background: rgba(26, 110, 138, .06); }

/* A set is a button, because picking one changes the panel beside it. */
.cls-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: .5rem;
    background: none;
    border: 0;
    padding: 0;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.cls-row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cls-row-note { font-size: .78rem; color: var(--nb-ink-muted); white-space: nowrap; }

.cls-row.is-active { background: rgba(26, 110, 138, .12); }
.cls-row.is-active .cls-row-name { color: var(--nb-primary-deep); }

/* The controls on a row appear on hover on a mouse, and are always there on
   touch, where there is no hover to reveal them with. */
.cls-row-actions { display: flex; gap: .25rem; opacity: 0; transition: opacity .15s; }
.cls-row:hover .cls-row-actions,
.cls-row:focus-within .cls-row-actions { opacity: 1; }
@media (hover: none) {
    .cls-row-actions { opacity: 1; }
}
.cls-row-actions .btn { padding: .15rem .4rem; font-size: .75rem; }

/* ── A song and its controls ──────────────────────────────────────────── */

/* The controls on a song do not wait for a hover the way a set's do:
   practising is the whole reason a student opened the page, and on a touch
   screen there is no hover to reveal anything with. */
.cls-song-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-shrink: 0;
    margin-left: auto;
}
.cls-song-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    border-radius: 3rem;
}
/* Icon-only controls: round, the height of the pills beside them. */
.cls-song-actions .cls-round {
    width: 32px;
    height: 32px;
    padding: 0;
    /* A grid centres the one child on both axes, whatever the line height. */
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
}
/* The icon is a square box the size of the font, so the glyph is centred in a
   box that is itself centred, on whole pixels. The play triangle carries its
   weight on the left, so it is nudged right to look centred. */
.cls-song-actions .cls-round i {
    display: block;
    width: 1em;
    height: 1em;
    line-height: 1;
    text-align: center;
}
.cls-song-actions .cls-round .fa-play { transform: translateX(1px); }

/* Both go somewhere, so both carry a word; only the primary one is filled. */
.cls-song-go { font-weight: 600; }

/* Quiet until pointed at, and held off from the button beside it: Edit and
   "take out of the set" must not be neighbours a hurried click confuses. */
.cls-song-remove {
    margin-left: .3rem;
    color: var(--nb-ink-muted);
    border: 1px solid var(--nb-border-faint, rgba(0, 0, 0, .12));
    background: rgba(255, 255, 255, .6);
}
.cls-song-remove:hover,
.cls-song-remove:focus-visible {
    color: var(--nb-destructive);
    border-color: var(--nb-destructive);
    background: rgba(176, 42, 55, .08);
}

/* Narrow enough that the title and three controls stop sharing a line: the
   controls drop under the title rather than squeezing it to an ellipsis. */
@media (max-width: 620px) {
    .cls-song { flex-wrap: wrap; row-gap: .5rem; }
    .cls-song .cls-row-main { flex-basis: 100%; }
}

/* ── An exercise ──────────────────────────────────────────────────────────── */

/* A teacher's row is a form: a type, a name, a song and the controls. A grid
   rather than wrapping flex, so every row breaks in the same place: type, name
   and controls on the first line, the song on the second, whatever the song
   area holds. Wrapping made each row break somewhere different. */
.cls-exercise-edit {
    display: grid;
    grid-template-columns: auto minmax(7.5rem, auto) minmax(0, 1fr) auto;
    grid-template-areas:
        "drag type title actions"
        ".    song song  song";
    column-gap: .4rem;
    row-gap: .3rem;
    align-items: center;
}
.cls-exercise-edit .cls-drag { grid-area: drag; }
.cls-exercise-edit .cls-ex-type { grid-area: type; width: auto; }
.cls-exercise-edit .cls-ex-title { grid-area: title; min-width: 0; }
.cls-exercise-edit .cls-ex-song { grid-area: song; }
.cls-exercise-edit .cls-song-actions { grid-area: actions; display: flex; align-items: center; gap: .25rem; }

/* A phone: the name gets a line of its own. */
@media (max-width: 479.98px) {
    .cls-exercise-edit {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "drag type  actions"
            ".    title title"
            ".    song  song";
    }
}

.cls-ex-song {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}
/* The options a teacher sets when there is no song: a label above each menu. */
.cls-ex-options {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .5rem .75rem;
    flex-basis: 100%;
}
.cls-opt { display: inline-flex; flex-direction: column; gap: .15rem; margin: 0; }
.cls-opt-name {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--nb-ink-muted);
}
.cls-opt-select { height: 28px; font-size: .8rem; width: auto; max-width: 16rem; }
.cls-opt-number {
    height: 28px;
    width: 5.5rem;
    font-size: .8rem;
    border-radius: 3rem;
    padding: 0 .75rem;
}

/* Several at once: chips that fill when chosen. */
.cls-opt-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.cls-opt-chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 .7rem;
    border-radius: 3rem;
    border: 1px solid var(--nb-border, rgba(0, 0, 0, .15));
    background: rgba(255, 255, 255, .6);
    font-size: .78rem;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s, color .15s, border-color .15s;
}
.cls-opt-chip input { position: absolute; opacity: 0; pointer-events: none; }
.cls-opt-chip:has(input:checked) {
    background: var(--nb-primary);
    border-color: var(--nb-primary);
    color: #fff;
}
.cls-opt-chip:has(input:focus-visible) { outline: 2px solid var(--nb-primary); outline-offset: 2px; }

/* On/off settings, together at the end. */
.cls-opt-switches {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    flex-basis: 100%;
}
.cls-opt-switch { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-size: .8rem; min-height: 0; }
.cls-opt-switch .form-check-input { margin: 0; cursor: pointer; }

/* Change and New song: the pills of the toolbar, a size smaller. */
.cls-ex-song .btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    height: 26px;
    padding: 0 .75rem;
    border-radius: 3rem;
    font-size: .78rem;
    white-space: nowrap;
}
.cls-ex-song .btn .fas { font-size: .7em; }
.cls-song-chip {
    font-size: .8rem;
    font-weight: 600;
    padding: .1rem .5rem;
    border-radius: 50px;
    background: rgba(26, 110, 138, .1);
    color: var(--nb-primary-deep);
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* A type that needs a song and has none is half-written work, not an error —
   said in the concession colour rather than the destructive one. */
.cls-needs-song { color: var(--nb-concede); font-weight: 600; }

/* The handle is the only part that looks draggable, and the cursor says so
   over the whole row because that is what is actually being dragged. */
.cls-drag {
    color: var(--nb-ink-muted);
    opacity: .45;
    cursor: grab;
    padding: 0 .1rem;
}
/* Each exercise is a card of its own, numbered, with space between them, so
   where one ends and the next begins is never a guess. */
#clsExerciseList { gap: .6rem; counter-reset: cls-exercise; }
.cls-exercise-edit {
    counter-increment: cls-exercise;
    position: relative;
    padding: .65rem .7rem .7rem 1rem;
    background: #fff;
    border: 1px solid rgba(26, 110, 138, .18);
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(15, 69, 87, .08);
    transition: border-color .15s, box-shadow .15s;
}
/* The stripe and the number on the left edge mark the start of each one. */
.cls-exercise-edit::before {
    content: counter(cls-exercise);
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -1px;
    width: .35rem;
    border-radius: .75rem 0 0 .75rem;
    background: var(--nb-primary);
    opacity: .55;
    color: transparent;
    overflow: hidden;
    transition: opacity .15s;
}
.cls-exercise-edit .cls-drag::after {
    content: counter(cls-exercise);
    display: block;
    margin-top: .15rem;
    font-size: .7rem;
    font-weight: 700;
    text-align: center;
    color: var(--nb-primary-deep);
}
.cls-list .cls-exercise-edit + .cls-exercise-edit { border-top: 1px solid rgba(26, 110, 138, .18); }
.cls-exercise-edit:hover,
.cls-exercise-edit:focus-within {
    background: #fff;
    border-color: rgba(26, 110, 138, .4);
    box-shadow: 0 3px 10px rgba(15, 69, 87, .12);
}
.cls-exercise-edit:hover::before,
.cls-exercise-edit:focus-within::before { opacity: 1; }
.cls-exercise-edit { cursor: grab; }
.cls-exercise-edit:active { cursor: grabbing; }
.cls-exercise-edit.is-dragging {
    opacity: .5;
    outline: 2px dashed var(--nb-primary);
    outline-offset: -2px;
}
/* The fields inside are for typing in, not for dragging from. */
.cls-exercise-edit input,
.cls-exercise-edit select { cursor: auto; }

/* ── Done, or not ─────────────────────────────────────────────────────────── */

.cls-tick { color: var(--nb-border-faint); font-size: 1.05rem; flex: 0 0 auto; }
.cls-tick.is-done { color: var(--nb-answer-correct); }

/* ── What state a set is in ───────────────────────────────────────────────── */

.cls-status {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .1rem .4rem;
    border-radius: 50px;
    background: rgba(99, 110, 114, .16);
    color: var(--nb-ink-muted);
    white-space: nowrap;
}
/* Draft is the one that means "they cannot see this", so it is the one that
   carries a colour. Archived is finished with, and stays quiet. */
.cls-status-draft { background: rgba(154, 74, 6, .14); color: var(--nb-concede); }

.cls-status-select { width: auto; min-width: 8rem; }
.cls-status-select.is-draft { border-color: var(--nb-concede); color: var(--nb-concede); }

/* ── Who has done what ────────────────────────────────────────────────────── */

/* A grid: the roster down the side, the exercises across. Scrolls sideways
   rather than squeezing, because a set can hold more exercises than fit. */
.cls-review-scroll { overflow-x: auto; }

.cls-review {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.cls-review th,
.cls-review td {
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--nb-border-faint);
    text-align: center;
}
.cls-review th {
    font-size: .72rem;
    font-weight: 700;
    color: var(--nb-ink-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    vertical-align: bottom;
}
.cls-review .cls-review-name {
    text-align: left;
    white-space: nowrap;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cls-review-name .cls-badge { margin-left: .4rem; }

.cls-review-cell { color: var(--nb-border-faint); }
.cls-review-cell.is-done { color: var(--nb-answer-correct); }

.cls-people { margin-bottom: 0; }
.cls-invite {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: .4rem;
    align-items: center;
    margin-bottom: .6rem;
}
/* One height for the fields, the role and the button, so they line up. */
.cls-invite > .form-control,
.cls-invite > .form-select,
.cls-invite > .btn {
    height: 2.125rem;
    margin: 0;
}
.cls-invite > .btn { display: inline-flex; align-items: center; }
/* The labels are there for a screen reader, not for the grid to lay out. */
.cls-invite .visually-hidden { position: absolute; }

/* ── Narrow ───────────────────────────────────────────────────────────── */

@media (max-width: 800px) {
    .cls-columns { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
    .cls-head { align-items: flex-start; }
    /* The title and its buttons stop fitting on one line, and a two-word set
       name broken across two lines beside them reads worse than either. */
    .cls-card-head { flex-wrap: wrap; }
    .cls-card-actions { width: 100%; }
    .cls-head-actions { width: 100%; }
    .cls-head-actions .btn { flex: 1; }
    .cls-invite { grid-template-columns: minmax(0, 1fr); }
}
