/* =========================================================================
   Practical exams
   -------------------------------------------------------------------------
   Two audiences, one visual language. The teacher gets dense tables that stay
   readable at 100 rows; the student gets a single uncluttered screen with the
   clock and the submit button always in view.

   Colours come from the theme tokens with literal fallbacks, so an active
   Academic theme flows through and the default theme is unchanged.
   ========================================================================= */

.qp-exam-admin-body,
.qp-exams-body {
  --qp-exam-line: var(--qpt-border, var(--qp-ws-line, #e7e4ee));
  --qp-exam-surface: var(--qpt-surface, var(--qp-ws-surface, #fff));
  --qp-exam-surface-alt: var(--qpt-surface-alt, var(--qp-ws-surface-muted, #f8fafc));
  --qp-exam-ink: var(--qpt-text, var(--qp-ws-ink, #171326));
  --qp-exam-muted: var(--qpt-muted, var(--qp-ws-muted, #6f6a7d));
  --qp-exam-accent: var(--qpt-primary, var(--qp-ws-accent, #6428f5));
  --qp-exam-ok: var(--qpt-success, #16865a);
  --qp-exam-warn: var(--qpt-warning, #b45309);
  --qp-exam-bad: var(--qpt-danger, #c92f45);
  --qp-exam-radius: 12px;
}

/* ---- shared bits --------------------------------------------------------- */

.qp-exam-skeleton {
  height: 120px;
  border-radius: var(--qp-exam-radius);
  background: linear-gradient(90deg, var(--qp-exam-surface-alt), var(--qp-exam-surface), var(--qp-exam-surface-alt));
  background-size: 200% 100%;
  animation: qp-exam-shimmer 1.2s linear infinite;
}
@keyframes qp-exam-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .qp-exam-skeleton { animation: none; } }

.qp-exam-empty,
.qp-exam-empty-cell {
  padding: 26px;
  border-radius: var(--qp-exam-radius);
  background: var(--qp-exam-surface-alt);
  color: var(--qp-exam-muted);
  text-align: center;
  font-weight: 700;
}

.qp-exam-hint { margin: 0; color: var(--qp-exam-muted); font-size: 13px; }

.qp-exam-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--qp-exam-surface-alt);
  color: var(--qp-exam-muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.qp-exam-chip.is-started { background: color-mix(in srgb, var(--qp-exam-accent) 14%, transparent); color: var(--qp-exam-accent); }
.qp-exam-chip.is-submitted { background: color-mix(in srgb, var(--qp-exam-ok) 16%, transparent); color: var(--qp-exam-ok); }
.qp-exam-chip.is-blocked,
.qp-exam-chip.is-disqualified { background: color-mix(in srgb, var(--qp-exam-bad) 14%, transparent); color: var(--qp-exam-bad); }
.qp-exam-chip.is-absent { background: color-mix(in srgb, var(--qp-exam-warn) 16%, transparent); color: var(--qp-exam-warn); }

/* ---- teacher: exam picker ------------------------------------------------ */

.qp-exam-page { display: grid; gap: 16px; }

.qp-exam-picker {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--qp-exam-line);
  border-radius: var(--qp-exam-radius);
  background: var(--qp-exam-surface);
}
.qp-exam-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qp-exam-picker-head h2 { margin: 0; font-size: 18px; }

.qp-exam-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }

.qp-exam-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--qp-exam-line);
  border-radius: var(--qp-exam-radius);
  background: var(--qp-exam-surface);
  color: var(--qp-exam-ink);
  text-align: start;
  cursor: pointer;
  transition: border-color .15s ease, transform .12s ease;
}
.qp-exam-card:hover { transform: translateY(-1px); }
.qp-exam-card.is-active { border-color: var(--qp-exam-accent); box-shadow: inset 0 0 0 1px var(--qp-exam-accent); }
.qp-exam-card b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-exam-card small,
.qp-exam-card-counts { color: var(--qp-exam-muted); font-size: 12px; }
.qp-exam-card-status {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--qp-exam-surface-alt);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.qp-exam-card-status.is-published { background: color-mix(in srgb, var(--qp-exam-ok) 16%, transparent); color: var(--qp-exam-ok); }
.qp-exam-card-status.is-closed { background: color-mix(in srgb, var(--qp-exam-bad) 12%, transparent); color: var(--qp-exam-bad); }

/* ---- teacher: workspace -------------------------------------------------- */

.qp-exam-workspace {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--qp-exam-line);
  border-radius: var(--qp-exam-radius);
  background: var(--qp-exam-surface);
}

.qp-exam-headline { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.qp-exam-headline h2 { margin: 6px 0 2px; font-size: 24px; }
.qp-exam-window { margin: 0; color: var(--qp-exam-muted); font-size: 13px; }
.qp-exam-headline-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.qp-exam-status-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--qp-exam-surface-alt);
  color: var(--qp-exam-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.qp-exam-status-chip.is-published { background: color-mix(in srgb, var(--qp-exam-ok) 16%, transparent); color: var(--qp-exam-ok); }
.qp-exam-status-chip.is-closed { background: color-mix(in srgb, var(--qp-exam-bad) 12%, transparent); color: var(--qp-exam-bad); }

.qp-exam-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--qp-exam-line);
  border-radius: 10px;
  background: var(--qp-exam-surface-alt);
  scrollbar-width: none;
}
.qp-exam-tabs::-webkit-scrollbar { display: none; }
.qp-exam-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--qp-exam-muted);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}
.qp-exam-tabs button.active { background: var(--qp-exam-surface); color: var(--qp-exam-accent); box-shadow: 0 1px 3px rgba(23, 19, 38, .1); }

.qp-exam-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }

.qp-exam-block {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--qp-exam-line);
  border-radius: var(--qp-exam-radius);
  background: var(--qp-exam-surface);
}
.qp-exam-block h3 { margin: 0; font-size: 16px; }
.qp-exam-block label { display: grid; gap: 6px; font-size: 12px; font-weight: 850; }
.qp-exam-block label small { color: var(--qp-exam-muted); font-weight: 700; }

.qp-exam-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.qp-exam-metrics > div {
  padding: 14px;
  border: 1px solid var(--qp-exam-line);
  border-radius: var(--qp-exam-radius);
  background: var(--qp-exam-surface-alt);
}
.qp-exam-metrics b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.qp-exam-metrics span { color: var(--qp-exam-muted); font-size: 12px; font-weight: 800; }

.qp-exam-checklist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.qp-exam-checklist li { display: flex; gap: 10px; align-items: center; color: var(--qp-exam-muted); font-weight: 750; }
.qp-exam-checklist li.is-done { color: var(--qp-exam-ok); }
.qp-exam-checklist span { font-weight: 900; }

.qp-exam-set-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.qp-exam-set-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--qp-exam-line);
  border-radius: 9px;
  background: var(--qp-exam-surface-alt);
}
.qp-exam-set-list li small { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--qp-exam-muted); }

.qp-exam-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qp-exam-actions .qp-btn.primary { margin-inline-start: auto; }
.qp-exam-total { color: var(--qp-exam-muted); font-weight: 850; }

/* ---- teacher: tables ----------------------------------------------------- */

.qp-exam-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qp-exam-toolbar h3 { margin: 0; }
.qp-exam-toolbar .qp-input { flex: 1 1 220px; min-width: 180px; }
.qp-exam-toolbar-end { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.qp-exam-rows { display: flex; align-items: center; gap: 6px; color: var(--qp-exam-muted); font-size: 12px; font-weight: 800; }

.qp-exam-bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--qp-exam-line);
  border-radius: 9px;
  background: var(--qp-exam-surface-alt);
  color: var(--qp-exam-muted);
  font-size: 12px;
  font-weight: 800;
}
.qp-exam-bulk-divider { width: 1px; height: 20px; background: var(--qp-exam-line); }

