/* ===== Moodle app shell ===== */
.moodle-app { background: #fff; min-height: 100vh; }
.moodle-navbar { background: #fff; border-bottom: none; }
.moodle-navbar-inner {
  display: flex; align-items: center; gap: 32px;
  padding: 10px 24px; max-width: 100%; margin: 0 auto;
}
.moodle-brand { display: flex; align-items: center; }
.moodle-brand img { display: block; height: 40px; width: auto; }
.moodle-nav-links { display: flex; gap: 24px; }
.moodle-nav-links a {
  color: #1d2125; font-size: 14px; font-weight: 500; text-decoration: none;
  padding: 6px 0;
}
.moodle-nav-links a:hover { color: #f7941d; }
.moodle-nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.moodle-theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  background: #f8f9fa; border: 1px solid #dee2e6;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: #495057;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.moodle-theme-toggle:hover { background: #e9ecef; }
html.dark .moodle-theme-toggle { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-theme-toggle:hover { background: #3a3d42; }
.moodle-nav-login {
  color: #f7941d; font-size: 14px; font-weight: 500; text-decoration: none;
  padding: 6px 12px; border: 1px solid #f7941d; border-radius: 4px;
}
.moodle-nav-login:hover { background: #f7941d; color: #fff; }
.moodle-navbar-orange { height: 3px; background: #f7941d; }
.moodle-app-main { background: #fff; }

/* ===== Quiz body chrome ===== */
.moodle-quiz {
  max-width: 100%; margin: 0 auto; padding: 24px 32px 64px;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1d2125;
}
.moodle-quiz p { margin: 0 0 0.5em; }
.moodle-quiz h3, .moodle-quiz h4 { margin: 0; }
.moodle-quiz fieldset { border: 0; padding: 0; margin: 0; }
.moodle-quiz legend { display: block; padding: 0; }
.moodle-quiz table { border-collapse: collapse; }
.moodle-quiz a { color: #f7941d; text-decoration: none; }
.moodle-quiz a:hover { text-decoration: underline; }
.moodle-quiz button { font: inherit; }
.moodle-quiz .quiz-breadcrumb {
  font-size: 14px; color: #6c757d; margin-bottom: 12px;
}
.moodle-quiz .quiz-breadcrumb a { color: #002B49; text-decoration: none; }
.moodle-quiz .quiz-breadcrumb a:hover { text-decoration: underline; }
.moodle-quiz .quiz-breadcrumb span { margin: 0 4px; color: #adb5bd; }

.moodle-quiz .quiz-title-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 0 0 16px;
}
.moodle-quiz .quiz-title-row .btn-back { order: 0; flex-shrink: 0; }
.moodle-quiz .quiz-title-row .quiz-title { order: 1; flex: 1 1 auto; min-width: 0; }
.moodle-quiz .quiz-title-row .title-timer { order: 2; margin-left: auto; flex-shrink: 0; }
.moodle-quiz .quiz-title-row .drawer-toggle-btn { order: 3; flex-shrink: 0; }
.moodle-quiz .title-timer { height: 36px; }
.moodle-quiz .quiz-title {
  font-size: 28px; font-weight: 700; line-height: 1.2; margin: 0;
  display: flex; align-items: center; gap: 12px;
}
.moodle-quiz .quiz-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 4px; background: #e84a8d;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'><path d='M3 5h18v2H3zm0 4h18v2H3zm0 4h12v2H3zm0 4h12v2H3z'/></svg>");
  background-position: center; background-repeat: no-repeat; background-size: 20px;
}

.moodle-quiz .quiz-status-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; margin-bottom: 16px;
}
.moodle-quiz .timer {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: #f1f3f5; font-variant-numeric: tabular-nums; font-size: 14px;
}
.moodle-quiz .timer.timer-danger { background: #fdecea; color: #b3251c; }
.moodle-quiz .link-danger {
  background: none; border: none; padding: 4px 8px; cursor: pointer;
  color: #dc3545; font-size: 13px;
}
.moodle-quiz .link-danger:hover { text-decoration: underline; }

/* ===== Summary table ===== */
.moodle-quiz .quizreviewsummary {
  width: auto; border-collapse: collapse; margin-bottom: 24px;
  background: #fff; border: 1px solid #dee2e6;
}
.moodle-quiz .quizreviewsummary th,
.moodle-quiz .quizreviewsummary td {
  padding: 10px 14px; border-bottom: 1px solid #e9ecef; text-align: left;
  font-size: 14px;
}
.moodle-quiz .quizreviewsummary tr:last-child th,
.moodle-quiz .quizreviewsummary tr:last-child td { border-bottom: none; }
.moodle-quiz .quizreviewsummary th {
  background: #f8f9fa; font-weight: 600; width: 1%; white-space: nowrap; text-align: right;
}

/* ===== Layout ===== */
.moodle-quiz .quiz-layout {
  display: flex; gap: 24px; align-items: flex-start;
}
.moodle-quiz .quiz-main { flex: 1 1 auto; min-width: 0; }
.moodle-quiz .quiz-nav-side {
  position: sticky; top: 80px;
  width: 230px; flex: 0 0 230px;
  opacity: 1;
  transition: width 0.3s ease, flex-basis 0.3s ease, opacity 0.25s ease, margin-left 0.3s ease;
  overflow: hidden;
}
.moodle-quiz .quiz-layout.drawer-closed .quiz-nav-side {
  width: 0; flex-basis: 0; opacity: 0; margin-left: -24px; pointer-events: none;
}

/* Single toggle button — lives in the title row, never overlaps the question */
.drawer-toggle-btn {
  width: 36px;
  height: 36px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #1d2125;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}
.drawer-toggle-btn:hover { background-color: #e9ecef; }
.drawer-toggle-x {
  font-size: 22px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding-bottom: 2px;
}
.drawer-open-svg { width: 18px; height: 18px; margin-left: 2px; }

@media (max-width: 900px) {
  .moodle-quiz .quiz-layout { flex-direction: column; }
  .moodle-quiz .quiz-nav-side { width: 100%; flex-basis: auto; position: static; }
}
.moodle-quiz .card-block {
  background: #fff; border: 1px solid #dee2e6; border-radius: 6px; padding: 16px;
}
.moodle-quiz .card-block h3 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }

/* ===== Nav buttons grid ===== */
.moodle-quiz .qn_buttons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.moodle-quiz .qnbutton {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: 40px; padding: 4px; border: 1px solid #ced4da; border-radius: 3px;
  background: #f1f3f5; color: #1d2125; font-size: 14px; text-decoration: none;
  font-weight: 500; overflow: hidden;
}
.moodle-quiz .qnbutton:hover { border-color: #f7941d; text-decoration: none; }
.moodle-quiz .qnbutton .trafficlight {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent;
}
.moodle-quiz .qnbutton.correct .trafficlight { background: #080; }
.moodle-quiz .qnbutton.incorrect .trafficlight { background: #800; }
.moodle-quiz .qnbutton.answersaved .trafficlight { background: #6c757d; }
.moodle-quiz .qnbutton.notyetanswered { background: #f1f3f5; color: #495057; }
.moodle-quiz .qnbutton.answersaved { background: #e2e6ea; }
.moodle-quiz .qnbutton.correct { background: #cfc; color: #155724; }
.moodle-quiz .qnbutton.incorrect { background: #fcc; color: #721c24; }
.moodle-quiz .qnbutton.thispage {
  border: 2px solid #1d2125; font-weight: 700;
}
.moodle-quiz .qnbutton.flagged::before {
  content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 12px 12px 0;
  border-color: transparent #d34141 transparent transparent;
}
.moodle-quiz .finish-btn { width: 100%; margin-top: 12px; }
.moodle-quiz .btn {
  display: inline-block; padding: 8px 16px; border: 1px solid transparent;
  border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer;
  text-decoration: none; line-height: 1.5; text-align: center;
}
.moodle-quiz .btn-primary { background: #f7941d; color: #fff; border-color: #f7941d; }
.moodle-quiz .btn-primary:hover { background: #0a5394; color: #fff; }
.moodle-quiz .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.moodle-quiz .btn-secondary { background: #6c757d; color: #fff; border-color: #6c757d; }
.moodle-quiz .btn-secondary:hover { background: #5a6268; color: #fff; }

/* ===== Question block ===== */
.moodle-quiz .que {
  display: flex; align-items: flex-start; gap: 1rem;
  margin: 0 0 1.8em 0; background: transparent; border: none;
}
@media (max-width: 700px) { .moodle-quiz .que { flex-direction: column; } }

.moodle-quiz .que .info {
  flex: 0 0 9.5em; width: 9.5em;
  padding: 0; background: transparent; border: none;
  word-wrap: break-word; overflow-wrap: anywhere;
}
@media (max-width: 700px) { .moodle-quiz .que .info { width: 100%; flex-basis: auto; } }
.moodle-quiz .que .info .no { font-size: 0.9375rem; font-weight: 400; margin: 0 0 0.6em; line-height: 1.3; }
.moodle-quiz .que .info .no .qno { font-size: 0.9375rem; font-weight: 700; }
.moodle-quiz .que .info .state { font-size: 0.8125rem; margin-bottom: 0.4em; }
.moodle-quiz .que .info .grade { font-size: 0.8125rem; color: #1d2125; margin-bottom: 0.8em; line-height: 1.3; }
.moodle-quiz .que .info .questionflag { margin-top: 0.4em; }
.moodle-quiz .que .info .questionflag a {
  display: inline-flex; align-items: flex-start; gap: 4px; color: #002B49;
  font-size: 0.8125rem; cursor: pointer; line-height: 1.3;
}
.moodle-quiz .que .info .questionflagimage { width: 12px; height: 14px; margin-top: 1px; flex-shrink: 0; }
.moodle-quiz .que.correct .info .state { color: #155724; font-weight: 600; }
.moodle-quiz .que.incorrect .info .state { color: #721c24; font-weight: 600; }
.moodle-quiz .que.notanswered .info .state { color: #856404; font-weight: 600; }

.moodle-quiz .que .content { flex: 1 1 auto; min-width: 0; }
.moodle-quiz .formulation {
  background: #cce6ea; border: 1px solid #b3d9e0; border-radius: 0.5rem;
  padding: 0.75rem 1.25rem; margin-bottom: 1rem;
}
.moodle-quiz .qtext { font-size: 1rem; margin-bottom: 0.5em; display: block; }
.moodle-quiz .ablock { margin: 0; padding: 0; border: none; }
.moodle-quiz .ablock .prompt { font-size: 0.9375rem; margin: 0.5em 0; font-weight: 400; }
.moodle-quiz .answer > div { padding: 0.3em 0; display: flex; align-items: flex-start; gap: 8px; }
.moodle-quiz .answer input[type=radio] { margin-top: 5px; cursor: pointer; }
.moodle-quiz .answer input[type=radio]:disabled { cursor: not-allowed; }
.moodle-quiz .answer label { cursor: pointer; flex: 1; font-size: 0.9375rem; }
.moodle-quiz .answer .correct::after { content: '✓'; color: #28a745; font-weight: bold; margin-left: 6px; }
.moodle-quiz .answer .incorrect::after { content: '✕'; color: #dc3545; font-weight: bold; margin-left: 6px; }

/* ===== Feedback box ===== */
.moodle-quiz .outcome {
  background: #fcefdc; border: 1px solid #fbe6ca; border-radius: 0.5rem;
  padding: 0.75rem 1.25rem; margin-bottom: 1rem; color: #8e662e;
}
.moodle-quiz .outcome .rightanswer { color: #8e662e; font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.5em; }
.moodle-quiz .outcome .generalfeedback { color: #8e662e; font-size: 0.875rem; }

.moodle-quiz .submit-row { margin: 20px 0; text-align: right; }
.moodle-quiz .page-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin: 20px 0; gap: 12px;
}
.moodle-quiz .page-nav .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.moodle-quiz .score-summary { margin-top: 14px; border-top: 1px solid #dee2e6; padding-top: 10px; font-size: 13px; }
.moodle-quiz .score-summary .row { display: flex; justify-content: space-between; padding: 3px 0; }
.moodle-quiz .score-summary .row.total {
  border-top: 1px solid #dee2e6; margin-top: 6px; padding-top: 6px; font-weight: 600;
}
.moodle-quiz .score-summary .text-correct { color: #28a745; }
.moodle-quiz .score-summary .text-wrong { color: #dc3545; }

/* ===== Start screen ===== */
.moodle-quiz .start-card {
  background: #fff; border: 1px solid #dee2e6; border-radius: 6px;
  padding: 24px; max-width: 700px;
}
.moodle-quiz .start-card.start-card--wide { max-width: none; }
.moodle-quiz .start-card h2 { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
.moodle-quiz .start-card .quizreviewsummary { margin-bottom: 16px; }
.moodle-quiz .start-note {
  background: #fff3cd; border: 1px solid #ffeaa7; border-radius: 4px;
  padding: 10px 14px; font-size: 13px; color: #856404; margin-bottom: 16px;
}
.moodle-quiz .start-error {
  background: #f8d7da; border: 1px solid #f5c6cb; border-radius: 4px;
  padding: 10px 14px; font-size: 13px; color: #721c24; margin-bottom: 16px;
}
.moodle-quiz .start-btn { padding: 10px 22px; font-size: 15px; }

.exam-page-loading {
  padding: 60px 24px; text-align: center; color: #6c757d; font-size: 14px;
}

/* ==========================================
   MOODLE EXACT HIGH-FIDELITY OVERRIDES
   ========================================== */

/* Navbar enhancements */
.moodle-navbar {
  box-shadow: 0 2px 4px rgba(0,0,0,.04);
}
.moodle-sidebar-toggle {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #495057;
  margin-right: 8px;
  transition: background-color 0.15s ease-in-out;
}
.moodle-sidebar-toggle:hover {
  background: #e9ecef;
}
.moodle-user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.user-avatar-container {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.user-avatar-svg {
  width: 24px;
  height: 24px;
}
.user-dropdown-arrow::after {
  content: "▼";
  font-size: 9px;
  color: #6c757d;
  margin-left: 2px;
}

/* Main layouts and headers */
.quiz-header-toggle-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.moodle-drawer-toggle {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #495057;
  transition: all 0.15s ease-in-out;
}
.moodle-drawer-toggle:hover {
  background: #e9ecef;
}
.moodle-quiz .quiz-breadcrumb {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  font-size: 13.5px;
}
.moodle-quiz .quiz-title {
  font-size: 32px;
  font-weight: 600;
  color: #1d2125;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.moodle-quiz .quiz-icon {
  background: #e84a8d;
  border-radius: 6px;
}
.quiz-action-bar {
  margin-bottom: 24px;
}
.btn-back {
  background-color: #e9ecef !important;
  color: #495057 !important;
  border: 1px solid #ced4da !important;
  border-radius: 4px;
  padding: 6px 14px !important;
  font-size: 14px;
  cursor: pointer;
  box-shadow: none !important;
  transition: background-color 0.15s ease;
}
.btn-back:hover {
  background-color: #dee2e6 !important;
}

/* Timer row */
.moodle-timer-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.moodle-timer-wrapper {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 38px;
}
.moodle-timer-box {
  border: 1px solid #d32f2f;
  border-radius: 4px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #d32f2f;
  background-color: #fff;
  font-weight: 500;
}
.moodle-timer-value {
  margin-left: 6px;
  font-family: monospace;
  font-size: 15px;
}
.timer-toggle-btn {
  background-color: #e9ecef !important;
  color: #495057 !important;
  border: 1px solid #ced4da !important;
  border-radius: 4px;
  padding: 0 16px !important;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.timer-toggle-btn:hover {
  background-color: #dee2e6 !important;
}

/* Info Box */
.moodle-quiz .que .info {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 12px;
  box-sizing: border-box;
}
.moodle-quiz .que .info .no {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 6px;
}
.moodle-quiz .que .info .state-text {
  font-size: 12px;
  color: #495057;
  margin-bottom: 6px;
}
.moodle-quiz .que .info .grade {
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 12px;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 8px;
}
.questionflagimage-svg {
  fill: #6c757d;
  transition: fill 0.15s ease;
}
.questionflagimage-svg.flagged {
  fill: #d32f2f;
}
.moodle-quiz .que .info .questionflag a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #002B49;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}
.moodle-quiz .que .info .questionflag a:hover {
  text-decoration: underline;
}

/* Formulation Box */
.moodle-quiz .formulation {
  background: #deeff0 !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 20px 24px !important;
  color: #1d2125;
}
.moodle-quiz .qtext {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.moodle-quiz .ablock .prompt {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #495057;
}
.moodle-quiz .answer > div {
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.moodle-quiz .answer input[type=radio] {
  width: 16px;
  height: 16px;
  margin: 0;
}
.moodle-quiz .answer label {
  font-size: 15px;
  color: #212529;
  display: flex;
  align-items: center;
}
.option-label-bullet {
  font-weight: 600;
  color: #495057;
  margin-right: 6px;
}

/* Nav page buttons */
.moodle-quiz .page-nav {
  margin-top: 24px;
}
.moodle-quiz .page-nav .btn-secondary {
  background-color: #e9ecef !important;
  color: #495057 !important;
  border: 1px solid #ced4da !important;
  border-radius: 4px;
  padding: 8px 18px !important;
}
.moodle-quiz .page-nav .btn-secondary:hover {
  background-color: #dee2e6 !important;
}
.moodle-quiz .page-nav .btn-primary {
  background-color: #0f3057 !important;
  border-color: #0f3057 !important;
  color: #fff !important;
  border-radius: 4px;
  padding: 8px 18px !important;
  font-weight: 500;
  transition: background-color 0.15s ease;
}
.moodle-quiz .page-nav .btn-primary:hover {
  background-color: #061930 !important;
}

/* Navigation aside container */
.moodle-quiz .quiz-nav-side .card-block {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.nav-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 8px;
}
.nav-header-row h3 {
  font-size: 16.5px;
  font-weight: 600;
  margin: 0;
  color: #1d2125;
}
.nav-close-btn {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  font-weight: bold;
  color: #1d2125;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}
.nav-close-btn:hover {
  background-color: #e9ecef;
}

/* Navigation Grid */
.moodle-quiz .qn_buttons {
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.moodle-quiz .qnbutton {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid #adb5bd;
  border-radius: 4px;
  background-color: #fff;
  color: #495057;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.moodle-quiz .qnbutton.info {
  background-color: #dee2e6;
  border-color: #dee2e6;
  color: #495057;
  font-style: italic;
  font-family: serif;
  font-weight: bold;
}
.moodle-quiz .qnbutton.answersaved {
  background-color: #dee2e6 !important;
  background: #dee2e6 !important;
  color: #1d2125;
}
.moodle-quiz .qnbutton.thispage {
  border: 3px solid #1d2125 !important;
  font-weight: bold;
}

/* Finish attempt link */
.btn-finish-attempt {
  display: block;
  background: none;
  border: none;
  color: #002B49;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  margin-top: 16px;
  text-align: left;
}
.btn-finish-attempt:hover {
  text-decoration: underline;
}

/* Floating help button */
.moodle-help-float-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #ced4da;
  border: none;
  color: #495057;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: background-color 0.15s ease;
}
.moodle-help-float-btn:hover {
  background-color: #adb5bd;
}

/* ===== Config screen ===== */
.moodle-quiz .config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .moodle-quiz .config-layout { grid-template-columns: 1fr; }
}
.moodle-quiz .config-card {
  max-width: none;
  padding: 28px 32px;
  border-top: 3px solid #f7941d;
}
.moodle-quiz .config-card .config-grid input[type="number"] { max-width: 140px; }
.moodle-quiz .config-card .config-field { max-width: 240px; }

/* Sticky summary panel */
.moodle-quiz .config-summary { position: sticky; top: 24px; }
.moodle-quiz .config-summary-inner {
  background: #fff; border: 1px solid #dee2e6; border-radius: 6px;
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.moodle-quiz .summary-head { border-bottom: 1px solid #f1f3f5; padding-bottom: 14px; }
.moodle-quiz .summary-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #f7941d;
}
.moodle-quiz .summary-head h3 {
  font-size: 18px; font-weight: 600; margin: 4px 0 2px; color: #1d2125;
}
.moodle-quiz .summary-mode { font-size: 13px; color: #6c757d; }
.moodle-quiz .summary-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 0; padding: 0;
}
.moodle-quiz .summary-stats > div {
  background: #f8f9fa; border-radius: 4px; padding: 10px 8px; text-align: center;
}
.moodle-quiz .summary-stats dt {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: #6c757d; margin-bottom: 4px;
}
.moodle-quiz .summary-stats dd {
  font-size: 18px; font-weight: 700; color: #1d2125; margin: 0; line-height: 1;
}
.moodle-quiz .summary-filters {
  list-style: none; margin: 0; padding: 0;
  border-top: 1px solid #f1f3f5;
}
.moodle-quiz .summary-filters li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; font-size: 13px; border-bottom: 1px solid #f1f3f5;
}
.moodle-quiz .summary-filters li:last-child { border-bottom: 0; }
.moodle-quiz .summary-filters span { color: #6c757d; }
.moodle-quiz .summary-filters strong {
  color: #1d2125; font-weight: 600; text-align: right; max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.moodle-quiz .summary-cta {
  width: 100%; padding: 12px 16px; font-size: 14px; font-weight: 600;
}
.moodle-quiz .summary-note {
  font-size: 12px; color: #6c757d; margin: 0; line-height: 1.5;
}

/* Review retry-selection */
.moodle-quiz .review-question-wrap { position: relative; }
.moodle-quiz .review-question-wrap.is-selected > .que { box-shadow: 0 0 0 2px #f7941d; border-radius: 4px; }
.moodle-quiz .review-pick {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid #dee2e6; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 600; color: #495057;
  cursor: pointer; user-select: none;
}
.moodle-quiz .review-pick input { margin: 0; cursor: pointer; }
.moodle-quiz .review-pick:hover { border-color: #f7941d; color: #1d2125; }
.moodle-quiz .review-question-wrap.is-selected .review-pick {
  background: #f7941d; border-color: #d97e00; color: #fff;
}
.moodle-quiz .retry-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #1d2125; color: #fff; border-radius: 999px;
  padding: 8px 8px 8px 20px; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 100;
}
.moodle-quiz .retry-bar-count { font-size: 14px; }
.moodle-quiz .retry-bar-count strong { color: #f7941d; }
.moodle-quiz .retry-bar .btn { padding: 8px 18px; }

html.dark .moodle-quiz .review-pick { background: #2a2d33; border-color: #3a3d42; color: #adb5bd; }
html.dark .moodle-quiz .review-pick:hover { color: #e6e8eb; }

html.dark .moodle-quiz .config-summary-inner { background: #1a1d22; border-color: #3a3d42; }
html.dark .moodle-quiz .summary-head { border-bottom-color: #3a3d42; }
html.dark .moodle-quiz .summary-head h3 { color: #e6e8eb; }
html.dark .moodle-quiz .summary-stats > div { background: #2a2d33; }
html.dark .moodle-quiz .summary-stats dd { color: #e6e8eb; }
html.dark .moodle-quiz .summary-filters,
html.dark .moodle-quiz .summary-filters li { border-color: #2a2d33; }
html.dark .moodle-quiz .summary-filters strong { color: #e6e8eb; }
html.dark .moodle-quiz .summary-note { color: #9ba1a6; }
.moodle-quiz .config-card > h2 {
  font-size: 22px; font-weight: 600; margin: 0 0 24px;
  padding-bottom: 12px; border-bottom: 1px solid #e9ecef;
}
.moodle-quiz .config-section {
  margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 1px solid #f1f3f5;
}
.moodle-quiz .config-section:last-of-type { border-bottom: 0; padding-bottom: 0; }
.moodle-quiz .config-section h3 {
  font-size: 12px; font-weight: 700; margin: 0 0 12px;
  text-transform: uppercase; letter-spacing: 0.06em; color: #6c757d;
}
.moodle-quiz .config-section-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.moodle-quiz .config-section-head h3 { margin: 0; }
.moodle-quiz .config-section-actions { display: flex; gap: 12px; }
.moodle-quiz .config-hint {
  font-size: 12px; color: #6c757d; margin-top: 6px;
}
.moodle-quiz .link-btn {
  background: none; border: 0; color: #f7941d; cursor: pointer;
  font-size: 13px; padding: 0; text-decoration: none;
}
.moodle-quiz .link-btn:hover { text-decoration: underline; }
.moodle-quiz .link-btn:disabled { color: #adb5bd; cursor: not-allowed; text-decoration: none; }

.moodle-quiz .chip-group {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.moodle-quiz .chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid #ced4da; background: #fff;
  border-radius: 999px; font-size: 13px; cursor: pointer;
  color: #1d2125; transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
}
.moodle-quiz .chip:hover { background: #f1f3f5; border-color: #adb5bd; }
.moodle-quiz .chip-active {
  background: #f7941d; border-color: #d97e00; color: #fff;
  box-shadow: 0 1px 2px rgba(247,148,29,0.4), inset 0 0 0 1px rgba(255,255,255,0.2);
  font-weight: 600;
}
.moodle-quiz .chip-active:hover { background: #d97e00; border-color: #b56a00; }
.moodle-quiz .chip-count {
  background: rgba(0,0,0,0.08); color: inherit; font-size: 11px;
  padding: 1px 6px; border-radius: 999px; font-weight: 600;
}
.moodle-quiz .chip-active .chip-count { background: rgba(0,0,0,0.18); color: #fff; }

.moodle-quiz .config-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-top: 4px;
}
.moodle-quiz .config-field {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: #495057;
}
.moodle-quiz .config-field input[type="number"] {
  padding: 6px 10px; border: 1px solid #ced4da; border-radius: 4px;
  font-size: 14px; background: #fff;
}
.moodle-quiz .config-field small { color: #6c757d; font-size: 11px; }

.moodle-quiz .config-checkbox {
  display: flex; align-items: center; gap: 8px; font-size: 14px;
  margin: 6px 0; cursor: pointer;
}

.moodle-quiz .config-actions { margin-top: 8px; }

/* ==========================================
   DARK MODE
   ========================================== */
html.dark .moodle-app { background: #0f1115; }
html.dark .moodle-navbar { background: #1a1d22; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
html.dark .moodle-nav-links a { color: #e6e8eb; }
html.dark .moodle-app-main { background: #0f1115; }
html.dark .moodle-brand img { filter: brightness(0.95) invert(0.92) hue-rotate(180deg); }

html.dark .user-avatar-container { background: #2a2d33; border-color: #3a3d42; }
html.dark .user-avatar-svg { fill: #adb5bd; }
html.dark .user-dropdown-arrow::after { color: #9ba1a6; }
html.dark .moodle-sidebar-toggle { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-sidebar-toggle:hover { background: #3a3d42; }

html.dark .moodle-quiz { background: #0f1115; color: #e6e8eb; }
html.dark .moodle-quiz .quiz-breadcrumb { color: #9ba1a6; }
html.dark .moodle-quiz .quiz-breadcrumb a { color: #e6e8eb; }
html.dark .moodle-quiz .quiz-breadcrumb span { color: #5a5f66; }
html.dark .moodle-quiz .quiz-title { color: #f1f3f5; }
html.dark .moodle-quiz a { color: #f7941d; }

html.dark .moodle-quiz .timer { background: #2a2d33; color: #e6e8eb; }
html.dark .moodle-quiz .timer.timer-danger { background: #3a1f1c; color: #ff7a70; }
html.dark .moodle-timer-box { background: #2a2d33; border-color: #ff7a70; color: #ff7a70; }
html.dark .timer-toggle-btn { background-color: #2a2d33 !important; color: #e6e8eb !important; border-color: #3a3d42 !important; }
html.dark .timer-toggle-btn:hover { background-color: #3a3d42 !important; }

html.dark .moodle-drawer-toggle { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-drawer-toggle:hover { background: #3a3d42; }
html.dark .drawer-toggle-btn { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .drawer-toggle-btn:hover { background-color: #3a3d42; }

html.dark .btn-back { background-color: #2a2d33 !important; color: #e6e8eb !important; border-color: #3a3d42 !important; }
html.dark .btn-back:hover { background-color: #3a3d42 !important; }

html.dark .moodle-quiz .quizreviewsummary { background: #1a1d22; border-color: #3a3d42; }
html.dark .moodle-quiz .quizreviewsummary th { background: #242830; color: #e6e8eb; }
html.dark .moodle-quiz .quizreviewsummary td { color: #e6e8eb; }
html.dark .moodle-quiz .quizreviewsummary th,
html.dark .moodle-quiz .quizreviewsummary td { border-bottom-color: #3a3d42; }

html.dark .moodle-quiz .card-block { background: #1a1d22; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-quiz .card-block h3 { color: #f1f3f5; }
html.dark .moodle-quiz .quiz-nav-side .card-block { background: #1a1d22; border-color: #3a3d42; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
html.dark .nav-header-row { border-bottom-color: #3a3d42; }
html.dark .nav-header-row h3 { color: #f1f3f5; }
html.dark .nav-close-btn { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .nav-close-btn:hover { background-color: #3a3d42; }

html.dark .moodle-quiz .qnbutton { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-quiz .qnbutton:hover { border-color: #f7941d; }
html.dark .moodle-quiz .qnbutton.notyetanswered { background: #2a2d33; color: #adb5bd; }
html.dark .moodle-quiz .qnbutton.answersaved,
html.dark .moodle-quiz .qnbutton.answersaved { background-color: #3a3d42 !important; background: #3a3d42 !important; color: #e6e8eb; }
html.dark .moodle-quiz .qnbutton.correct { background: #1e3a25; color: #6dd58c; }
html.dark .moodle-quiz .qnbutton.incorrect { background: #3a1f1c; color: #ff7a70; }
html.dark .moodle-quiz .qnbutton.thispage { border-color: #f1f3f5 !important; }
html.dark .moodle-quiz .qnbutton.info { background-color: #3a3d42; border-color: #3a3d42; color: #adb5bd; }

html.dark .moodle-quiz .que .info { background: #242830; border-color: #3a3d42; }
html.dark .moodle-quiz .que .info .no { color: #f1f3f5; }
html.dark .moodle-quiz .que .info .state-text { color: #adb5bd; }
html.dark .moodle-quiz .que .info .grade { color: #9ba1a6; border-bottom-color: #3a3d42; }
html.dark .moodle-quiz .que .info .questionflag a { color: #e6e8eb; }
html.dark .questionflagimage-svg { fill: #9ba1a6; }
html.dark .questionflagimage-svg.flagged { fill: #ff7a70; }
html.dark .moodle-quiz .que.correct .info .state { color: #6dd58c; }
html.dark .moodle-quiz .que.incorrect .info .state { color: #ff7a70; }
html.dark .moodle-quiz .que.notanswered .info .state { color: #f0c674; }

html.dark .moodle-quiz .formulation { background: #1c2a30 !important; color: #e6e8eb; }
html.dark .moodle-quiz .qtext { color: #e6e8eb; }
html.dark .moodle-quiz .ablock .prompt { color: #adb5bd; }
html.dark .moodle-quiz .answer label { color: #e6e8eb; }
html.dark .option-label-bullet { color: #adb5bd; }
html.dark .moodle-quiz .answer .correct::after { color: #6dd58c; }
html.dark .moodle-quiz .answer .incorrect::after { color: #ff7a70; }

html.dark .moodle-quiz .outcome { background: #3a2e1c; border-color: #5a4528; color: #f0c674; }
html.dark .moodle-quiz .outcome .rightanswer,
html.dark .moodle-quiz .outcome .generalfeedback { color: #f0c674; }

html.dark .moodle-quiz .score-summary { border-top-color: #3a3d42; }
html.dark .moodle-quiz .score-summary .row.total { border-top-color: #3a3d42; }
html.dark .moodle-quiz .score-summary .text-correct { color: #6dd58c; }
html.dark .moodle-quiz .score-summary .text-wrong { color: #ff7a70; }

html.dark .moodle-quiz .page-nav .btn-secondary { background-color: #2a2d33 !important; color: #e6e8eb !important; border-color: #3a3d42 !important; }
html.dark .moodle-quiz .page-nav .btn-secondary:hover { background-color: #3a3d42 !important; }
html.dark .moodle-quiz .page-nav .btn-primary { background-color: #f7941d !important; border-color: #f7941d !important; color: #1a1d22 !important; }
html.dark .moodle-quiz .page-nav .btn-primary:hover { background-color: #ffa53d !important; }

html.dark .moodle-quiz .start-card { background: #1a1d22; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-quiz .start-note { background: #3a2e1c; border-color: #5a4528; color: #f0c674; }
html.dark .moodle-quiz .start-error { background: #3a1f1c; border-color: #5a2a26; color: #ff7a70; }

html.dark .exam-page-loading { color: #9ba1a6; }

html.dark .moodle-quiz .config-section h3 { color: #adb5bd; }
html.dark .moodle-quiz .config-hint { color: #9ba1a6; }
html.dark .moodle-quiz .chip { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-quiz .chip:hover { background: #3a3d42; }
html.dark .moodle-quiz .chip-active { background: #f7941d; border-color: #d97e00; color: #1a1d22; }
html.dark .moodle-quiz .chip-active:hover { background: #d97e00; border-color: #b56a00; }
html.dark .moodle-quiz .config-card > h2 { border-bottom-color: #3a3d42; }
html.dark .moodle-quiz .config-section { border-bottom-color: #2a2d33; }
html.dark .moodle-quiz .config-field { color: #adb5bd; }
html.dark .moodle-quiz .config-field input[type="number"] { background: #2a2d33; border-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-quiz .config-field small { color: #9ba1a6; }
html.dark .moodle-quiz .config-checkbox { color: #e6e8eb; }

html.dark .moodle-help-float-btn { background-color: #3a3d42; color: #e6e8eb; }
html.dark .moodle-help-float-btn:hover { background-color: #4a4d52; }

html.dark .btn-finish-attempt { color: #f7941d; }

/* Override quiz.css high-specificity light rules */
html.dark .moodle-quiz table.quizreviewsummary th.cell { background: #242830 !important; color: #e6e8eb; }
html.dark .moodle-quiz table.quizreviewsummary td.cell { background: #1a1d22 !important; color: #e6e8eb; }

html.dark .moodle-quiz .generaltable { color: #e6e8eb; }
html.dark .moodle-quiz .generaltable tbody tr:nth-of-type(odd) { background-color: rgba(255,255,255,0.03) !important; }
html.dark .moodle-quiz .generaltable tbody tr:nth-of-type(even) { background-color: #1a1d22 !important; }
html.dark .moodle-quiz .generaltable thead .sticky-column { background-color: #242830 !important; }
html.dark .moodle-quiz .generaltable tbody tr:nth-of-type(odd) .sticky-column { background-color: rgba(255,255,255,0.03) !important; }
html.dark .moodle-quiz .generaltable tbody tr:hover { color: #f1f3f5 !important; background-color: rgba(255,255,255,0.06) !important; }
html.dark .moodle-quiz .generaltable tbody tr:hover td.sticky-column { background-color: rgba(255,255,255,0.06) !important; }
html.dark .moodle-quiz .generaltable th,
html.dark .moodle-quiz .generaltable td { border-color: #3a3d42; }

/* Advanced settings <details> */
.moodle-quiz .advanced-settings,
.advanced-settings { background: #f8f9fa; }
html.dark .moodle-quiz .advanced-settings,
html.dark .advanced-settings {
  background: #1a1d22 !important;
  border-color: #3a3d42 !important;
  color: #e6e8eb;
}

/* WrittenViewer Solution box - hidden state (light mode default) */
.moodle-quiz .outcome.solution-hidden { background: #f1f3f5; border-color: #dee2e6; color: #495057; }
html.dark .moodle-quiz .outcome.solution-hidden { background: #242830 !important; border-color: #3a3d42 !important; color: #e6e8eb; }
html.dark .moodle-quiz .outcome { background: #3a2e1c !important; border-color: #5a4528 !important; color: #f0c674 !important; }
html.dark .moodle-quiz .outcome .rightanswer,
html.dark .moodle-quiz .outcome .generalfeedback { color: #f0c674 !important; }

/* QuestionBank chip backgrounds */
html.dark .qb-chip-light { background: #2a2d33 !important; color: #e6e8eb !important; }
