/* UX10 overrides: layout, panel mechanics, theming consistency, response aesthetics.
   This file sits on top of the base component styles and fine-tunes the shell,
   panels, reading lane, and responsive behavior used by the current product UI. */

:root {
  --sources-width: 380px;
  --student-rail-width: 64px;
  --student-shell-gutter: var(--space-4);
  --premium-card-shadow: var(--shadow-mint);
  --premium-card-shadow-hover: var(--shadow-sm);
  --lecture-active-accent: var(--color-accent);
  --lecture-active-border: color-mix(in srgb, var(--lecture-active-accent) 80%, transparent);
  --lecture-active-glow: color-mix(in srgb, var(--lecture-active-accent) 60%, transparent);
}

/* ---------- Student accounts and account-scoped progress ---------- */
.student-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 14%, color-mix(in srgb, var(--color-accent) 24%, transparent), transparent 34%),
    color-mix(in srgb, var(--color-bg) 92%, #102b2c 8%);
  overflow: auto;
}

.student-auth-gate[hidden] {
  display: none;
}

.student-auth-card {
  width: min(460px, 100%);
  border: 1px solid color-mix(in srgb, var(--color-border) 78%, transparent);
  border-radius: 24px;
  padding: clamp(24px, 5vw, 38px);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--color-accent) 16%, transparent), transparent 42%),
    var(--color-surface);
  box-shadow: 0 28px 80px rgba(10, 32, 33, 0.2);
}

.student-auth-card__brand {
  margin-bottom: 22px;
  font-family: "Cinzel", serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--color-accent);
}

.student-auth-card__checking {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
}

.student-auth-card__checking[hidden],
#studentAuthContent[hidden] {
  display: none;
}

.student-auth-card__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--color-accent) 28%, transparent);
  border-top-color: var(--color-accent);
  border-radius: 999px;
  animation: student-auth-spin 0.8s linear infinite;
}

@keyframes student-auth-spin {
  to { transform: rotate(360deg); }
}

.student-auth-card__eyebrow {
  margin-bottom: 8px;
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.student-auth-card h1 {
  margin: 0;
  font-size: clamp(1.65rem, 5vw, 2.1rem);
  line-height: 1.12;
  color: var(--color-text);
}

.student-auth-card p {
  color: var(--text-secondary);
}

.student-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 24px 0 18px;
  padding: 4px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-surface-2) 88%, transparent);
}

.student-auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 750;
  cursor: pointer;
}

.student-auth-tab.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 3px 14px rgba(20, 40, 41, 0.09);
}

.student-auth-form {
  display: grid;
  gap: 14px;
}

.student-auth-form label {
  display: grid;
  gap: 7px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
}

.student-auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.student-auth-form input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-accent) 60%, transparent);
  outline-offset: 2px;
}

.student-auth-error {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, #b42318 35%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, #b42318 9%, var(--color-surface));
  color: #b42318;
  font-size: var(--text-xs);
}

.student-auth-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 2px;
}

.student-auth-hint {
  margin: 14px 0 0;
  font-size: var(--text-xs);
  text-align: center;
}

.student-account-bar {
display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
}

.student-account-bar[hidden] {
  display: none;
}

.student-account-bar__identity {
min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.student-account-bar__label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.student-account-bar__identity strong {
overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-md);
  color: var(--color-text);
}

.saved-practice-tests {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--color-border) 75%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-surface-2) 68%, transparent);
}

/* The account label always comes from the authenticated session. */
.student-account-bar__avatar { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-mint); color: var(--text-supporting); }
.student-account-bar__avatar svg { width: 27px; height: 27px; }
#studentAccountEmail { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-xs); color: var(--text-secondary); }
#studentLogout { padding: 6px; flex-shrink: 0; font-size: var(--text-xs); }
.nav-orbit { width: 26px; height: 26px; flex: 0 0 26px; }

.saved-practice-tests__header,
.student-account-registry__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saved-practice-tests__header h3 {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.saved-practice-tests__header span,
.student-account-registry__header strong {
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
  color: var(--color-accent);
  font-size: var(--text-xs);
  text-align: center;
}

.saved-practice-tests__list {
  display: grid;
  gap: 7px;
  max-height: 178px;
  overflow: auto;
}

.saved-practice-tests__empty {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--text-xs);
}

.saved-practice-test {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  border-radius: 11px;
  background: var(--color-surface);
}

.saved-practice-test__details {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.saved-practice-test__details strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--color-text);
}

.saved-practice-test__details span {
  font-size: 11px;
  color: var(--text-soft);
}

.saved-practice-test__actions {
  display: flex;
  gap: 5px;
}

.student-account-registry {
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-mint);
}

.student-account-registry__list {
  max-height: 240px;
}

.live-usage-user {
  display: grid;
  gap: 2px;
}

.live-usage-user__primary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.live-usage-user__meta {
  color: var(--text-soft);
  font-size: 11px;
}

@media (max-width: 560px) {
  .student-auth-gate { padding: 12px; }
  .student-auth-card { border-radius: 18px; padding: 22px 18px; }
  .saved-practice-test { grid-template-columns: 1fr; }
  .saved-practice-test__actions { justify-content: flex-start; }
}

/* ---------- Practice test builder and runner ---------- */
body.practice-test-builder-open {
  overflow: hidden;
}

.practice-test-builder-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
}

.practice-test-builder-overlay[hidden],
.practice-test-builder-dialog[hidden],
.practice-test-runner[hidden] {
  display: none !important;
}

.practice-test-builder-dialog {
  position: fixed;
  inset: 0;
  z-index: 1210;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--surface-pearl);
  color: var(--color-text);
}

.practice-test-builder {
  width: 100%;
  max-width: 1600px;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  margin: 0 auto;
  overflow: hidden;
  overscroll-behavior: contain;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: var(--space-3);
  padding: 18px clamp(16px, 3vw, 36px) max(16px, env(safe-area-inset-bottom));
}

.practice-test-builder__tabs {
  display: flex;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill, 999px);
  background: var(--surface-pearl);
  padding: 4px;
  box-shadow: var(--shadow-inset);
}

.practice-test-builder__tabs [aria-selected="true"] {
  color: var(--text-heading);
  background: var(--surface-mint);
  border-color: var(--border-mint);
  box-shadow: var(--shadow-inset);
}

.practice-test-builder__tabs .btn { border-radius: var(--radius-pill, 999px); }

.practice-test-builder__workspace,
.practice-test-builder__history {
  grid-row: 3;
  min-width: 0;
  min-height: 0;
}

.practice-test-builder [data-practice-builder-panel][hidden] {
  display: none !important;
}

.practice-test-builder__workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(390px, .9fr);
  gap: clamp(16px, 2vw, 24px);
  overflow: hidden;
}

.practice-test-builder__lectures {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
}

.practice-test-builder__settings,
.practice-test-builder__history {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.practice-test-builder__settings {
  min-width: 0;
  min-height: 0;
  padding: var(--space-4);
  border: 1px solid var(--border-mint);
  border-radius: var(--radius-xl);
  background: var(--surface-mint);
  box-shadow: var(--shadow-inset);
}

.practice-test-builder__section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-test-builder__section-heading h3,
.practice-test-builder__section-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text-heading);
}

.practice-test-builder__section-title { margin-bottom: 14px; }

.practice-test-builder__lecture-hint {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--text-secondary);
}

.practice-test-builder .practice-test-modes {
  gap: 8px;
  margin: 14px 0 0;
}

.practice-test-builder .practice-test-modes legend { margin-bottom: 8px; }
.practice-test-builder .practice-test-mode { padding: 11px 12px; gap: 10px; }
.practice-test-builder .practice-test-mode small,
.practice-test-builder .practice-test-modes > p { line-height: 1.45; }

.practice-test-builder__history .saved-practice-tests:first-child { margin-top: 0; }
.practice-test-builder__history .saved-practice-tests { margin-bottom: 16px; }
.practice-test-builder__history .saved-practice-tests__list { max-height: none; overflow: visible; }
.practice-test-builder__summary {
  flex: 1 1 240px;
  margin: 0;
  color: var(--text-supporting);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.practice-test-builder :focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.practice-test-builder__header,
.practice-test-builder__selection-tools,
.practice-test-builder__actions,
.practice-test-runner__actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.practice-test-builder__header {
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-mint);
  border-radius: var(--radius-xl);
  background: var(--surface-mint);
  box-shadow: var(--shadow-inset);
}

.practice-test-builder__heading { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.practice-test-builder__icon { width: 64px; height: 64px; flex: none; }

.practice-test-builder__title {
  margin: var(--space-1) 0 0;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  line-height: 1.15;
  color: var(--text-heading);
}

.practice-test-builder__description {
  margin: 6px 0 0;
  color: var(--text-supporting);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.practice-test-builder__scope {
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--border-mint);
  border-radius: var(--radius-sm);
  background: var(--surface-mint);
  color: var(--text-heading);
  font-size: var(--text-sm);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.practice-test-builder__scope:empty {
  display: none;
}

.practice-test-builder__selection-tools {
  flex-wrap: wrap;
  padding-block: var(--space-1);
}

.practice-test-builder__master {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  font-size: var(--text-sm);
  font-weight: 750;
  cursor: pointer;
}

.practice-test-builder :is(input[type="checkbox"], input[type="number"]) {
  accent-color: var(--color-accent);
}

.practice-test-builder__selection-status {
  margin-inline-start: auto;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
}

.practice-test-builder__lecture-list {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-surface-2) 48%, transparent);
}

.practice-test-builder__lecture-group {
  min-width: 0;
  display: grid;
  gap: var(--space-2);
}

.practice-test-builder__lecture-group + .practice-test-builder__lecture-group {
  padding-top: var(--space-3);
  border-top: 1px solid color-mix(in srgb, var(--color-border) 65%, transparent);
}

.practice-test-builder__lecture-group-title {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.practice-test-builder__lecture-rows {
  display: grid;
  gap: 6px;
}

.practice-test-builder__lecture {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-2);
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
  cursor: pointer;
}

.practice-test-builder__lecture:hover:not(.is-empty),
.practice-test-builder__lecture:focus-within:not(.is-empty) {
  border-color: var(--border-mint-hover);
  background: var(--surface-mint-hover);
}

.practice-test-builder__lecture:has(input:checked) {
  border-color: var(--border-mint-hover);
  background: var(--surface-mint);
  box-shadow: var(--shadow-inset), inset 3px 0 var(--color-accent);
}

.practice-test-builder__lecture:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.practice-test-builder__lecture.is-empty {
  opacity: 0.64;
  cursor: not-allowed;
}

.practice-test-builder__lecture input {
  margin: 3px 0 0;
}

.practice-test-builder__lecture-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.practice-test-builder__lecture-title,
.practice-test-builder__lecture-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.practice-test-builder__lecture-title {
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 750;
}

.practice-test-builder__lecture-meta,
.practice-test-builder__empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.practice-test-builder__configuration {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(110px, .6fr) minmax(250px, 1.4fr);
  gap: var(--space-3);
}

.practice-test-builder__count-field,
.practice-test-builder__blueprint {
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  padding: var(--space-3);
  border: 1px solid var(--border-mint);
  border-radius: var(--radius-md);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
}

.practice-test-builder__count-field > span:first-child,
.practice-test-builder__blueprint legend,
.practice-test-builder__tier-grid label > span {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 800;
}

.practice-test-builder__blueprint legend {
  padding: 0 4px;
}

.practice-test-builder__tier-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.practice-test-builder__tier-grid label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.practice-test-builder :is(.practice-test-builder__count-field, .practice-test-builder__tier-grid) input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.practice-test-builder :is(.practice-test-builder__count-field, .practice-test-builder__tier-grid) input[type="number"][aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-danger) 22%, transparent);
}

.practice-test-builder__blueprint-summary-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
}

.practice-test-builder__blueprint-summary-row strong {
  overflow-wrap: anywhere;
  color: var(--color-text);
  font-size: var(--text-xs);
  line-height: 1.5;
}

#practiceTestUseDefault {
  min-height: 40px;
  border-radius: 12px;
  white-space: nowrap;
}

.practice-test-builder__field-error {
  color: var(--color-danger);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.4;
}

.practice-test-builder__field-error[hidden] {
  display: none;
}

.practice-test-builder__error {
  grid-row: 4;
  max-height: 20dvh;
  overflow-y: auto;
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--color-danger) 48%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
  color: var(--color-danger);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.practice-test-builder__error[hidden] {
  display: none;
}

.practice-test-builder__actions {
  grid-row: 5;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset), var(--shadow-sm);
  justify-content: flex-end;
  flex-wrap: wrap;
}

#practiceTestResumeBtn {
  margin-inline-end: auto;
}

.quiz-modal.is-practice-test .quiz-set {
  min-width: 0;
}

.quiz-modal.is-practice-test .quiz-question {
  min-width: 0;
  overflow-wrap: anywhere;
}

.practice-test-runner {
  position: sticky;
  bottom: 0;
  z-index: 2;
  min-width: 0;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-mint);
  border-radius: var(--radius-md);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset), var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.practice-test-runner__status {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 750;
  text-align: center;
}

.practice-test-runner__actions {
  justify-content: center;
  flex-wrap: wrap;
}

.practice-test-runner__jump {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 700;
}

.practice-test-runner__jump select {
  max-width: min(240px, 45vw);
  min-height: 38px;
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

@media (max-width: 900px) {
  .practice-test-builder__workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: 20px;
    align-content: start;
    padding: 3px;
  }

  .practice-test-builder__lectures {
    height: clamp(270px, 44dvh, 400px);
  }

  .practice-test-builder__settings { overflow: visible; }
}

@media (max-width: 640px) {
  .practice-test-builder {
    gap: 8px;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  }

  .practice-test-builder__title { font-size: 1.3rem; }
  .practice-test-builder__header { padding: 12px; align-items: flex-start; }
  .practice-test-builder__icon { width: 44px; height: 44px; }
  .practice-test-builder__heading { gap: 8px; align-items: flex-start; }
  .practice-test-builder__lectures, .practice-test-builder__settings { padding: 12px; }
  .practice-test-builder__header .eyebrow { display: none; }
  .practice-test-builder__description { font-size: var(--text-xs); line-height: 1.4; }
  .practice-test-builder__summary { flex-basis: 100%; font-size: var(--text-xs); }
  .practice-test-builder__actions { padding-top: 8px; }
  .practice-test-builder__tabs .btn { flex: 1; }

  .practice-test-builder__section-heading {
    align-items: flex-start;
  }

  .practice-test-builder__configuration {
    grid-template-columns: 1fr;
  }

  .practice-test-builder__selection-status {
    flex-basis: 100%;
    margin-inline-start: 0;
  }

  .practice-test-builder__actions .btn {
    flex: 1 1 130px;
  }

  #practiceTestResumeBtn {
    flex-basis: 100%;
    margin-inline-end: 0;
  }

  .practice-test-builder__blueprint-summary-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .practice-test-runner__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .practice-test-runner__jump {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: center;
  }

  .practice-test-runner__jump select {
    max-width: min(220px, 58vw);
  }
}

