/* Styles for the features in learn.js and teach.js. Uses the colour and spacing variables of styles.css. */

/* ---- reading settings (Settings page, students): set on <html> by learn.js */
html[data-text="large"] { font-size: 20px; }
html[data-text="xlarge"] { font-size: 23px; }
html[data-text="large"] body[data-theme="kids"] { font-size: 21px; }
html[data-text="xlarge"] body[data-theme="kids"] { font-size: 24px; }
html[data-spacing="wide"] body { line-height: 1.9; letter-spacing: 0.03em; word-spacing: 0.14em; }
html[data-spacing="wide"] .msg { padding-block: 0.85rem; }
/* calm mode: no stars, no badges page, nothing that moves */
html[data-calm="on"] .star-count, html[data-calm="on"] .burst, html[data-calm="on"] .nav-link[href="#/badges"] { display: none; }
html[data-calm="on"] *, html[data-calm="on"] *::before, html[data-calm="on"] *::after { animation: none !important; transition: none !important; }

/* ---- the session */
.msg.solution { border-inline-start-color: var(--accent); border-inline-start-style: solid; background: var(--surface); outline: 2px solid var(--mark); }
/* read aloud (learn.js): a speaker on each message of the AI, shown when the message is pointed at */
.msg .speak { border: 0; background: none; cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0.15rem 0.3rem; margin-inline-start: 0.3rem;
  border-radius: 6px; opacity: 0; vertical-align: middle; transition: opacity 0.15s ease; }