.qp-exam-scroll { overflow-x: auto; }

.qp-exam-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.qp-exam-table th,
.qp-exam-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--qp-exam-line);
  text-align: start;
  vertical-align: middle;
}
.qp-exam-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--qp-exam-surface-alt);
  color: var(--qp-exam-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.qp-exam-table th small { display: block; font-size: 10px; opacity: .7; text-transform: none; }
.qp-exam-table tbody tr:hover { background: var(--qp-exam-surface-alt); }
.qp-exam-table td small { display: block; color: var(--qp-exam-muted); font-size: 11px; }
.qp-exam-extra { color: var(--qp-exam-accent) !important; font-weight: 850; }
.qp-exam-row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.qp-exam-total-cell { white-space: nowrap; }

.qp-input.tiny, .qp-select.tiny { min-height: 34px; padding: 6px 8px; font-size: 13px; }
.qp-input.tiny { width: 84px; }
.qp-input.tiny.wide { width: 180px; }
.qp-exam-question-table .qp-input:not(.tiny) { width: 100%; }

.qp-exam-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 12px; color: var(--qp-exam-muted); font-size: 12px; font-weight: 800; }
.qp-exam-pager-note { padding-top: 10px; margin: 0; color: var(--qp-exam-muted); font-size: 12px; }