@media (max-width: 300px) {
  .practice-test-builder__tier-grid,
  .practice-test-builder__blueprint-summary-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .practice-test-builder-dialog,
  .quiz-modal.is-practice-test .quiz-set {
    animation: none !important;
    transition: none !important;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

html {
  font-size: calc(16px * var(--owen-font-scale, 1));
}

body {
  background: var(--color-bg);
  color: var(--color-text);
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

html,
body,
body * {
  scrollbar-width: thin;
  scrollbar-color: #ffffff rgba(0, 0, 0, 0.15);
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
body *::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
body *::-webkit-scrollbar-track {
  background: transparent !important;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
body *::-webkit-scrollbar-thumb {
  background: transparent !important;
  background-color: #ffffff !important;
  background-image: none !important;
  box-shadow: none !important;
  border-radius: 999px;
  border: 2px solid var(--scrollbar-thumb-border) !important;
  background-clip: padding-box !important;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
body *::-webkit-scrollbar-thumb:hover {
  background: transparent !important;
  background-color: #ffffff !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 2px solid var(--scrollbar-thumb-border-hover) !important;
}

html::-webkit-scrollbar-thumb:active,
body::-webkit-scrollbar-thumb:active,
body *::-webkit-scrollbar-thumb:active {
  background: transparent !important;
  background-color: #ffffff !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 2px solid var(--scrollbar-thumb-border-active) !important;
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
body *::-webkit-scrollbar-corner {
  background: transparent !important;
}

:is(
  .lecture-library,
  .lecture-library-scroll,
  .lecture-list,
  .student-library__list,
  .chat-log,
  .conversation-list-scroll,
  .sidebar-scroll-region,
  .sources-drawer__list,
  .owen-table-scroll,
  .owen-pretty-table__wrap,
  #libraryResults,
  .library-course-list,
  .library-manager__list,
  .faculty-lecture-picker__list,
  .faculty-custom-select__options,
  .pipeline-tracker
) {
  scrollbar-width: thin;
  scrollbar-color: #ffffff rgba(0, 0, 0, 0.15);
}

/* Diagnostic: skip-link stayed clickable off-screen above the OWEN banner.
   Keep it keyboard-accessible, but disable pointer hit-testing until focused. */
body[data-route="student"] .skip-link {
  pointer-events: none;
  opacity: 0;
  transform: translateY(-180%);
}

body[data-route="student"] .skip-link:focus,
body[data-route="student"] .skip-link:focus-visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Stable app grid ---------- */
body[data-route="student"] .student-workspace-grid {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  gap: 0;
  padding: var(--student-shell-gutter);
}

body[data-route="student"].sources-open .student-workspace-grid {
  grid-template-columns: minmax(0, 1fr) var(--sources-width);
  gap: var(--student-shell-gutter);
}

body[data-route="student"] .student-shell {
  grid-column: 1;
  height: calc(100dvh - (var(--student-shell-gutter) * 2));
  min-height: 0;
  margin: 0;
  padding: 0;
  gap: var(--student-shell-gutter);
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

/* Let the sidebar/Sources grid determine the shared header, chat and composer width. */
body[data-route="student"] .conversation-lane,
body[data-route="student"].focus-mode .conversation-lane {
  width: 100%;
  max-width: none;
}

body[data-route="student"] .conversation-lane {
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

body[data-route="student"] .chat-log,
body[data-route="student"] .chat-composer {
  width: 100%;
}

body[data-route="student"] .student-sidebar .sidebar-section-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

body[data-route="student"] .student-sidebar .sidebar-section-tab {
  justify-content: center;
  padding-inline: 12px;
}

body[data-route="student"] .student-sidebar .sidebar-tabs .sidebar-section-tab.is-active {
border-color: var(--border-mint-hover);
  background: var(--surface-mint);
  color: var(--text-heading);
  box-shadow: var(--shadow-inset);
}

body[data-route="student"] #libraryPanel > .library-card-header {
  justify-content: flex-end;
  min-height: 0;
  padding: 0 0 6px;
  margin: 0;
}

body[data-route="student"] #libraryPanel > .library-card-header .icon-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
}

body[data-route="student"] #libraryPanelBody .student-library__utilities {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}

body[data-route="student"] #libraryPanelBody .student-library__action-dock {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-surface-2) 72%, transparent);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

body[data-route="student"] #libraryPanelBody .student-library__action-dock::before {
  content: none;
}

body[data-route="student"] #libraryPanelBody :is(.student-library__action-primary, .student-library__action-secondary) {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 8px;
}

body[data-route="student"] #libraryPanelBody .student-library__action-primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-route="student"] #libraryPanelBody .student-library__action-secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-route="student"] #libraryPanelBody :is(.student-library__action-primary, .student-library__action-secondary) > :is(.btn, .library-advanced-toggle) {
  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.09);
}

body[data-route="student"] #libraryPanelBody :is(.student-library__action-primary, .student-library__action-secondary) > [hidden] {
  display: none !important;
  pointer-events: none !important;
}

body[data-route="student"] #libraryPanelBody :is(.student-library__action-primary, .student-library__action-secondary) > :disabled {
  pointer-events: none;
}

body[data-route="student"] #libraryPanelBody :is(.student-library__action-primary, .student-library__action-secondary) > :is(.btn, .library-advanced-toggle):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 5px color-mix(in srgb, var(--focus-ring) 72%, transparent);
}

body[data-route="student"] #libraryPanelBody .library-advanced-toggle {
  border-color: color-mix(in srgb, var(--color-border) 68%, transparent);
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
  color: var(--text-secondary);
  font-weight: 700;
}

body[data-route="student"] #libraryPanelBody .library-advanced-toggle:is(:hover, :focus-visible),
body[data-route="student"] #libraryPanelBody .library-advanced-toggle.is-open {
  border-color: color-mix(in srgb, var(--color-accent) 44%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  color: var(--color-text);
}

body[data-route="student"] #libraryPanelBody .library-advanced-toggle .chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
}

body[data-route="student"] #libraryPanelBody #libraryClear {
  min-width: 0;
  border-color: color-mix(in srgb, var(--color-border) 68%, transparent);
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
  color: var(--text-secondary);
}

body[data-route="student"] #libraryPanelBody #libraryClear:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-accent) 38%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent) 9%, var(--color-surface));
  color: var(--color-text);
}

body[data-route="student"] #libraryPanelBody .start-quiz-btn {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  font-weight: 750;
}

body[data-route="student"] #libraryPanelBody .start-quiz-btn:hover:not(:disabled) {
  border-color: #115e59;
  background: #115e59;
  color: #fff;
}

body[data-route="student"] #libraryPanelBody .start-quiz-btn:active:not(:disabled) {
  background: #134e4a;
}

body[data-route="student"] #libraryPanelBody .student-library__action-explanation {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

body[data-route="student"] #libraryPanelBody .student-library__action-explanation[hidden] {
  display: none;
}

body[data-route="student"] #libraryPanelBody .student-library__utilities > .library-advanced-body {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  max-height: clamp(118px, 18vh, 152px);
  overflow-y: auto;
  margin-top: 0;
  padding-right: 2px;
}

@media (pointer: coarse) {
  body[data-route="student"] #libraryPanelBody :is(.student-library__action-primary, .student-library__action-secondary) > :is(.btn, .library-advanced-toggle) {
    height: 44px;
    min-height: 44px;
  }
}

body[data-route="student"] #retrieveType.faculty-select-legacy {
  display: none !important;
}

body[data-route="student"] :is(#retrieve-status, #retrieve-result):empty { display: none; }

body[data-route="student"] #retrieveType + .faculty-custom-select {
  width: 100%;
}

body[data-route="student"] #retrieveType + .faculty-custom-select .faculty-custom-select__trigger {
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mint);
  background: var(--surface-pearl);
  color: var(--color-text);
  text-align: left;
  display: grid;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: border-color var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard), transform var(--dur-2) var(--ease-standard);
}

body[data-route="student"] #retrieveType + .faculty-custom-select .faculty-custom-select__trigger:hover,
body[data-route="student"] #retrieveType + .faculty-custom-select[data-open="true"] .faculty-custom-select__trigger {
  border-color: color-mix(in srgb, var(--color-accent) 46%, transparent);
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface) 90%);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

body[data-route="student"] #retrieveType + .faculty-custom-select .faculty-custom-select__eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

body[data-route="student"] #retrieveType + .faculty-custom-select .faculty-custom-select__value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

body[data-route="student"] #retrieveType + .faculty-custom-select .faculty-custom-select__meta {
  display: none !important;
}

body[data-route="student"] #retrieveType + .faculty-custom-select .faculty-custom-select__icon {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  color: var(--text-soft);
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="retrieveType"] {
  --faculty-surface-max-height: min(78vh, 28rem);
  z-index: 2400;
  width: max(100%, 260px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mint);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="retrieveType"] .faculty-custom-select__options {
  display: grid;
  gap: var(--space-2);
  max-height: min(52vh, calc(var(--faculty-surface-max-height) - 4.5rem));
  overflow-y: auto;
  padding-right: 4px;
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="retrieveType"] .faculty-custom-select__option {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  padding: 10px 12px;
  text-align: left;
  display: grid;
  gap: 4px;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="retrieveType"] .faculty-custom-select__option:hover,
body[data-route="student"] .faculty-custom-select__panel[data-select-id="retrieveType"] .faculty-custom-select__option.is-selected {
  border-color: color-mix(in srgb, var(--color-accent) 46%, transparent);
  background: var(--surface-mint);
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="retrieveType"] .faculty-custom-select__option-label {
  font-size: var(--text-sm);
  font-weight: 600;
}

body[data-route="student"] #response-mode.faculty-select-legacy {
  display: none !important;
}

body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] {
  position: relative;
  width: 100%;
  min-width: 124px;
}

body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__trigger {
  width: 100%;
  min-height: 40px;
  padding: 0 34px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border-mint);
  background: var(--surface-pearl);
  color: var(--color-text);
  display: flex;
  align-items: center;
  text-align: left;
  position: relative;
  transition: border-color var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard), transform var(--dur-2) var(--ease-standard);
}

body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__trigger:hover,
body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__trigger:focus-visible,
body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"][data-open="true"] .faculty-custom-select__trigger {
  border-color: color-mix(in srgb, var(--color-accent) 46%, transparent);
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface) 90%);
  box-shadow: var(--shadow-sm);
  outline: none;
}

body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__eyebrow,
body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__meta {
  display: none !important;
}

body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}

body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__icon {
  position: absolute;
  right: 13px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  color: var(--text-soft);
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] {
  --faculty-surface-max-height: min(60vh, 18rem);
  z-index: 2400;
  width: max(100%, 180px);
  max-height: var(--faculty-surface-max-height);
  min-height: 0;
  border-radius: 12px;
  border: 1px solid var(--border-mint);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
}

body[data-route="student"] #facultyFloatingSurfacePortal .faculty-custom-select__panel[data-select-id="response-mode"][data-floating="true"] {
  z-index: 2400;
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__options {
  display: grid;
  gap: 6px;
  min-height: 0;
  max-height: min(44vh, calc(var(--faculty-surface-max-height) - 1.25rem));
  overflow-y: auto;
  padding-right: 2px;
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  padding: 10px 12px;
  text-align: left;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard), transform var(--dur-2) var(--ease-standard);
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option:hover,
body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option.is-selected,
body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option:focus-visible {
  border-color: color-mix(in srgb, var(--color-accent) 46%, transparent);
  background: var(--surface-mint);
  transform: translateY(-1px);
  outline: none;
}

body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option-label {
  font-size: 13px;
  font-weight: 700;
}

body[data-route="student"] .student-retrieve__helper {
  margin-top: -2px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

/* Lecture Library: keep one inner scroller in the real panel wrapper chain. */
body[data-route="student"] #libraryPanelBody {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

body[data-route="student"] #libraryPanelBody .student-library {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

body[data-route="student"] #libraryPanelBody .lecture-library-scroll {

  display: grid;
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  align-content: start;
  overflow: hidden;
  padding: 0;
}

body[data-route="student"] #libraryPanelBody .lecture-list-wrapper {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

body[data-route="student"] #libraryPanelBody .student-library__list {
  display: grid;
  align-content: start;
  gap: 10px;
  width: 100%;
  max-height: none;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #ffffff rgba(0, 0, 0, 0.15);
  padding: 0 2px 2px 0;
}

body[data-route="student"] #libraryPanelBody .student-library__list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body[data-route="student"] #libraryPanelBody .student-library__list::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

body[data-route="student"] #libraryPanelBody .student-library__list::-webkit-scrollbar-thumb {
  background: transparent;
  background-color: #ffffff !important;
  background-image: none;
  box-shadow: none;
  border-radius: 999px;
  border: 2px solid var(--scrollbar-thumb-border);
  background-clip: padding-box;
}

body[data-route="student"] #libraryPanelBody .student-library__list::-webkit-scrollbar-thumb:hover {
  background: transparent;
  background-color: #ffffff !important;
  background-image: none;
  box-shadow: none;
  border: 2px solid var(--scrollbar-thumb-border-hover);
}

body[data-route="student"] #libraryPanelBody .student-library__list::-webkit-scrollbar-thumb:active {
  background: transparent;
  background-color: #ffffff !important;
  background-image: none;
  box-shadow: none;
  border: 2px solid var(--scrollbar-thumb-border-active);
}

body[data-route="student"] #libraryPanelBody .selected-lecture {
  margin-top: 0;
}

body[data-route="student"] .student-library__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
}

body[data-route="student"] .student-library__item-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

body[data-route="student"] .student-library__item-title {
  min-width: 0;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-route="student"] .student-library__item-meta {
  min-width: 0;
  line-height: 1.45;
}

body[data-route="student"] .student-library__item-chevron {
  align-self: center;
  justify-self: end;
  font-size: 16px;
  line-height: 1;
  color: var(--text-soft);
}

body[data-route="faculty"] .library-manager__rename {
  display: grid;
  gap: var(--space-2);
}

body[data-route="faculty"] .library-rename-input {
  width: 100%;
}

body[data-route="faculty"] .library-manager__rename-actions {
  display: flex;
  gap: var(--space-2);
}

body[data-route="faculty"] .faculty-lecture-select-legacy,
body[data-route="faculty"] .faculty-select-legacy {
  display: none !important;
}

body[data-route="faculty"] .faculty-lecture-picker {
  position: relative;
  width: min(100%, 360px);
  min-width: min(100%, 280px);
}

body[data-route="faculty"] .faculty-combobox__trigger,
body[data-route="faculty"] .faculty-custom-select__trigger {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mint);
  background: var(--surface-pearl);
  color: var(--color-text);
  text-align: left;
  display: grid;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: border-color var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard), transform var(--dur-2) var(--ease-standard);
}

body[data-route="faculty"] .faculty-combobox__trigger:hover,
body[data-route="faculty"] .faculty-custom-select__trigger:hover {
  border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border) 60%);
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface) 90%);
  transform: translateY(-1px);
}

body[data-route="faculty"] .faculty-combobox__trigger:disabled,
body[data-route="faculty"] .faculty-custom-select__trigger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

body[data-route="faculty"] .faculty-combobox[data-open="true"] .faculty-combobox__trigger,
body[data-route="faculty"] .faculty-custom-select[data-open="true"] .faculty-custom-select__trigger {
  border-color: color-mix(in srgb, var(--color-accent) 52%, transparent);
  box-shadow: var(--shadow-sm);
  background: var(--surface-mint);
}

body[data-route="faculty"] .faculty-combobox__trigger-copy,
body[data-route="faculty"] .faculty-custom-select__trigger {
  min-width: 0;
}

body[data-route="faculty"] .faculty-combobox__trigger-label,
body[data-route="faculty"] .faculty-custom-select__value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

body[data-route="faculty"] .faculty-combobox__trigger-meta,
body[data-route="faculty"] .faculty-custom-select__meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

body[data-route="faculty"] .faculty-custom-select__eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

body[data-route="faculty"] .faculty-combobox__trigger-icon,
body[data-route="faculty"] .faculty-custom-select__icon {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  color: var(--text-soft);
}

body[data-route="faculty"] .faculty-combobox__panel,
body[data-route="faculty"] .faculty-custom-select__panel {
  --faculty-surface-max-height: min(78vh, 34rem);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 35;
  width: max(100%, 320px);
  max-height: var(--faculty-surface-max-height);
  min-height: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mint);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: var(--space-2);
  overflow: hidden;
}

body[data-route="faculty"] .faculty-combobox__panel[data-floating="true"],
body[data-route="faculty"] .faculty-custom-select__panel[data-floating="true"] {
  position: fixed;
  inset: auto auto auto auto;
  z-index: 2400;
}

body[data-route="faculty"] .faculty-combobox__panel[data-floating-mode="sheet"],
body[data-route="faculty"] .faculty-custom-select__panel[data-floating-mode="sheet"] {
  width: min(calc(100vw - 24px), 560px);
  border-radius: clamp(18px, 4vw, 24px);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
}

body[data-route="faculty"] .faculty-combobox__search,
body[data-route="faculty"] .faculty-custom-select__search {
  display: grid;
}

body[data-route="faculty"] .faculty-combobox__search .sidebar-input,
body[data-route="faculty"] .faculty-custom-select__search .sidebar-input {
  width: 100%;
}

body[data-route="faculty"] .faculty-lecture-picker__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

body[data-route="faculty"] .faculty-lecture-picker__heading {
  display: grid;
  gap: 2px;
}

body[data-route="faculty"] .faculty-lecture-picker__label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

