[hidden] { display: none !important; }

.exam-header { margin-bottom: 18px; }
.exam-intro { max-width: 900px; margin: 0 auto; }
.intro-copy { position: relative; z-index: 1; }
.mock-label {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff9e9;
  background: var(--berry);
  font: 700 0.78rem/1 "Fredoka", sans-serif;
  letter-spacing: 0.09em;
}
.exam-intro h2 { margin: 0 0 8px; font-size: clamp(1.55rem, 4vw, 2.2rem); }
.exam-intro > .intro-copy > p { line-height: 1.55; }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.rule-grid article {
  padding: 15px;
  border: 2px solid rgba(122, 74, 40, 0.18);
  border-radius: 16px;
  background: var(--cream);
}
.rule-grid strong, .rule-grid span { display: block; }
.rule-grid strong { margin-bottom: 5px; color: var(--pine); font-size: 1.05rem; }
.rule-grid span { line-height: 1.45; }
.scoring-rule {
  padding: 15px 17px;
  border-left: 6px solid var(--gold);
  border-radius: 12px;
  background: #fffaf0;
}
.scoring-rule h3, .scoring-rule p { margin: 0; }
.scoring-rule p { margin-top: 7px; line-height: 1.5; }
.scoring-rule a { color: var(--bark); font-weight: 700; }
.disclaimer { color: #654c3b; font-size: 0.93rem; }
.start-button { margin-top: 6px; padding: 13px 22px; font-size: 1.05rem; }

.exam-shell { display: grid; gap: 14px; }
.storage-notice {
  padding: 11px 14px;
  border: 2px solid #d8b56a;
  border-radius: 12px;
  color: var(--pine);
  background: #fff6d7;
  font-weight: 700;
}
.storage-notice[data-kind="error"] { border-color: #b9432b; color: #872e1e; background: #fff0e9; }

.exam-statusbar {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 3px solid #d8b56a;
  border-radius: 18px;
  color: #fff9e9;
  background: #294733;
  box-shadow: 0 5px 0 rgba(20, 43, 28, 0.35);
}
.timer-box { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.timer-box span { font-size: 0.82rem; opacity: 0.82; }
.timer-box strong { font: 700 1.35rem/1 "Fredoka", sans-serif; letter-spacing: 0.04em; }
.timer-box strong.urgent { color: #ffd274; }
.exam-statusbar > p { flex: 1; margin: 0; text-align: center; }
.status-actions { display: flex; gap: 8px; }
.small-button { padding: 8px 13px; box-shadow: none !important; }

.exam-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.answer-panel, .exam-main, .exam-results {
  position: relative;
  border: 4px solid #d8b56a;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 10px 0 rgba(31, 61, 43, 0.16);
}
.answer-panel { position: sticky; top: 92px; padding: 16px; }
.answer-panel h2 { margin: 0 0 12px; font-size: 1.1rem; }
.answer-card { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.card-number {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 2px solid #ccb77e;
  border-radius: 9px;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: none;
  font: 700 0.92rem/1 "Fredoka", sans-serif;
}
.card-number.answered { color: white; border-color: var(--moss); background: var(--moss); }
.card-number.current { outline: 3px solid var(--gold); outline-offset: 2px; }
.card-number > span { position: absolute; top: -5px; right: -4px; color: #ffd25a; font-size: 0.72rem; text-shadow: 0 1px 2px #553714; }
.card-number.correct { background: #2e7d45; border-color: #2e7d45; }
.card-number.wrong { background: #b8432c; border-color: #b8432c; }
.card-number.blank { color: var(--ink); background: #efe2c4; }
.card-key { margin: 12px 0 0; color: #655848; font-size: 0.76rem; line-height: 1.7; }
.key-dot { display: inline-block; width: 0.75rem; height: 0.75rem; margin-right: 3px; border-radius: 50%; background: var(--moss); }
.key-star { margin-left: 8px; color: #b97700; }

.exam-main { min-width: 0; padding: clamp(16px, 3vw, 28px); }
.question-meta { margin: 0 0 10px; color: var(--bark); font: 700 0.91rem/1.4 "Fredoka", sans-serif; }
.exam-stem { margin: 0 0 16px; font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.45; }
.reader-note { margin: 0 0 18px; }
.reader-note > p { margin: 0 0 6px; color: #665d50; font-size: 0.82rem; }
.exam-figure {
  overflow-x: auto;
  margin: 12px 0 18px;
  padding: 12px;
  border-radius: 16px;
  text-align: center;
  background: #fffdf7;
}
.exam-figure svg, .exam-choice svg, .review-correct svg, .correct-choice svg { max-width: 100%; height: auto; }
.exam-figure svg { max-height: 360px; }
.exam-figure img { max-width: 100%; height: auto; }
.exam-guided-learning {
  margin: 14px 0 18px;
  padding: 15px;
  border: 2px solid #8db29a;
  border-radius: 16px;
  background: #f1f8ef;
}
.exam-guided-learning > h3 { margin: 0 0 6px; color: var(--pine); }
.exam-guided-learning > p { margin: 0; color: #526257; line-height: 1.45; }
.exam-guided-learning .kangaroo-cube-viewer { margin-bottom: 0; }
.exam-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.exam-choice {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 82px;
  padding: 10px;
  border: 3px solid transparent;
  border-radius: 14px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 4px 0 #c8aa69;
  font-family: inherit;
}
.exam-choice > b { align-self: flex-start; color: var(--bark); font: 700 1rem/1 "Fredoka", sans-serif; }
.exam-choice > span { display: grid; flex: 1; place-items: center; min-width: 0; overflow-wrap: anywhere; }
.exam-choice.selected { border-color: var(--gold); background: #fff3bf; }
.exam-choice.correct { border-color: #2e7d45; background: #dcefdc; }
.exam-choice.wrong { border-color: #b8432c; background: #f8d9d1; }
.exam-choice:disabled { cursor: default; opacity: 1; }
.exam-controls { display: grid; grid-template-columns: repeat(4, max-content); justify-content: space-between; gap: 9px; margin-top: 22px; }
.exam-controls button:disabled { cursor: default; filter: grayscale(0.6); opacity: 0.45; }

.current-explanation { margin-top: 18px; padding: 16px; border-radius: 14px; background: #eef4da; }
.current-explanation h3 { margin: 0 0 8px; }
.current-explanation ol { margin-bottom: 0; padding-left: 22px; line-height: 1.55; }
.answer-gate { display: grid; gap: 10px; }
.answer-gate p { margin: 0; line-height: 1.5; }
.answer-reveal-button { justify-self: start; padding: 10px 16px; }
.correct-choice, .review-correct { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: #fff; }
.correct-choice > b, .review-correct > b { color: #28653c; font: 700 1rem "Fredoka", sans-serif; }

.exam-results { padding: clamp(17px, 3vw, 28px); }
.exam-results > h2 { margin: 0 0 12px; }
.result-summary { padding: 18px; border-radius: 16px; color: #fff9e9; background: var(--pine); }
.score-number { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.score-number strong { font: 700 3rem/1 "Fredoka", sans-serif; }
.score-number span { font-size: 1.2rem; opacity: 0.8; }
.score-breakdown { padding: 9px 11px; border-radius: 9px; color: var(--ink); background: #fff5ce; }
.score-note { margin-bottom: 0; font-size: 0.84rem; overflow-wrap: anywhere; opacity: 0.85; }
.result-disclaimer { color: #6d5444; font-size: 0.88rem; }
.review-privacy-note { margin-top: -4px; color: #655848; line-height: 1.45; }
.review-list { display: grid; gap: 12px; }
.review-item { padding: 14px; border: 2px solid #d6c49b; border-radius: 14px; background: #fffaf0; }
.review-item.answer-hidden { border-color: #d6c49b; }
.review-item.correct { border-color: #7cae85; }
.review-item.wrong { border-color: #d18b79; }
.review-item.blank { border-color: #cbbb96; }
.review-item.learning { border-color: #72978b; background: #f1f8ef; }
.review-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  color: var(--ink);
  background: #eadcb8;
  box-shadow: none;
}
.review-heading b { text-transform: capitalize; }
.review-item > p, .review-item > ol { line-height: 1.5; }
.review-hidden-message { color: #655848; font-weight: 700; }
.review-learning-note { padding: 8px 10px; border-radius: 8px; color: #315e50; background: #e1efe7; font-weight: 700; }

@media (max-width: 780px) {
  .exam-statusbar { position: static; flex-wrap: wrap; }
  .exam-statusbar > p { order: 3; flex-basis: 100%; text-align: left; font-size: 0.87rem; }
  .status-actions { margin-left: auto; }
  .exam-layout { grid-template-columns: 1fr; }
  .answer-panel { position: static; }
  .answer-card { grid-template-columns: repeat(8, 1fr); }
  .exam-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-controls button { min-width: 0; padding-inline: 10px; }
}

@media (max-width: 520px) {
  .rule-grid { grid-template-columns: 1fr; }
  .answer-card { grid-template-columns: repeat(6, 1fr); }
  .exam-statusbar { padding: 10px; }
  .timer-box { width: 100%; justify-content: space-between; }
  .status-actions { width: 100%; margin: 0; }
  .status-actions button { flex: 1; }
  .exam-main { padding: 15px 12px; }
  .exam-choice { min-height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

.source-reference { display:flex; flex-wrap:wrap; align-items:center; gap:6px 14px; margin:0 0 8px; }
.source-reference small { color:#716451; font-size:.78rem; }
.exam-difficulty, .review-difficulty { margin: 0 0 12px; }
.review-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.ai-review-link {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  color: #fff9e9;
  background: var(--berry);
  font: 700 0.93rem/1.2 "Fredoka", sans-serif;
  text-decoration: none;
}
.source-question-link { text-decoration: underline; }
.ai-review-link[hidden], .source-question-link[hidden] { display: none; }