/* ---- teacher: one paper -------------------------------------------------- */

.qp-exam-paper-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.qp-exam-paper-head h3 { margin: 0 0 2px; }
.qp-exam-paper-head small { color: var(--qp-exam-muted); }
.qp-exam-paper-score { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.qp-exam-paper-score b { font-size: 30px; color: var(--qp-exam-accent); }
.qp-exam-paper-score span { color: var(--qp-exam-muted); font-weight: 800; }

.qp-exam-attachments { display: flex; gap: 8px; flex-wrap: wrap; }

.qp-exam-paper { display: grid; gap: 12px; }
.qp-exam-answer { border: 1px solid var(--qp-exam-line); border-radius: 10px; overflow: hidden; }
.qp-exam-answer header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--qp-exam-surface-alt);
}
.qp-exam-answer header span { flex: 1 1 auto; min-width: 0; color: var(--qp-exam-muted); font-size: 12px; }
.qp-exam-mark { display: flex; align-items: center; gap: 6px; }
.qp-exam-mark small { color: var(--qp-exam-muted); font-weight: 800; }
.qp-exam-answer pre {
  margin: 0;
  padding: 14px;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.55;
}
.qp-exam-explanation { display: grid; gap: 6px; font-size: 12px; font-weight: 850; }

/* ---- teacher: dialog ----------------------------------------------------- */

.qp-exam-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 14, 32, .55);
}
.qp-exam-backdrop[hidden] { display: none; }
.qp-exam-dialog {
  width: min(520px, 100%);
  max-height: 90dvh;
  overflow: auto;
  border-radius: 16px;
  background: var(--qp-exam-surface, #fff);
  box-shadow: 0 30px 80px rgba(15, 12, 30, .3);
}
.qp-exam-dialog header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--qp-exam-line); }
.qp-exam-dialog h2 { margin: 0; font-size: 19px; }
.qp-exam-form { display: grid; gap: 14px; padding: 20px; }
.qp-exam-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 850; }
.qp-exam-form label small { color: var(--qp-exam-muted); font-weight: 700; }
.qp-exam-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.qp-exam-form footer { display: flex; align-items: center; gap: 10px; }
.qp-exam-form footer .qp-btn { margin-inline-start: 0; }
.qp-exam-form footer .qp-btn:first-of-type { margin-inline-start: auto; }
.qp-exam-form-error { color: var(--qp-exam-bad); font-size: 12px; font-weight: 800; }
.qp-exam-switch { display: flex !important; align-items: center; gap: 10px; }
.qp-exam-switch input { width: 18px; height: 18px; }

/* ---- student: exam list -------------------------------------------------- */

.qp-student-exams { display: grid; gap: 16px; align-content: start; }

.qp-exam-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 26px;
  border: 1px solid var(--qp-exam-line);
  border-radius: 18px;
  background: var(--qp-exam-surface);
  color: var(--qp-exam-ink);
  text-align: start;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease;
}
.qp-exam-hero:hover { transform: translateY(-2px); border-color: var(--qp-exam-accent); }
.qp-exam-hero-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--qp-exam-accent) 12%, var(--qp-exam-surface));
  font-size: 30px;
}
.qp-exam-hero-copy { display: grid; gap: 4px; flex: 1 1 auto; min-width: 0; }
.qp-exam-hero-copy b { font-size: 22px; }
.qp-exam-hero-copy small { color: var(--qp-exam-muted); font-size: 14px; }
.qp-exam-hero-go { font-size: 26px; color: var(--qp-exam-muted); transition: transform .14s ease; }
.qp-exam-hero.is-open .qp-exam-hero-go { transform: rotate(90deg); }