.msg:hover .speak, .msg:focus-within .speak, .msg .speak.on { opacity: 0.7; }
.msg .speak:hover, .msg .speak:focus-visible, .msg .speak.on { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
@media (hover: none) { .msg .speak { opacity: 0.5; } }
/* An exercise is always on one line ("y = x + 2" never splits over two), left to right in Hebrew text too. One too
   long for a narrow screen scrolls sideways inside itself rather than wrapping. */
bdi.math { display: inline-block; white-space: nowrap; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  vertical-align: bottom; scrollbar-width: thin; }
.composer form textarea { flex: 1; min-width: 0; resize: vertical; }
.composer-extras { margin-top: 0.45rem; }
.sure { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.sure-btn { font: inherit; font-size: 0.86rem; padding: 0.22rem 0.7rem; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.sure-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.stop-here { background: var(--accent-soft); color: var(--accent-strong); border-radius: var(--radius); padding: 0.6rem 0.9rem; font-size: 0.92rem; }
.memory p + p { margin-top: 0.35rem; }

/* ---- a live question */
.live-slot:not(:empty) { margin-bottom: 1rem; }
.live-card { align-items: stretch; }
.live-card h2 { margin: 0.2rem 0 0.7rem; unicode-bidi: plaintext; }
.live-card .choices { max-height: none; }
.live-answer { font-size: 1.1rem; margin: 0.4rem 0; }
.live-form { display: grid; gap: 0.8rem; max-width: 640px; }
.live-form textarea, .live-form input[type="text"] { width: 100%; }
.live-prompt { font-size: 1.5rem; line-height: 1.35; margin: 0.3rem 0 1rem; unicode-bidi: plaintext; }
.live-rounds { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; margin-bottom: 1rem; }
.live-round h3 { font-size: 0.95rem; margin-bottom: 0.4rem; }
.live-bars .bar-row .meter { max-width: none; height: 14px; }
.live-bars .bar-row.right span:first-child { font-weight: 700; color: var(--accent-strong); }
.live-bars .bar-row.right .meter i { background: var(--accent-strong); }

/* ---- teacher: Today */
.missed { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.missed:first-child { padding-top: 0; }
.missed .grow { flex: 1; min-width: 240px; }
.missed h3 { font-size: 1rem; unicode-bidi: plaintext; }
.missed .tags { margin-top: 0.4rem; align-items: center; }
.reteach { margin-top: 0.6rem; padding: 0.6rem 0.8rem; background: var(--bg); border-radius: var(--radius); }
.pre { white-space: pre-wrap; }
.actions.ticket { margin-top: 0.9rem; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }

/* ---- teacher: classes */
.class-access { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.5rem 0.9rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); }
.class-access > p, .class-access > label.check { grid-column: 1 / -1; }
.class-access select { width: 100%; }
label.check { display: flex; gap: 0.5rem; align-items: flex-start; cursor: pointer; }
label.check input { width: 1.1rem; height: 1.1rem; margin: 0.2rem 0 0; flex: none; }
.checks h4 { font-size: 0.9rem; margin: 0.8rem 0 0.3rem; }
.check-row { display: flex; gap: 0.8rem; align-items: flex-start; flex-wrap: wrap; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.check-row .grow { flex: 1; min-width: 220px; }
.check-row b { unicode-bidi: plaintext; }
.check-why { color: var(--wrong); }
.check-fix { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; max-width: 100%; }
.check-fix input { flex: 1 1 8rem; width: 9rem; min-width: 6rem; }
.live-bars .bar-row { grid-template-columns: minmax(70px, 1fr) 2fr 2.5rem; }

/* ---- a long class name with the teacher's name must wrap on a phone instead of widening the page */
.classes-strip .grow { min-width: min(200px, 100%); }
.classes-strip .chip { white-space: normal; overflow-wrap: anywhere; }
/* ...and with large text the join form's button drops under its box */
.join { flex-wrap: wrap; }

/* ---- school classes (school.js; the class form in app.js) */
.school-page { display: grid; gap: 1rem; min-width: 0; }       /* min-width: the wide table scrolls inside its panel */
div.field > span:first-child { display: block; font-size: 0.86rem; color: var(--muted); margin-bottom: 0.25rem; }
.class-form .select { width: 100%; }
.subject-pick { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.subject-pick select, .subject-pick input { flex: 1 1 10rem; min-width: 0; }
.fixed-room { font-size: 1.05rem; padding: 0.35rem 0; }
.class-card .legacy { display: inline-block; margin-top: 0.7rem; white-space: normal; }
.room-note { margin-bottom: 1rem; }
.change-room { flex-basis: 100%; }
.grade-add .count { width: 4.5rem; flex: none; }
.grade-add select { width: auto; flex: none; }
.grade-add span { align-self: center; }
.room-code { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0.1em; background: var(--surface);
  border: 1.5px dashed var(--accent); border-radius: var(--radius); padding: 0.1rem 0.5rem; white-space: nowrap; }
.school-grid .grade-row th { background: var(--bg); font-size: 0.85rem; color: var(--muted); }
.school-grid td .actions { flex-wrap: nowrap; justify-content: flex-end; }

/* Demo AI (frontend/demo_ai.js) */
.demoai { display: grid; gap: 1rem; }
.dai-kinds { display: grid; gap: 0.5rem; margin-bottom: 0.9rem; }
.dai-kind { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.65rem 0.85rem; border: 1.5px solid var(--line);
  border-radius: var(--radius); cursor: pointer; }
.dai-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dai-kind input { margin: 0.25rem 0 0; flex: none; accent-color: var(--accent); }
.dai-kind > span { display: grid; gap: 0.15rem; }
.dai-options { display: flex; gap: 1rem 1.5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 0.4rem; }
.dai-options .num-input { width: 6rem; }
.demoai .meter.dai-meter { max-width: none; height: 8px; margin: 0.3rem 0 0.8rem; }
.dai-metrics { gap: 1.2rem 2rem; }
.dai-metrics .metric.bad b { color: var(--wrong); }
.dai-findings { display: grid; }
.dai-finding { display: grid; gap: 0.4rem; padding: 0.9rem 0; border-top: 1px solid var(--line); }
.dai-finding:first-child { border-top: 0; padding-top: 0.2rem; }
.dai-finding h3 { font-size: 1rem; margin: 0; unicode-bidi: plaintext; }
.dai-where { margin: 0; font-size: 0.88rem; color: var(--muted); white-space: pre-line; unicode-bidi: plaintext; }
.dai-detail { margin: 0; unicode-bidi: plaintext; }
.dai-finding details summary, .dai-step summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.dai-evidence { font-family: var(--font-display); font-size: 0.78rem; line-height: 1.5; background: var(--bg); border-radius: var(--radius);
  padding: 0.6rem 0.8rem; margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.dai-finding .actions { margin-top: -0.2rem; }
.dai-step { border-top: 1px solid var(--line); padding: 0.55rem 0; }
.dai-step:first-child { border-top: 0; }
.dai-step summary { color: var(--ink); font-size: 0.95rem; }
.dai-checks { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.3rem; font-size: 0.88rem; }
.dai-checks li { display: flex; gap: 0.45rem; align-items: baseline; flex-wrap: wrap; unicode-bidi: plaintext; }
.dai-mark { color: var(--accent-strong); font-weight: 700; width: 1rem; flex: none; }
.dai-checks li.bad .dai-mark { color: var(--wrong); }
.dai-checks li.skip .dai-mark { color: var(--muted); }
.dai-copy { position: fixed; inset-inline-start: -9999px; top: 0; }
.dai-kind:has(input:disabled) { opacity: 0.55; }
.dai-tester-line { margin: 0.6rem 0 0.2rem; unicode-bidi: plaintext; }
.dai-rules { margin: 0.4rem 0 0.6rem; display: grid; gap: 0.45rem; font-size: 0.9rem; }
.dai-rules summary { display: flex; gap: 0.5rem; align-items: baseline; cursor: pointer; list-style: none; unicode-bidi: plaintext; }
.dai-rules summary::-webkit-details-marker { display: none; }
.dai-rules summary > .chip { flex: none; min-width: 4.8rem; justify-content: center; }
.dai-rules details p { margin: 0.25rem 0 0.2rem; padding-inline-start: 5.3rem; unicode-bidi: plaintext; }
.dai-dismissed { margin-top: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.dai-dismissed summary, .dai-log summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.dai-log { margin-top: 0.4rem; }

/* Installing as an app (frontend/install.js) */
.install-note { margin: 0; max-width: 22rem; unicode-bidi: plaintext; }
/* The "Get the app" button in the top corner: on a phone's top bar, and on the sign-in page */
.install-top { display: inline-flex; align-items: center; gap: 0.4rem; margin-inline-start: auto; padding: 0.45rem 0.85rem;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; font-size: 0.9rem;
  line-height: 1.2; white-space: nowrap; cursor: pointer; box-shadow: 0 2px 8px rgba(21, 32, 59, 0.18);
  animation: install-nudge 1.4s ease-in-out 0.6s 2; }
.install-top:hover { background: var(--accent-strong); }
.install-top:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.install-top .icon { width: 1.05rem; height: 1.05rem; stroke-width: 2.2; }
main.auth { position: relative; }
main.auth > .install-top { position: absolute; top: 0.9rem; inset-inline-end: 0.9rem; z-index: 5; }
body[data-theme="kids"] .install-top { font-size: 0.95rem; padding: 0.5rem 0.95rem; }
@keyframes install-nudge { 0%, 100% { transform: none; } 30% { transform: translateY(-3px) scale(1.04); } 60% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .install-top { animation: none; } }
@media (max-width: 360px) { .mobile-bar .install-top span { display: none; } .mobile-bar .install-top { padding: 0.5rem; } }

/* How to install, where one tap cannot (frontend/install.js) */
.install-sheet { width: min(420px, calc(100vw - 2rem)); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.3rem 1.2rem 1.1rem;
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(21, 32, 59, 0.3); display: grid; gap: 1rem; }
.install-sheet:not([open]) { display: none; }
.install-sheet::backdrop { background: rgba(21, 32, 59, 0.45); }
.install-sheet-head { display: flex; align-items: center; gap: 0.75rem; }
.install-sheet-head img { border-radius: 12px; flex: none; }
.install-sheet-head h2 { font-size: 1.15rem; margin: 0; }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; counter-reset: step; }
.install-steps li { display: flex; gap: 0.7rem; align-items: center; unicode-bidi: plaintext; }
.install-step-icon { flex: none; display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); }
.install-note.warn { background: var(--mark-soft); border-radius: var(--radius); padding: 0.6rem 0.8rem; max-width: none; }
.install-sheet .btn { justify-self: stretch; }

/* Phone notifications (frontend/notify.js) */
.notify-card { border-inline-start-color: var(--accent); }
.notify-card .btn { display: inline-flex; align-items: center; gap: 0.45rem; }
.notify-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.notify-control { display: flex; justify-content: flex-end; align-items: center; gap: 0.3rem 0.6rem; flex-wrap: wrap; }

/* The admin's Teacher | Student switch (frontend/admin.js): the top corner of every page */
.role-switch { flex: none; }
.role-switch .segmented button { padding: 0.3rem 0.8rem; font-size: 0.88rem; font-weight: 700; }
.role-switch .segmented button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.role-corner { display: flex; justify-content: flex-end; padding: 0.8rem 1.25rem 0; }
.mobile-bar .role-switch { margin-inline-start: auto; }
.mobile-bar:has(.role-switch) { gap: 0.5rem; padding-inline: 0.75rem; }
.mobile-bar .role-switch ~ .install-top { margin-inline-start: 0; padding: 0.5rem; }
.mobile-bar .role-switch ~ .install-top span { display: none; }
@media (max-width: 860px) { .role-corner { display: none; } }
@media (max-width: 359px) {
  .mobile-bar:has(.role-switch) .wordmark svg { height: 1.4rem; }
  .mobile-bar .role-switch .segmented button { padding: 0.28rem 0.5rem; font-size: 0.8rem; }
}
/* Replacing the admin account */
.admin-sheet h2 { font-size: 1.15rem; margin: 0; }
.admin-sheet .muted { margin: -0.4rem 0 0; }
.admin-form { display: grid; gap: 0.75rem; }
.btn.danger-fill { background: var(--wrong); box-shadow: 0 var(--press) 0 color-mix(in srgb, var(--wrong) 78%, #000); }
.btn.danger-fill:hover { background: color-mix(in srgb, var(--wrong) 90%, #000); }

/* ---- the Students page: just the students (app.js teacherStudents) */
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.person { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--line); min-width: 0; }
.person .grow { flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }   /* 8rem: the button wraps below before a name is squeezed to a letter a line */
.person-mark { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.person > div[style] { flex-basis: 100%; }

/* ---- the admin's Analytics tab (stats.js) */
.st-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: -0.3rem 0 1rem; border-bottom: 1px solid var(--line); }
.st-tab { padding: 0.5rem 0.95rem; border-radius: var(--radius) var(--radius) 0 0; color: var(--muted); text-decoration: none; font-weight: 700;
  border-bottom: 3px solid transparent; margin-bottom: -1px; }
.st-tab:hover { color: var(--ink); background: var(--surface); }
.st-tab[aria-current="page"] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.st-metrics { margin-bottom: 1rem; }
.st-metrics .metric.good b { color: var(--accent-strong); }
.st-metrics .metric.bad b { color: var(--wrong); }
.st-metrics .metric.live b::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: #2fa36b; margin-inline-end: 0.4rem; vertical-align: middle; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; align-items: start; }
.st-grid > .panel { min-width: 0; margin: 0; }
.st-grid > .st-wide { grid-column: 1 / -1; }
.st-sub { font-size: 0.9rem; margin: 0.9rem 0 0.4rem; color: var(--muted); }
.st-sub:first-child { margin-top: 0; }
.st-foot { margin-top: 1rem; }
.st-back { text-decoration: none; font-weight: 700; }
.st-person { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; margin: 0.2rem 0 0.9rem; }
.st-person .page-title { margin: 0; overflow-wrap: anywhere; }
.st-demo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin: -0.4rem 0 1rem; }
.st-demo-row .muted { flex: 1 1 18rem; min-width: 0; }
.st-tools { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin-bottom: 0.8rem; }
.st-tools input[type="search"] { flex: 1 1 14rem; min-width: 0; max-width: 22rem; }
.st-table td, .st-table th { white-space: nowrap; }
.st-table td:first-child { white-space: normal; min-width: 8rem; }
.st-users td:first-child { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.st-sort { border: 0; background: none; font: inherit; font-weight: 700; color: inherit; cursor: pointer; padding: 0; white-space: nowrap; }
.st-sort:hover { color: var(--accent-strong); }
.dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--line); flex: none; }
.dot.live { background: #2fa36b; box-shadow: 0 0 0 3px rgba(47, 163, 107, 0.18); }
.st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.st-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem; min-width: 0; overflow-wrap: anywhere; }
.st-list .dot { align-self: center; }
.st-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 1rem; margin: 0; }
.st-dl dt { color: var(--muted); font-size: 0.9rem; }
.st-dl dd { margin: 0; overflow-wrap: anywhere; }
.st-missed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.st-missed li { padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.st-missed li:last-child { border-bottom: 0; padding-bottom: 0; }
.st-missed b { unicode-bidi: plaintext; }
.st-topic-bars .bar-row { grid-template-columns: minmax(0, 1fr) 90px 3rem; }
/* what happened: one line each, time first */
.st-feed { list-style: none; margin: 0; padding: 0; display: grid; }
.st-ev { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); gap: 0.2rem 0.8rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.st-timeline .st-ev { grid-template-columns: 4.8rem minmax(0, 1fr); }
.st-ev:last-child { border-bottom: 0; }
.st-ev time { font-variant-numeric: tabular-nums; padding-top: 0.1rem; }
.st-ev-body { min-width: 0; overflow-wrap: anywhere; }
.st-ev-text { unicode-bidi: plaintext; }
.st-kind { font-weight: 700; }
.st-ev.good .st-kind { color: var(--accent-strong); }
.st-ev.weak .st-kind { color: var(--wrong); }
.st-ev.warn .st-kind { color: var(--mark-ink); }
.st-ev.st-from-tutor .st-ev-body, .st-ev.st-from-builder_ai .st-ev-body { color: var(--muted); }
.st-day { position: sticky; top: 0; z-index: 1; background: var(--surface); font-weight: 700; padding: 0.7rem 0 0.35rem; border-bottom: 2px solid var(--line); }
@container main (max-width: 520px) {
  .st-ev, .st-timeline .st-ev { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
/* a small bar chart: one hue, thin bars rounded at the top, standing on the baseline; the line under it reads a bar */
.spark { display: grid; gap: 0.3rem; }
.spark-frame { position: relative; padding-top: 1.1rem; }
.spark-max { position: absolute; inset-inline-start: 0; top: 0; font-size: 0.75rem; }
.spark-bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--line), var(--line)) 0 0 / 100% 1px no-repeat, linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat; }
.spark-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; padding: 0; border: 0; background: none; cursor: pointer; }
.spark-col i { display: block; width: 100%; max-width: 28px; margin-inline: auto; background: var(--accent); border-radius: 4px 4px 0 0; transition: background 0.15s; }
.spark-col:hover i, .spark-col:focus-visible i { background: var(--accent-strong); }
.spark-col:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.spark-axis { display: flex; justify-content: space-between; font-size: 0.75rem; }
.spark-read { margin: 0; min-height: 1.3em; }
.st-scroll { max-height: 34rem; overflow-y: auto; overscroll-behavior: contain; padding-inline-end: 0.3rem; }
/* one person's page, in tabs */
.st-subtabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: -0.3rem 0 1.1rem; }
.st-subtab { padding: 0.35rem 0.9rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted);
  text-decoration: none; font-weight: 700; font-size: 0.92rem; }
.st-subtab:hover { color: var(--ink); border-color: var(--muted); }
.st-subtab[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.st-subtab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.panel .st-demo-row { margin: 0; }
.panel-head label.check { font-weight: 400; color: var(--muted); align-items: center; }
.panel-head label.check input { margin: 0; }
/* needs attention: the most serious first; a coloured edge says how serious */
.st-attention-panel { margin-bottom: 1rem; }
.st-attention-panel .panel-head { flex-wrap: wrap; gap: 0.3rem 0.8rem; }
.st-attention { list-style: none; margin: 0; padding: 0; display: grid; }
.st-att { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 0.35rem 0.85rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.st-att:first-child { padding-top: 0.2rem; }
.st-att:last-child { border-bottom: 0; }
.st-att-mark { border-radius: 2px; background: var(--line); }
.st-att.bad .st-att-mark { background: var(--wrong); }
.st-att.warn .st-att-mark { background: repeating-linear-gradient(var(--mark) 0 6px, transparent 6px 10px); }   /* dashed: not only a colour apart from bad */
.st-att.seen { opacity: 0.62; }
.st-att-body { min-width: 0; display: grid; gap: 0.3rem; overflow-wrap: anywhere; }
.st-att-line { font-weight: 700; }
.st-att-quote { padding: 0.4rem 0.75rem; background: var(--bg); border-radius: var(--radius); white-space: pre-wrap; unicode-bidi: plaintext; }
.st-att-quote.code { font-family: var(--font-display); font-size: 0.82rem; }
.st-att-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: flex-start; justify-content: flex-end; }
.st-att-actions .btn { padding: 0.38rem 0.8rem; font-size: 0.88rem; }
.st-att-foot:not(:empty) { margin-top: 0.4rem; }
.st-att-none { padding: 0.2rem 0; }
@container main (max-width: 560px) {
  .st-att { grid-template-columns: 4px minmax(0, 1fr); }
  .st-att-actions { grid-column: 2; justify-content: flex-start; }
}
/* the chats with the AI tutor: a list, and one conversation as the student saw it */
.st-flags { margin-top: -0.3rem; }
.st-flags .segmented { flex-wrap: wrap; }
.st-chats { display: grid; }
.st-chat { display: grid; gap: 0.25rem; padding: 0.75rem 0.15rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; }
.st-chat:first-child { padding-top: 0.2rem; }
.st-chat:last-child { border-bottom: 0; }
.st-chat:hover .st-chat-title, .st-chat:focus-visible .st-chat-title { color: var(--accent-strong); text-decoration: underline; }
.st-chat:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
.st-chat-top { display: flex; flex-wrap: wrap; gap: 0.3rem 0.55rem; align-items: center; min-width: 0; }
.st-chat-title { font-weight: 700; unicode-bidi: plaintext; overflow-wrap: anywhere; }
.st-chat-who { overflow-wrap: anywhere; }
.st-chat-snip { unicode-bidi: plaintext; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-chat-with { margin: -0.5rem 0 1rem; overflow-wrap: anywhere; }
.st-convo { gap: 0.7rem; }
.st-turn { display: grid; gap: 0.2rem; min-width: 0; }
.st-turn.by-student { justify-items: end; }
.st-turn.by-assistant { justify-items: start; }
.st-convo .msg { max-width: min(85%, 48rem); animation: none; }
.st-cap { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-size: 0.78rem; color: var(--muted); }
.st-cap time { font-variant-numeric: tabular-nums; }
.st-cap .chip { font-size: 0.75rem; padding: 0.08rem 0.5rem; }
.st-cap-kind { font-weight: 700; }
.st-mark { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; align-items: baseline; font-size: 0.88rem; max-width: min(85%, 48rem); }
.st-mark.good b { color: var(--accent-strong); }
.st-mark.weak b { color: var(--wrong); }
.st-convo-day { justify-self: center; font-size: 0.8rem; font-weight: 700; color: var(--muted); background: var(--bg); border-radius: 999px;
  padding: 0.2rem 0.85rem; margin: 0.4rem 0 0.1rem; }
.st-convo-nav { justify-content: space-between; margin-top: 1rem; }
.st-earlier:has(button[hidden]) { display: none; }
.st-earlier { margin-bottom: 0.6rem; }

/* ---- more.js: streak and weekly goal, maths keys, explain it differently, practice tests */
.habits { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; margin: 0.2rem 0 1rem; padding: 0.75rem 1rem;
  background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line); }
.habit { display: grid; gap: 0.15rem; min-width: 12rem; flex: 1 1 14rem; }
.habit b { font-size: 1rem; }
.habit .meter { max-width: 260px; margin-top: 0.2rem; }
.habit.lit b { color: var(--accent-strong); }
.math-pad { flex-basis: 100%; display: flex; gap: 0.35rem; align-items: center; min-width: 0; }
.math-toggle { flex: none; }
.math-keys { display: flex; gap: 0.3rem; overflow-x: auto; min-width: 0; flex: 1; padding-bottom: 2px; scrollbar-width: thin; }
.math-keys[hidden] { display: none; }
.math-key { flex: none; min-width: 2.4rem; min-height: 2.3rem; padding: 0 0.5rem; font: 600 1.05rem var(--font-body);
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer;
  touch-action: manipulation; }
.math-key:hover { border-color: var(--accent); }
.math-key:active { background: var(--accent-soft); }
.again-row { margin-top: 0.45rem; white-space: normal; }
.again-btn { font: inherit; font-size: 0.86rem; padding: 0.22rem 0.75rem; border-radius: 99px; cursor: pointer;
  border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent-strong); }
.again-btn:hover { background: var(--accent-soft); }
.again-btn:disabled { opacity: 0.6; cursor: default; }
.test-clock { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; padding: 0.2rem 0.7rem; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent-strong); white-space: nowrap; font-variant-numeric: tabular-nums; }
.test-clock.low { background: var(--wrong-soft); color: var(--wrong); }
/* during a test the progress line would tell how many were right: only the clock is shown */
.session-head.testing .grow > p, .session-head.testing .grow > div { display: none; }
.page-intro { margin: -0.3rem 0 1rem; max-width: 72ch; }
.test-list { display: grid; gap: 0.9rem; }
.test-card .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.7rem; }
.test-title { font-size: 1.1rem; margin-bottom: 0.2rem; }
.test-scores { margin-top: 0.9rem; }
.test-scores ul { list-style: none; margin: 0.3rem 0 0; padding: 0; display: grid; gap: 0.2rem; }