body[data-route="faculty"] .faculty-lecture-picker__breadcrumb {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

body[data-route="faculty"] .faculty-lecture-picker__list {
  display: grid;
  gap: var(--space-2);
  min-height: 280px;
  max-height: min(58vh, calc(var(--faculty-surface-max-height) - 7.5rem));
  overflow-y: auto;
  padding-right: 4px;
}

body[data-route="faculty"] .faculty-lecture-picker__row {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  font: inherit;
  min-height: 72px;
  cursor: pointer;
  transition: border-color var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard), transform var(--dur-2) var(--ease-standard);
}

body[data-route="faculty"] .faculty-lecture-picker__row:hover {
  border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border) 60%);
  background: color-mix(in srgb, var(--color-accent) 14%, var(--color-surface) 86%);
  transform: translateY(-1px);
}

body[data-route="faculty"] .faculty-lecture-picker__row.is-active {
  border-color: color-mix(in srgb, var(--color-accent) 58%, transparent);
  background: var(--surface-mint);
  box-shadow: var(--shadow-sm);
}

body[data-route="faculty"] .faculty-lecture-picker__row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

body[data-route="faculty"] .faculty-lecture-picker__row-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

body[data-route="faculty"] .faculty-lecture-picker__row-meta {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

body[data-route="faculty"] .faculty-lecture-picker__row-count {
  font-size: var(--text-xs);
  color: var(--text-soft);
  white-space: nowrap;
}

body[data-route="faculty"] .faculty-lecture-picker__empty {
  border: 1px dashed color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-soft);
}

body[data-route="faculty"] .faculty-custom-select {
  position: relative;
  width: 100%;
}

body[data-route="faculty"] .faculty-custom-select[data-kind="download"] .faculty-custom-select__trigger {
  min-height: 40px;
  padding-block: 8px;
}

body[data-route="faculty"] .library-row-actions .faculty-custom-select {
  flex: 0 0 160px;
  min-width: 160px;
}

body[data-route="faculty"] .faculty-custom-select__panel {
  width: max(100%, 260px);
}

body[data-route="faculty"] .faculty-custom-select[data-kind="lecture"] .faculty-custom-select__panel {
  width: max(100%, 340px);
}

body[data-route="faculty"] .faculty-custom-select__options {
  display: grid;
  gap: var(--space-2);
  min-height: 0;
  max-height: min(58vh, calc(var(--faculty-surface-max-height) - 5.5rem));
  overflow-y: auto;
  padding-right: 4px;
}

body[data-route="faculty"] .faculty-custom-select__options--lecture {
  min-height: 280px;
  max-height: none;
}

body[data-route="faculty"] .faculty-custom-select__group {
  display: grid;
  gap: 6px;
}

body[data-route="faculty"] .faculty-custom-select__group-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding-inline: 2px;
}

body[data-route="faculty"] .faculty-custom-select__group-options {
  display: grid;
  gap: 6px;
}

body[data-route="faculty"] .faculty-custom-select__option {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  padding: 10px 12px;
  text-align: left;
  display: grid;
  gap: 4px;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard), transform var(--dur-2) var(--ease-standard);
}

body[data-route="faculty"] .faculty-custom-select__option:hover {
  border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border) 60%);
  background: var(--surface-mint);
  transform: translateY(-1px);
}

body[data-route="faculty"] .faculty-custom-select__option.is-selected {
  border-color: color-mix(in srgb, var(--color-accent) 56%, transparent);
  background: color-mix(in srgb, var(--color-accent) 16%, var(--color-surface) 84%);
  box-shadow: var(--shadow-sm);
}

body[data-route="faculty"] .faculty-custom-select__option[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

body[data-route="faculty"] .faculty-custom-select__option-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

body[data-route="faculty"] .faculty-custom-select__option-meta {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

body[data-route="faculty"] .faculty-custom-select__empty {
  border: 1px dashed color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-soft);
}

/* Saved-conversation menus were clipping beneath sibling cards. Keep row stacking explicit while menu is open. */
body[data-route="student"] .saved-item {
  position: relative;
  z-index: 1;
  overflow: visible;
}

body[data-route="student"] .saved-item.menu-open {
  z-index: 32;
}

body[data-route="student"] .menu-popover {
  z-index: 320;
}

body[data-route="student"] .menu-popover[data-floating="true"] {
  z-index: 2400;
  min-width: 180px;
  background: color-mix(in srgb, var(--color-surface) 96%, var(--color-surface-2) 4%);
  border-color: color-mix(in srgb, var(--color-border) 72%, transparent);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

/* ---------- Sidebar navigation (desktop) ---------- */
@media (min-width: 1100px) {
  body[data-route="student"] #sidebarDrawerToggle,
  body[data-route="student"] #toolsToggle {
    display: none !important;
  }

  body[data-route="student"] .student-sidebar {
    padding: var(--space-4);
    min-width: 0;
    overflow: hidden;
  }

  body[data-route="student"] .sidebar-scroll-region {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    overflow: hidden;
  }

  body[data-route="student"] .brand-card {
    margin: 0;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded {
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    opacity: 1 !important;
    max-height: none !important;
    pointer-events: auto !important;
    overflow: hidden;
    width: 100%;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded > .section-label {
    display: none !important;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded > .sidebar-panel {
    width: 100%;
    min-height: 0;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded > .sidebar-panel > .sidebar-card[data-sidebar-panel] {
    width: 100%;
    margin: 0;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded > .sidebar-panel:not(.active) {
    display: none;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded > .sidebar-panel.active {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded > .sidebar-panel.active > .sidebar-card.is-active-panel {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
  }

  body[data-route="student"] .student-sidebar .sidebar-expanded > .sidebar-panel.active > .sidebar-card.is-active-panel .sidebar-panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    width: 100%;
    padding: 0;
  }

  body[data-route="student"] .student-sidebar #historyPanel.is-active-panel #historyList {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  body[data-route="student"] .student-sidebar #historyPanel.is-active-panel .conversation-list-scroll {
    flex: 1;
    min-height: 0;
    max-height: none !important;
    overflow: auto;
  }
}

@media (max-width: 1099px) {
  body[data-route="student"] .student-workspace-grid {
    display: block;
    padding: var(--space-3);
  }

  body[data-route="student"] .student-shell {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: calc(100dvh - (var(--space-3) * 2));
    gap: 0;
  }

  body[data-route="student"] #sidebarDrawerToggle,
  body[data-route="student"] #toolsToggle {
    display: inline-flex !important;
  }

  body[data-route="student"] .conversation-lane {
    width: 100%;
    max-width: 100%;
  }
}

body[data-route="student"] #sidebarCollapseToggle,
body[data-route="student"] .sidebar-rail {
  display: none !important;
}

/* Key-term highlighting is intentionally disabled for calmer response reading. */
.response-highlight-toggle {
  display: none !important;
}

.response-card[data-highlight="on"] .response-content strong,
.response-card[data-highlight="on"] .response-summary strong,
.response-card .keyterm-highlight,
.response-card .highlight-chip,
.response-card .term-highlight,
.response-card .response-highlight-term {
  background: none !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
}

/* ---------- Sources panel ---------- */
body[data-route="student"] #sourcesDockToggle {
  display: inline-flex;
}

@media (min-width: 1100px) {
  body[data-route="student"] .sources-overlay {
    display: none !important;
  }

  body[data-route="student"] .student-workspace-grid > .sources-drawer {
    grid-column: 2;
    position: relative;
    inset: auto;
    transform: translateX(18px);
    width: 100%;
    min-width: var(--sources-width);
    max-width: var(--sources-width);
    height: calc(100dvh - (var(--student-shell-gutter) * 2));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: var(--space-4);
  }

  body[data-route="student"] .student-workspace-grid > .sources-drawer.is-open,
  body[data-route="student"].sources-open .student-workspace-grid > .sources-drawer {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sources-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    border: 0;
    background: transparent;
    cursor: col-resize;
    padding: 0;
    margin: 0;
    z-index: 2;
  }

  .sources-resize-handle::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 20%;
    bottom: 20%;
    width: 2px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-border) 80%, transparent);
  }
}

@media (max-width: 1099px) {
  body[data-route="student"] .student-workspace-grid > .sources-drawer {
    position: fixed;
    right: 0;
    top: 0;
    height: 100dvh;
    width: min(440px, 94vw);
    border-radius: 0;
    transform: translateX(104%);
    visibility: hidden;
    pointer-events: none;
  }

  body[data-route="student"].sources-open .student-workspace-grid > .sources-drawer,
  body[data-route="student"] .student-workspace-grid > .sources-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .sources-resize-handle {
    display: none;
  }
}

@media (max-width: 640px) {
  body[data-route="student"] .student-workspace-grid > .sources-drawer {
    width: 100vw;
  }
}

body.sources-resizing,
body.sources-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* ---------- Quiz modal ---------- */
.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
}

.quiz-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(900px, 92vw);
  max-height: min(80vh, 900px);
  display: flex;
  flex-direction: column;
  z-index: 110;
  transform: none !important;
}

.quiz-body {
  min-height: 0;
  overflow: auto;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.quiz-sets {
  gap: var(--space-3);
}

.quiz-set {
  gap: var(--space-3);
  padding: 0 var(--space-1);
}

.quiz-question {
  padding: var(--space-4);
  margin: 0;
}

/* ---------- Generating / interrupt ---------- */
.bubble.assistant.thinking,
.bubble.assistant.scaffold {
  width: auto;
  max-width: max-content;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.bubble.thinking .bubble-status {
  width: auto !important;
  margin: 0;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  background: color-mix(in srgb, var(--color-surface) 90%, var(--color-accent) 10%);
  box-shadow: var(--shadow-sm);
}

.thinking-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-accent) 55%, transparent);
  animation: owen-thinking-dot 1s ease-in-out infinite;
}

.bubble.thinking .interrupt-btn {
  margin-left: 2px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  min-width: 24px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bubble.thinking .interrupt-btn span {
  display: none;
}

.bubble.thinking .thinking-text-strong {
  letter-spacing: 0.02em;
  font-size: var(--text-xs);
  font-weight: 700;
}

.bubble.thinking .loading-bar {
  display: none !important;
}

.bubble.assistant.has-response .response-mode-badge {
  margin-top: var(--space-2);
  margin-left: var(--space-2);
  padding: 5px 10px;
}

.bubble.assistant.has-response .response-card {
  padding: clamp(16px, 2vw, 20px) clamp(16px, 3vw, 24px);
}

.quiz-clear-btn {
  align-self: center;
  margin-left: 0;
}

.quiz-save-qbank-btn {
  white-space: nowrap;
}

.quiz-open-all-sets-btn {
  white-space: nowrap;
}

.quiz-focus-btn {
  white-space: nowrap;
}

.quiz-modal.is-focus-mode {
  inset: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border-radius: 0;
}

.quiz-modal.is-focus-mode .quiz-header {
  flex: 0 0 auto;
}

.quiz-modal.is-focus-mode .quiz-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.quiz-difficulty-select {
  --quiz-difficulty-tint: var(--color-danger);
  align-self: center;
  flex: 0 0 126px;
  width: 126px;
  min-width: 110px;
  max-width: 145px;
  height: 30px;
  min-height: 30px;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  padding: 0 30px 0 12px;
  border: 1px solid color-mix(in srgb, var(--quiz-difficulty-tint) 38%, var(--color-border));
  border-radius: var(--radius-sm);
  background-color: color-mix(in srgb, var(--quiz-difficulty-tint) 13%, var(--color-surface));
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  color: color-mix(in srgb, var(--quiz-difficulty-tint) 76%, var(--color-text));
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 52%, transparent);
  transition:
    border-color var(--dur-2) var(--ease-standard),
    background-color var(--dur-2) var(--ease-standard),
    box-shadow var(--dur-2) var(--ease-standard),
    color var(--dur-2) var(--ease-standard);
}

.quiz-difficulty-select[data-difficulty="medium"] {
  --quiz-difficulty-tint: var(--color-warning);
  background-color: color-mix(in srgb, var(--quiz-difficulty-tint) 15%, var(--color-surface));
  color: color-mix(in srgb, var(--quiz-difficulty-tint) 78%, var(--color-text));
}

.quiz-difficulty-select[data-difficulty="easy"] {
  --quiz-difficulty-tint: var(--color-success);
  background-color: color-mix(in srgb, var(--quiz-difficulty-tint) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--quiz-difficulty-tint) 78%, var(--color-text));
}

.quiz-difficulty-select:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--quiz-difficulty-tint) 54%, var(--color-border));
  background-color: color-mix(in srgb, var(--quiz-difficulty-tint) 18%, var(--color-surface));
  box-shadow: var(--shadow-sm);
}

.quiz-difficulty-select:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.quiz-difficulty-select:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.quiz-difficulty-select[hidden] {
  display: none !important;
}

.quiz-difficulty-select option {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 700;
}

@media (max-width: 720px) {
  .quiz-header {
    flex-wrap: wrap;
  }

  .quiz-header__content {
    flex-basis: 100%;
  }

  .quiz-header__actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .quiz-difficulty-select {
    flex-basis: 118px;
    width: 118px;
  }
}

.qbank-difficulty-modal__overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
}

.qbank-difficulty-modal {
  width: min(360px, 100%);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-xl);
}

.qbank-import-modal {
  width: min(520px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow-y: auto;
}

.qbank-import-modal__group {
  min-width: 0;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.qbank-import-modal__group legend {
  margin: 0 0 8px;
  padding: 0;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 700;
}

.qbank-import-modal__options {
  display: grid;
  gap: 8px;
}

.qbank-import-modal__options--difficulty {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.qbank-import-modal__option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle, rgba(148, 163, 184, 0.08));
  color: var(--color-text);
  cursor: pointer;
}

.qbank-import-modal__option:hover {
  border-color: var(--color-primary);
}

.qbank-import-modal__option:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.qbank-import-modal__option:has(input:checked) {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
}

.qbank-import-modal__option input {
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--color-primary);
}

.qbank-import-modal__option span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.qbank-import-modal__option small {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.4;
}

.qbank-import-modal__actions {
  justify-content: flex-end;
  align-items: stretch;
}

.qbank-import-modal__actions .btn {
  min-height: 40px;
}

@media (max-width: 520px) {
  .qbank-import-modal__options--difficulty {
    grid-template-columns: 1fr;
  }

  .qbank-import-modal__actions .btn {
    flex: 1 1 140px;
  }
}

.qbank-difficulty-modal h2 {
  margin: 0 0 8px;
  font-size: var(--text-lg);
}

.qbank-difficulty-modal p {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.qbank-difficulty-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qbank-difficulty-modal__choice--hard {
  background: #991b1b;
  border-color: #991b1b;
}

.qbank-difficulty-modal__choice--medium {
  background: #b7791f;
  border-color: #b7791f;
  color: #111827;
}

.qbank-difficulty-modal__choice--easy {
  background: #047857;
  border-color: #047857;
  color: #ffffff;
}

@keyframes owen-thinking-dot {
  0% { transform: scale(0.95); opacity: 0.78; }
  50% { transform: scale(1.35); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.78; }
}

/* ---------- Landing entrance: console surfaces, original mascot layout ---------- */
.landing > .landing-card {
  box-shadow: var(--landing-glow), var(--shadow-inset);
}

.landing .landing-wordmark {
  color: var(--text-heading);
}

.landing .landing-tagline {
  color: var(--text-supporting);
}

/* Landing CTA balance:
   retain layout slots while symbols and title chips paint within each button. */
.landing-actions .landing-button {
  --landing-icon-frame-width: 148px;
  --landing-icon-frame-height: 96px;
  --landing-icon-size: clamp(118px, 10vw, 132px);
  --landing-icon-shift-y: 8px;
  box-shadow: var(--shadow-mint);
  transform: none !important;
  transition: border-color 180ms ease-out, background 180ms ease-out, box-shadow 180ms ease-out;
}

.landing-actions .landing-button:hover,
.landing-actions .landing-button:focus-visible {
  transform: none !important;
  box-shadow: var(--landing-cta-shadow);
}

.landing-actions .landing-button:focus-visible {
  outline: 3px solid var(--color-accent-strong);
  outline-offset: 2px;
}

.landing-actions .landing-button:active {
  box-shadow: var(--shadow-inset);
}

.landing-actions .landing-button > .landing-card.landing-button__card {
  width: 100%;
  max-width: 420px;
  height: 100%;
  min-height: inherit;
  padding: 32px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 0;
  text-align: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out;
  will-change: transform;
  isolation: isolate;
}

.landing-actions .landing-button .landing-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(var(--landing-icon-frame-width), 100%);
  min-height: var(--landing-icon-frame-height);
  margin: 0;
  line-height: 0;
  transform: translateY(var(--landing-icon-shift-y));
}