.qp-exam-student-list { display: grid; gap: 10px; }
.qp-exam-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--qp-exam-line);
  border-inline-start: 4px solid var(--qp-exam-line);
  border-radius: var(--qp-exam-radius);
  background: var(--qp-exam-surface);
}
.qp-exam-row.is-live { border-inline-start-color: var(--qp-exam-ok); }
.qp-exam-row.is-soon { border-inline-start-color: var(--qp-exam-warn); }
.qp-exam-row.is-done { border-inline-start-color: var(--qp-exam-accent); }
.qp-exam-row-copy { display: grid; gap: 2px; min-width: 0; }
.qp-exam-row-copy b { font-size: 16px; }
.qp-exam-row-copy small,
.qp-exam-row-window { color: var(--qp-exam-muted); font-size: 12px; }
.qp-exam-row-badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--qp-exam-surface-alt);
  color: var(--qp-exam-muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.qp-exam-row.is-live .qp-exam-row-badge { background: color-mix(in srgb, var(--qp-exam-ok) 16%, transparent); color: var(--qp-exam-ok); }

.qp-exam-result-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  background: var(--qp-exam-surface-alt);
}
.qp-exam-result-score { display: flex; align-items: baseline; gap: 6px; }
.qp-exam-result-score b { font-size: 34px; color: var(--qp-exam-accent); font-variant-numeric: tabular-nums; }
.qp-exam-result-score span { color: var(--qp-exam-muted); font-weight: 800; }
.qp-exam-result-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.qp-exam-result-table td { padding: 6px 0; border-bottom: 1px solid var(--qp-exam-line); }
.qp-exam-result-table td:last-child { text-align: end; font-weight: 850; font-variant-numeric: tabular-nums; }
.qp-exam-result-note { margin: 0; color: var(--qp-exam-ink); font-size: 13px; }

/* ---- student: sitting the exam ------------------------------------------- */