/* ---- library.js: the menu on a published lesson, its dialogs, homework, the printable worksheet */
.lesson-actions { width: 1%; white-space: nowrap; }
.lm-wrap { position: relative; display: inline-block; }
.lm-menu { position: fixed; z-index: 40; min-width: 14rem; margin: 0; padding: 0.3rem;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(21, 32, 59, 0.16); }
.lm-menu button { display: block; width: 100%; text-align: start; font: inherit; padding: 0.5rem 0.7rem; border: 0; border-radius: 6px;
  background: none; color: var(--ink); cursor: pointer; }
.lm-menu button:hover, .lm-menu button:focus-visible { background: var(--bg); }
.lm-menu button.danger { color: var(--wrong); }
.lm-dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
  color: var(--ink); background: var(--surface); box-shadow: 0 20px 60px rgba(21, 32, 59, 0.3); }
.lm-dialog::backdrop { background: rgba(21, 32, 59, 0.45); }
.lm-dialog form { display: grid; gap: 0.9rem; padding: 1.3rem 1.4rem; }
.lm-dialog h2 { font-size: 1.15rem; }
.lm-dialog .actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.3rem; }
.lm-field { display: grid; gap: 0.25rem; }
.lm-field input, .lm-field select { width: 100%; }
.lm-grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.lm-row { display: flex; align-items: center; gap: 0.45rem; }
.lm-row .select { width: auto; flex: 1; }
.lm-field[hidden] { display: none; }
.hw-line { margin-top: 0.15rem; }
.worksheet { max-width: 820px; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 2rem) 3rem; }
.ws-bar { display: flex; justify-content: space-between; gap: 0.6rem; margin-bottom: 1rem; }
.ws-page { background: #fff; color: #111; border-radius: var(--radius-lg); padding: 2rem clamp(1rem, 5vw, 2.6rem); margin-bottom: 1.2rem;
  box-shadow: 0 1px 3px rgba(21, 32, 59, 0.12); }
