[hidden] { display: none !important; }

/* Simple, clean styling (no frameworks) */
:root {
  --bg: #0b1220;
  --card: #101a33;
  --text: #e9eefc;
  --muted: #a7b4d6;
  --border: rgba(255,255,255,0.10);
  --primary: #4f7cff;
  --danger: #ff4f63;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 20% 0%, #152652 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.45;
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.container { max-width: 980px; margin: 22px auto; padding: 0 16px; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

h1 { margin: 0 0 10px; font-size: 24px; }
h2 { margin: 18px 0 10px; font-size: 18px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin: 14px 0;
}
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--muted); }
.field small { font-size: 12px; }
.field input, .field select {
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}
.field input:focus, .field select:focus { border-color: rgba(79,124,255,0.7); }

.field.compact { width: 160px; }

#resultsTopBar {
  margin-bottom: 14px; /* space below the button row */
}

.row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

.spacer { flex: 1; }

button {
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
button.primary { background: rgba(79,124,255,0.22); border-color: rgba(79,124,255,0.65); }
button.danger  { background: rgba(255,79,99,0.18); border-color: rgba(255,79,99,0.6); }
button.ghost   { background: rgba(0,0,0,0.10); }

button.warn {
  background: rgba(255, 215, 0, 0.14);
  border-color: rgba(255, 215, 0, 0.55);
  color: rgba(255, 215, 0, 0.95);
}
button.warn:hover {
  background: rgba(255, 215, 0, 0.18);
  border-color: rgba(255, 215, 0, 0.70);
}

.notice {
  margin-top: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.20);
  padding: 12px;
  border-radius: 10px;
}

/* Results: Breakdown title bigger + divider */
.breakdownNotice strong {
  display: block;                 /* makes the divider span full width */
  font-size: 22px;                /* adjust size here */
  font-weight: 800;
  color: #fff;                    /* white */

  padding-bottom: 10px;           /* space above divider */
  margin-bottom: 10px;            /* space below divider */
  border-bottom: 1px solid var(--border); /* subtle divider */
}

.examHeader {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.kicker {
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 700;
  color: #fff;
}
.titleLine { display: flex; gap: 12px; align-items: baseline; }
.progress { font-weight: 650; }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); }

.questionBlock { padding: 6px 0 10px; }
.qText { font-size: 18px; white-space: pre-wrap; }
.qImage {
  margin-top: 10px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* Options list */
.options { display: grid; gap: 8px; margin: 12px 0; }

/* Row = letter OUTSIDE + pill INSIDE */
.optionRow {
  display: flex;
  align-items: center; /* vertical alignment fixed */
  gap: 10px;
}

/* Letter column (outside pill) */
.optLetter {
  width: 1.6em;
  font-weight: 700;
  opacity: 0.85;
  text-align: center;
}

/* Pill */
.option {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center; /* align checkbox/radio + text */
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.14);
}

/* nicer UX on hover */
.option:hover {
  border-color: rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.18);
}

/* ✅ Make CHECKBOX look like RADIO (both circular) */
.option input[type="checkbox"],
.option input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;

  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;

  border: 2px solid rgba(255,255,255,0.45);
  border-radius: 999px;
  background: rgba(0,0,0,0.25);

  display: grid;
  place-content: center;
  cursor: pointer;
}

.option input[type="checkbox"]::before,
.option input[type="radio"]::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
  transform: scale(0);
  transition: transform 120ms ease-in-out;
}

.option input[type="checkbox"]:checked::before,
.option input[type="radio"]:checked::before {
  transform: scale(1);
}

.option input:focus-visible {
  outline: 2px solid rgba(79,124,255,0.85);
  outline-offset: 2px;
}

.option label { cursor: pointer; flex: 1; }

/* Fill-in-the-blank input inside options area */
.options .field {
  margin: 0;
  width: 100%;
}
.options .field input {
  width: 100%;
}

.navRow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
/* Results: make the Breakdown box span both columns */
#summary > .breakdownNotice {
  grid-column: 1 / -1;
}

@media (max-width: 820px) {
  .summary { grid-template-columns: 1fr; }
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.18);
}
.kpi .big { font-size: 34px; font-weight: 800; }
.kpi .label { color: var(--muted); font-size: 13px; }