.landing-actions .landing-button .landing-icon {
  max-width: 100%;
  max-height: 100%;
  display: block;
  color: currentColor;
}

.landing-actions .landing-button .landing-icon--raster {
  width: var(--landing-icon-size);
  height: auto;
  object-fit: contain;
  object-position: center;
}

@supports not (mask-image: linear-gradient(#000, #000)) {
  .landing-actions .landing-button .landing-icon--raster {
    filter: brightness(0) saturate(100%) invert(38%) sepia(20%) saturate(1400%) hue-rotate(137deg);
  }
}

/* Paint through the original PNG alpha, preserving every edge and proportion.
   The original image still loads and determines the frame's intrinsic height. */
@supports (mask-image: linear-gradient(#000, #000)) {
  .landing-actions .landing-button .landing-icon--raster {
    opacity: 0;
  }

  .landing-actions .landing-button .landing-icon-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--landing-icon-fill);
    mask-image: var(--landing-symbol);
    mask-mode: alpha;
    mask-size: min(var(--landing-icon-size), 100%) auto;
    mask-position: center;
    mask-repeat: no-repeat;
    pointer-events: none;
  }
}

.landing-actions .landing-button .landing-text-group {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  text-align: center;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 200ms ease, transform 200ms cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
  will-change: opacity, transform;
}

/* The chip's padding is painted around the existing title slot so neither the
   button's intrinsic size nor its symbol position changes during reveal. */
.landing-actions .landing-button .landing-text-group::before {
  content: "";
  position: absolute;
  inset: -10px -12px;
  z-index: -1;
  border: 1px solid var(--border-mint);
  border-radius: var(--radius-md);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset), 0 4px 10px #23596114;
  pointer-events: none;
}

.landing-actions .landing-button .landing-title {
  margin: 0;
  font-size: var(--landing-cta-title-size);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.015em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.landing-actions .landing-button .landing-title--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.landing-actions .landing-button .landing-title__line {
  display: block;
}

.landing-actions .landing-button .landing-subtitle {
  margin: 6px 0 0;
  font-size: var(--landing-cta-subtitle-size);
  line-height: 1.08;
  opacity: 0.8;
  color: var(--landing-cta-subtitle-color);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.landing-actions .landing-button:hover > .landing-card.landing-button__card,
.landing-actions .landing-button:focus-visible > .landing-card.landing-button__card,
.landing-actions .landing-button > .landing-card.landing-button__card:hover {
  transform: none;
  box-shadow: none;
}

/* No-hover devices keep titles visible and navigate on the first tap. */
@media (hover: hover) {
  .landing-actions .landing-button .landing-text-group {
    opacity: 0;
    transform: translateY(6px);
  }

  .landing-actions .landing-button:hover .landing-text-group,
  .landing-actions .landing-button:focus-visible .landing-text-group {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-actions .landing-button .landing-text-group {
    transition: none;
    transform: none !important;
  }
}

.landing-actions .landing-button.student {
  --landing-symbol: url("/cd370f69-4663-44a3-8e0e-41d0ad209ffc.png");
  --landing-icon-size: clamp(126px, 10.6vw, 140px);
  --landing-icon-shift-y: 12px;
}

/* Scale the whole original circle-and-orbit mark, including its alpha mask,
   without changing the frame's layout dimensions or the faculty symbol. */
.landing-actions .landing-button.student .landing-icon-wrapper {
  transform: translateY(var(--landing-icon-shift-y)) scale(1.125);
}

.landing-actions .landing-button.faculty {
  --landing-symbol: url("/aa2cda68-73fa-4e64-b675-c987cfb6096f.png");
  --landing-icon-size: clamp(118px, 10vw, 132px);
  --landing-icon-shift-y: 8px;
}

/* ---------- Themed surfaces ---------- */
.workspace-header,
.chat-log,
.chat-composer,
.student-sidebar,
.sources-drawer,
.quiz-modal,
.library-modal,
.bubble.assistant.has-response .response-card {
  background: var(--color-surface);
  border-color: color-mix(in srgb, var(--color-border) 75%, transparent);
}

/* ---------- AnswerSpec / response aesthetics (OWEN 3.0 style) ---------- */
.assistant-section {
  margin-bottom: var(--space-3);
}

.response-section .section-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--response-pill-border);
  background: var(--response-pill-bg);
  color: var(--response-pill-text);
  box-shadow: var(--response-pill-shadow);
  width: fit-content;
}

.answer-title {
  font-size: clamp(1.2rem, 1.05rem + 0.35vw, 1.45rem);
  font-weight: 700;
  margin: 0 0 var(--space-3);
  letter-spacing: 0.01em;
}

.answer-section {
  margin-bottom: var(--space-4);
}

.answer-section-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.answer-bullets,
.answer-notes-list,
.answer-takeaways-list {
  margin: 0 0 0 1.1rem;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.answer-notes {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border-left: 3px solid var(--border);
  background: var(--bg-soft);
  border-radius: var(--radius-md);
}

.answer-notes-heading {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-1);
  color: var(--text-soft);
}

.answer-takeaways {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.answer-takeaways-heading {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Faculty live usage ---------- */
.live-usage-card {
  gap: var(--space-3);
}

.live-usage-graph {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mint);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
  overflow: hidden;
}

.live-usage-graph__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.live-usage-graph__area {
  fill: url(#trafficUsageGradient);
  transition: d var(--dur-3) var(--ease-standard);
}

.live-usage-graph__line {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: d var(--dur-3) var(--ease-standard);
}

.live-usage-graph__dot {
  fill: var(--color-accent);
  transition: cx var(--dur-3) var(--ease-standard), cy var(--dur-3) var(--ease-standard);
}

.live-usage-graph__label {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-mint);
  background: var(--surface-mint);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.live-usage-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.live-usage-stat {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mint);
  background: var(--surface-mint);
  box-shadow: var(--shadow-inset);
  padding: var(--space-3) var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-supporting);
}

.live-usage-stat strong {
  font-size: var(--text-xl);
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.live-usage-users-wrap {
  display: grid;
  gap: var(--space-2);
}

.student-account-registry__search-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-supporting);
}

.student-account-registry__search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.student-account-registry__search .sidebar-input {
  flex: 1;
  min-width: 0;
}

.student-account-registry__search .btn {
  flex: 0 0 auto;
}

.live-usage-users-title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.live-usage-users {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.live-usage-user {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text);
}

.live-usage-empty {
  font-size: var(--text-xs);
  color: var(--text-soft);
}

.live-usage-updated {
  font-size: var(--text-xs);
  color: var(--text-soft);
}

@media (max-width: 1100px) {
  .live-usage-stats {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mobile + half-window stability ---------- */
@media (max-width: 1099px) {
  html,
  body {
    height: 100%;
  }

  body[data-route="student"] {
    overflow: hidden;
  }

  body[data-route="student"] .app-root {
    height: 100dvh;
    min-height: 100dvh;
  }

  body[data-route="student"] .student-workspace-grid {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: var(--space-3);
  }

  body[data-route="student"] .student-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    gap: var(--space-3);
  }

  body[data-route="student"] .chat-column,
  body[data-route="student"] .chat-pane,
  body[data-route="student"] .conversation-lane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    width: 100%;
    max-width: none;
    overflow: visible;
  }

  body[data-route="student"] .workspace-header {
    flex: 0 0 auto;
  }

  body[data-route="student"] .chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: var(--space-4);
  }

  body[data-route="student"] .chat-composer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    flex: 0 0 auto;
    margin-top: auto;
  }
}

@media (max-width: 768px) {
  body[data-route="student"] #focusModeToggle,
  body[data-route="student"] #sidebarFocusShortcut,
  body[data-route="student"] #focusSidebarRestore {
    display: none !important;
  }
}

/* ---------- Sidebar stability: fixed header + independent content scroll ---------- */
body[data-route="student"] .student-sidebar {
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

body[data-route="student"] .student-sidebar .sidebar-structure {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

body[data-route="student"] .student-sidebar .sidebar-header {
flex-shrink: 0;
  box-sizing: border-box;
  padding: 12px var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
}

body[data-route="student"] .sidebar-header__top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

body[data-route="student"] #sidebarDrawerClose { display: none; }

@media (max-width: 768px) {
  body[data-route="student"] .sidebar-header__top .mystats-nav { flex: 1; min-width: 0; }
  body[data-route="student"] #sidebarDrawerClose {
    display: inline-flex;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }
}

body[data-route="student"] .workspace-header__utilities {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
  max-width: 100%;
}

body[data-route="student"] .workspace-header__utilities .workspace-utility-group {
  width: auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--surface-pearl);
  box-shadow: var(--shadow-inset);
}

body[data-route="student"] .workspace-header__utilities .workspace-tools-btn {
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}

body[data-route="student"] .workspace-header__utilities .student-theme-toggle.workspace-tools-btn {
  flex: 0 0 48px;
}

body[data-route="student"] .student-sidebar .sidebar-tabs {
  min-height: 92px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

body[data-route="student"] .student-sidebar .sidebar-tabs .sidebar-section-tabs {
  grid-column: 1 / -1;
  height: 100%;
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
}

body[data-route="student"] .student-sidebar .sidebar-tabs .sidebar-section-tab {
width: 100%;
  height: 100%;
  min-height: 44px;
  border-radius: var(--radius-sm);
  padding: 8px;
  gap: 6px;
  line-height: 1.25;
  font-size: var(--text-xs);
  background: var(--surface-pearl);
}

body[data-route="student"] .student-sidebar .sidebar-content {
flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 0 var(--space-4) var(--space-4);
  transition: opacity var(--dur-1) ease;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
  overflow: hidden;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel > .sidebar-card[data-sidebar-panel] {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  height: auto;
  margin: 0;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel.active > .sidebar-card.is-active-panel .sidebar-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  padding: 0;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-library {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-route="student"] .chat-history-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 320px;
  max-width: 100%;
  transition: width 180ms ease, opacity 180ms ease;
  overflow: hidden;
}

body[data-route="student"] .chat-history-panel.collapsed {
  width: 0;
  opacity: 0;
  pointer-events: none;
}

body[data-route="student"] #historyPanel .sidebar-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding-right: 0;
}

body[data-route="student"] #historyPanel #historyList {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body[data-route="student"] #historyPanel .conversation-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto;
  overflow-x: hidden;
}

body[data-route="student"] #historyToggle .chevron {
  transition: transform 180ms ease;
}

body[data-route="student"] #historyToggle.is-collapsed .chevron {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel,
  body[data-route="student"] .chat-history-panel,
  body[data-route="student"] #historyToggle .chevron {
    transition: none !important;
  }
}

body[data-route="student"] .student-sidebar .sidebar-header,
body[data-route="student"] .student-sidebar .sidebar-tabs {
  transition: none !important;
}

@media (max-width: 1099px) {
  body[data-route="student"] .student-sidebar .sidebar-header {
    padding: 12px 16px;
    gap: 8px;
  }

  body[data-route="student"] .student-sidebar .sidebar-content {
    padding: 0 16px 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
  }
}

@media (max-width: 768px) {
  body[data-route="student"] .sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body[data-route="student"] .student-sidebar .sidebar-structure {
    height: auto;
    min-height: 100%;
  }

  body[data-route="student"] .student-sidebar .sidebar-content {
    height: auto;
    overflow: visible;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded {
    overflow: visible;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active {
    overflow: visible;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-library {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-library-scroll {

    max-height: calc(100vh - 240px);
    max-height: calc(100dvh - 240px);
    overflow: hidden;
    padding-bottom: 0;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-list {
    min-height: 0;
    overflow: hidden;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .student-library__list {
    -webkit-overflow-scrolling: touch;
  }

  body[data-route="student"] .selected-lecture-card {
    position: relative;
    bottom: auto;
    margin-top: 16px;
  }

  body[data-route="student"] .sidebar,
  body[data-route="student"] .student-library__list {
    overscroll-behavior: contain;
  }
}

@media (min-width: 769px) and (max-width: 1099px) {
  body[data-route="student"] .app-container {
    display: flex;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    padding: var(--space-3);
    gap: var(--space-3);
  }

  body[data-route="student"] .student-shell {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: calc(100dvh - (var(--student-shell-gutter) * 2));
    min-height: 0;
    min-width: 0;
    gap: var(--space-3);
  }

  body[data-route="student"] .sidebar {
    position: relative;
    top: auto;
    left: auto;
    width: var(--sidebar-width);
    min-width: 300px;
    max-width: 360px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  body[data-route="student"] .main-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  body[data-route="student"] #sidebarDrawerToggle,
  body[data-route="student"] #toolsToggle {
    display: none !important;
  }

  body[data-route="student"] .student-sidebar .sidebar-structure,
  body[data-route="student"] .student-sidebar .sidebar-content,
  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded,
  body[data-route="student"] .student-sidebar .sidebar-expanded {
    justify-content: flex-start;
    align-items: stretch;
  }

  body[data-route="student"] .student-sidebar .sidebar-header {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    justify-content: flex-start;
    align-items: stretch;
  }

  body[data-route="student"] .student-sidebar .sidebar-content,
  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded,
  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody,
  body[data-route="student"] .lecture-library,
  body[data-route="student"] .sidebar-section {
    height: 100%;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    position: relative;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel,
  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody,
  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-library,
  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-library-scroll {
    flex: 1 1 auto;
    min-height: 0;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-library-scroll {

    overflow: hidden;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .lecture-list {
    min-height: 0;
    overflow: hidden;
  }

  body[data-route="student"] .student-sidebar .sidebar-content .sidebar-expanded > .sidebar-panel[data-panel="library"].active > #libraryPanel.is-active-panel #libraryPanelBody .student-library__list {
    -webkit-overflow-scrolling: touch;
  }

  body[data-route="student"] .selected-lecture-card {
    position: relative;
    bottom: auto;
    margin-top: 16px;
  }

  body[data-route="student"] .sidebar,
  body[data-route="student"] .student-library__list {
    overscroll-behavior: contain;
  }
}

@media (min-width: 769px) and (max-width: 1099px) {
  body[data-route="student"].focus-mode .student-shell {
    gap: 0;
  }

  body[data-route="student"].focus-mode .student-sidebar,
  body[data-route="student"].focus-mode .sidebar {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }

  body[data-route="student"].focus-mode .main-content {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(20, 184, 166, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
  }
}

@keyframes premiumFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.988);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body[data-route="student"] :is(.student-sidebar, .sidebar-card, .workspace-header, .chat-log, .chat-composer, .sources-drawer, .quiz-modal, .student-library__selected) {
  border-radius: 16px;
  box-shadow: var(--premium-card-shadow);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

body[data-route="student"] :is(.sidebar-card, .workspace-header, .chat-composer, .student-library__selected):hover {
  box-shadow: var(--premium-card-shadow-hover);
}

body[data-route="student"] .chat-column {
  position: relative;
}

body[data-route="student"] .workspace-header {
  justify-content: flex-start;
  padding: 9px 14px 10px;
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
}

body[data-route="student"] .workspace-header.workspace-header--brand {
min-height: 60px;
  background: var(--surface-pearl);
  border-color: var(--border-mint-hover);
  box-shadow: var(--shadow-inset);
}

body[data-route="student"] .workspace-header__title {
  font-size: clamp(1rem, 0.96rem + 0.18vw, 1.1rem);
  font-weight: 700;
}

body[data-route="student"] .workspace-header__title--student {
display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-body);
  font-weight: 700;
  min-width: 0;
  line-height: 1.3;
}

body[data-route="student"] .workspace-header__eyebrow {
  color: color-mix(in srgb, var(--color-accent) 58%, var(--text-soft) 42%);
}

body[data-route="student"] .workspace-header__brand {
font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--color-text);
}

body[data-route="student"] .workspace-header__meta {
  color: color-mix(in srgb, var(--text-secondary) 90%, var(--color-accent) 10%);
}

body[data-route="student"] .workspace-header--brand #sidebarDrawerToggle {
  border: 1px solid color-mix(in srgb, var(--color-border) 58%, var(--color-accent) 42%);
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-accent) 12%);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

body[data-route="student"] #focusSidebarRestore {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + clamp(72px, 11dvh, 118px));
  left: 0;
  z-index: 44;
}

body[data-route="student"].focus-mode #focusSidebarRestore {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + clamp(72px, 11dvh, 118px));
  left: 0;
  z-index: 44;
  width: 34px;
  min-width: 34px;
  height: 44px;
  padding: 0 2px 0 0;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  opacity: 0.86;
  transform: translateX(0);
  transition: transform var(--dur-2) var(--ease-standard), opacity var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard), background var(--dur-2) var(--ease-standard);
}

body[data-route="student"].focus-mode #focusSidebarRestore:hover,
body[data-route="student"].focus-mode #focusSidebarRestore:focus-visible {
  opacity: 1;
  transform: translateX(2px);
}

@media (min-width: 1100px) {
  body[data-route="student"].focus-mode .student-shell {
    grid-template-columns: 0 minmax(0, 1fr);
    gap: 0;
  }

  body[data-route="student"].focus-mode .student-sidebar,
  body[data-route="student"].focus-mode .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }
}