.qp-exam-sitting-body {
  min-height: 100dvh;
  margin: 0;
  background: var(--qpt-background, #f5f6fa);
  color: var(--qpt-text, #171326);
}

.qp-exam-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(12px, 3vw, 26px);
  border-bottom: 1px solid var(--qpt-border, #e7e4ee);
  background: var(--qpt-surface, #fff);
}
.qp-exam-bar[hidden] { display: none; }
.qp-exam-bar-title { display: grid; min-width: 0; }
.qp-exam-bar-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-exam-bar-title small { color: var(--qpt-muted, #6f6a7d); font-size: 12px; }

/* The clock is the one thing a student looks up for, so it is the largest
   thing in the bar and turns red with five minutes left. */
.qp-exam-bar-clock {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-inline: auto;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--qpt-surface-alt, #f1f2f7);
  font-variant-numeric: tabular-nums;
}
.qp-exam-bar-clock b { font-size: clamp(22px, 4vw, 30px); font-weight: 950; }
.qp-exam-bar-clock small { color: var(--qpt-muted, #6f6a7d); font-weight: 800; }
.qp-exam-bar-clock.is-urgent { background: color-mix(in srgb, #c92f45 14%, transparent); }
.qp-exam-bar-clock.is-urgent b { color: #c92f45; }

.qp-exam-bar-actions { display: flex; align-items: center; gap: 10px; }
.qp-exam-save-state { color: var(--qpt-muted, #6f6a7d); font-size: 12px; font-weight: 850; white-space: nowrap; }
.qp-exam-save-state.is-pending { color: var(--qpt-warning, #b45309); }
.qp-exam-save-state.is-error { color: var(--qpt-danger, #c92f45); }

.qp-exam-sitting { padding: clamp(12px, 2.4vw, 24px); }

.qp-exam-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 1560px;
  margin-inline: auto;
}
.qp-exam-layout.is-single { grid-template-columns: minmax(0, 820px); justify-content: center; }

.qp-exam-paper-pane {
  position: sticky;
  top: 78px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100dvh - 104px);
  border: 1px solid var(--qpt-border, #e7e4ee);
  border-radius: var(--qp-exam-radius, 12px);
  background: var(--qpt-surface, #fff);
  overflow: hidden;
}
.qp-exam-paper-pane header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--qpt-border, #e7e4ee); }
.qp-exam-paper-pane object { width: 100%; height: 100%; border: 0; }

.qp-exam-answer-pane { display: grid; gap: 14px; align-content: start; }
.qp-exam-instructions {
  margin: 0;
  padding: 14px 16px;
  border-inline-start: 4px solid var(--qpt-primary, #6428f5);
  border-radius: 10px;
  background: var(--qpt-surface, #fff);
  line-height: 1.6;
}
.qp-exam-locked {
  padding: 14px 16px;
  border-radius: 10px;
  background: color-mix(in srgb, #16865a 12%, transparent);
  color: #0f6b48;
  font-weight: 800;
}

.qp-exam-question {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--qpt-border, #e7e4ee);
  border-radius: var(--qp-exam-radius, 12px);
  background: var(--qpt-surface, #fff);
}
.qp-exam-question header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.qp-exam-question header b { font-size: 18px; }
.qp-exam-question-marks { color: var(--qpt-muted, #6f6a7d); font-size: 12px; font-weight: 850; }
.qp-exam-question p { margin: 0; color: var(--qpt-muted, #6f6a7d); line-height: 1.55; }
.qp-exam-question textarea { width: 100%; min-height: 160px; line-height: 1.6; resize: vertical; }

.qp-exam-uploads {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--qpt-border, #e7e4ee);
  border-radius: var(--qp-exam-radius, 12px);
  background: var(--qpt-surface, #fff);
}
.qp-exam-uploads header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.qp-exam-uploads header small { color: var(--qpt-muted, #6f6a7d); font-size: 12px; }
.qp-exam-uploads ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.qp-exam-uploads li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--qpt-surface-alt, #f1f2f7); }
.qp-exam-uploads li a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-exam-uploads li small { color: var(--qpt-muted, #6f6a7d); font-size: 11px; }

/* ---- student: the password gate ------------------------------------------ */

.qp-exam-gate {
  display: grid;
  gap: 14px;
  width: min(520px, 100%);
  margin: clamp(24px, 8vh, 90px) auto;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--qpt-border, #e7e4ee);
  border-radius: 18px;
  background: var(--qpt-surface, #fff);
  text-align: center;
}
.qp-exam-gate h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); }
.qp-exam-gate-instructions { margin: 0; color: var(--qpt-muted, #6f6a7d); line-height: 1.6; text-align: start; }
.qp-exam-gate-form { display: grid; gap: 12px; text-align: start; }
.qp-exam-gate-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 850; }
.qp-exam-gate-error { margin: 0; min-height: 18px; color: var(--qpt-danger, #c92f45); font-size: 13px; font-weight: 800; }
.qp-exam-gate-back { color: var(--qpt-muted, #6f6a7d); font-size: 13px; }

/* ---- narrow screens ------------------------------------------------------ */

@media (max-width: 1080px) {
  .qp-exam-layout { grid-template-columns: minmax(0, 1fr); }
  /* On a phone the PDF gets a fixed slice rather than a sticky column, so the
     answer boxes are always reachable by scrolling. */
  .qp-exam-paper-pane { position: static; height: min(56dvh, 520px); }
}

@media (max-width: 760px) {
  .qp-exam-bar { flex-wrap: wrap; gap: 8px; }
  .qp-exam-bar-clock { order: -1; margin-inline: 0; }
  .qp-exam-bar-title { flex: 1 1 100%; order: -2; }
  .qp-exam-bar-actions { flex: 1 1 100%; justify-content: space-between; }
  .qp-exam-row { grid-template-columns: minmax(0, 1fr); }
  .qp-exam-row-action { justify-self: stretch; }
  .qp-exam-row-action .qp-btn { width: 100%; }
  .qp-exam-hero { padding: 18px; }
  .qp-exam-headline-actions { width: 100%; }
  .qp-exam-toolbar-end { margin-inline-start: 0; }
}

/* A wide table scrolls inside its own container; the page itself never does.
   The sticky header stays put while the columns move under it. */
.qp-exam-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 8px;
  scrollbar-width: thin;
}
.qp-exam-scroll .qp-exam-table { min-width: 760px; }
.qp-exam-results-table { min-width: 900px; }

/* -------------------------------------------------------------------------
   Exam bar corrections
   .qp-btn sets its own display, which beats the [hidden] attribute, so a
   submitted paper still showed Save and Submit. And the account chrome the
   shared header injects is noise while a student is being examined.
   ------------------------------------------------------------------------- */
.qp-exam-sitting-body .qp-exam-bar [hidden],
.qp-exam-sitting-body .qp-exam-bar .qp-btn[hidden] { display: none !important; }

.qp-exam-sitting-body .qp-header-account-cluster,
.qp-exam-sitting-body .qp-account-menu-trigger,
.qp-exam-sitting-body .qp-header-notifications,
.qp-exam-sitting-body .qp-adaptive-chat-launcher,
.qp-exam-sitting-body .qp-dashboard-top-actions { display: none !important; }

/* The submitted notice is the answer to "did it go through", so it leads. */
.qp-exam-sitting-body .qp-exam-locked { order: -1; }
.qp-exam-bar-clock small[hidden] { display: none !important; }
