/* Timed exam and chapter diagnostics */
.bank-page-title .bank-exam-link {
  flex: 0 0 auto;
  align-self: flex-end;
  min-height: 44px;
  border: 1px solid #ebd3b4;
  background: #fcf2e4;
  color: #84460f;
  white-space: nowrap;
}
.bank-page-title .bank-exam-link:hover { background: #f5e2c8; }
.bank-page-title .bank-exam-link:focus-visible { outline: 2px solid #995312; outline-offset: 3px; }

/* Leave room for the centered brand when the sixth navigation item is present. */
@media (min-width: 1241px) and (max-width: 1399px) {
  .side-nav .nav-item,
  .side-nav .nav-item.nav-ai-qa,
  .side-nav .nav-item.nav-ai-qa:hover,
  .side-nav .nav-item.nav-ai-qa.active { padding-inline: 7px !important; }
}

.exam-page,
.weak-chapters {
  --exam-accent: #995312;
  --exam-fill: #de8e35;
  --exam-line: #e6dcd0;
  --exam-tint: #fcf4e8;
  --exam-paper: #faf7f3;
  --exam-danger: #932f27;
  --exam-danger-bg: #fff2ef;
}

.exam-page {
  --exam-sticky-top: 86px;
  max-width: 1140px;
  margin: 0 auto;
}

.exam-page .page-title { margin-bottom: 24px; }
.exam-page .page-title h1 {
  margin: 5px 0 8px;
  font-size: clamp(27px, 4vw, 42px);
  letter-spacing: -.04em;
}
.exam-page .page-title p,
.exam-rules,
.exam-history,
.exam-results,
.weak-chapters { line-height: 1.65; }
.exam-page .page-title p { font-size: 14px; }

.exam-page button:focus-visible,
.exam-page select:focus-visible,
.exam-page input:focus-visible,
.weak-chapters button:focus-visible {
  outline: 2px solid var(--exam-accent);
  outline-offset: 3px;
}

.exam-setup {
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--exam-line);
  border-radius: 24px;
  background: linear-gradient(145deg, #fff 24%, var(--exam-tint) 100%);
}

.exam-setup h2,
.exam-history h2,
.exam-results h2,
.weak-chapters h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  letter-spacing: -.025em;
}
.exam-setup p,
.exam-history p,
.exam-result-header p,
.weak-chapters-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.exam-setup-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin: 20px 0 16px;
}
.exam-setup-fields label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}
.exam-setup-fields select,
.exam-setup-fields input {
  min-width: 0;
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--exam-line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.exam-page .btn,
.exam-page .plain-button,
.weak-chapters .btn { min-height: 44px; }
.exam-setup-fields .btn { min-height: 46px; white-space: nowrap; }

.exam-rules {
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.exam-rules li + li { margin-top: 4px; }
.exam-resume {
  margin: 14px 0;
  padding: 15px 17px;
  border: 1px solid #edcfaa;
  border-radius: 15px;
  background: var(--exam-tint);
  color: var(--muted);
  font-size: 13px;
}
.exam-resume p { margin: 0 0 9px; }

.exam-history {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--exam-line);
  border-radius: 22px;
  background: var(--exam-paper);
}
.exam-history .section-head { margin: 0; }
.exam-history-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.exam-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--exam-line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
}
.exam-history-item small { display: block; color: var(--muted); }
.exam-history-item b { color: var(--exam-accent); font-variant-numeric: tabular-nums; }

.exam-topline {
  position: sticky;
  top: var(--exam-sticky-top);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--exam-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 5px 18px #38240d13;
}
.exam-topline-copy { min-width: 0; }
.exam-topline-copy h1 {
  margin: 3px 0;
  color: var(--ink);
  font-size: clamp(16px, 3vw, 24px);
  letter-spacing: -.035em;
  line-height: 1.2;
}
.exam-topline-copy p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.exam-timer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: 10px;
  background: #23170e;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}
