/* Portal shell: mobile-first, Hebrew RTL. No external fonts or CDNs - the
   portal must work on a school network without internet access. */

/* The code IDE typeface ships with the portal (SIL OFL, see
   static/fonts/OFL.txt), so it renders the same on every machine. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #eef3fa;
  --ink: #172033;
  --muted: #5d6b82;
  --line: #d9e2ef;
  --primary: #1f5fae;
  --primary-dark: #174a89;
  --primary-soft: #e5effb;
  --success: #1d7a4f;
  --success-soft: #e4f5ec;
  --danger: #b42335;
  --danger-soft: #fdecef;
  --warning: #8a5a00;
  --warning-soft: #fff4d8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  --tap: 44px;
  --code-font: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas,
    ui-monospace, SFMono-Regular, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

h2 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 0.75rem;
}

.container {
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  padding-inline: 16px;
}

.skip-link {
  position: absolute;
  inset-inline-start: -999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  z-index: 20;
}

.skip-link:focus {
  inset-inline-start: 16px;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(243, 246, 251, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.nav-link {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

.who {
  color: var(--muted);
}

.inline-form {
  display: inline;
  margin: 0;
}

/* ---------------------------------------------------------------- main */

main.container {
  flex: 1;
  padding-block: 20px 40px;
}

.site-footer {
  padding-block: 18px 26px;
  color: var(--muted);
  font-size: 0.85rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-block: 6px 18px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-block: 4px 10px;
}

/* Class screen tabs: one bar for the merged content list and the roster.
   Two equal taps on a phone, wrapped in a soft track so the active tab is
   obvious without a separate page title. */