.ws-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem 2rem; flex-wrap: wrap;
  border-bottom: 2px solid #111; padding-bottom: 0.8rem; margin-bottom: 1.2rem; }
.ws-head h1 { font-size: 1.5rem; }
.ws-who { display: grid; grid-template-columns: auto 11rem; gap: 0.6rem 0.5rem; align-items: end; }
.ws-who i { display: block; border-bottom: 1px solid #111; height: 1.2rem; }
.ws-overview { margin-bottom: 1rem; }
.ws-list { margin: 0; padding-inline-start: 1.6rem; display: grid; gap: 1.4rem; }
.ws-q { break-inside: avoid; }
.ws-prompt { font-weight: 700; margin-bottom: 0.5rem; unicode-bidi: plaintext; }
.ws-lines { display: grid; gap: 1.5rem; padding-top: 1rem; }
.ws-lines i { display: block; border-bottom: 1px dotted #555; }
.ws-options { display: grid; gap: 0.35rem; }
.ws-option { display: flex; gap: 0.6rem; align-items: baseline; }
.ws-mark { font-size: 1.05rem; }
.ws-key h2 { font-size: 1.2rem; margin-bottom: 0.8rem; }
.ws-answers { margin: 0; padding-inline-start: 1.6rem; display: grid; gap: 0.35rem; }
@media print {
  body { background: #fff !important; }
  .no-print, #toast { display: none !important; }
  .worksheet { max-width: none; padding: 0; }
  .ws-page { box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
  .ws-key { break-before: page; }
}

/* ---- accounts.js: password, accounts, the year's end, private classes */
.pw-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pw-form input { flex: 1 1 12rem; min-width: 0; }
.acc-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.1rem; }
.acc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; padding: 0.5rem 0; border-top: 1px solid var(--line); }
.acc-row:first-child { border-top: 0; }
.acc-row .grow { flex: 1 1 14rem; min-width: 0; }
.acc-row .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.acc-row .select { width: auto; }
.acc-ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; max-height: 45vh; overflow-y: auto; }
.acc-ticks li { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
/* The teachers of a school class (school.js): every control at least 44px to tap */
.ht-body { display: grid; gap: 0.8rem; min-width: 0; }
.ht-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; max-height: 40vh; overflow-y: auto; }
.ht-list li { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; overflow-wrap: anywhere; }
.lm-dialog:has(.ht-body) .btn, .ht-body .select, .school-grid .btn.ht-open { min-height: 44px; }
.school-grid .btn.ht-open { padding-inline: 0; }
.temp-password { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: 0.04em; padding: 0.6rem 0.9rem; text-align: center;
  background: var(--bg); border-radius: var(--radius); user-select: all; }
.ye-list { margin: 0.2rem 0 0.4rem; padding-inline-start: 1.2rem; display: grid; gap: 0.15rem; max-height: 30vh; overflow-y: auto; }
.pc-open { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.pc-open summary { cursor: pointer; font-weight: 700; }
.pc-open form { margin-top: 0.7rem; }
.pc-chip { display: inline-flex; margin-top: 0.4rem; }
.pc-chip code { font-weight: 700; letter-spacing: 0.05em; }

/* ---- the sign-up in steps (signup.js) ---- */
.su-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; min-height: 2rem; }
.su-back { padding-inline: 0; }
.auth-card .su-meter { max-width: none; margin-top: -0.6rem; }
.su-sub { margin-top: -0.7rem; }
.su-form { display: grid; gap: 0.85rem; }
.su-choices { display: grid; gap: 0.6rem; }
.su-choice { display: grid; gap: 0.2rem; text-align: start; padding: 0.9rem 1rem; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); }
.su-choice strong { font-size: 1.05rem; }
.su-choice:hover, .su-choice:focus-visible { border-color: var(--accent); outline: none; }
.su-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.su-grades { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.4rem; }
.su-grade { padding: 0.55rem 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); }
.su-grade[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.su-form .segmented { display: flex; flex-wrap: wrap; }
.su-form .segmented button { flex: 1 1 auto; }
.su-hint { display: block; margin-top: 0.3rem; font-size: 0.8rem; line-height: 1.35; }
.su-pass { display: flex; gap: 0.3rem; align-items: center; }
.su-pass input { flex: 1; min-width: 0; }
.su-show { flex: none; }
.su-code { font-size: 1.35rem; letter-spacing: 0.2em; text-transform: uppercase; text-align: center; }
.su-found { justify-self: start; }
.su-tips { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: 0.55rem; }
input[type="tel"] { font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 0.6rem 0.75rem; width: 100%; }
.org-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 0.8rem; }
.org-facts dd { margin: 0; }
.org-row { display: flex; gap: 1rem; align-items: flex-start; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.org-row:first-child { border-top: 0; }
.org-row p { margin: 0.15rem 0 0; }
@media (max-width: 520px) {
  .org-row { flex-direction: column; gap: 0.5rem; }
}

/* ---- an organisation's pages (org.js) and the admin's billing line (signup.js) ---- */
.org-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; }
.org-step { display: grid; gap: 0.2rem; padding: 0.8rem 0.95rem; border: 1.5px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; background: var(--surface); }
.org-step:hover, .org-step:focus-visible { border-color: var(--accent); outline: none; }
.org-step.done { border-color: var(--accent-soft); background: var(--accent-soft); }
.org-step.done strong::after { content: " ✓"; color: var(--accent-strong); }
.org-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.85rem; align-items: start; }
.org-classes { display: grid; gap: 0.8rem; }
.org-class h2 { font-size: 1.05rem; }
.org-class-line { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 0.7rem; }
.org-code { display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.org-code bdi, .org-invite-code bdi { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.12em;
  background: var(--bg); border-radius: 6px; padding: 0.1rem 0.5rem; }
.org-class-actions { margin-top: 0.4rem; }
.org-invite { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.org-invite-code { font-size: 1.4rem; }
.org-features { display: grid; gap: 0; padding-top: 0.2rem; padding-bottom: 0.2rem; }
.org-feature { display: flex; gap: 1rem; align-items: center; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.org-feature:first-child { border-top: 0; }
.org-feature p { margin: 0.2rem 0 0; }
.org-feature .btn { flex: none; min-width: 6rem; }
.org-billing { display: grid; gap: 1rem; }
.org-billing .segmented { display: flex; flex-wrap: wrap; }
.org-billing .segmented button { flex: 1 1 auto; }
.org-blocked { margin: 0; }
.org-month p { margin: 0 0 0.35rem; }
.org-meter { max-width: none; margin: 0.2rem 0 0.4rem; }
.org-credit { display: grid; gap: 0.6rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.org-credit h3 { font-size: 0.98rem; margin: 0; }
.org-credit p { margin: 0; }
.org-credit-go { align-self: end; }
.org-history { border-top: 1px solid var(--line); padding-top: 0.7rem; }
.org-history summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; }
.org-credit-row { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; padding: 0.45rem 0; }
.org-credit-row + .org-credit-row { border-top: 1px solid var(--line); }
.org-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.92rem; }
.org-table th, .org-table td { text-align: start; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
.org-table th { color: var(--muted); font-weight: 400; }
.org-chip { display: inline-flex; margin-top: 0.4rem; }
.org-billing-admin { margin-top: 0.5rem; font-size: 0.93rem; }
.org-billing-admin summary { cursor: pointer; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.org-billing-admin > p { margin: 0.45rem 0; }
.org-pay { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.org-pay input[type="number"] { width: 8rem; }
.org-pay input[type="text"] { flex: 1; min-width: 10rem; }
.builder-off { margin: 0 0 0.8rem; }
.build.solo { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
@media (max-width: 520px) {
  .org-feature { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .org-feature .btn { align-self: flex-start; }
}

/* ---- the personalized study plan (plan.js) ---- */
.plan-steps { list-style: none; margin: 0; padding: 0; display: grid; }
.plan-step { display: flex; gap: 0.8rem; align-items: center; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.plan-step:first-child { border-top: 0; padding-top: 0.2rem; }
.plan-step .btn { flex: none; }
.plan-meter { max-width: 260px; margin-top: 0.4rem; }
.plan-summary { font-size: 1.05rem; line-height: 1.55; margin: 0 0 0.9rem; }
.plan-notes { display: grid; gap: 0.75rem; margin: 0; }
.plan-note { display: grid; grid-template-columns: minmax(8.5rem, 0.35fr) 1fr; gap: 0.2rem 1rem; }
.plan-note dt { color: var(--muted); font-size: 0.9rem; }
.plan-note dd { margin: 0; }
.plan-note ul { margin: 0; padding-inline-start: 1.1rem; display: grid; gap: 0.2rem; }
.plan-foot { display: grid; gap: 0.4rem; }
.plan-foot p { margin: 0; }
.plan-focus p { margin: 0.25rem 0 0; font-size: 1.02rem; }
@media (max-width: 520px) {
  .plan-note { grid-template-columns: 1fr; }
}
.org-groups { display: grid; gap: 1rem; }
.org-feature > .grow { flex: 1; min-width: 0; }
.org-blocked { margin: 0; background: var(--mark-soft); color: var(--mark-ink); border-radius: var(--radius); padding: 0.6rem 0.9rem; font-size: 0.92rem; }
.org-chip code { font-weight: 700; letter-spacing: 0.05em; }
.org-join { display: grid; gap: 0.8rem; justify-items: start; }
.org-join p { margin: 0; }
.org-join-title { font-size: 1.3rem; }
.plan-step > .grow { flex: 1; min-width: 0; }
.org-chip { flex-wrap: wrap; white-space: normal; border-radius: var(--radius); }
.org-chip code { white-space: nowrap; }
.su-form input[aria-invalid="true"] { border-color: var(--wrong); box-shadow: 0 0 0 2px var(--wrong-soft); }
/* an error about one field, right under it (app.js fieldError) */
.field-error { color: var(--wrong); font-size: 0.86rem; margin: 0.3rem 0 0; line-height: 1.35; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--wrong); box-shadow: 0 0 0 2px var(--wrong-soft); }
.su-signs { letter-spacing: 0.08em; white-space: nowrap; font-family: var(--font-display); }
.pw-box { flex: 1 1 12rem; min-width: 0; display: grid; gap: 0.2rem; }
.pw-box input { width: 100%; }
/* Free learning (free.js): the big syllabus, a tree of every subject's topics */
.free-page > p { margin: -0.6rem 0 0; }
.free-search input { width: 100%; }
.free-subjects { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.free-subject {
  display: grid; gap: 0.1rem; justify-items: start; text-align: start; min-width: 7.5rem; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-lg); padding: 0.55rem 0.9rem;
}
.free-subject span + span { font-weight: 400; }
@media (hover: hover) { .free-subject:hover { border-color: var(--accent); } }
.free-subject[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.free-browse { display: grid; gap: 0.9rem; }
.free-tree[aria-busy="true"] { opacity: 0.6; }
.free-list, .free-kids { list-style: none; margin: 0; padding: 0; }
.free-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.free-node { border-top: 1px solid var(--line); }
.free-list > .free-node:first-child { border-top: 0; }
/* deeper levels: the rows move in, the background alternates (and the chips on it with it) */
.free-kids { border-top: 1px solid var(--line); background: var(--bg); }
.free-kids .free-kids { background: var(--surface); }
.free-kids .free-row { padding-inline-start: 2.2rem; }
.free-kids .free-kids .free-row { padding-inline-start: 3.5rem; }
.free-kids .free-kids .free-kids .free-row { padding-inline-start: 4.8rem; }
.free-kids .chip:not(.good) { background: var(--surface); }
.free-kids .free-kids .chip:not(.good) { background: var(--bg); }
.free-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; padding: 0.55rem 0.9rem; }
.free-name { flex: 1 1 14rem; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; }
.free-title { overflow-wrap: anywhere; }
.free-node.top > .free-row .free-title { font-weight: 700; }
.free-path { flex-basis: 100%; overflow-wrap: anywhere; }
.free-open {
  display: inline-flex; align-items: baseline; gap: 0.3rem 0.6rem; flex-wrap: wrap; min-width: 0; text-align: start;
  font: inherit; color: inherit; background: none; border: 0; padding: 0.3rem 0.35rem; margin-inline-start: -0.35rem;
  border-radius: var(--radius); cursor: pointer;
}
.free-open::before { content: "▸"; color: var(--muted); display: inline-block; transition: transform 0.15s; }
.free-open[aria-expanded="true"]::before { transform: rotate(90deg); }
[dir="rtl"] .free-open::before { content: "◂"; }
[dir="rtl"] .free-open[aria-expanded="true"]::before { transform: rotate(-90deg); }
@media (hover: hover) { .free-open:hover { background: var(--bg); } .free-kids .free-open:hover { background: var(--surface); } }
.free-acts { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: none; }
.free-acts .btn { padding: 0.4rem 0.85rem; font-size: 0.92rem; }
.free-results { display: grid; gap: 0.6rem; }
.free-results p { margin: 0; }
.free-any { display: grid; gap: 0.6rem; }
@media (max-width: 599px) {
  .free-acts { flex: 1 1 100%; }
  .free-kids .free-row { padding-inline-start: 1.6rem; }
  .free-kids .free-kids .free-row { padding-inline-start: 2.3rem; }
  .free-kids .free-kids .free-kids .free-row { padding-inline-start: 3rem; }
}
/* The big syllabus, the admin's page (master.js) */
.bs-page { display: grid; gap: 1rem; }
.bs-page > p { margin: 0; }
.bs-list { list-style: none; margin: 0; padding: 0; display: grid; }
.bs-row { display: flex; align-items: center; gap: 0.6rem 1rem; flex-wrap: wrap; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.bs-list > .bs-row:first-child { border-top: 0; padding-top: 0.2rem; }
.bs-row > .grow { flex: 1 1 14rem; min-width: 0; }
.bs-row p { margin: 0.15rem 0 0; }
.bs-meter { max-width: 320px; margin-top: 0.4rem; }
.bs-sources { list-style: none; margin: 0.2rem 0 0; padding: 0; flex: 1 1 100%; display: grid; gap: 0.6rem; }
.bs-source { padding: 0.55rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, transparent); }
.bs-source > p { margin: 0 0 0.35rem; }
.bs-makers { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.bs-maker { display: flex; align-items: center; gap: 0.4rem 0.8rem; flex-wrap: wrap; }
.bs-maker > .grow { flex: 1 1 12rem; min-width: 0; display: flex; align-items: center; gap: 0.25rem 0.5rem; flex-wrap: wrap; }
.bs-maker-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.bs-back { justify-self: start; padding-inline: 0; }
.bs-page .page-title .chip { vertical-align: middle; font-family: var(--font-body, inherit); font-size: 0.85rem; font-weight: 600; }
.bs-counts { gap: 0.4rem; }
.bs-anomalies { border-color: var(--mark-soft); box-shadow: inset 4px 0 0 var(--mark); }
[dir="rtl"] .bs-anomalies { box-shadow: inset -4px 0 0 var(--mark); }
.bs-pair, .bs-change { display: grid; gap: 0.15rem; padding: 0.65rem 0; border-top: 1px solid var(--line); }
.bs-list > .bs-pair:first-child, .bs-list > .bs-change:first-child { border-top: 0; padding-top: 0.2rem; }
.bs-pair p, .bs-change p { margin: 0; }
.bs-path { overflow-wrap: anywhere; }
.bs-tabs { margin-bottom: 0.8rem; flex-wrap: wrap; }
.bs-tree { list-style: none; margin: 0; padding: 0; }
.bs-tree .bs-tree { padding-inline-start: 1.3rem; border-inline-start: 1px solid var(--line); margin-inline-start: 0.35rem; }
.bs-node-row { display: inline-flex; align-items: center; gap: 0.3rem 0.6rem; flex-wrap: wrap; padding: 0.25rem 0; }
.bs-node > .bs-node-row { padding-inline-start: 1.15rem; }
.bs-tree summary { cursor: pointer; }
.bs-tree.top > .bs-node + .bs-node { border-top: 1px solid var(--line); margin-top: 0.3rem; padding-top: 0.3rem; }
.bs-actions { position: sticky; bottom: 0; display: flex; gap: 0.6rem; flex-wrap: wrap; padding: 0.8rem 0; background: var(--bg);
  border-top: 1px solid var(--line); z-index: 2; }
.bs-crumbs { overflow-wrap: anywhere; }
.bs-change-head { display: flex; align-items: center; gap: 0.3rem 0.6rem; flex-wrap: wrap; }
/* "All merges": what came in = what was there */
.bs-same { display: flex; align-items: baseline; gap: 0.5rem; }
.bs-eq { font-weight: 700; color: var(--muted, inherit); flex: none; }
.bs-merge .chips { margin-top: 0.15rem; }
.bs-search { width: 100%; max-width: 26rem; margin-bottom: 0.3rem; }
.bs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* an organisation's school classes (org.js) */
.org-rooms { display: grid; gap: 0.7rem; }
.org-rooms > p { margin: 0; }

/* a live question while the student is on another page (learn.js) */
.live-banner { position: fixed; z-index: 60; inset-inline: 0.75rem; top: max(0.6rem, env(safe-area-inset-top)); margin-inline: auto;
  max-width: 36rem; display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.6rem 0.55rem 0.9rem; border-radius: 14px;
  background: var(--ink); color: var(--surface); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22); animation: rise 0.25s ease-out; }
[dir="rtl"] .live-banner { padding: 0.55rem 0.9rem 0.55rem 0.6rem; }
.live-banner .grow { flex: 1; min-width: 0; font-weight: 600; font-size: 0.95rem; }
.live-banner .btn { padding: 0.4rem 0.9rem; background: var(--mark); color: var(--on-mark); box-shadow: none; }   /* stands out on the ink banner */
.live-banner .btn.text { background: none; color: var(--surface); font-size: 1.3rem; line-height: 1; padding: 0.2rem 0.45rem; }
.live-banner-dot { flex: none; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: #3ddc97; animation: live-pulse 1.6s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.7); } 100% { box-shadow: 0 0 0 0.6rem rgba(61, 220, 151, 0); } }
@media (prefers-reduced-motion: reduce) { .live-banner, .live-banner-dot { animation: none; } }

/* the Demo AI: the owner's own instructions and the plan made of them (demo_ai.js) */
.dai-custom { display: grid; gap: 0.6rem; margin: 0.4rem 0 0.8rem; }
.dai-custom textarea { width: 100%; resize: vertical; }
.dai-plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; background: var(--bg); display: grid; gap: 0.4rem; }
.dai-plan-card h3, .dai-plan-card p { margin: 0; }
.dai-plan-steps { margin: 0; padding-inline-start: 1.3rem; display: grid; gap: 0.15rem; font-size: 0.92rem; }

/* the help assistant (help.js): a green circle with a head in headphones on every page, and its chat */
.help-fab { position: fixed; z-index: 55; inset-inline-end: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom));
  width: 3.5rem; height: 3.5rem; border-radius: 50%; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #34c38f, #13875f 70%); box-shadow: 0 8px 22px rgba(19, 135, 95, 0.38), 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.18s ease, box-shadow 0.18s ease; }
.help-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 26px rgba(19, 135, 95, 0.45), 0 2px 6px rgba(0, 0, 0, 0.15); }
.help-fab:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.help-fab .help-agent { width: 2.35rem; height: 2.35rem; }
.help-ring { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; animation: help-ring 4.5s ease-out infinite; }
@keyframes help-ring { 0%, 70% { box-shadow: 0 0 0 0 rgba(52, 195, 143, 0.55); } 100% { box-shadow: 0 0 0 0.9rem rgba(52, 195, 143, 0); } }
.help-agent .help-face { fill: #fff; }
.help-agent .help-eye { fill: #0d4f39; transform-box: fill-box; transform-origin: center; animation: help-blink 5s infinite; }
.help-agent .help-smile { fill: none; stroke: #0d4f39; stroke-width: 1.6; stroke-linecap: round; }
.help-agent .help-band, .help-agent .help-boom { fill: none; stroke: #0b3d2c; stroke-width: 2.4; stroke-linecap: round; }
.help-agent .help-boom { stroke-width: 1.6; }
.help-agent .help-cup { fill: #0b3d2c; }
.help-agent .help-mic { fill: #ffd166; animation: help-mic 1.8s ease-in-out infinite; }
.help-agent .help-head { transform-box: fill-box; transform-origin: 50% 90%; animation: help-nod 3.6s ease-in-out infinite; }
@keyframes help-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes help-mic { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes help-nod { 0%, 100% { transform: rotate(0deg) translateY(0); } 25% { transform: rotate(-4deg) translateY(-0.4px); } 60% { transform: rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .help-ring, .help-agent .help-eye, .help-agent .help-mic, .help-agent .help-head { animation: none; } }
/* in an exercise session the answer box is at the bottom: the button sits above it */
body:has(#app > .session) .help-fab { bottom: calc(max(0.7rem, env(safe-area-inset-bottom)) + 4.6rem); width: 3rem; height: 3rem; }
body:has(#app > .session) .help-fab .help-agent { width: 2rem; height: 2rem; }
body.help-open .help-fab { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px #13875f; }

.help-panel { position: fixed; z-index: 56; inset-inline-end: max(1rem, env(safe-area-inset-right)); bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 4.4rem);
  width: min(24rem, calc(100vw - 2rem)); height: min(34rem, calc(100dvh - 7rem)); display: grid; grid-template-rows: auto 1fr auto auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22); overflow: hidden;
  animation: rise 0.2s ease-out; }
.help-panel[hidden] { display: none; }
body:has(#app > .session) .help-panel { bottom: calc(max(0.7rem, env(safe-area-inset-bottom)) + 8.2rem); height: min(32rem, calc(100dvh - 10rem)); }
.help-head-bar { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.6rem 0.7rem 0.9rem; background: linear-gradient(135deg, #13875f, #1f6f5c); color: #fff; }
[dir="rtl"] .help-head-bar { padding: 0.7rem 0.9rem 0.7rem 0.6rem; }
.help-head-bar h2 { margin: 0; font-size: 1.05rem; color: #fff; }
.help-head-bar .muted { color: rgba(255, 255, 255, 0.85); margin: 0.1rem 0 0; }
.help-head-bar .grow { flex: 1; min-width: 0; }
.help-badge { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: rgba(255, 255, 255, 0.16); display: grid; place-items: center; }
.help-badge .help-agent { width: 1.85rem; height: 1.85rem; }
.help-panel .help-x { color: #fff; font-size: 1.6rem; line-height: 1; padding: 0.2rem 0.55rem; border-radius: 8px; }
.help-panel .help-x:hover, .help-panel .help-x:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.16); text-decoration: none; }
.help-list { overflow-y: auto; padding: 0.9rem; align-content: start; background: var(--bg); }
.help-list .msg { max-width: 90%; font-size: 0.95rem; }
.help-note { margin: 0; padding: 0.5rem 0.9rem; background: var(--wrong-soft); color: var(--ink); }
.help-form { display: flex; gap: 0.5rem; padding: 0.6rem; border-top: 1px solid var(--line); background: var(--surface); }
.help-form textarea { flex: 1; min-width: 0; resize: none; max-height: 120px; }
@media (max-width: 560px) {
  .help-panel { inset-inline: 0.5rem; width: auto; bottom: calc(max(0.5rem, env(safe-area-inset-bottom)) + 4.3rem); height: min(36rem, calc(100dvh - 6rem)); }
  body:has(#app > .session) .help-panel { bottom: calc(max(0.5rem, env(safe-area-inset-bottom)) + 7.8rem); height: calc(100dvh - 9rem); }
}
@media print { .help-fab, .help-panel, .live-banner { display: none !important; } }

/* the admin's Users tab (users.js) */
.us-body { padding-top: 0.2rem; padding-bottom: 0.2rem; }
.us-list { list-style: none; margin: 0; padding: 0; }
.us-row { border-top: 1px solid var(--line); }
.us-row:first-child { border-top: 0; }
.us-empty { padding: 1rem 0; }
.us-head { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; padding: 0.75rem 0; }
.us-who { flex: 1 1 12rem; min-width: 0; display: grid; gap: 0.1rem; }
.us-who b, .us-who span { overflow-wrap: anywhere; unicode-bidi: plaintext; justify-self: start; }
.us-tags { flex: 0 1 auto; }
.us-seen { white-space: nowrap; min-width: 5.5rem; text-align: end; }
.us-tools .segmented { flex-wrap: wrap; max-width: 100%; }
.us-row.open > .us-head .us-who b { color: var(--accent-strong); }
.us-edit { display: grid; gap: 0.8rem; padding: 0 0 1rem; }
.us-box { background: var(--bg); border-radius: var(--radius); padding: 0.8rem 1rem; }
.us-box h3 { margin: 0; font-size: 1rem; }
.us-box > p { margin: 0.2rem 0 0.4rem; }
.us-opt { padding: 0.55rem 0; border-top: 1px solid var(--line); }
.us-box > p + .us-opt { border-top: 0; }
.us-opt > span { display: grid; gap: 0.1rem; }
.us-opt.off { cursor: default; opacity: 0.6; }
.us-note { margin: 0.4rem 0 0; }
.us-signin { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; }
.us-signin .grow { flex: 1 1 14rem; }
.us-signin p { margin: 0.2rem 0 0; }
.us-bad { color: var(--wrong); }
@media (max-width: 640px) {
  .us-seen { min-width: 0; text-align: start; }
}

/* Free learning: topics a teacher suggested (free.js) */
.chip.suggest, .free-kids .chip.suggest, .free-kids .free-kids .chip.suggest { background: var(--mark-soft); color: var(--mark-ink); }
.chip.suggest { white-space: nowrap; display: inline-flex; align-items: center; }
.chip.suggest::before { content: "★"; margin-inline-end: 0.3em; }
.free-from bdi { unicode-bidi: isolate; }
.free-sugg-panel .panel-body > p.small { margin: 0 0 0.6rem; }
.free-sugg-list { list-style: none; margin: 0; padding: 0; }
.free-sugg { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.free-sugg:first-child { border-top: 0; padding-top: 0; }
.free-sugg:last-child { padding-bottom: 0; }
.free-sugg .grow { flex: 1 1 16rem; min-width: 0; display: grid; gap: 0.15rem; }
.free-sugg b, .free-sugg p { overflow-wrap: anywhere; }
.free-sugg p { margin: 0; }
.free-why { margin: -0.35rem 0 0; padding: 0 0.9rem 0.55rem; overflow-wrap: anywhere; }
.free-kids .free-why, .free-kids .free-reason { padding-inline-start: 2.2rem; }
.free-kids .free-kids .free-why, .free-kids .free-kids .free-reason { padding-inline-start: 3.5rem; }
.free-reason { display: grid; gap: 0.3rem; padding: 0 0.9rem 0.8rem; }
.free-reason-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.free-reason-row input { flex: 1 1 14rem; min-width: 0; }
.free-warn { color: var(--mark-ink); }
.free-teacher .page-head { margin-bottom: 0; }
@media (max-width: 640px) {
  .free-kids .free-why, .free-kids .free-reason, .free-kids .free-kids .free-why, .free-kids .free-kids .free-reason { padding-inline-start: 1.6rem; }
}

/* a lesson's Share button (Published lessons, app.js shareLesson) */
.lesson-actions { text-align: end; }
.lesson-actions > * + * { margin-inline-start: 0.4rem; }
.share-btn { padding: 0.4rem 0.75rem; }
.share-btn .icon { width: 1.05rem; height: 1.05rem; }

/* the review window (reviews.js) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rv-stars { display: flex; gap: 0.35rem; }
.rv-star { position: relative; cursor: pointer; font-size: 2.1rem; line-height: 1; color: var(--line); padding: 0.1rem 0.15rem; border-radius: var(--radius); }
.rv-star input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.rv-star.on { color: var(--mark); }
.rv-star:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .rv-star:hover { transform: scale(1.08); } }
.rv-dialog h2:focus { outline: none; }
.rv-why { display: grid; gap: 0.35rem; }
.rv-why[hidden] { display: none; }
.rv-why textarea { width: 100%; resize: vertical; min-height: 4.5rem; }
.rv-note { margin: 0; color: var(--wrong); }
.rv-note:empty { display: none; }
/* the ratings panel on the Analytics tab */
.rv-avg { margin: 0 0 0.6rem; }
.rv-avg b { font-size: 1.4rem; color: var(--mark-ink); }
.rv-bars { list-style: none; margin: 0 0 0.6rem; padding: 0; display: grid; gap: 0.3rem; }
.rv-bars li { display: grid; grid-template-columns: 2.5rem 1fr 2rem; gap: 0.5rem; align-items: center; }
.rv-comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.rv-comments p { margin: 0.15rem 0 0; overflow-wrap: anywhere; }
.rv-comments b { color: var(--mark-ink); letter-spacing: 0.05em; }