body[data-route="student"] .conversation-lane {
  gap: var(--space-2);
}

body[data-route="student"] .chat-log {
  container-type: inline-size;
  padding: clamp(16px, 2vw, 24px);
  background: var(--surface-welcome);
  border-color: var(--color-border);
  scrollbar-gutter: stable;
}

body[data-route="student"] .bubble {
  animation: premiumFadeIn 180ms var(--ease-standard);
}

body[data-route="student"] .bubble.assistant {
  background: linear-gradient(160deg, color-mix(in srgb, var(--color-surface) 97%, var(--color-accent) 3%), color-mix(in srgb, var(--color-surface) 93%, var(--color-accent) 7%));
  border-color: color-mix(in srgb, var(--color-border) 72%, transparent);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

/* Expand every response layer while retaining user bubbles and compact status pills. */
body[data-route="student"] .bubble.assistant:not(.thinking):not(.scaffold),
body[data-route="student"] .bubble.assistant .response-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body[data-route="student"] :is(.bubble.assistant .bubble-text, .response-body, .response-content, .assistant-structured, .section-body) {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  font-size: clamp(1.02rem, 0.99rem + 0.18vw, 1.08rem);
  line-height: 1.6;
  color: color-mix(in srgb, var(--color-text) 98%, #000 2%);
}

body[data-route="student"] :is(.response-body, .response-content, .assistant-structured) {
  grid-template-columns: minmax(0, 1fr);
}

/* Plain Markdown tables use the section body instead of the enhanced table scroller. */
body[data-route="student"] .response-content .section-body:has(> table) {
  overflow-x: auto;
}

body[data-route="student"] :is(.response-content h2, .assistant-structured h2, .section-body h2) {
  font-size: clamp(1.26rem, 1.04rem + 0.48vw, 1.58rem);
  font-weight: 800;
}

body[data-route="student"] :is(.response-content h3, .assistant-structured h3, .section-body h3) {
  font-weight: 700;
}

body[data-route="student"] .response-toolbar-row :is(.response-action, .response-sources, .response-mode-badge) {
  opacity: 0.72;
}

body[data-route="student"] .response-toolbar-row :is(.response-action, .response-sources, .response-mode-badge):is(:hover, :focus-visible) {
  opacity: 1;
}

body[data-route="student"] .student-sidebar .card-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}

body[data-route="student"] .student-sidebar .sidebar-card {
  background: color-mix(in srgb, var(--color-surface) 94%, var(--color-surface-2) 6%);
}

body[data-route="student"] .selected-lecture-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: calc(var(--space-4) + 8px);
  background: color-mix(in srgb, var(--color-surface-2) 58%, var(--color-accent) 42%);
  border-color: color-mix(in srgb, var(--color-accent) 30%, transparent);
}

body[data-route="student"] .selected-lecture-card::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--lecture-active-accent);
}

body[data-route="student"] .student-library__item,
body[data-route="student"] .saved-item {
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

body[data-route="student"] .student-library__item:hover,
body[data-route="student"] .saved-item:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body[data-route="student"] .student-library__item.is-active {
  border-color: var(--lecture-active-border);
  background: linear-gradient(145deg, color-mix(in srgb, var(--color-surface) 86%, var(--lecture-active-accent) 14%), color-mix(in srgb, var(--color-surface-2) 68%, var(--lecture-active-accent) 32%));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--lecture-active-accent) 16%, transparent);
}

body[data-route="student"] .student-library__item.is-active::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--lecture-active-accent);
}

body[data-route="student"].student-tutorial-step-select-lecture #libraryPanel .student-library__item[data-library-level="lecture"] {
  box-shadow:
    0 0 0 1px color-mix(in srgb, #2563eb 18%, var(--color-border)),
    0 0 0 6px color-mix(in srgb, #2563eb 10%, transparent);
  animation: none;
}

body[data-route="student"].student-tutorial-step-select-lecture #libraryPanel .student-library__item[data-library-level="lecture"].is-active {
  box-shadow:
    0 12px 28px color-mix(in srgb, var(--lecture-active-accent) 16%, transparent),
    0 0 0 1px color-mix(in srgb, #2563eb 24%, var(--lecture-active-border)),
    0 0 0 8px color-mix(in srgb, #2563eb 14%, transparent);
}

body[data-route="student"] .library-year-tabs {
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  background: color-mix(in srgb, var(--color-surface) 90%, var(--color-surface-2) 10%);
  opacity: 0.88;
}

body[data-route="student"] .library-year-tab {
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-route="student"] .library-year-tabs:is(:hover, :focus-within),
body[data-route="student"] .library-year-tab[aria-selected="true"] {
  opacity: 1;
}

body[data-route="student"] .student-library__controls--top {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}

body[data-route="student"] .student-library__controls--top .library-year-tabs {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
}

body[data-route="student"] .student-library__controls--top .library-year-tabs::-webkit-scrollbar {
  display: none;
}

body[data-route="student"] .student-library__back-btn {
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
}

body[data-route="student"] .student-library__back-btn[hidden] {
  display: none !important;
}

body[data-route="student"] .active-lecture-banner {
  position: relative;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--lecture-active-border) 72%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--color-surface) 88%, var(--lecture-active-accent) 12%), color-mix(in srgb, var(--color-surface-2) 76%, var(--lecture-active-accent) 24%));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--lecture-active-accent) 12%, transparent);
  animation: premiumFadeIn 180ms var(--ease-standard);
}

body[data-route="student"] .active-lecture-banner__label {
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

body[data-route="student"] .active-lecture-banner__prefix {
  color: color-mix(in srgb, var(--text-soft) 72%, var(--color-text) 28%);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: none;
}

body[data-route="student"] .active-lecture-banner__copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-route="student"] .active-lecture-banner__close {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.62);
  border-color: color-mix(in srgb, var(--lecture-active-border) 38%, transparent);
  color: var(--color-text);
  font-size: 18px;
}

body[data-route="student"] .chat-composer {
  padding: var(--space-3);
}

body[data-route="student"] .chat-composer .composer-field {
position: relative;
  padding: 6px 12px;
  background: var(--surface-pearl);
  border-color: var(--color-border);
  border-radius: var(--radius-xl);
  transition: border-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}

body.active-lecture-mode .chat-composer .composer-field {
  border-color: var(--lecture-active-border);
  box-shadow: 0 0 0 2px var(--lecture-active-glow), 0 18px 42px rgba(15, 23, 42, 0.08);
}

body.active-lecture-mode .chat-composer .composer-field::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;
  animation: none;
}

body[data-route="student"] .chat-input {
min-height: 46px;
  font-size: var(--text-md);
  line-height: 1.6;
}

body[data-route="student"] .btn.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

body[data-route="student"] .btn.btn-primary:active {
  transform: scale(0.97);
}

body[data-route="student"] :is(.btn-inline-spinner, .quiz-loading__spinner) {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid rgba(20, 184, 166, 0.22);
  border-top-color: #14b8a6;
  animation: anki-spin 0.9s linear infinite;
}

body[data-route="student"] .btn[data-loading="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

body[data-route="student"] .btn-inline-label {
  white-space: nowrap;
}

body[data-route="student"] .quiz-loading .attachment-chip.loading {
  gap: 10px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--color-surface) 78%, rgba(20, 184, 166, 0.22));
  border-color: color-mix(in srgb, var(--lecture-active-border) 42%, transparent);
}

body[data-route="student"] .quiz-footer {
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body[data-route="student"] .quiz-generate-more-status {
  gap: 10px;
  padding: 8px 12px;
  margin-inline-end: auto;
  white-space: nowrap;
  background: color-mix(in srgb, var(--color-surface) 82%, rgba(20, 184, 166, 0.18));
  border-color: color-mix(in srgb, var(--lecture-active-border) 36%, transparent);
}

body[data-route="student"] .quiz-stored-set-status {
  flex: 1 1 100%;
  color: var(--text-secondary);
}

body[data-route="student"] .quiz-faculty-generate-btn {
  border-color: color-mix(in srgb, var(--color-accent) 44%, var(--color-border));
}

body[data-route="student"] .quiz-loading__label {
  font-weight: 700;
  letter-spacing: 0.02em;
}

body[data-route="student"] .quiz-set {
  animation: premiumFadeIn 180ms var(--ease-standard);
}

@media (prefers-reduced-motion: reduce) {
  body.active-lecture-mode .chat-composer .composer-field::after,
  body[data-route="student"] .bubble,
  body[data-route="student"] .quiz-set,
  body[data-route="student"] .student-library__item.is-active,
  body[data-route="student"] .active-lecture-banner {
    animation: none !important;
  }
}

/* -------------------------------------------------------------
   Pilot Deployment Surface Refinements
------------------------------------------------------------- */
body[data-route="student"] .workspace-header {
  align-items: center;
  flex-wrap: wrap;
}

body[data-route="student"] .workspace-header__left {
  flex: 1 1 auto;
  width: auto;
  align-items: center;
  gap: 10px;
}

body[data-route="student"] .workspace-header__context {
  gap: 1px;
  min-width: 0;
}

body[data-route="student"] .workspace-header__title--student {
  flex-wrap: nowrap;
  white-space: normal;
}

body[data-route="student"] .workspace-header__brand { flex-shrink: 0; }

@media (max-width: 1099px) {
  body[data-route="student"] .workspace-header__utilities .workspace-tools-btn { min-height: 44px; }
}

body[data-route="student"] .workspace-utility-group {
  gap: 8px;
  padding: 6px;
  border-color: color-mix(in srgb, var(--color-border) 68%, transparent);
  background: color-mix(in srgb, var(--color-surface) 90%, var(--color-surface-2) 10%);
}

body[data-route="student"] .workspace-tools-btn {
  min-height: 38px;
  padding-inline: 12px;
  border-radius: 999px;
  opacity: 0.88;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

body[data-route="student"] .workspace-tools-btn:is(:hover, :focus-visible),
body[data-route="student"] .workspace-utility-group:focus-within .workspace-tools-btn {
  opacity: 1;
}

body[data-route="student"] .student-theme-toggle.workspace-tools-btn {
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
}

body[data-route="student"] .student-theme-toggle.workspace-tools-btn svg {
  width: 22px;
  height: 22px;
}

body[data-route="student"] .chat-log[data-empty="true"] {
  display: block;
}
body[data-route="student"] .chat-pane:has(.chat-log[data-empty="true"]) .chat-jump-latest { display: none; }

/* Welcome artwork is inside the empty state, leaving sibling-message detection intact. */
body[data-route="student"] .chat-log[data-empty="true"] { padding: 0; }
body[data-route="student"] .student-empty-state {
  position: relative;
  isolation: isolate;
  min-height: 100%;
  padding: clamp(24px, 4vw, 60px);
  gap: var(--space-5);
  align-content: start;
  align-items: start;
  border: 0;
  border-radius: var(--radius-xl);
  background: transparent;
}
body[data-route="student"] .student-empty-state::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("/assets/orbit-welcome.svg") right top / auto 100% no-repeat;
  opacity: .7;
  pointer-events: none;
  border-radius: inherit;
}
body[data-route="student"] .student-empty-state__hero { gap: var(--space-4); }
body[data-route="student"] .student-empty-state__hero-copy { gap: var(--space-4); }
body[data-route="student"] .student-empty-state__title {
  margin: 0;
  max-width: 23ch;
  color: var(--color-text);
  font-size: clamp(2rem, 3.35vw, 3.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.045em;
  text-wrap: balance;
}
body[data-route="student"] .student-empty-state__body {
  max-width: 48ch;
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(1.1rem, 1.65vw, 1.6rem);
  line-height: 1.5;
}
body[data-route="student"] .student-empty-state__tutorial-callout {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  margin: 4px 0 6px;
}
body[data-route="student"] .student-empty-state__badge--tutorial {
  appearance: none;
  cursor: pointer;
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr 20px;
  grid-template-rows: auto auto;
  column-gap: 16px;
  row-gap: 4px;
  align-items: center;
  min-width: min(100%, 280px);
  min-height: 76px;
  padding: 14px 20px;
  border: 1px solid var(--walkthrough-border);
  border-radius: var(--radius-xl);
  background: var(--action-walkthrough);
  color: var(--action-text);
  text-align: left;
  box-shadow: var(--shadow-mint);
  transition: box-shadow var(--dur-2) ease, border-color var(--dur-2) ease;
}
body[data-route="student"] .student-empty-state__badge-label { font-size: 1.25rem; grid-column: 2; color: inherit; letter-spacing: -.02em; }
body[data-route="student"] .student-empty-state__badge-meta { font-size: var(--text-sm); grid-column: 2; color: inherit; font-weight: 500; letter-spacing: 0; }
.student-empty-state__play { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid #ffffff55; border-radius: 50%; box-shadow: inset 0 1px 4px #ffffff44; }
.student-empty-state__walkthrough-arrow { grid-column: 3; grid-row: 1 / 3; font-size: 2rem; font-weight: 400; }
body[data-route="student"] .student-empty-state__badge--tutorial:hover { box-shadow: var(--shadow-md); }
body[data-route="student"] .student-empty-state__badge--tutorial:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
body[data-route="student"] .student-empty-state__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: var(--space-4); }
body[data-route="student"] .student-empty-state__action-copy { display: grid; gap: 6px; min-width: 0; }
body[data-route="student"] .student-empty-state__action-copy strong { font-size: clamp(1rem, 1.5vw, 1.45rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.2; }
body[data-route="student"] .student-empty-state__action-copy > span { color: var(--text-supporting); font-size: var(--text-md); font-weight: 500; line-height: 1.5; }
body[data-route="student"] .student-empty-state__action-icon { width: clamp(56px, 6vw, 94px); height: auto; flex-shrink: 0; }
body[data-route="student"] .student-empty-state__action-arrow { margin-left: auto; font-size: 1.7rem; color: var(--color-accent); }
body[data-route="student"] .student-empty-state__actions .student-empty-state__action-btn:hover { background: var(--surface-mint-hover); border-color: var(--border-mint-hover); }
@container (max-width: 650px) {
  body[data-route="student"] .student-empty-state { padding: var(--space-5); }
  body[data-route="student"] .student-empty-state__title { font-size: 2.2rem; }
  body[data-route="student"] .student-empty-state__actions { grid-template-columns: 1fr; }
  body[data-route="student"] .student-empty-state__action-icon { width: 64px; }
  body[data-route="student"] .student-empty-state__action-copy strong { font-size: 1.15rem; }
  body[data-route="student"] .student-empty-state__action-copy br { display: none; }
}



body[data-route="student"] .student-empty-state__actions .student-empty-state__action-btn {
display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
  min-width: 0;
  min-height: 136px;
  height: auto;
  padding: var(--space-4);
  border: 1px solid var(--border-mint);
  border-radius: var(--radius-lg);
  background: var(--surface-mint);
  box-shadow: var(--shadow-mint);
  color: var(--color-text);
  text-align: left;
  white-space: normal;
}

/* Compact laptop spacing without reducing the user's font scale. */
@media (min-width: 1100px) and (max-height: 820px) {
  body[data-route="student"] .student-empty-state { padding: var(--space-6); gap: var(--space-4); }
  body[data-route="student"] .student-empty-state__hero-copy { gap: var(--space-3); }
  body[data-route="student"] .student-empty-state__title { font-size: 2.65rem; }
  body[data-route="student"] .student-empty-state__body { font-size: 1.25rem; }
  body[data-route="student"] .student-empty-state__badge--tutorial { min-height: 64px; padding-block: 10px; }
  body[data-route="student"] .student-empty-state__actions .student-empty-state__action-btn { min-height: 112px; padding: var(--space-3); }
  body[data-route="student"] .student-empty-state__action-icon { width: 68px; }
}


@media (prefers-reduced-motion: reduce) {
  body[data-route="student"] .student-empty-state__badge--tutorial {
    box-shadow:
      0 12px 22px color-mix(in srgb, var(--student-empty-tutorial-accent-strong) 16%, transparent),
      0 0 0 4px color-mix(in srgb, var(--student-empty-tutorial-accent) 10%, transparent);
  }

  body[data-route="student"] .student-empty-state__tutorial-callout::after {
    animation: none !important;
    opacity: 0.54;
    transform: scale(1.03);
  }

  body[data-route="student"].student-tutorial-step-select-lecture #libraryPanel .student-library__item[data-library-level="lecture"] {
    animation: none;
  }
}

body[data-route="student"] #settingsPanel .sidebar-panel-body {
  gap: 8px;
  padding-top: 0;
  min-height: 0;
  overflow-y: auto;
}

body[data-route="student"] #settingsPanel .student-settings-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 20%, var(--color-border));
  border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 96%, rgba(20, 184, 166, 0.05)), color-mix(in srgb, var(--color-surface-2) 84%, rgba(20, 184, 166, 0.12)));
}