.class-tabs {
  display: flex;
  gap: 4px;
  margin-block: 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.class-tab {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 8px 12px;
  border-radius: calc(var(--radius-sm) - 3px);
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.class-tab:hover {
  color: var(--ink);
}

.class-tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.class-tab.is-active .count {
  background: var(--surface-soft);
}

.class-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 6px 0 0;
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-block-end: 16px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.class-card {
  display: block;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.class-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(23, 32, 51, 0.13);
}

.class-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.class-card h2 {
  margin: 0;
}

.code-chip {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85rem;
  white-space: nowrap;
}

.stat-row {
  display: flex;
  gap: 22px;
  margin: 16px 0 10px;
}

.stat-row dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-row dd {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.card-cta {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.92rem;
}

.empty-state {
  text-align: center;
  padding-block: 34px;
}

.empty-state .button {
  margin-top: 8px;
}

.notice-card {
  border-inline-start: 4px solid var(--primary);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 10px;
}

.section-head h2 {
  margin: 0;
}

.count {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

/* ---------------------------------------------------------------- forms */

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  font-weight: 600;
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(31, 95, 174, 0.35);
  outline-offset: 2px;
}

.ltr-input,
.ltr-inline {
  direction: ltr;
  text-align: left;
}

.ltr-inline {
  unicode-bidi: isolate;
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.row-form input {
  flex: 1 1 220px;
}

.row-form.compact {
  margin-top: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.checkbox-row input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.form-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* ---------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.button:hover {
  text-decoration: none;
  filter: brightness(0.98);
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.button-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f3c4cc;
}

.button-block {
  width: 100%;
}

.link-button {
  background: none;
  border: 0;
  padding: 6px;
  min-height: var(--tap);
  color: var(--primary);
  font: inherit;
  cursor: pointer;
}

.danger-text {
  color: var(--danger);
}

.head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.inline-details {
  position: relative;
}

.inline-details[open] .row-form {
  position: static;
}

details.disclosure {
  margin-top: 14px;
}

details summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  width: auto;
}

details summary::-webkit-details-marker {
  display: none;
}

details[open] > summary {
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------- lists */

.person-list,
.assignment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.person-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 10px;
  border-top: 1px solid var(--line);
}

.person-list li:first-child {
  border-top: 0;
}

.assignment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 12px;
  border-top: 1px solid var(--line);
}

.assignment-row:first-child {
  border-top: 0;
}

.assignment-main {
  flex: 1 1 240px;
  min-width: 0;
}

.assignment-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.assignment-link {
  font-weight: 700;
  font-size: 1.02rem;
}

.meta {
  font-size: 0.85rem;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* The publish panel opens inline in the assignment row. Once open it takes a
   full row so the date field stays wide enough to edit on a phone. */
.publish-disclosure[open] {
  flex-basis: 100%;
}

.publish-panel {
  max-width: 420px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-published {
  background: var(--success-soft);
  color: var(--success);
}

.badge-draft {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-new {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  margin: 6px 0 0;
}

.prose {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.75;
}

/* ---------------------------------------------------------------- flash */

.flash {
  border-radius: 12px;
  padding: 12px 14px;
  margin-block-end: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.flash-success {
  background: var(--success-soft);
  border-color: #bfe6d1;
  color: #145c3b;
}

.flash-error {
  background: var(--danger-soft);
  border-color: #f3c4cc;
  color: #8d1c2c;
}

.flash-info {
  background: var(--primary-soft);
  border-color: #cfe0f7;
  color: var(--primary-dark);
}

/* ---------------------------------------------------------------- auth */

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 55vh;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 26px 20px;
}

.auth-card h1 {
  margin-bottom: 6px;
}

.error-code {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------- lessons */

.lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lesson-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 12px;
  border-top: 1px solid var(--line);
}

.lesson-row:first-child {
  border-top: 0;
}

.lesson-main {
  flex: 1 1 240px;
  min-width: 0;
}

.lesson-link {
  font-weight: 700;
  font-size: 1.02rem;
}

.button-small {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 1rem;
}

.button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- slides */

#slide-viewer {
  /* Fallback for a full page load to ?slide=N#slide-viewer (no JavaScript):
     the two-row mobile header is ~109px tall. app.js measures it exactly. */
  scroll-margin-top: 124px;
}

.slide-viewer {
  padding: 22px 18px 26px;
}

.slide-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block-end: 18px;
  font-size: 0.86rem;
}

.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.progress-value {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

.slide-title {
  font-size: clamp(1.25rem, 5vw, 1.6rem);
  margin-block-end: 14px;
}

.slide-body {
  font-size: 1.04rem;
  line-height: 1.8;
}

.slide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-block: 4px 16px;
}

.slide-nav .button {
  min-width: 96px;
}

.slide-nav-spacer {
  width: 1px;
}

.done-chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 700;
}

.slide-index-card {
  padding: 14px 18px;
}

.slide-index {
  margin: 0;
  padding-inline-start: 1.2rem;
  display: grid;
  gap: 6px;
}

.slide-index-link {
  display: block;
  padding: 6px 4px;
  border-radius: 8px;
}

.slide-index-link.current {
  font-weight: 700;
  background: var(--primary-soft);
}

.slide-admin {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface);
}

.slide-admin h3 {
  margin: 0;
  font-size: 1rem;
}

.code-block {
  direction: ltr;
  text-align: left;
  background: #101828;
  color: #e7eefc;
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre;
}

.code-block code {
  font: inherit;
}

/* ------------------------------------------------------- redacted rubric */

.hidden-answers-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 700;
}

.weight-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.rubric-section {
  margin-block-start: 18px;
  padding-block-start: 14px;
  border-top: 1px dashed var(--line);
}

.rubric-section:first-of-type {
  border-top: 0;
  padding-block-start: 0;
}

.rubric-section h3 {
  font-size: 1.05rem;
  margin: 0;
}

.question-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 14px;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-block-end: 8px;
}

.question-id {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  unicode-bidi: isolate;
}

.badge-type {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.question-text {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.question-card .code-block {
  margin-block: 10px 0;
}

.criteria {
  margin-block-start: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.criteria h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.criteria ul {
  margin: 0;
  padding-inline-start: 1.2rem;
  font-size: 0.92rem;
}

/* ------------------------------------------------- lesson x.2 worksheet */

.notes-disclosure {
  padding: 14px 18px;
}

.notes-disclosure summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
}

.notes-disclosure[open] summary {
  margin-block-end: 10px;
}

.worksheet-hint {
  margin-block: 0 12px;
}

.worksheet-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-block: 4px 12px;
}

.worksheet-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-block: 20px 10px;
  padding-block-start: 14px;
  border-top: 1px dashed var(--line);
}

.worksheet-section-head:first-of-type {
  border-top: 0;
  padding-block-start: 0;
  margin-block-start: 4px;
}