.exam-timer [data-exam-clock] {
  min-width: 7.5ch;
  color: #fff2de;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.exam-timer.is-urgent,
.exam-topline.is-urgent .exam-timer { background: var(--exam-danger); }

.exam-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(215px, 260px);
  align-items: start;
  gap: 14px;
}
.exam-layout > * { min-width: 0; }
.exam-question {
  scroll-margin-top: calc(var(--exam-sticky-top) + 82px);
  padding: clamp(16px, 3vw, 28px);
}
.exam-question-meta { flex-wrap: wrap; line-height: 1.45; }
.exam-question .question-text { overflow-wrap: anywhere; }
.exam-question .option { min-height: 45px; overflow-wrap: anywhere; }
.exam-question .option.selected:not(.correct):not(.incorrect) {
  background: #fff7e9;
  border-color: var(--exam-accent);
}
.exam-question .option.correct { background: #edf6ee; border-color: #609c74; }
.exam-question .option.incorrect { background: var(--exam-danger-bg); border-color: #bd7168; }
.exam-question .option[disabled] { opacity: 1; cursor: default; }
.exam-actions { flex-wrap: wrap; }
.exam-actions .btn.secondary { background: #f2e1cc; color: #48280e; }
.exam-actions .btn.secondary:hover { background: #ebd4b8; }
.exam-actions .actions-left,
.exam-actions .actions-right { flex-wrap: wrap; }

.exam-side {
  position: sticky;
  top: calc(var(--exam-sticky-top) + 82px);
  padding: 15px;
}
.exam-side h2,
.exam-side h3 { margin: 0 0 5px; font-size: 15px; }
.exam-nav-summary,
.exam-side p { margin: 0 0 9px; color: var(--muted); font-size: 12px; }
.exam-nav-scroll {
  max-height: min(48vh, 400px);
  overflow: auto;
  padding: 4px;
  scrollbar-width: thin;
}
@media (min-width: 701px) and (max-height: 550px) {
  .exam-side { top: calc(var(--exam-sticky-top) + 100px); }
  .exam-question { scroll-margin-top: calc(var(--exam-sticky-top) + 100px); }
  .exam-nav-scroll {
    max-height: min(48vh, 400px, max(64px, calc(100vh - var(--exam-sticky-top) - 188px)));
    max-height: min(48vh, 400px, max(64px, calc(100dvh - var(--exam-sticky-top) - 188px)));
  }
}
.exam-number-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}
.exam-number-grid .number-button {
  display: grid;
  place-items: center;
  min-height: 31px;
  padding: 3px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.exam-number-grid .number-button.is-wrong {
  border-color: #d69c94;
  background: var(--exam-danger-bg);
  color: var(--exam-danger);
}
.exam-number-grid .number-button.is-blank {
  border-style: dashed;
  color: var(--muted);
}
.exam-number-grid .number-button.current {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.exam-number-grid .number-button:focus-visible {
  outline: 2px solid var(--exam-accent);
  outline-offset: 1px;
}

.exam-results {
  margin-bottom: 20px;
  padding: clamp(17px, 3.5vw, 30px);
  border: 1px solid var(--exam-line);
  border-radius: 23px;
  background: var(--exam-paper);
}
.exam-result-header,
.exam-review-header,
.exam-subject-heading,
.weak-chapters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.exam-result-header,
.exam-review-header { flex-wrap: wrap; }
.exam-result-header h1,
.exam-review-header h2 { margin: 0; }
.exam-review-header { margin: 25px 0 12px; }
.exam-review-header h1 { margin: 2px 0; font-size: 25px; }
.exam-review-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.exam-result-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
  margin: 16px 0 22px;
}
.exam-metric {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--exam-line);
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.exam-metric:first-child {
  border-color: #21160e;
  background: #21160e;
  color: #f7e5cd;
}
.exam-metric strong,
.exam-metric b {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.exam-metric:first-child strong,
.exam-metric:first-child b { color: #fff; }
.exam-subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 9px;
  margin-top: 10px;
}
.exam-subject-row {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--exam-line);
  border-radius: 13px;
  background: #fff;
}
.exam-subject-heading { color: var(--ink); font-size: 13px; }
.exam-subject-heading span { color: var(--exam-accent); white-space: nowrap; }
.exam-subject-row small { display: block; color: var(--muted); font-size: 11px; }
.exam-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.exam-result-actions .btn.secondary { background: #f2e4d2; }
.exam-subject-track,
.weak-chapter-track {
  height: 5px;
  margin: 8px 0 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe8df;
}
.exam-subject-track span,
.weak-chapter-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--exam-fill);
}

.weak-chapters {
  margin-top: 20px;
  padding: clamp(16px, 3vw, 25px);
  border: 1px solid var(--exam-line);
  background: var(--exam-paper);
}
.weak-chapters-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.weak-chapter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(145px, 225px) auto;
  align-items: center;
  gap: 13px;
  padding: 11px 13px;
  border: 1px solid var(--exam-line);
  border-radius: 14px;
  background: #fff;
}
.weak-chapter-name,
.weak-chapter-score { display: grid; gap: 2px; min-width: 0; }
.weak-chapter-name strong { font-size: 15px; overflow-wrap: anywhere; }
.weak-chapter-name span,
.weak-chapter-score span { color: var(--muted); font-size: 12px; }
.weak-chapter-score b { color: var(--exam-accent); font-size: 13px; font-variant-numeric: tabular-nums; }
.weak-chapter-track { margin: 3px 0 0; }
.weak-chapters-empty {
  margin-top: 14px;
  padding: 15px;
  border: 1px dashed var(--exam-line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}
.weak-chapters-empty p { margin: 4px 0 12px; color: var(--muted); font-size: 13px; }

@media (max-width: 700px) {
  .bank-page-title { flex-direction: row; align-items: flex-start; gap: 10px; }
  .bank-page-title .bank-exam-link { align-self: flex-start; padding-inline: 12px; }
  .exam-page { --exam-sticky-top: max(6px, env(safe-area-inset-top)); }
  .exam-page .page-title { gap: 10px; margin-bottom: 14px; }
  .exam-page .page-title p { font-size: 13px; }
  .exam-setup-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-setup-fields .btn { grid-column: 1 / -1; }
  .exam-topline { gap: 7px; padding: 8px; border-radius: 13px; }
  .exam-topline-copy p { font-size: 11px; }
  .exam-timer { gap: 5px; padding: 6px 8px; }
  .exam-timer [data-exam-clock] { font-size: 16px; }
  .exam-layout { grid-template-columns: minmax(0, 1fr); }
  .exam-side { position: static; }
  .exam-nav-scroll { max-height: min(35vh, 250px); }
  .exam-number-grid { grid-template-columns: repeat(auto-fit, minmax(37px, 1fr)); }
  .exam-number-grid .number-button { min-height: 38px; aspect-ratio: auto; }
  .exam-actions { gap: 9px; }
  .exam-actions .plain-button { flex: 1; }
  .exam-actions > .btn { align-self: stretch; }
  .exam-history { padding: 15px; }
  .exam-history-item { gap: 8px; padding-inline: 9px; }
  .exam-result-header, .exam-review-header { gap: 7px; }
  .exam-result-metrics, .exam-subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-result-actions .btn:first-child { flex: 1 0 100%; }
  .exam-result-actions .btn { flex: 1; padding-inline: 11px; }
  .weak-chapter-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 9px; }
  .weak-chapter-row .btn { grid-row: 1 / span 2; grid-column: 2; white-space: nowrap; }
  .weak-chapter-score { grid-column: 1; }
}

@media (max-width: 359px) {
  .exam-clock-label { font-size: 10px; }
  .exam-topline .btn { padding-inline: 10px; }
  .exam-setup-fields { grid-template-columns: 1fr; }
}
.exam-submit-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 15px;
  border: 1px solid var(--exam-line);
  border-radius: 12px;
  background: var(--exam-tint);
}
.exam-submit-confirm p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.exam-submit-confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