body[data-route="student"] #settingsPanel .student-settings-panel__header {
  display: grid;
  gap: 2px;
}

body[data-route="student"] #settingsPanel .student-settings-panel__eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

body[data-route="student"] #settingsPanel .student-settings-panel__summary {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
}

body[data-route="student"] #settingsPanel .settings-text-scale.settings-text-scale--compact {
  border-color: color-mix(in srgb, var(--color-accent) 28%, var(--color-border));
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-accent) 12%);
  gap: 8px;
  padding: 6px 8px;
}

body[data-route="student"] #settingsPanel .settings-text-scale__meta {
  gap: 0;
}

body[data-route="student"] #settingsPanel .settings-text-scale__value {
  font-size: 11px;
  color: var(--text-soft);
}

body[data-route="student"] #settingsPanel .settings-text-scale__buttons {
  gap: 3px;
  padding: 2px;
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--color-accent) 18%, var(--color-border));
  background: color-mix(in srgb, var(--color-surface) 94%, var(--color-accent) 6%);
}

body[data-route="student"] #settingsPanel .settings-text-scale__button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 8px;
  font-size: 13px;
}

body[data-route="student"] #settingsPanel .student-settings-panel__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

body[data-route="student"] #settingsPanel .student-settings-panel__action {
  height: 32px;
  min-height: 32px;
  padding-inline: 10px;
  border-radius: 10px;
  font-size: 12px;
}

body[data-route="student"] #settingsPanel .student-settings-panel__action--primary {
  justify-content: center;
}

body[data-route="student"] #settingsPanel .student-settings-panel__action--secondary {
  height: 30px;
  min-height: 30px;
  padding-inline: 9px;
  font-size: 11px;
  color: var(--text-secondary);
}

body[data-route="student"] #settingsPanel .settings-feedback-row {
  margin-top: var(--space-3);
}

body[data-route="student"] #settingsPanel #feedbackBtn {
  width: 100%;
  justify-content: center;
  display: inline-flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

body[data-route="student"] #settingsPanel .meta-helper {
  margin-top: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-soft);
}

@media (max-width: 560px) {
  body[data-route="student"] .quiz-footer {
    justify-content: flex-start;
  }

  body[data-route="student"] .quiz-generate-more-status {
    order: 2;
    margin-inline-end: 0;
  }

  body[data-route="student"] #settingsPanel .student-settings-panel__actions {
    grid-template-columns: 1fr;
  }

  body[data-route="student"] #settingsPanel .student-settings-panel__action--secondary {
    justify-self: start;
  }
}

body[data-route="student"] .active-lecture-banner {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body[data-route="student"] .active-lecture-banner__context {
  flex: 1 1 auto;
}

body[data-route="student"] .active-lecture-banner__actions {
  flex: 0 0 auto;
  align-self: center;
}

body[data-route="student"] .student-guided-overlay__backdrop {
  background: rgba(8, 15, 31, 0.34);
}

body[data-route="student"] .student-guided-overlay[data-spotlight-scope="sidebar"][data-sidebar-backdrop="dim"] .student-guided-overlay__backdrop--full {
  background: rgba(8, 15, 31, 0.18);
  backdrop-filter: none;
}

body[data-route="student"] .student-guided-overlay__card {
  z-index: 2402;
  border-color: color-mix(in srgb, #2563eb 40%, transparent);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, #2563eb 10%, transparent), transparent 44%),
    color-mix(in srgb, var(--color-surface) 96%, rgba(255, 255, 255, 0.04));
}

body[data-route="student"] .student-guided-overlay__card[data-card-mode="sheet"] {
  width: min(440px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
}

body[data-route="student"] .student-guided-overlay__prev:hover,
body[data-route="student"] .student-guided-overlay__prev:focus-visible,
body[data-route="student"] .student-guided-overlay__next:hover,
body[data-route="student"] .student-guided-overlay__next:focus-visible {
  background: color-mix(in srgb, #2563eb 16%, var(--color-surface));
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: none;
}

body[data-route="student"] .student-guided-overlay__close:hover,
body[data-route="student"] .student-guided-overlay__close:focus-visible {
  background: color-mix(in srgb, var(--color-surface-2) 76%, transparent);
  color: var(--color-text);
  outline: none;
}

body[data-route="student"] .is-guided-spotlight {
  outline: 2px solid rgba(37, 99, 235, 0.54);
  outline-offset: 2px;
  border-color: color-mix(in srgb, #2563eb 48%, var(--color-border)) !important;
  box-shadow:
    inset 0 0 0 2px rgba(37, 99, 235, 0.26),
    0 16px 34px rgba(15, 23, 42, 0.14);
}

body[data-route="student"] :is(#libraryPanel, #retrievePanel, #settingsPanel, .sidebar-section-tab).is-guided-spotlight {
  box-shadow:
    inset 0 0 0 2px rgba(37, 99, 235, 0.28),
    inset 0 0 0 999px rgba(37, 99, 235, 0.04);
}

body[data-route="student"] .sidebar-section-tab.is-guided-spotlight {
  background: color-mix(in srgb, #2563eb 14%, var(--color-surface));
  color: var(--color-text);
}

body[data-route="faculty"] .faculty-login-card,
body[data-route="faculty"] .pipeline-active {
  background: var(--surface-mint);
  border-color: var(--border-mint);
  box-shadow: var(--shadow-inset), var(--shadow-mint);
}

body[data-route="faculty"] .faculty-login-card {
  width: min(500px, 100%);
  padding: clamp(var(--space-4), 4vw, var(--space-6));
}

body[data-route="faculty"] .faculty-login-card h2 {
  font-size: clamp(1.5rem, 1.35rem + 0.6vw, 1.9rem);
}

body[data-route="faculty"] .pipeline-summary-card--helper {
  background: var(--surface-pearl);
}

body[data-route="faculty"] .pipeline-step[data-ui-state="current"] {
  background: var(--surface-pearl);
}

body[data-route="faculty"] .pipeline-tracker__step[data-ui-state="current"] {
  background: var(--surface-mint);
}

body[data-route="faculty"] .pipeline-step[data-ui-state="blocked"] {
  border-style: dashed;
}

body[data-route="faculty"] .pipeline-secondary-tabs {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body[data-route="faculty"] .pipeline-sidebar {
  position: sticky;
  top: var(--space-4);
  align-self: stretch;
  max-height: var(--faculty-sidebar-max-height);
  overflow: hidden;
}

body[data-route="faculty"] .faculty-tab-container {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-route="faculty"] .faculty-tab-panel.active {
  min-height: 0;
  overflow: hidden;
}

body[data-route="faculty"] .pipeline-active__actions {
  flex: 1 1 760px;
  min-width: 0;
  align-items: stretch;
  row-gap: 10px;
}

body[data-route="faculty"] .pipeline-run-next-helper {
  flex: 1 1 180px;
  min-width: min(100%, 180px);
}

body[data-route="faculty"] .faculty-lecture-picker {
  flex: 1 1 320px;
}

body[data-route="faculty"] .pipeline-console-stepper {
  min-width: 0;
}

body[data-route="faculty"] .pipeline-tracker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  scrollbar-width: thin;
  background: var(--surface-pearl);
  border-color: var(--color-border);
}

body[data-route="faculty"] .pipeline-tracker::before {
  display: none;
}

body[data-route="faculty"] .pipeline-tracker__step {
  flex: 1 0 132px;
  min-width: 132px;
  min-height: 84px;
  justify-content: space-between;
  padding: 10px 12px;
  box-shadow: var(--shadow-inset);
  text-align: left;
  appearance: none;
}

body[data-route="faculty"] .pipeline-tracker__footer {
  display: grid;
  gap: 4px;
}

body[data-route="faculty"] .pipeline-tracker__state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--surface-pearl);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}

body[data-route="faculty"] .pipeline-tracker__step[aria-selected="true"] {
  border-color: var(--border-mint-hover);
  background: var(--surface-mint);
  box-shadow: var(--shadow-inset), var(--shadow-sm);
}

body[data-route="faculty"] .pipeline-tracker__step[aria-selected="true"] .pipeline-tracker__state,
body[data-route="faculty"] .pipeline-tracker__state[data-state="current"] {
  border-color: var(--border-mint);
  background: var(--surface-mint);
  color: var(--text-heading);
}

body[data-route="faculty"] .pipeline-tracker__state[data-state="running"] {
  border-color: color-mix(in srgb, var(--color-warning) 44%, transparent);
  background: color-mix(in srgb, var(--color-warning) 16%, var(--color-surface));
  color: color-mix(in srgb, var(--color-warning) 84%, var(--color-text));
}

body[data-route="faculty"] .pipeline-tracker__state[data-state="completed"] {
  border-color: color-mix(in srgb, var(--color-success) 44%, transparent);
  background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--color-success) 84%, var(--color-text));
}

body[data-route="faculty"] .pipeline-tracker__state[data-state="failed"] {
  border-color: color-mix(in srgb, var(--color-danger) 44%, transparent);
  background: color-mix(in srgb, var(--color-danger) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--color-danger) 84%, var(--color-text));
}

body[data-route="faculty"] .pipeline-tracker__state[data-state="blocked"] {
  border-color: color-mix(in srgb, var(--color-warning) 34%, transparent);
  background: color-mix(in srgb, var(--color-warning) 10%, var(--color-surface));
  color: var(--text-secondary);
}

body[data-route="faculty"] .pipeline-layout {
  grid-template-columns: minmax(0, 1.08fr) minmax(460px, 0.92fr);
  gap: clamp(18px, 2vw, 28px);
}

body[data-route="faculty"] .pipeline-step {
  overflow: hidden;
}

body[data-route="faculty"] details.pipeline-step:not(.is-active-panel) {
  display: none;
}

body[data-route="faculty"] details.pipeline-step.is-active-panel {
  display: flex;
  animation: faculty-tab-panel-in 0.18s ease;
}

body[data-route="faculty"] .pipeline-step__summary {
  cursor: default;
}

body[data-route="faculty"] .pipeline-step__body {
  padding-top: 0;
}

body[data-route="faculty"] .pipeline-sidebar,
body[data-route="faculty"] .faculty-tab-container,
body[data-route="faculty"] .faculty-tab-panel.active,
body[data-route="faculty"] .lecture-library-card,
body[data-route="faculty"] .live-usage-card {
  width: 100%;
  min-width: 0;
}

body[data-route="faculty"] .faculty-tab-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

body[data-route="faculty"] .pipeline-sidebar,
body[data-route="faculty"] .faculty-tab-container {
  flex: 1 1 auto;
}

body[data-route="faculty"] {
  --faculty-library-panel-min-height: clamp(560px, 70vh, 980px);
  --faculty-sidebar-max-height: calc(100vh - (var(--space-4) * 2));
  /* Reserve the sticky topbar's wordmark/control lines, padding and top gap.
     Typography tokens scale with the reader's text size, including when the
     compact header wraps at narrow widths. */
  --faculty-anchor-offset: calc(2 * var(--text-3xl) + 4 * var(--space-3));
}

body[data-route="faculty"] #facultyTabNav {
  scroll-margin-block-start: var(--faculty-anchor-offset);
}

body[data-route="faculty"] .lecture-library-card,
body[data-route="faculty"] .live-usage-card {
  min-height: var(--faculty-library-panel-min-height);
  max-height: var(--faculty-sidebar-max-height);
  overflow: hidden;
}

body[data-route="faculty"] .lecture-library-body,
body[data-route="faculty"] #libraryBrowserView,
body[data-route="faculty"] #libraryResults,
body[data-route="faculty"] #libraryCourseView,
body[data-route="faculty"] #libraryExamView,
body[data-route="faculty"] #libraryLectureView {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-route="faculty"] .live-usage-card {
  display: flex;
  flex-direction: column;
}

body[data-route="faculty"] #libraryResults,
body[data-route="faculty"] .library-course-list,
body[data-route="faculty"] .library-manager__list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

@media (max-width: 960px) {
  body[data-route="student"] .workspace-header {
    gap: 12px;
  }

  body[data-route="student"] .workspace-header__title-row {
    align-items: flex-start;
  }

  body[data-route="faculty"] .pipeline-active__row {
    flex-direction: column;
  }

  body[data-route="faculty"] .pipeline-active__actions {
    width: 100%;
    flex-basis: auto;
  }

  body[data-route="faculty"] .pipeline-secondary-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-route="faculty"] .pipeline-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  body[data-route="faculty"] .pipeline-layout {
    grid-template-columns: 1fr;
  }

  body[data-route="faculty"] {
    --faculty-library-panel-min-height: min(78vh, 840px);
    --faculty-sidebar-max-height: none;
  }

  body[data-route="faculty"] .faculty-lecture-picker,
  body[data-route="faculty"] .faculty-custom-select {
    width: 100%;
  }

  body[data-route="faculty"] .faculty-combobox__panel,
  body[data-route="faculty"] .faculty-custom-select__panel {
    width: 100%;
    max-width: 100%;
  }

  body[data-route="faculty"] .library-browser__search {
    grid-template-columns: 1fr;
  }

  body[data-route="faculty"] .library-browser__search .sidebar-input,
  body[data-route="faculty"] .library-browser__search .btn,
  body[data-route="faculty"] .library-browser__search .sidebar-select {
    width: 100%;
  }

  body[data-route="faculty"] .library-toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  body[data-route="faculty"] .library-toolbar__primary,
  body[data-route="faculty"] .library-year-tabs {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
  }

  body[data-route="faculty"] #libraryResults,
  body[data-route="faculty"] #libraryCourseView,
  body[data-route="faculty"] #libraryExamView,
  body[data-route="faculty"] #libraryLectureView {
    min-height: 320px;
  }
}