.worksheet-section-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.worksheet-form {
  gap: 14px;
}

.worksheet-question {
  background: var(--surface);
  scroll-margin-top: 84px;
}

.question-number {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.worksheet-title {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.answer-label {
  display: block;
  margin-block: 14px 6px;
  font-weight: 700;
  font-size: 0.92rem;
}

.worksheet textarea[data-answer-editor] {
  min-height: 110px;
}

.answer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-block: 8px;
}

.answer-tools .hint {
  margin: 0;
}

.worksheet .terminal,
.worksheet .sandbox-stdin {
  margin-block-start: 8px;
}

.legacy-submission {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.legacy-submission summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.legacy-text {
  max-height: 220px;
  margin-block: 10px 6px;
}

/* ------------------------------------------------- lesson x.3 mixed sheet */

.worksheet-prompt {
  white-space: pre-line;
}

.worksheet-item + .worksheet-item {
  margin-block-start: 14px;
}

.worksheet-part + .worksheet-part {
  margin-block-start: 16px;
  padding-block-start: 14px;
  border-top: 1px dashed var(--line);
}

.part-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-block: 12px 8px;
}

.part-label {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.82rem;
}

.part-prompt {
  margin: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.worksheet-code {
  margin-block: 8px 10px;
}

.code-line-input,
.table-input,
.short-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
}

.code-line-input,
.table-input {
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92rem;
}

.code-line-input:focus,
.table-input:focus,
.short-input:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

.short-input {
  min-height: 82px;
  resize: vertical;
}

.worksheet-table-wrap {
  margin-block: 10px 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

.worksheet-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  background: var(--surface);
}

.worksheet-table th {
  background: var(--surface-soft);
  font-size: 0.86rem;
  text-align: start;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.worksheet-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.worksheet-table tbody tr:last-child td {
  border-bottom: 0;
}

.worksheet-table .given {
  color: var(--muted);
  background: var(--surface-soft);
}

.worksheet-table .given pre {
  margin: 0;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.45;
}

.worksheet-table .table-input {
  min-width: 110px;
  padding: 6px 8px;
  font-size: 0.88rem;
}

.worksheet-choice {
  margin-block-start: 10px;
}

.choice-row {
  padding-block: 10px;
  border-top: 1px dashed var(--line);
}

.choice-row:first-child {
  border-top: 0;
  padding-block-start: 0;
}

.choice-statement {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.choice-index {
  flex: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}

.choice-prompt {
  margin: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.choice-code {
  margin: 6px 0 0;
  direction: ltr;
  text-align: left;
  background: #0d1117;
  color: #e6edf3;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: pre;
}

.choice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 8px;
  padding-inline-start: 24px;
}

.choice-option {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.choice-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.choice-option span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.choice-option input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.choice-option input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.choice-option input:disabled + span {
  opacity: 0.65;
}

.submit-bar {
  position: sticky;
  bottom: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
}

.submit-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.submit-bar .button-primary {
  flex: 0 0 auto;
}

@media (max-width: 520px) {
  .submit-bar .button-primary {
    width: 100%;
  }
}

.criteria li {
  margin-block: 3px;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------- exam paper */

.exam-card {
  border-inline-start: 4px solid var(--primary);
  background: var(--surface-soft);
}

.exam-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  font-size: 0.94rem;
}

.exam-facts li {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

/* The exam clock follows the student down the page: answers are long, and the
   time left until the exam closes has to stay visible while they scroll. */
.exam-clock {
  position: sticky;
  top: var(--sticky-header, 64px);
  z-index: 9;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.exam-clock-title {
  font-weight: 600;
  color: var(--muted);
}

.exam-clock-time {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--primary-dark);
  /* Clock digits stay in reading order inside the RTL page. */
  direction: ltr;
}

.exam-clock-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.exam-clock.is-soon {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.exam-clock.is-soon .exam-clock-title,
.exam-clock.is-soon .exam-clock-time,
.exam-clock.is-over .exam-clock-time {
  color: var(--danger);
}

.exam-locked {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

/* A read-only snippet is part of the question, not an answer: it sits on the
   same muted paper as the rest of the prompt. */
.worksheet-given {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px dashed var(--line);
}

.code-plain-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0d1117;
  color: #e6edf3;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
  resize: vertical;
}

.code-plain-input:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

/* ---------------------------------------------------------------- desktop */

@media (min-width: 640px) {
  .container {
    padding-inline: 24px;
  }

  .card {
    padding: 22px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------- imported content */

.slide-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.rich-text {
  white-space: normal;
}

.rich-text > *:first-child {
  margin-block-start: 0;
}

.rich-text > *:last-child {
  margin-block-end: 0;
}

.rich-text h1,
.rich-text h2,
.rich-text h3,
.rich-text h4 {
  margin-block: 1.1em 0.45em;
  line-height: 1.35;
}

.rich-text p,
.rich-text ul,
.rich-text ol,
.rich-text blockquote {
  margin-block: 0.55em;
}

.rich-text ul,
.rich-text ol {
  padding-inline-start: 1.4em;
}

.rich-text table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 0.8em;
  font-size: 0.94rem;
}

.rich-text th,
.rich-text td {
  border: 1px solid var(--line);
  padding: 7px 9px;
  text-align: start;
  vertical-align: top;
}

.rich-text img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.rich-text pre,
.rich-text code {
  direction: ltr;
  text-align: left;
}

.import-attachments {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.import-attachments li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

.media-list a {
  font-weight: 600;
}

.import-item h2 {
  font-size: 1.08rem;
  margin: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-block: 8px 24px;
}

/* ------------------------------------------------ classroom content picker */

.selection-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.selection-row {
  padding-block: 14px;
  border-top: 1px solid var(--line);
}

.selection-row:first-child {
  border-top: 0;
  padding-block-start: 4px;
}

.selection-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.selection-head .checkbox-row {
  font-weight: 700;
}

.selection-controls {
  margin-block-start: 10px;
}

.selection-controls > [hidden] {
  display: none;
}

.picker-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 2px 14px;
}

.picker-jump a {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.picker-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block: 8px 4px;
}

.picker-filter label {
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: var(--muted);
}

.picker-filter input {
  flex: 1 1 auto;
}

.picker-group {
  border-top: 1px solid var(--line);
  margin-block-start: 12px;
  padding-block-start: 2px;
}

.picker-group:first-of-type {
  border-top: 0;
  margin-block-start: 8px;
}

.picker-group-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 10px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.picker-group-summary::-webkit-details-marker {
  display: none;
}

.picker-group-summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.8rem;
}

.picker-group[open] .picker-group-summary::before {
  content: "▾";
}

.picker-group-name {
  flex: 1 1 auto;
}

.picker-group-summary [hidden] {
  display: none;
}

/* ------------------------------------------------------ submissions/grading */

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.submission-card textarea[data-code-editor] {
  min-height: 260px;
}

.notice-inline {
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #cfe0f7;
  margin-block: 8px 14px;
  font-size: 0.92rem;
}

.grade-summary {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.grade-summary-main {
  flex: 1 1 240px;
  min-width: 200px;
}

.score-ring {
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: var(--success-soft);
  color: var(--success);
  border: 3px solid #bfe6d1;
}

.score-number {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1;
}

.score-of {
  font-size: 0.8rem;
  color: var(--muted);
}

.feedback-text {
  font-size: 1.02rem;
  line-height: 1.7;
  margin-block: 4px 10px;
}

.status-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-ok {
  background: var(--success-soft);
  color: var(--success);
}

.status-partial {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-missing {
  background: var(--surface-soft);
  color: var(--muted);
}

.deduction-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deduction-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.deduction-list p {
  margin: 4px 0 0;
}

.deduction-points {
  flex: 0 0 auto;
  min-width: 42px;
  text-align: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 800;
}

.grading-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.grading-main {
  flex: 1 1 240px;
  min-width: 0;
}

.audit-findings {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-finding {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 0.9rem;
}

.audit-finding.severity-error {
  background: var(--danger-soft);
}

.audit-finding.severity-warning {
  background: var(--warning-soft);
}

.audit-flag {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--muted);
}

.code-inline {
  direction: ltr;
  text-align: left;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.small {
  font-size: 0.82rem;
}

/* Phase 4 — student code playground */

.sandbox-stdin {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--surface-soft);
}

.sandbox-stdin summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.sandbox-stdin label {
  display: block;
  margin-top: 10px;
}

.sandbox-hint {
  margin: 0;
}

/* ------------------------------------------------------- code IDE (Phase 3)

   A single dark frame: toolbar, highlighted code with line numbers, and the
   output console docked at the bottom. The <textarea> is the real input (and
   the form value); the highlighted <pre> sits behind it and is kept in sync
   by app.js. */

.ide {
  direction: ltr;
  text-align: left;
  margin-block: 10px 6px;
  border: 1px solid #30363d;
  border-radius: 10px;
  overflow: hidden;
  background: #0d1117;
  box-shadow: 0 10px 24px -18px rgba(13, 17, 23, 0.9);
}

.ide-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  font-family: var(--code-font);
  font-size: 0.8rem;
  color: #8b949e;
}

.ide-dots {
  display: inline-flex;
  gap: 5px;
}

.ide-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f57;
}

.ide-dots i:nth-child(2) {
  background: #febc2e;
}

.ide-dots i:nth-child(3) {
  background: #28c840;
}

.ide-filename {
  color: #c9d1d9;
  font-weight: 600;
}

.ide-meta {
  margin-inline-start: auto;
  color: #6e7681;
  font-size: 0.75rem;
  white-space: nowrap;
}

.ide-run {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #238636;
  border-radius: 6px;
  background: #238636;
  color: #ffffff;
  padding: 5px 12px;
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.ide-run:hover {
  background: #2ea043;
  border-color: #2ea043;
}

.ide-run:disabled {
  opacity: 0.6;
  cursor: default;
}

.ide-run-icon {
  font-size: 0.65em;
  line-height: 1;
}

.ide-editor {
  display: flex;
  align-items: stretch;
  height: 260px;
  background: #0d1117;
}

.ide-gutter {
  flex: 0 0 auto;
  width: 3.1em;
  padding: 12px 8px 12px 0;
  overflow: hidden;
  border-inline-end: 1px solid #21262d;
  background: #0d1117;
  color: #6e7681;
  font-family: var(--code-font);
  font-size: 0.86rem;
  line-height: 1.6;
  text-align: right;
  white-space: pre;
  user-select: none;
}

.ide-code {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
}

.ide-highlight,
.ide-input {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  font-family: var(--code-font);
  font-size: 0.86rem;
  line-height: 1.6;
  letter-spacing: 0;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 4;
}

.ide-highlight {
  overflow: hidden;
  color: #e6edf3;
  background: transparent;
  pointer-events: none;
}

.ide-input {
  width: 100%;
  height: 100%;
  resize: none;
  overflow: auto;
  background: transparent;
  color: transparent;
  caret-color: #e6edf3;
  outline: none;
  -webkit-text-fill-color: transparent;
}

.ide-input::placeholder {
  color: #6e7681;
  -webkit-text-fill-color: #6e7681;
}

.ide-input::selection {
  background: rgba(56, 139, 253, 0.35);
}

.ide:focus-within {
  border-color: #388bfd;
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.18);
}

/* Python token colours, GitHub-dark flavoured. */
.tok-keyword { color: #ff7b72; }
.tok-string { color: #a5d6ff; }
.tok-comment { color: #8b949e; font-style: italic; }
.tok-number { color: #79c0ff; }
.tok-builtin { color: #d2a8ff; }
.tok-call { color: #d2a8ff; }
.tok-def { color: #ffa657; }
.tok-decorator { color: #d2a8ff; }
.tok-constant { color: #79c0ff; }
.tok-operator { color: #c9d1d9; }

.ide-stdin {
  direction: ltr;
  text-align: left;
  margin: 0;
  padding: 10px 14px 12px;
  background: #161b22;
  border-top: 1px solid #30363d;
}

.ide-stdin summary {
  color: #c9d1d9;
  font-size: 0.82rem;
  cursor: pointer;
}

.ide-stdin label {
  display: block;
  margin-block: 8px 4px;
  color: #8b949e;
  font-size: 0.78rem;
}

.ide-stdin textarea {
  min-height: 54px;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  font-family: var(--code-font);
  font-size: 0.82rem;
}

.ide-output {
  border-top: 1px solid #30363d;
  background: #0d1117;
  color: #f0f6fc;
  max-height: 280px;
  overflow: auto;
}

.ide-output .terminal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  direction: ltr;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  padding: 6px 12px;
}

.ide-output-title {
  color: #c9d1d9;
  font-weight: 700;
  font-size: 0.8rem;
}

.ide-output .terminal-status {
  margin-inline-start: auto;
  font-family: var(--code-font);
  font-size: 0.76rem;
}

.ide-output .terminal-output {
  min-height: 2.4em;
  max-height: 200px;
  padding: 10px 14px;
}

.ide-output .terminal-stdout {
  color: #f0f6fc;
}

.ide-output .terminal-stdout:empty,
.ide-output .terminal-stderr:empty {
  display: none;
}

.ide-output-empty {
  direction: ltr;
  text-align: left;
  margin: 0;
  padding: 12px 14px;
  color: #8b949e;
  font-size: 0.82rem;
}

.ide-output-empty[hidden] {
  display: none;
}

.ide-output .terminal-stderr {
  border-top: 1px solid #21262d;
}

/* Console input row: visible only while a run is waiting for the program. */
.ide-console-input {
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 1;
  direction: ltr;
  padding: 4px 14px 6px;
  background: #0d1117;
  border-top: 1px solid #21262d;
}

.ide-console-input[hidden] {
  display: none;
}

.ide-console-prompt {
  color: #3fb950;
  font-family: var(--code-font);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
}

.ide-console-input input {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: 30px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f0f6fc;
  caret-color: #58a6ff;
  font-family: var(--code-font);
  font-size: 0.86rem;
  direction: ltr;
  text-align: left;
}

.ide-console-input input::placeholder {
  color: #6e7681;
}

.ide-console-input input:focus {
  outline: none;
  box-shadow: inset 0 -1px 0 #58a6ff;
}

@media (max-width: 560px) {
  .ide-editor {
    height: 220px;
  }

  .ide-toolbar {
    gap: 7px;
    padding: 6px 10px;
  }

  .ide-meta {
    display: none;
  }
}

.terminal {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #10151d;
  color: #e7edf5;
  border: 1px solid #273142;
}

.terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #18202c;
  border-bottom: 1px solid #273142;
  font-size: 0.85rem;
}

.terminal-status {
  color: #aab6c8;
  font-weight: 600;
}

.terminal-status-ok {
  color: #7ee2a8;
}

.terminal-status-error {
  color: #ff9b9b;
}

.terminal-clear {
  background: transparent;
  border: 1px solid #3a4658;
  color: #c7d2e0;
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.terminal-clear:hover {
  border-color: #5a6b83;
}

.terminal-output {
  margin: 0;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--code-font);
  font-size: 0.86rem;
  line-height: 1.55;
  direction: ltr;
  text-align: left;
  background: transparent;
  color: inherit;
}

.terminal-stdout:empty,
.terminal-stderr:empty {
  display: none;
}

.terminal-stderr {
  color: #ff9b9b;
  border-top: 1px solid #273142;
}

.terminal-output[hidden] {
  display: none;
}


/* ------------------------------------------------------ gradebook (Phase 5) */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.badge-missing {
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

.badge-late {
  background: var(--danger-soft);
  color: var(--danger);
}

.gradebook-stats {
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 18px;
}

.gradebook-stats > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 108px;
}

.gradebook-stats dt {
  font-size: 0.78rem;
}

.gradebook-stats dd {
  font-size: 1.3rem;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.table-scroll:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.matrix-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.matrix-table th,
.matrix-table td {
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  border-inline-start: 1px solid var(--line);
}

.matrix-table tr > :first-child {
  border-inline-start: 0;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-soft);
}

.matrix-student-col,
.matrix-student {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  min-width: 168px;
  background: var(--surface);
  text-align: start;
}

.matrix-table thead .matrix-student-col {
  z-index: 3;
  background: var(--surface-soft);
}

.matrix-table tbody tr:hover td,
.matrix-table tbody tr:hover .matrix-student {
  background: #f6f9ff;
}

.matrix-table tbody tr:last-child th,
.matrix-table tbody tr:last-child td {
  border-bottom: 0;
}

.matrix-student a {
  display: block;
  font-weight: 700;
  color: var(--ink);
}

.matrix-username {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.75rem;
}

.matrix-student .badge {
  margin-top: 4px;
  font-size: 0.7rem;
}

.matrix-assignment {
  min-width: 136px;
  max-width: 200px;
}

.matrix-assignment a {
  display: block;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.matrix-due {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 400;
}

.matrix-cell {
  min-width: 112px;
}

.matrix-score {
  display: inline-block;
  min-width: 2.2em;
  color: var(--primary-dark);
  font-size: 1.06rem;
  font-weight: 800;
  text-decoration: none;
}

.matrix-score:hover {
  text-decoration: underline;
}

.matrix-flags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
}

.matrix-flags .badge {
  padding: 1px 6px;
  font-size: 0.68rem;
}

.matrix-pending,
.matrix-failed {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
}

.matrix-pending {
  color: var(--warning);
}

.matrix-failed {
  color: var(--danger);
}

.matrix-cell-failed {
  background: #fff8f6;
}

.matrix-missing {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.matrix-average-col {
  min-width: 78px;
}

.matrix-average {
  background: var(--surface-soft);
  font-weight: 800;
}

.matrix-foot {
  background: var(--surface-soft);
}

.matrix-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}

.profile-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.profile-contact {
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.profile-contact > div {
  flex: 1 1 150px;
  min-width: 0;
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.profile-contact dd {
  margin-top: 2px;
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.profile-trend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-trend li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.profile-trend .trend-score {
  flex: 0 0 auto;
  min-width: 44px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}

.profile-trend strong {
  display: block;
  overflow-wrap: anywhere;
}

.profile-trend p {
  margin: 2px 0 0;
  font-size: 0.8rem;
}

@media (max-width: 639px) {
  .gradebook-stats > div {
    flex: 1 1 118px;
  }
}

/* ---------------------------------------------------------- class expansion */

.sync-summary-head,
.sync-class-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sync-summary-head h2,
.sync-class-head h2 {
  margin: 0;
}

.sync-hint {
  margin-top: 10px;
  line-height: 1.6;
}

.sync-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.sync-list {
  display: grid;
  gap: 14px;
}

.sync-class {
  display: grid;
  gap: 10px;
}

.sync-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
}

.sync-pick input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.sync-class-name {
  font-size: 1.1rem;
}

.sync-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sync-course {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.sync-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.sync-mode select {
  min-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.sync-stats {
  margin: 0;
}

.sync-warning,
.form-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.sync-warning {
  background: #fff8e6;
  color: #7a5200;
}

.form-error {
  background: #fff1ef;
  color: var(--danger);
}

.sync-details {
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.sync-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary-dark);
}

.sync-items {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.sync-items li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.sync-item-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sync-item-meta {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.78rem;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 4px 0 12px;
}

.sync-actions p {
  margin: 0;
  max-width: 46ch;
  line-height: 1.5;
}

@media (max-width: 639px) {
  .sync-mode select {
    width: 100%;
    min-width: 0;
  }

  .sync-actions .button {
    width: 100%;
  }
}

/* ------------------------------------------------- teacher student preview */
.preview-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--primary);
  border-radius: var(--radius-sm);
}

.preview-banner-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.preview-banner-main strong {
  display: block;
}

.preview-banner-main p {
  margin: 2px 0 0;
  font-size: 0.85rem;
}

.preview-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.preview-class-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.preview-banner select {
  min-height: var(--tap);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

@media (max-width: 639px) {
  .preview-banner-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-banner-actions .button,
  .preview-banner select {
    width: 100%;
  }
}

/* ------------------------------------------------- student topic feed */

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-block-end: 6px;
}

.badge-lesson {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.badge-assignment {
  background: #efe9fb;
  color: #5b3a99;
}

.badge-exam {
  background: #fdf0e3;
  color: #92520f;
}

.topic-card .section-head h2 {
  font-size: 1.12rem;
}

.feed-row {
  align-items: flex-start;
}

.feed-row .button {
  flex: 0 0 auto;
}

.topic-block + .topic-block {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.topic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-block-end: 4px;
}

.topic-head h3 {
  margin: 0;
  font-size: 1.03rem;
}

/* ------------------------------------------------- one-time password reveal */

/* Shown once, right after a teacher resets a student password. One click
   selects the whole value so it can be copied without a clipboard prompt. */
.password-reveal {
  display: block;
  direction: ltr;
  text-align: left;
  user-select: all;
  -webkit-user-select: all;
  cursor: copy;
  font-family: var(--code-font);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  margin-block: 6px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
