:root {
  color-scheme: light;
  --text: #111;
  --muted: #555;
  --line: #cfcfcf;
  --button-blue: #2d55ff;
  --good: #0a6b2c;
  --bad: #a40000;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.35;
}

.page {
  width: min(1180px, calc(100% - 40px));
  margin: 24px auto 40px;
}

.top-line {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 18px;
  font-size: 16px;
}

.top-line strong {
  font-weight: 700;
}

.mode-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.mode-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.test-select {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.test-select select {
  border: 1px solid #777;
  background: #fff;
  color: var(--text);
  padding: 2px 6px;
  font: inherit;
}

h1,
h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
}

p {
  margin: 0 0 18px;
}

.question-stem p,
.choice span,
.tutorial-feedback p,
.review-note p {
  white-space: pre-line;
}

.question-stem {
  max-width: 1120px;
  font-size: 22px;
}

.question-prompt {
  margin-top: 22px;
  font-size: 22px;
  font-weight: 700;
}

.timer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 16px 0 12px;
}

.timer-row label {
  font-weight: 700;
}

.timer-row input {
  width: 126px;
  border: 2px solid #a7a7b6;
  border-radius: 3px;
  padding: 4px 6px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.question-body {
  display: grid;
  grid-template-columns: minmax(0, 700px) minmax(220px, 1fr);
  gap: 34px;
  align-items: start;
}

.choices {
  display: grid;
  gap: 14px;
  margin: 8px 0 28px;
}

.choice {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  max-width: 900px;
  cursor: pointer;
}

.choice input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
}

.choice span {
  display: block;
  font-size: 21px;
}

.choice.correct span {
  color: var(--good);
  font-weight: 700;
}

.choice.incorrect span {
  color: var(--bad);
  font-weight: 700;
}

.figure,
.image-panel {
  min-height: 220px;
  padding-top: 110px;
}

.figure-title,
.image-item figcaption {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.figure-box,
.image-thumb {
  width: 48px;
  height: 48px;
  border: 2px solid #999;
  display: grid;
  place-items: center;
  background: #fff;
  color: #777;
  font-size: 12px;
}

.image-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.image-item {
  margin: 0;
}

.image-thumb {
  width: min(360px, 100%);
  height: auto;
  min-height: 72px;
  padding: 0;
}

.image-thumb img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.96);
  padding: 24px;
}

.image-modal-content {
  max-width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border: 2px solid #444;
  background: #fff;
  padding: 12px;
}

.image-modal-bar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 10px;
}

.image-modal-content img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  border: 2px solid #444;
  background: #fff;
  color: #111;
  padding: 5px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  border-color: var(--button-blue);
  color: var(--button-blue);
}

button:disabled {
  color: #777;
  border-color: #aaa;
  cursor: default;
}

.message {
  min-height: 26px;
  margin: 4px 0 10px;
  color: var(--bad);
  font-weight: 700;
}

.tutorial-feedback {
  border-top: 1px solid var(--line);
  margin: 4px 0 18px;
  padding-top: 12px;
  max-width: 760px;
}

.tutorial-feedback p {
  margin-bottom: 10px;
}

.report-summary {
  display: grid;
  gap: 6px;
  margin: 14px 0 24px;
  font-size: 20px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 24px;
  font-size: 16px;
}

.report-table th,
.report-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  font-weight: 700;
  background: #f4f4f4;
}

.status-correct {
  color: var(--good);
  font-weight: 700;
}

.status-incorrect {
  color: var(--bad);
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.review-note {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
  max-width: 940px;
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .page {
    width: min(100% - 24px, 1180px);
    margin-top: 14px;
  }

  .question-stem,
  .question-prompt {
    font-size: 19px;
  }

  .choice span {
    font-size: 18px;
  }

  .question-body {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .figure {
    min-height: auto;
    padding-top: 4px;
    margin-bottom: 16px;
  }

  .image-panel {
    min-height: auto;
    padding-top: 4px;
    margin-bottom: 16px;
  }

  .image-item figcaption {
    font-size: 21px;
  }

  .image-thumb {
    width: 100%;
  }

  .report-table {
    font-size: 14px;
  }
}