@media (max-width: 720px) {
  body[data-route="student"] .workspace-header__title--student { flex-direction: column; align-items: flex-start; gap: 2px; }
  body[data-route="student"] .workspace-header__brand { font-size: 1.45rem; }
  body[data-route="student"] .workspace-header__context { min-width: 0; }
  body[data-route="student"] .student-empty-state::before { opacity: .25; }

  body[data-route="student"] .workspace-header {
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
  }

  body[data-route="student"] .workspace-utility-group {
    width: 100%;
  }

  body[data-route="student"] .workspace-utility-group {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  body[data-route="student"] .student-empty-state__hero {
    gap: 10px;
  }

  body[data-route="student"] .student-empty-state__hero-copy {
    width: 100%;
    gap: 10px;
  }

  body[data-route="student"] .student-empty-state__tutorial-callout {
    width: 100%;
    max-width: none;
  }

  body[data-route="student"] .student-empty-state__badge--tutorial {
    width: 100%;
    min-width: 0;
    justify-items: start;
  }

  body[data-route="faculty"] {
    --faculty-library-panel-min-height: min(82vh, 760px);
  }

  body[data-route="faculty"] .library-lecture-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  body[data-route="faculty"] .library-breadcrumb {
    white-space: normal;
    overflow: visible;
  }

  body[data-route="faculty"] .library-lecture-controls {
    width: 100%;
    justify-content: flex-start;
  }

  body[data-route="faculty"] .faculty-login-card {
    padding: 24px;
  }
}

body[data-route="student"] .composer-send-icon {
  display: block;
}

body[data-route="student"] .composer-send-label { display: none; }
body[data-route="student"] .faculty-custom-select__option.is-selected { background: var(--surface-mint); }


@media (min-width: 721px) {
  body[data-route="student"] .chat-log {
    padding-bottom: clamp(20px, 2.4vw, 30px);
    scroll-padding-bottom: calc(var(--composer-height) + 20px + var(--safe-bottom, 0px));
  }

  body[data-route="student"] .chat-composer {
    --composer-control-size: 54px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    bottom: calc(14px + var(--safe-bottom));
    margin-bottom: 0;
    padding: 10px 12px;
    padding-bottom: calc(10px + var(--safe-bottom));
    border-radius: var(--radius-xl);
    border-color: color-mix(in srgb, var(--color-border) 62%, transparent);
    background: var(--surface-pearl);
    box-shadow: var(--shadow-mint);
  }

  body[data-route="student"] .chat-composer:hover {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.11), inset 0 1px 0 color-mix(in srgb, #ffffff 42%, transparent);
  }

  body[data-route="student"] .chat-composer .composer-attachments {
    gap: 6px;
    margin-inline: 2px;
  }

  body[data-route="student"] .chat-composer .attachment-chip {
    max-width: 100%;
    padding: 5px 8px;
  }

  body[data-route="student"] .chat-composer .active-lecture-banner {
    margin-bottom: 2px;
    padding: 5px 8px;
    border-radius: 10px;
  }

  body[data-route="student"] .composer-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: var(--composer-control-size);
  }

  body[data-route="student"] .chat-composer .composer-field {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.active-lecture-mode[data-route="student"] .chat-composer {
    border-color: color-mix(in srgb, var(--lecture-active-border) 58%, var(--color-border));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--lecture-active-glow) 26%, transparent), 0 10px 24px rgba(15, 23, 42, 0.09);
  }

  body.active-lecture-mode[data-route="student"] .chat-composer .composer-field {
    border-color: transparent;
    box-shadow: none;
  }

  body.active-lecture-mode[data-route="student"] .chat-composer .composer-field::after {
    content: none;
    animation: none;
  }

  body[data-route="student"] .chat-composer.is-dragging-files .composer-field {
    border-color: transparent;
    background: transparent;
  }

  body[data-route="student"] .chat-composer .chat-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: var(--composer-control-size);
    min-height: var(--composer-control-size);
    max-height: 128px;
    padding: 13px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    resize: none;
    overflow-y: auto;
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.4;
  }

  body[data-route="student"] .chat-composer .chat-input:focus,
  body[data-route="student"] .chat-composer .chat-input:focus-visible {
    outline: none;
    box-shadow: none;
  }

  body[data-route="student"] .composer-attach-btn,
  body[data-route="student"] .composer-send {
    position: static;
    flex: 0 0 var(--composer-control-size);
    width: var(--composer-control-size);
    min-width: var(--composer-control-size);
    height: var(--composer-control-size);
    min-height: var(--composer-control-size);
    padding: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body[data-route="student"] .composer-attach-btn {
    border-color: color-mix(in srgb, var(--color-border) 58%, transparent);
    background: color-mix(in srgb, var(--color-surface-2) 64%, transparent);
    color: var(--text-secondary);
  }

  body[data-route="student"] .composer-attach-btn svg {
    width: 18px;
    height: 18px;
  }

  body[data-route="student"] .composer-send {
    border-color: color-mix(in srgb, var(--color-accent-strong) 62%, transparent);
    background: var(--action-primary);
    color: #ffffff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--color-accent) 26%, transparent);
  }

  body[data-route="student"] .composer-send:hover:not(:disabled),
  body[data-route="student"] .composer-send:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
  }

  body[data-route="student"] .composer-send:disabled {
    opacity: 0.54;
    filter: grayscale(0.25);
    box-shadow: none;
    cursor: not-allowed;
  }

  body[data-route="student"] .composer-mode {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
  }

  body[data-route="student"] .composer-mode-label {
    display: none;
  }

  body[data-route="student"] .composer-mode-select {
    width: auto;
    min-width: 106px;
    height: 44px;
    min-height: 44px;
    padding: 0 26px 0 10px;
    border-radius: 999px;
    font-size: var(--text-sm);
    font-weight: 700;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] {
    width: auto;
    min-width: 0;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__trigger {
    width: auto;
    min-width: 144px;
    min-height: 44px;
    height: 44px;
    padding: 0 26px 0 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-surface) 78%, var(--color-accent) 10%);
    box-shadow: none;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__value {
    font-size: var(--text-sm);
    line-height: 1;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__icon {
    right: 11px;
    width: 7px;
    height: 7px;
    border-width: 1.7px;
  }

  body[data-route="student"] #facultyFloatingSurfacePortal .faculty-custom-select__panel[data-select-id="response-mode"][data-floating="true"] {
    padding: 6px;
    border-radius: 12px;
  }

  body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__options {
    max-height: 148px;
    gap: 4px;
    padding-right: 0;
  }

  body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option {
    min-height: 44px;
    padding: 7px 9px;
    border-radius: 9px;
  }

  body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option-label {
    font-size: var(--text-sm);
  }
}

@media (min-width: 721px) and (max-width: 1099px) {
  body[data-route="student"] .chat-composer {
    margin-bottom: calc(26px + var(--safe-bottom));
  }
}

@media (min-width: 1100px) {
  body[data-route="student"] .chat-composer {
    bottom: var(--safe-bottom);
  }
}