.review {
  display: grid;
  /* Explicit 1-column track that can shrink (prevents grid overflow on long content) */
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.reviewItem {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.18);

  /* Performance: skip rendering off-screen cards until you scroll to them */
  content-visibility: auto;
  contain-intrinsic-size: 520px;

  /* Allow the card itself to shrink inside the grid without forcing horizontal overflow */
  min-width: 0;
  max-width: 100%;

  /* Prevent long lines (incl. copied NBSPs / long equations) from overflowing the card */
  overflow-wrap: anywhere;
}

.reviewQuestion {
  margin-top: 6px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.reviewQuestion strong {
  display: inline;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Results page: question identifier line (domain • subarea • Q#) */
.reviewMeta {
  font-size: 22px;            /* change this to whatever you want */
  font-weight: 700;
  color: #fff;

  padding-bottom: 10px;       /* space between text and divider */
  margin-bottom: 12px;        /* space after divider */
  border-bottom: 1px solid var(--border); /* subtle divider line */
}

/* If your HTML still uses: class="reviewMeta muted" */
.reviewMeta.muted {
  color: #fff;
}

.badge {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  margin-right: 8px;
  color: var(--muted);
}
.badge.ok { border-color: rgba(79,255,179,0.5); color: rgba(79,255,179,0.9); }
.badge.no { border-color: rgba(255,79,99,0.55); color: rgba(255,79,99,0.92); }

/* Results tag colors */
.badge.yellow {
  border-color: rgba(255, 215, 0, 0.55);
  color: rgba(255, 215, 0, 0.95);
}

.badge.green {
  border-color: rgba(79, 255, 179, 0.55);
  color: rgba(79, 255, 179, 0.95);
}

.badge.orange {
  border-color: rgba(255, 159, 64, 0.60);
  color: rgba(255, 159, 64, 0.95);
}

/* Review sections (Results page) */
.reviewSection {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.14);
}

.reviewSectionTitle {
  margin-bottom: 8px;
}

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

.reviewSection.answerSection {
  background: rgba(255, 215, 0, 0.06);
  border-color: rgba(255, 215, 0, 0.18);
}

.reviewSection.correctSection {
  background: rgba(79, 255, 179, 0.06);
  border-color: rgba(79, 255, 179, 0.18);
}

.reviewSection.explanationSection {
  background: rgba(255, 159, 64, 0.06);
  border-color: rgba(255, 159, 64, 0.18);
}

/* ✅ Put "Your answer" + "Correct" values to the RIGHT of their badges */
.reviewSection.answerSection,
.reviewSection.correctSection {
  display: grid;
  /* Allow the right column to shrink/wrap instead of overflowing */
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
}

/* ✅ Answer section: keep answer text on the LEFT and put the manual grading toggle on the RIGHT */
.reviewSection.answerSection .reviewSectionContent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.reviewSection.answerSection .answerText {
  flex: 1 1 auto;
  min-width: 0;
}


.reviewSectionContent {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* MathJax output doesn't like aggressive word-breaking.
   Keep math layout intact while still letting surrounding text wrap. */
mjx-container, mjx-container * {
  overflow-wrap: normal !important;
  word-break: normal !important;
  white-space: normal !important;
}

/* Manual grading toggle (Results page)
   Used for fill-in-the-blank questions when you want to count an answer as correct. */
.manualCorrectToggle {
  margin-top: 0;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
  white-space: nowrap;
}


.manualCorrectToggle input {
  transform: translateY(1px);
}

.manualCorrectHint {
  margin-top: 8px;
}

.reviewSection.answerSection .reviewSectionTitle,
.reviewSection.correctSection .reviewSectionTitle {
  margin-bottom: 0; /* remove stacked spacing */
}

.reviewSection.answerSection .reviewSectionContent,
.reviewSection.correctSection .reviewSectionContent {
  margin: 0;
}

/* Explanation dropdown (Results page) */
.reviewSection.explanationSection details {
  width: 100%;
}

.reviewSection.explanationSection details > summary {
  list-style: none;            /* Firefox */
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

/* Hide the default marker (Chrome/Safari) */
.reviewSection.explanationSection details > summary::-webkit-details-marker {
  display: none;
}

/* Hide marker (Firefox) */
.reviewSection.explanationSection details > summary::marker {
  content: "";
}

/* Custom arrow on the RIGHT */
.reviewSection.explanationSection details > summary::after {
  content: "▸";
  margin-left: auto;
  opacity: 0.85;
  transition: transform 120ms ease-in-out;
}

/* Rotate arrow when open */
.reviewSection.explanationSection details[open] > summary::after {
  transform: rotate(90deg);
}

.reviewMeta {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.footer { text-align: center; padding: 22px 10px; }