@media (max-width: 720px) {
  body[data-route="student"] .conversation-lane {
    gap: var(--space-2);
  }

  body[data-route="student"] .chat-log {
    padding: var(--space-3);
    padding-bottom: var(--space-3);
    scroll-padding-bottom: calc(var(--composer-height) + var(--space-2) + var(--safe-bottom, 0px));
  }

  body[data-route="student"] .chat-composer {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    padding-bottom: calc(8px + var(--safe-bottom));
    border-radius: 18px;
    border-color: color-mix(in srgb, var(--color-border) 72%, transparent);
    background: color-mix(in srgb, var(--color-surface) 94%, var(--color-surface-2) 6%);
    box-shadow: 0 12px 30px rgba(2, 8, 23, 0.18);
  }

  body[data-route="student"] .chat-composer .composer-attachments {
    gap: 6px;
  }

  body[data-route="student"] .chat-composer .attachment-chip {
    max-width: 100%;
    padding: 5px 8px;
  }

  body[data-route="student"] .chat-composer .attachment-chip-text {
    max-width: min(220px, 58vw);
  }

  body[data-route="student"] .chat-composer .active-lecture-banner {
    padding: 6px 8px;
  }

  body[data-route="student"] .composer-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-rows: minmax(58px, auto) 32px;
    align-items: stretch;
    gap: 6px 8px;
  }

  body[data-route="student"] .chat-composer:not(.attachments-enabled) .composer-row {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  body[data-route="student"] .chat-composer:not(.attachments-enabled) .chat-input {
    grid-column: 1 / -1;
  }

  body[data-route="student"] .chat-composer:not(.attachments-enabled) .composer-send {
    grid-column: 2;
  }

  body[data-route="student"] .chat-composer:not(.attachments-enabled) .composer-mode {
    grid-column: 1;
  }

  body[data-route="student"] .chat-composer .composer-field {
    display: contents;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.active-lecture-mode[data-route="student"] .chat-composer {
    border-color: color-mix(in srgb, var(--lecture-active-border) 72%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--lecture-active-glow) 32%, transparent), 0 12px 30px rgba(2, 8, 23, 0.18);
  }

  body.active-lecture-mode[data-route="student"] .chat-composer .composer-field::after {
    content: none;
    animation: none;
  }

  body[data-route="student"] .chat-composer .chat-input {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    min-height: 58px;
    max-height: 116px;
    padding: 4px 2px 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    resize: none;
    color: var(--color-text);
    font-size: 16px;
    line-height: 1.38;
  }

  body[data-route="student"] .chat-composer .chat-input:focus,
  body[data-route="student"] .chat-composer .chat-input:focus-visible {
    outline: none;
    box-shadow: none;
  }

  body[data-route="student"] .composer-attach-btn,
  body[data-route="student"] .composer-send {
    position: static;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: stretch;
  }

  body[data-route="student"] .composer-attach-btn {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    background: color-mix(in srgb, var(--color-surface-2) 70%, transparent);
    border-color: color-mix(in srgb, var(--color-border) 66%, transparent);
    color: var(--text-secondary);
  }

  body[data-route="student"] .composer-attach-btn svg {
    width: 19px;
    height: 19px;
  }

  body[data-route="student"] .composer-send {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    border-color: color-mix(in srgb, var(--color-accent-strong) 60%, transparent);
    background: linear-gradient(145deg, var(--color-accent), var(--color-accent-strong));
    color: #ffffff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--color-accent) 28%, transparent);
  }

  body[data-route="student"] .composer-send:hover:not(:disabled),
  body[data-route="student"] .composer-send:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
  }

  body[data-route="student"] .composer-send:disabled {
    opacity: 0.54;
    filter: grayscale(0.25);
    box-shadow: none;
    cursor: not-allowed;
  }

  body[data-route="student"] .composer-send-icon {
    display: block;
  }

  body[data-route="student"] .composer-send-label {
    display: none;
  }

  body[data-route="student"] .composer-mode {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    justify-self: start;
    width: auto;
    min-width: 0;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
  }

  body[data-route="student"] .composer-mode-label {
    display: none;
  }

  body[data-route="student"] .composer-mode-select {
    width: auto;
    min-width: 104px;
    height: 30px;
    min-height: 30px;
    padding: 0 26px 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] {
    width: auto;
    min-width: 0;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__trigger {
    width: auto;
    min-width: 106px;
    min-height: 30px;
    height: 30px;
    padding: 0 27px 0 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-surface) 78%, var(--color-accent) 10%);
    box-shadow: none;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__value {
    font-size: 12px;
    line-height: 1;
  }

  body[data-route="student"] .faculty-custom-select[data-select-id="response-mode"] .faculty-custom-select__icon {
    right: 11px;
    width: 7px;
    height: 7px;
    border-width: 1.7px;
  }

  body[data-route="student"] #facultyFloatingSurfacePortal .faculty-custom-select__panel[data-select-id="response-mode"][data-floating="true"] {
    width: min(144px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    padding: 6px;
    border-radius: 12px;
  }

  body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__options {
    max-height: 148px;
    gap: 4px;
    padding-right: 0;
  }

  body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option {
    min-height: 30px;
    padding: 7px 9px;
    border-radius: 9px;
  }

  body[data-route="student"] .faculty-custom-select__panel[data-select-id="response-mode"] .faculty-custom-select__option-label {
    font-size: 12px;
  }
}
/* Account-owned practice tests and read-only review. */
.practice-test-modes { display: grid; gap: 10px; margin: 12px 0 20px; padding: 0; border: 0; }
.practice-test-modes legend { margin-bottom: 10px; color: var(--text-heading); font-weight: 700; }
.practice-test-mode { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--surface-pearl); box-shadow: var(--shadow-inset); cursor: pointer; }
.practice-test-mode:hover { border-color: var(--border-mint-hover); }
.practice-test-mode:has(input:checked) { border-color: var(--border-mint-hover); background: var(--surface-mint); box-shadow: var(--shadow-inset), inset 3px 0 var(--color-accent); }
.practice-test-mode input { flex: none; margin-top: 5px; accent-color: var(--color-accent); }
.practice-test-mode strong, .practice-test-mode small { display: block; }
.practice-test-mode small, .practice-test-modes > p { margin: 4px 0 0; font-size: .875rem; line-height: 1.55; color: var(--text-supporting); }
body.practice-attempt-open { overflow: hidden; }
.practice-attempt-overlay { position: fixed; inset: 0; z-index: 1600; display: flex; background: var(--color-bg); }
.practice-attempt-overlay[hidden] { display: none; }
.practice-attempt { --practice-gutter: max(clamp(16px, 3vw, 56px), calc((100% - 1760px) / 2)); width: 100%; height: 100dvh; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface-pearl); color: var(--color-text); font-family: var(--font-body); font-size: 1rem; }
.practice-attempt__header, .practice-attempt__toolbar, .practice-attempt__navigation { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.practice-attempt__heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.practice-attempt__heading > div { min-width: 0; }
.practice-attempt__icon { width: 48px; height: 48px; flex: none; }
.practice-attempt__header h2 { margin: 0; font-size: 1.25em; line-height: 1.3; letter-spacing: -.035em; color: var(--text-heading); overflow-wrap: anywhere; }
.practice-attempt__toolbar { flex: none; padding: 8px clamp(16px, 3vw, 40px); border-bottom: 1px solid var(--color-border); background: var(--surface-pearl); }
.practice-attempt__timer { padding: 9px 13px; border: 1px solid var(--border-mint); border-radius: var(--radius-pill, 999px); background: var(--surface-mint); color: var(--text-heading); box-shadow: var(--shadow-inset); font-variant-numeric: tabular-nums; font-weight: 750; }
.practice-attempt__timer.is-low-time { background: color-mix(in srgb, var(--color-warning) 14%, var(--color-surface)); border-color: var(--color-warning); color: var(--color-warning); }
.practice-attempt__error { flex: none; display: flex; gap: 12px; justify-content: space-between; align-items: center; margin: 8px 24px 0; border: 1px solid color-mix(in srgb, var(--color-danger) 45%, var(--color-border)); border-radius: var(--radius-md); padding: 13px; color: var(--color-danger); background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface)); font-size: .875em; }
.practice-attempt__error[hidden] { display: none; }
.practice-attempt__content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 18px var(--practice-gutter); line-height: 1.65; overflow-wrap: anywhere; }
.practice-attempt__content h3 { line-height: 1.5; font-size: 1.13em; color: var(--text-heading); }
.practice-attempt__ready { padding: clamp(20px, 3vh, 32px); border: 1px solid var(--border-mint); border-radius: var(--radius-xl); background: var(--surface-mint); box-shadow: var(--shadow-inset), var(--shadow-mint); text-align: center; }
.practice-attempt__ready-icon { display: block; margin: 0 auto 12px; width: 88px; height: 88px; }
.practice-attempt__ready h3 { margin: 4px 0 8px; font-size: clamp(1.6em, 3vw, 2em); letter-spacing: -.04em; }
.practice-attempt__ready p { margin: 0; color: var(--text-supporting); }
.practice-attempt__eyebrow { font-size: .8em; font-weight: 650; }
.practice-attempt__instructions { padding: 18px 20px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--surface-pearl); color: var(--text-supporting); font-size: .9375em; }
.practice-attempt__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 24px 0; }
.practice-attempt__facts > div { padding: 18px 14px; border: 1px solid var(--border-mint); border-radius: var(--radius-lg); background: var(--surface-mint); box-shadow: var(--shadow-inset); }
.practice-attempt__facts strong, .practice-attempt__facts span { display: block; }
.practice-attempt__facts strong { color: var(--text-heading); font-size: 1.15em; font-variant-numeric: tabular-nums; }
.practice-attempt__facts span, .practice-attempt__meta, .practice-attempt__save { color: var(--text-supporting); font-size: .875em; }
.practice-attempt__save { flex: none; padding: 2px 24px max(10px, env(safe-area-inset-bottom)); min-height: 1.5em; text-align: center; background: var(--color-surface); }
.practice-attempt__question { margin: 12px 0; padding: clamp(18px, 2vw, 28px); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--surface-pearl); box-shadow: var(--shadow-inset), var(--shadow-sm); }
.practice-attempt__question h3, .practice-attempt__review-question h4 { white-space: pre-wrap; }
.practice-attempt__navigation { padding: 0; }
.practice-attempt__navigation select { max-width: 100%; min-height: 42px; margin-left: 5px; padding: 8px 12px; border: 1px solid var(--border-mint); border-radius: var(--radius-md); background: var(--color-surface); color: var(--text-heading); font: inherit; font-variant-numeric: tabular-nums; }
.practice-attempt__navigation select option { background: var(--color-surface); color: var(--color-text); }
.practice-attempt__choices { display: grid; gap: 10px; }
.practice-attempt__choice { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--surface-pearl); color: inherit; box-shadow: var(--shadow-inset); font: inherit; line-height: 1.5; text-align: left; cursor: pointer; transition: background var(--dur-1), border-color var(--dur-1), box-shadow var(--dur-1); }
.practice-attempt__choice-letter { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 1px solid var(--color-border); border-radius: 11px; background: var(--color-surface); color: var(--text-supporting); font-size: .875em; font-weight: 750; }
.practice-attempt__choice-text { flex: 1; min-width: min(160px, 60%); }
.practice-attempt__choice:hover:not(:disabled):not(.is-correct):not(.is-incorrect) { background: var(--surface-mint-hover); border-color: var(--border-mint-hover); }
.practice-attempt__choice.is-selected { border-color: var(--border-mint-hover); background: var(--surface-mint); box-shadow: var(--shadow-inset), inset 3px 0 var(--color-accent); }
.practice-attempt__choice.is-selected .practice-attempt__choice-letter { border-color: var(--border-mint-hover); background: var(--surface-mint); color: var(--text-heading); }
.practice-attempt__choice.is-correct { border-color: var(--color-success); background: color-mix(in srgb, var(--color-success) 10%, var(--color-surface)); }
.practice-attempt__choice.is-incorrect { border-color: var(--color-danger); background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface)); }
.practice-attempt__choice:disabled { cursor: default; }
.practice-attempt__choice-status { flex-shrink: 0; white-space: nowrap; font-size: .875em; font-weight: 600; }
.practice-attempt__choice.is-correct .practice-attempt__choice-status { color: var(--color-success); }
.practice-attempt__choice.is-incorrect .practice-attempt__choice-status { color: var(--color-danger); }
.practice-attempt__option-row > .practice-attempt__choice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 60px;
  padding-inline-end: 62px;
}
.practice-attempt__option-row .practice-attempt__choice-text { min-width: 0; overflow-wrap: anywhere; }
.practice-attempt__option-row .practice-attempt__choice-status { grid-column: 2; white-space: normal; }
.practice-attempt__option-row .practice-attempt__choice.is-eliminated .practice-attempt__choice-letter { color: var(--color-muted); }
.practice-attempt__feedback { margin-top: 18px; padding: 18px; border: 1px solid var(--border-mint); border-radius: var(--radius-md); background: var(--surface-mint); }
.practice-attempt__feedback p { margin-bottom: 0; }
.practice-attempt__confirmation { margin-top: 20px; padding: 20px; border: 1px solid var(--color-warning); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-warning) 10%, var(--color-surface)); }
.practice-attempt__confirmation .btn + .btn { margin-left: 10px; }
.practice-attempt__result { display: grid; grid-template-columns: minmax(0, 1fr) 180px; align-items: center; column-gap: 24px; max-width: 680px; margin: 16px auto; text-align: center; padding: 16px 24px; border: 1px solid var(--border-mint); border-radius: var(--radius-xl); background: var(--surface-mint); box-shadow: var(--shadow-inset), var(--shadow-mint); }
.practice-attempt__score { min-width: 0; }
.practice-attempt__score > strong { display: block; font-size: clamp(3em, 10vw, 4.8em); letter-spacing: -.065em; color: var(--text-heading); font-variant-numeric: tabular-nums; line-height: 1.15; }
.practice-attempt__result h3 { margin: 8px 0 0; }
.practice-attempt__result > p { grid-column: 1 / -1; margin: 8px 0 0; color: var(--text-supporting); font-size: .9em; line-height: 1.5; }
.practice-attempt__result + .practice-attempt__facts { margin: 14px 0; }
.practice-attempt__result + .practice-attempt__facts > div { padding: 10px 14px; }
.practice-attempt__result + .practice-attempt__facts + h3 { margin: 12px 0 8px; }
.practice-attempt:has(.practice-attempt__result) .practice-attempt__toolbar { padding-block: 4px; }
.practice-attempt__celebration { width: 180px; min-width: 0; }
.practice-attempt__celebration-art { width: 100%; aspect-ratio: 1; }
.practice-attempt__celebration-art video, .practice-attempt__celebration-art img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.practice-attempt__celebration-controls { display: grid; justify-items: stretch; gap: 6px; }
.practice-attempt__celebration-controls .btn { min-height: 38px; padding: 6px 8px; font-size: .8em; line-height: 1.4; white-space: normal; }
.practice-attempt__celebration-controls [data-action="claim-reward"] { min-height: 42px; }
.practice-attempt__celebration-controls [data-action="claim-reward"]:disabled { opacity: 1; cursor: default; }
.practice-attempt__celebration-controls [data-action="toggle-celebration"] { min-height: 28px; padding-block: 3px; font-size: .72em; color: var(--text-supporting); border-color: transparent; box-shadow: none; }
.practice-attempt__reward-name { margin: 8px 0; font-size: .85em; font-weight: 650; color: var(--text-heading); }
.practice-attempt__reward-message { margin: 2px 0; font-size: .75em; line-height: 1.45; color: var(--text-supporting); }
.practice-attempt__celebration [hidden] { display: none !important; }
.practice-attempt__filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.practice-attempt__filters .btn { border-radius: var(--radius-pill, 999px); }
.practice-attempt__filters [aria-pressed="true"] { background: var(--surface-mint); color: var(--text-heading); border-color: var(--border-mint-hover); box-shadow: var(--shadow-inset); }
.practice-attempt__review-question { padding: 24px; margin-top: 16px; border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--surface-pearl); box-shadow: var(--shadow-inset); }
.practice-attempt__review-question[data-outcome="correct"] { border-inline-start: 3px solid var(--color-success); }
.practice-attempt__review-question[data-outcome="incorrect"] { border-inline-start: 3px solid var(--color-danger); }
.practice-attempt__review-question[data-outcome="unanswered"] { border-inline-start: 3px solid var(--color-warning); }
.practice-attempt__review-question h4 { margin: 10px 0 18px; }
.practice-attempt__review-choices { padding-left: 25px; }
.practice-attempt__review-choices li { padding: 3px 0; }
.practice-attempt__review-choices:has(.practice-attempt__option-row) { display: grid; gap: 8px; list-style: none; padding: 0; }
.practice-attempt__review-choice { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 56px; padding: 10px 62px 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.practice-attempt__review-choice .practice-attempt__choice-text { min-width: 0; }
.practice-attempt__correct-answer { color: var(--color-success); font-weight: 650; }
.practice-attempt__learned { color: var(--color-warning); font-size: .875em; }
.practice-attempt__empty { padding: 28px 20px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--surface-pearl); text-align: center; color: var(--text-supporting); }
.practice-attempt :focus-visible, .practice-test-modes :focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.practice-attempt__history-intro { margin-top: 0; color: var(--text-supporting); }
.practice-attempt__history-list { max-height: none; overflow: visible; }
.practice-attempt__history-item { padding: 18px; border-color: var(--border-mint); border-radius: var(--radius-lg); background: var(--surface-mint); box-shadow: var(--shadow-inset); }
.practice-attempt__history-item .saved-practice-test__details strong { color: var(--text-heading); }
.practice-attempt__history-item .saved-practice-test__details span { color: var(--text-supporting); font-variant-numeric: tabular-nums; }
.practice-attempt__confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.practice-attempt__confetti i { position: absolute; bottom: -20px; left: var(--x); width: 8px; height: 13px; border-radius: 2px; background: hsl(var(--hue) 55% 62%); animation: practice-confetti 1.5s var(--delay) ease-out both; }
@keyframes practice-confetti { 0% { transform: translateY(0) rotate(0); opacity: 0; } 20% { opacity: 1; } 65% { transform: translateY(-70vh) rotate(240deg); opacity: 1; } 100% { transform: translateY(-50vh) rotate(420deg); opacity: 0; } }
@media (max-width: 600px) {
  .practice-attempt-overlay { padding: 0; }
  .practice-attempt { padding: 0; }
  .practice-attempt__navigation { gap: 8px; }
  .practice-attempt__navigation label { order: 3; width: 100%; }
  .practice-attempt__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice-attempt__choice { padding: 13px; }
  .practice-attempt__result { grid-template-columns: minmax(0, 1fr) 142px; column-gap: 12px; padding: 12px; }
  .practice-attempt__celebration { width: 142px; }
  .practice-attempt__result + .practice-attempt__facts { gap: 8px; margin: 14px 0; }
  .practice-attempt__result + .practice-attempt__facts > div { padding: 6px 12px; }
  .practice-attempt__filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .practice-attempt__filters .btn { min-height: 44px; padding: 7px 4px; font-size: .75em; line-height: 1.4; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .practice-attempt *, .practice-attempt__confetti i { transition: none !important; animation: none !important; }
  .practice-attempt__confetti { display: none; }
  /* Reward and opt-in motion controls remain available with reduced motion. */
}

/* The question is the only scrolling region; test actions remain in view. */
.practice-attempt__header { flex: none; padding: 14px clamp(16px, 3vw, 40px); border-bottom: 1px solid var(--border-mint); background: var(--surface-mint); box-shadow: var(--shadow-inset); }
.practice-attempt__header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.practice-attempt__progress { margin: 4px 0 0; font-size: .875em; color: var(--text-supporting); font-variant-numeric: tabular-nums; }
.practice-attempt__actions { flex: none; padding: 12px var(--practice-gutter); border-top: 1px solid var(--border-mint); background: var(--surface-pearl); box-shadow: 0 -4px 20px color-mix(in srgb, var(--color-accent) 5%, transparent); }
.practice-attempt__actions > .btn-primary { display: block; min-width: 180px; margin-inline-start: auto; }
.practice-attempt__actions:empty { display: none; }
.practice-attempt__toolbar[hidden], .practice-attempt [hidden] { display: none !important; }
.practice-attempt__navigation label { display: flex; align-items: center; justify-content: center; gap: 10px; flex: 1; min-width: 0; font-size: .875em; }
.practice-attempt__navigation select { flex: 1; min-width: 0; width: 100%; margin-left: 0; }
.practice-attempt__navigation .btn { min-height: 40px; }
.practice-attempt__content > .practice-attempt__meta { margin: 0; }
.practice-attempt__content .saved-practice-tests__list { max-height: none; overflow: visible; }
.practice-attempt__question h3 { margin: 10px 0 16px; }
.practice-attempt__question .quiz-question-stem { margin: 0; font: inherit; color: inherit; }
.practice-highlight-action { position: fixed; }
.practice-pause { position: absolute; inset: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 20px; background: var(--color-bg); }
.practice-pause[hidden] { display: none; }
/* Hide, rather than blur, the exam so stopped-time reading is impossible. */
.practice-attempt-overlay.is-paused > .practice-attempt { visibility: hidden; }
.practice-pause__dialog { width: min(440px, 100%); flex-shrink: 0; margin: auto 0; box-sizing: border-box; padding: 24px 30px 30px; border: 1px solid var(--border-mint); border-radius: var(--radius-xl); background: var(--surface-mint); color: var(--text-heading); text-align: center; box-shadow: var(--shadow-inset), var(--shadow-mint), var(--shadow-lg); font-size: 1rem; }
.practice-pause__dialog h2 { margin: 8px 0; font-size: 1.4em; }
.practice-pause__dialog p { font-size: 1em; line-height: 1.55; margin: 8px 0 22px; color: var(--text-supporting); }
.practice-pause__dialog .btn { min-height: 44px; }
.practice-pause__dialog :focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 4px; }
.practice-pause__art { position: relative; max-width: 320px; margin: 0 auto; }
.practice-pause__art img { display: block; width: 100%; height: auto; max-height: 240px; border-radius: var(--radius-lg); object-fit: contain; }
.practice-pause__zzz { position: absolute; top: 12%; right: 12%; width: 42px; height: 70px; color: var(--text-supporting); font-weight: 650; pointer-events: none; }
.practice-pause__zzz i { position: absolute; font-style: normal; opacity: 0; animation: practice-sleep-z 4s ease-in-out infinite; }
.practice-pause__zzz i:nth-child(2) { animation-delay: 1.3s; right: 5px; font-size: 20px; }
.practice-pause__zzz i:nth-child(3) { animation-delay: 2.6s; right: -8px; font-size: 24px; }
.practice-pause__dialog .practice-pause__error { color: var(--color-danger); }
@keyframes practice-sleep-z { 0% { opacity: 0; transform: translateY(12px); } 25% { opacity: .7; } 100% { opacity: 0; transform: translate(14px, -35px); } }
@media (max-width: 600px) {
  .practice-attempt__header { padding: 10px 14px; gap: 8px; }
  .practice-attempt__header h2 { font-size: 1.1em; }
  .practice-attempt__icon { width: 38px; height: 38px; }
  .practice-attempt__heading { gap: 8px; }
  .practice-attempt__header-actions { gap: 6px; width: 100%; }
  .practice-attempt__header-actions [data-action="close"] { margin-left: auto; }
  .practice-attempt__header-actions .btn { padding: 8px 10px; font-size: .875em; }
  .practice-attempt:has(.practice-attempt__result) .practice-attempt__header { flex-wrap: nowrap; }
  .practice-attempt:has(.practice-attempt__result) .practice-attempt__header-actions { width: auto; flex: none; }
  .practice-attempt__content { padding: 16px; }
  .practice-attempt__question, .practice-attempt__review-question { padding: 16px; }
  .practice-attempt__choice-letter { width: 30px; height: 30px; }
  .practice-attempt__ready { padding: 20px 16px; }
  .practice-attempt__ready-icon { width: 68px; height: 68px; }
  .practice-attempt__actions { padding: 8px 14px; }
  .practice-attempt__navigation label { order: -1; width: 100%; flex-basis: 100%; }
  .practice-attempt__navigation .btn { flex: 1; padding: 8px; font-size: .875em; }
  .practice-attempt__save { font-size: .75em; padding: 0 14px max(6px, env(safe-area-inset-bottom)); }
  .practice-attempt__error { margin: 8px 14px 0; }
  .practice-pause__dialog { padding: 18px 20px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .practice-pause__zzz i { animation: none; opacity: .65; }
  .practice-pause__zzz i:nth-child(2) { top: -20px; }
  .practice-pause__zzz i:nth-child(3) { top: -42px; }
}

@media (max-width: 600px) and (max-height: 650px) {
  .practice-attempt:has(.practice-attempt__result) .practice-attempt__content { padding: 12px; }
  .practice-attempt__result { grid-template-columns: minmax(0, 1fr) 128px; column-gap: 10px; padding: 4px 0; }
  .practice-attempt__celebration { width: 128px; }
  .practice-attempt__celebration-controls .btn { padding-inline: 4px; font-size: .75rem; }
  .practice-attempt__result > p { margin-top: 4px; font-size: .8125rem; }
  .practice-attempt__result + .practice-attempt__facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 6px; margin: 8px 0; }
  .practice-attempt__result + .practice-attempt__facts > div { padding: 6px 3px; }
  .practice-attempt__result + .practice-attempt__facts strong { font-size: 1rem; }
  .practice-attempt__result + .practice-attempt__facts span { font-size: .6875rem; line-height: 1.4; }
  .practice-attempt__result + .practice-attempt__facts + h3 { margin: 4px 0 6px; }
  .practice-attempt__filters .btn { padding-inline: 2px; font-size: .6875rem; }
}

/* Uploaded-source Anki draft controls remain inside the faculty manual workflow. */
.anki-upload { width: 100%; }
.anki-upload-fields { display: grid; gap: .8rem; padding-top: .8rem; min-width: 0; }
.anki-upload-fields label { display: grid; gap: .35rem; min-width: 0; }
.anki-upload-fields input { max-width: 100%; min-width: 0; }
.anki-upload-fields p { margin: 0; overflow-wrap: anywhere; }
.anki-upload-fields [data-anki-upload-status][data-state="error"] { color: var(--color-danger, #a23333); }
.anki-upload-fields [data-anki-upload-result] { min-width: 0; overflow-wrap: anywhere; }
.anki-upload-fields [data-anki-upload-result] .btn { margin: .3rem .5rem .5rem 0; }

.anki-upload-fields input[type="file"]::file-selector-button { font: inherit; color: var(--text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: .45rem .7rem; margin-right: .6rem; cursor: pointer; }

.anki-quality-issues { padding-left: 1.35rem; overflow-wrap: anywhere; }
.anki-quality-issues li + li { margin-top: .4rem; }
