@font-face {
  font-family: "CASIO ClassWiz CW01";
  src: url("assets/fonts/CASIO-ClassWiz-CW01.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

/* Grade 10, question 7: approved mathematical analysis. */
.g10-q7-heading,
.g10-q7-copy,
.g10-q7-equation,
.g10-q7-case {
  display: block;
}

.g10-q7-heading {
  margin-bottom: 1.2em;
  color: #245894;
  font-weight: 800;
}

.g10-q7-copy {
  margin-bottom: .9em;
  line-height: 1.9;
}

.g10-q7-equation {
  margin: .7em 0 1em;
  overflow-x: auto;
  padding: .15em 0;
  text-align: left;
  font-family: "Cambria Math", "STIX Two Math", serif;
  font-size: 1.18em;
  line-height: 1.9;
}

.g10-q7-case {
  margin: 1em 0 .55em;
  color: #245894;
  font-weight: 800;
}

.g10-q7-equation .math-frac,
.g10-q7-equation .math-root {
  font-size: 1em;
}

.g10-q7-classification {
  display: block;
  margin: 1.15em 0 .85em;
  font-weight: 800;
}

.g10-q7-indented {
  padding-left: 1.15em;
}

.g10-q7-step2-heading {
  margin-top: 2.2em;
}

.g10-q7-calculator-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .28em;
  line-height: 1.8;
}

.g10-q7-procedure-line {
  display: block;
  margin-bottom: .78em;
  line-height: 1.85;
}

.g10-q7-bullet {
  margin-top: .35em;
}

.g10-q7-subline {
  padding-left: 2.8em;
}

.g10-q7-keyrow {
  display: flex;
  align-items: center;
  min-height: 2.2em;
  padding-left: 4.4em;
  margin: -.35em 0 .45em;
}

.g10-q7-search-note {
  margin-top: 1.6em;
}

@media (max-width: 560px) {
  .g10-q7-subline,
  .g10-q7-keyrow {
    padding-left: 1em;
  }
}


@media (max-width: 560px) {
  .g10-q7-indented {
    padding-left: 0;
  }
}


@media (max-width: 560px) {
  .g10-q7-copy {
    line-height: 1.75;
  }

  .g10-q7-equation {
    font-size: 1.05em;
    text-align: left;
  }
}


/* Grade 10, question 6: detailed algebra copied from the approved answer guide. */
.g10-q6-detail {
  display: grid;
  gap: .72em;
  line-height: 1.75;
}

.g10-q6-detail-line {
  display: block;
}

.g10-q6-detail-math {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: .34em;
  row-gap: .42em;
}

.g10-q6-detail .math-frac {
  font-size: 1em;
  margin-inline: .14em;
}

.g10-q6-detail .math-root {
  font-size: 1em;
}

.g10-q6-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .28em;
}

.g10-q6-inline-key {
  min-width: 0;
  min-height: 0;
  margin-inline: .08em;
  font-size: 1.85em;
  vertical-align: middle;
}

.g10-q6-inline-menu {
  margin-inline: .08em;
  font-size: .9em;
  vertical-align: middle;
}

.g10-q6-step4 {
  display: grid;
  gap: .55em;
}

.g10-q6-keyline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25em;
}

.g10-q6-step4-title {
  margin-bottom: .15em;
}

.g10-q6-step5-title {
  margin-top: .5em;
}

.g10-q6-summary {
  display: grid;
  gap: .7em;
  line-height: 1.75;
}

@media (max-width: 560px) {
  .g10-q6-detail {
    gap: .8em;
    line-height: 1.65;
  }

  .g10-q6-detail-math {
    row-gap: .55em;
  }
}

.g10-q3-factor {
  display: grid;
  grid-template-columns: max-content max-content;
  column-gap: 3.5em;
  align-items: start;
}

.g10-q3-factor-lines {
  display: grid;
  gap: 0.65em;
}

.g10-q3-factor-lines > span {
  display: block;
  white-space: nowrap;
}

.g10-q3-truth {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  column-gap: 2.2em;
  align-items: baseline;
}

.g10-q3-truth > span {
  white-space: nowrap;
}

.g10-q3-check {
  display: grid;
  gap: 1em;
}

.g10-q3-check-eval,
.g10-q3-check-result {
  display: grid;
  align-items: baseline;
}

.g10-q3-check-eval {
  grid-template-columns: repeat(2, max-content);
  column-gap: 2em;
}

.g10-q3-check-result {
  grid-template-columns: repeat(6, max-content);
  column-gap: 1.6em;
}

.g10-q3-check span {
  white-space: nowrap;
}

.g10-q5-table-step {
  max-width: 100%;
  margin: 0.45em 0 1.35em;
}

.g10-q5-truth-table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 0 8px;
  color: #18354a;
  font-size: 14px;
  line-height: 1.35;
  -webkit-overflow-scrolling: touch;
}

.g10-q5-truth-table.is-compact {
  width: min(100%, 620px);
}

.g10-q5-table-row {
  display: grid;
}

.g10-q5-truth-table.is-full .g10-q5-table-row {
  grid-template-columns: minmax(54px, .7fr) repeat(4, minmax(44px, .5fr)) repeat(2, minmax(72px, .9fr)) minmax(154px, 1.7fr) minmax(72px, .9fr) minmax(220px, 2.4fr);
  min-width: 1080px;
}

.g10-q5-truth-table.is-compact .g10-q5-table-row {
  grid-template-columns: repeat(4, minmax(44px, .55fr)) minmax(250px, 2.8fr);
  min-width: 520px;
}

.g10-q5-table-row > span {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: center;
  padding: 5px 6px;
  border-right: 1px solid #9eb7c5;
  border-bottom: 1px solid #9eb7c5;
  background: #fff;
  text-align: center;
  white-space: nowrap;
}

.g10-q5-table-row > span:first-child {
  border-left: 1px solid #9eb7c5;
}

.g10-q5-table-row.is-header > span {
  min-height: 39px;
  border-top: 1px solid #9eb7c5;
  background: #e7f3f9;
  color: #102f44;
  font-weight: 700;
}

.g10-q5-table-row:nth-child(even):not(.is-header):not(.is-false) > span {
  background: #f7fbfd;
}

.g10-q5-table-row.is-false > span {
  background: #d8edf7;
  color: #0b3f5c;
  font-weight: 700;
}

@media (max-width: 700px) {
  .g10-q3-factor {
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 3.5em;
  }

  .g10-q3-truth {
    grid-template-columns: repeat(2, max-content);
    row-gap: 0.6em;
  }

  .g10-q3-check-result {
    grid-template-columns: repeat(2, max-content);
    row-gap: 0.6em;
  }
}

.question-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px 0 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.hero h1 .hero-main {
  color: #11314f;
}

.question-image[hidden] {
  display: none;
}

.answer-images {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
  margin: 18px 0 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.answer-images.image-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.answer-images.image-size-standard {
  grid-template-columns: repeat(3, minmax(0, calc((100% - 30px) / 4)));
  justify-content: start;
}
.answer-images.q8-integration-images {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.answer-images.q8-integration-images .answer-image {
  flex: 0 0 auto;
  margin-left: 0;
  margin-right: 0;
}
.answer-images.q8-integration-images .answer-image:first-child {
  width: calc((100% - 30px) / 4);
  max-width: calc((100% - 30px) / 4);
}
.answer-images.q8-integration-images .answer-image:last-child {
  width: calc((100% - 30px) / 2 + 10px);
  max-width: calc((100% - 30px) / 2 + 10px);
  height: auto;
  aspect-ratio: auto;
}
.answer-images .answer-image[src$="/g12/answers/q10-03.png"],
.answer-images .answer-image[src$="/g12/answers/q10-05.png"],
.answer-images .answer-image[src$="/g10/answers/q10-05.png"] {
  grid-column: 1 / span 2;
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: auto;
}
.calculator-note { color: #b3261e; font-weight: 600; }

.answer-image {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: #fff;
}

@media (max-width: 800px) {
  .answer-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-images.image-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .answer-images.image-size-standard { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .answer-images.q8-integration-images .answer-image:first-child { width: calc((100% - 10px) / 2); max-width: calc((100% - 10px) / 2); }
  .answer-images.q8-integration-images .answer-image:last-child { width: 100%; max-width: 100%; }
  .answer-images .answer-image[src$="/g12/answers/q10-03.png"], .answer-images .answer-image[src$="/g12/answers/q10-05.png"], .answer-images .answer-image[src$="/g10/answers/q10-05.png"] { grid-column: 1 / span 2; width: 100%; max-width: 100%; }
}

.review-choice-list {
  display: grid;
  gap: 5px;
  margin: 18px 0 16px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", "Noto Serif Thai", "Noto Sans Thai", serif;
  line-height: 1.65;
}

.review-choice.correct-choice {
  color: var(--success);
  font-weight: 700;
}

.review-choice.selected-wrong {
  color: var(--danger);
  font-weight: 700;
}

.solution-steps {
  margin-top: 16px;
  padding: 14px;
  border-radius: 6px;
  background: #f3f7fa;
  color: #344b60;
}

.solution-step {
  margin: 0 0 14px;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", "Noto Serif Thai", "Noto Sans Thai", serif;
  line-height: 1.75;
  white-space: pre-wrap;
  word-spacing: 0.11em;
}

.solution-step .math-frac,
.solution-step .math-exp-frac,
.solution-step .math-integral,
.solution-step .math-vector,
.solution-step math {
  margin-left: 0.24em;
  margin-right: 0.24em;
}

.solution-step:last-child {
  margin-bottom: 0;
}

/* Grade 11–12: hierarchy follows each solution's mathematical and calculator flow. */
.solution-steps-g12 {
  display: grid;
  gap: 0;
  padding: 18px 20px;
}

.solution-steps-g12 .solution-step {
  margin: 0;
}

.solution-steps-g12 .g12-role-root {
  padding: 0 0 15px;
}

.solution-steps-g12 .g12-role-root > strong:first-child {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--blue);
  font-family: Inter, "Noto Sans Thai", Arial, sans-serif;
  font-size: 1.03em;
}

.solution-steps-g12 .g12-role-operation,
.solution-steps-g12 .g12-role-subheading,
.solution-steps-g12 .g12-role-result {
  padding: 9px 0;
}

.solution-steps-g12 .g12-role-detail,
.solution-steps-g12 .g12-role-operation-detail,
.solution-steps-g12 .g12-role-note {
  margin-left: 1.35rem;
  padding: 9px 0;
}

.solution-steps-g12 .g12-role-subdetail,
.solution-steps-g12 .solution-keylog {
  margin-left: 2.7rem;
  padding: 8px 0;
}

.solution-steps-g12 .g12-role-operation,
.solution-steps-g12 .g12-role-subheading {
  margin-top: 7px;
}

.solution-steps-g12 .g12-role-subheading {
  padding-bottom: 3px;
  color: #173f66;
  font-family: Inter, "Noto Sans Thai", Arial, sans-serif;
  font-weight: 700;
}

.solution-steps-g12 .g12-role-result {
  margin-top: 5px;
  color: #123a5f;
  font-weight: 650;
}

.solution-steps-g12 .g12-answer-images {
  padding-top: 0;
  border-top: 0 !important;
  background: transparent;
}

.solution-steps-g12 .g12-images-root {
  width: 100%;
  margin: 4px 0 15px;
}

.solution-steps-g12 .g12-images-operation,
.solution-steps-g12 .g12-images-subheading,
.solution-steps-g12 .g12-images-result {
  width: 100%;
  margin: 4px 0 15px;
}

.solution-steps-g12 .g12-images-detail,
.solution-steps-g12 .g12-images-operation-detail,
.solution-steps-g12 .g12-images-note {
  width: calc(100% - 1.35rem);
  margin: 4px 0 15px 1.35rem;
}

.solution-steps-g12 .g12-images-subdetail,
.solution-steps-g12 .solution-keylog + .g12-answer-images {
  width: calc(100% - 2.7rem);
  margin: 4px 0 15px 2.7rem;
}

/* G11 Q1: preserve the source content while matching the shared G10/G12 hierarchy. */
.grade-11 #review-list > .review-item:first-child .g11-q1-matrix-step {
  overflow-x: auto;
}

.g11-q1-matrix-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.g11-q1-column-explanation {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  gap: 0 1.25rem;
}

.g11-q1-column-body {
  display: grid;
  gap: 4px;
}

.g11-q1-column-reason {
  margin-left: 1.25rem;
}

.g11-q1-matrix {
  --g11-q1-columns: 1;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--g11-q1-columns), minmax(34px, auto));
  gap: 7px 12px;
  padding: 7px 15px;
  color: #253f57;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  line-height: 1.3;
}

.g11-q1-matrix::before,
.g11-q1-matrix::after {
  content: "";
  position: absolute;
  inset-block: 0;
  width: 7px;
  border-block: 1.5px solid currentColor;
}

.g11-q1-matrix::before {
  left: 0;
  border-left: 1.5px solid currentColor;
}

.g11-q1-matrix::after {
  right: 0;
  border-right: 1.5px solid currentColor;
}

.g11-q1-matrix > span {
  min-width: 28px;
  text-align: center;
}

.g11-equation-stack {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.08em;
  line-height: 1.55;
}

.g11-equation-stack > span {
  max-width: 100%;
}

.math-upright {
  font-style: normal;
}

.g11-q3-equation-block {
  display: grid;
  gap: 7px;
}

.g11-q4-table-wrap,
.g11-q4-vector-line,
.g11-q4-score-list,
.g11-q4-check {
  display: grid;
  gap: 10px;
}

.g11-q4-table-wrap > strong,
.g11-q4-check > strong {
  color: #173f66;
  font-family: Inter, "Noto Sans Thai", Arial, sans-serif;
}

.g11-q4-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.g11-q4-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-family: Inter, "Noto Sans Thai", Arial, sans-serif;
  font-size: .94em;
}

.g11-q4-table th,
.g11-q4-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #d5dee7;
  text-align: left;
  white-space: nowrap;
}

.g11-q4-table th {
  color: #173f66;
  font-weight: 700;
}

.g11-q4-vector-line {
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
}

.g11-q4-score-list,
.g11-q4-check {
  margin-left: 1.35rem;
}

.g11-q4-score-list > span,
.g11-q4-check > span {
  display: grid;
  grid-template-columns: minmax(95px, auto) minmax(0, 1fr);
  gap: 12px;
}

.g11-q4-check > strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.g11-q5-equation-step {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.g11-q5-equation-step .g11-equation-stack > span {
  min-width: max-content;
}

.g11-q5-check {
  display: grid;
  gap: 5px;
}

.g11-matrix-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px 12px;
  max-width: 100%;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.06em;
}

.g11-q6-matrix-stack {
  display: grid;
  justify-items: center;
  gap: 9px;
  max-width: 100%;
}

.g11-vector-equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  max-width: 100%;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.06em;
}

.g11-root {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  margin-left: .72em;
  vertical-align: middle;
}

.g11-root::before {
  content: "√";
  position: absolute;
  top: -.09em;
  right: 100%;
  font-size: 1.18em;
  line-height: 1;
}

.g11-root > span {
  display: inline-block;
  margin-left: -.1em;
  padding: 0 .1em 0 .2em;
  border-top: 1.3px solid currentColor;
  line-height: 1.35;
}

/* Use the browser's native math radical so the vinculum stays joined at every zoom level. */
.g11-native-root {
  display: inline-block;
  margin: 0 .05em;
  color: inherit;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1em;
  line-height: 1;
  vertical-align: -.12em;
}

/* G11 Q8: the two opening vector lines follow the compact, left-aligned source layout. */
.grade-11 #review-list > .review-item:nth-child(8) .g12-solution-step:has(.g11-q8-vector-line) {
  margin-left: 0;
  padding: 4px 0;
}

.grade-11 #review-list > .review-item:nth-child(8) .g11-q8-vector-line {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px 10px;
  width: 100%;
  text-align: left;
}

.g11-q10-equation {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.g11-q10-equation .g11-equation-stack > span {
  min-width: max-content;
}

.g11-image-anchor {
  display: none;
}

/* Every G11 calculator screen is supporting evidence for the step above it. */
.grade-11 .solution-steps-g12 .g12-answer-images {
  width: calc(100% - 1.35rem);
  margin: 4px 0 15px 1.35rem;
  align-items: start;
}

@media (max-width: 700px) {
  .grade-11 #review-list > .review-item:nth-child(8) .g11-q8-vector-line {
    flex-wrap: wrap;
  }

  .g11-q1-matrix-line {
    align-items: flex-start;
  }

  .g11-q4-vector-line {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .g11-q4-score-list,
  .g11-q4-check {
    margin-left: 0;
  }

  .g11-q4-score-list > span,
  .g11-q4-check > span {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .g11-q1-column-explanation {
    gap: 0 0.75rem;
  }

  .g11-q1-column-reason {
    margin-left: 0.75rem;
  }

  .grade-11 .solution-steps-g12 .g12-answer-images {
    width: calc(100% - 0.65rem) !important;
    margin: 4px 0 15px 0.65rem !important;
  }
}

#topic-layout[hidden] {
  display: none;
}

.quiz-result {
  min-height: 420px;
  text-align: center;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
}

.quiz-result[hidden] {
  display: none;
}

.result-label {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.quiz-result h3 {
  margin: 0;
  font-size: 30px;
}

.result-score {
  width: 170px;
  height: 170px;
  border: 10px solid var(--sky);
  border-radius: 50%;
  display: grid;
  place-content: center;
}

.result-score strong,
.result-score span {
  display: block;
}

.result-score strong {
  color: var(--blue);
  font-size: 42px;
}

.result-score span {
  color: var(--muted);
  font-size: 12px;
}

.quiz-result p {
  margin: 0 0 8px;
  color: var(--muted);
}

.quiz-instruction {
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.quiz-list,
.review-list {
  display: grid;
  gap: 18px;
}

.quiz-item,
.review-item {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quiz-item.missing {
  border-color: var(--danger);
  background: #fffafa;
}

.item-number {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.1px;
}

.item-question {
  margin: 0 0 18px;
  white-space: pre-line;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", "Noto Serif Thai", "Noto Sans Thai", serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0;
}

.question-supplement {
  margin: 4px 0 22px;
  font-family: "Cambria Math", "STIX Two Math", "Noto Serif Thai", "Noto Sans Thai", serif;
  color: #102a43;
}

.question-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.question-data-table {
  width: min(100%, 700px);
  margin: 0 auto;
  border-collapse: collapse;
  background: #fff;
  font-size: 16px;
  line-height: 1.45;
}

.question-data-table th,
.question-data-table td {
  padding: 9px 12px;
  border: 1px solid #7b8794;
  text-align: center;
  vertical-align: middle;
}

.question-data-table th {
  background: #f3f6f9;
  font-weight: 700;
}

.question-table-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 34px;
  align-items: start;
}

.question-table-panel {
  min-width: 0;
}

.question-table-panel h4 {
  margin: 0 0 10px;
  color: #102a43;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.question-table-panel .question-data-table {
  width: 100%;
  min-width: 430px;
  font-size: 15px;
}

.question-table-panel .question-data-table th,
.question-table-panel .question-data-table td {
  padding: 8px 9px;
}

.question-document-table {
  width: 100%;
  table-layout: fixed;
}

.question-document-table th {
  font-size: 16px;
}

.question-document-table td {
  text-align: left;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .question-document-table {
    min-width: 720px;
  }
}

.question-data-table[data-columns="7"] {
  width: 920px;
  min-width: 920px;
}

.question-matrices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 24px 42px;
}

.question-matrices-stacked {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.question-matrix-block {
  min-width: 0;
}

.question-matrices-stacked .question-matrix-figure {
  display: flex;
  justify-content: center;
  align-items: center;
}

.question-matrices-stacked .question-matrix-figure figcaption {
  min-height: 0;
  margin: 0 10px 0 0;
}

.question-matrix-intro {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.8;
}

.question-inline-matrix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 18px;
  line-height: 1.8;
}

.question-inline-matrix .question-matrix-figure {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.question-inline-matrix .question-matrix-figure figcaption {
  min-height: 0;
  margin: 0 8px 0 0;
  color: inherit;
  font-size: 18px;
  font-weight: 400;
}

.question-inline-matrix-continuation {
  flex: 1 1 310px;
  min-width: 0;
}

.math-overbar {
  display: inline-block;
  text-decoration: overline;
  text-decoration-thickness: 1px;
}

.question-matrix-figure {
  margin: 0;
  text-align: center;
}

.question-matrix-figure figcaption {
  min-height: 1.5em;
  margin-bottom: 10px;
  color: #52616f;
  font-size: 15px;
  font-weight: 600;
}

.question-matrix-suffix {
  flex: 0 0 auto;
  margin-left: 10px;
  font-size: 16px;
  line-height: 1.5;
  white-space: nowrap;
}

.question-matrix {
  --matrix-columns: 3;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--matrix-columns), minmax(34px, auto));
  gap: 8px 16px;
  padding: 8px 17px;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.3;
}

.question-matrix::before,
.question-matrix::after {
  content: "";
  position: absolute;
  inset-block: 0;
  width: 8px;
  border-block: 1.5px solid currentColor;
}

.question-matrix::before {
  left: 0;
  border-left: 1.5px solid currentColor;
}

.question-matrix::after {
  right: 0;
  border-right: 1.5px solid currentColor;
}

.question-matrix span {
  min-width: 26px;
  text-align: center;
}

.question-matrix .augmented-cell {
  margin-left: 2px;
  padding-left: 14px;
  border-left: 1px solid #52616f;
}

.question-documents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.question-document {
  overflow: hidden;
  border: 1px solid #b8c4d0;
  border-radius: 7px;
  background: #fff;
}

.question-document h4 {
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid #b8c4d0;
  background: #f3f6f9;
  color: #0b3f7a;
  font-size: 16px;
  line-height: 1.4;
}

.question-document dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.question-document dt,
.question-document dd {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #e0e6ed;
}

.question-document dt {
  color: #52616f;
  font-weight: 600;
  white-space: nowrap;
}

.question-document dd {
  color: #102a43;
}

.question-after {
  margin-top: 18px;
}

@media (max-width: 700px) {
  .question-table-group {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .question-data-table[data-columns="5"] {
    min-width: 540px;
    font-size: 15px;
  }

  .question-documents {
    grid-template-columns: 1fr;
  }
}

.math-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  align-items: stretch;
  line-height: 1.15;
  min-width: 1.2em;
  margin: 0 .08em;
  font-size: .92em;
}

.math-frac > span {
  display: block;
  white-space: nowrap;
  text-align: center;
}

.math-frac > span:first-child {
  border-bottom: 1px solid currentColor;
  padding: 0 .12em .14em;
}

.math-frac > span:last-child {
  padding: .26em .12em .02em;
  line-height: 1.15;
}

.math-frac > span:last-child sup {
  font-size: .78em;
  line-height: 0;
  position: relative;
  left: .06em;
  top: -.02em;
}

.math-exp-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  align-items: center;
  line-height: .8;
  font-size: .72em;
  margin: 0 .03em;
}

.item-question sup .math-exp-frac,
.choice sup .math-exp-frac,
.review-answer sup .math-exp-frac,
.review-explanation sup .math-exp-frac {
  font-size: .95em;
  line-height: .95;
  position: relative;
  top: .05em;
}

.math-exp-frac > span:first-child {
  border-bottom: 1px solid currentColor;
  padding: 0 .1em .1em;
}

.math-exp-frac > span:last-child {
  padding-top: .1em;
}

.math-formula {
  display: inline-block;
  vertical-align: middle;
  margin: 0 .12em;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.08em;
  line-height: 1.2;
}

.math-formula mi {
  font-style: italic;
  padding: 0 .015em;
}

.math-root {
  display: inline-block;
  vertical-align: -.04em;
  margin: 0 .025em;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.05em;
}

.math-vector {
  position: relative;
  display: inline-block;
  padding-top: .18em;
  margin: 0 .045em;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-style: italic;
  line-height: 1;
}

.math-vector .math-var {
  margin: 0;
}

.math-vector::before {
  content: "";
  position: absolute;
  top: .04em;
  left: -.015em;
  right: -.09em;
  border-top: 1px solid currentColor;
}

.math-vector::after {
  content: "";
  position: absolute;
  top: -.045em;
  right: -.095em;
  width: .19em;
  height: .19em;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

.math-integral {
  display: inline-flex;
  align-items: center;
  position: relative;
  font-size: 1.15em;
  margin-right: .15em;
}

.math-limits {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: .48em;
  line-height: .8;
  margin-left: -.18em;
  transform: translateY(-.28em);
}

.math-limits sup,
.math-limits sub {
  font-size: 1em;
  line-height: .8;
  vertical-align: baseline;
}

.math-power {
  font-size: .72em;
  line-height: 0;
  vertical-align: super;
}

.item-question sup,
.choice sup,
.review-answer sup,
.review-explanation sup {
  font-size: .7em;
  line-height: 0;
  vertical-align: super;
}

.item-question sub,
.choice sub,
.review-answer sub,
.review-explanation sub {
  font-size: .7em;
  line-height: 0;
  vertical-align: sub;
}

.math-var {
  font-style: italic;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  margin: 0 .025em;
}

.math-frac .math-var {
  margin: 0 .015em;
}

.math-var .math-var {
  margin: 0;
}

.item-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid #ccd7e1;
  border-radius: 6px;
  color: #334455;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", "Noto Serif Thai", "Noto Sans Thai", serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
}

.choice:hover,
.choice:has(input:checked) {
  border-color: var(--blue);
  background: #eef7ff;
}

.choice input {
  flex: 0 0 auto;
  margin-top: 3px;
  accent-color: var(--blue);
}

.submit-area {
  padding-top: 26px;
  text-align: center;
}

.submit-area .feedback {
  max-width: 620px;
  margin: 0 auto 14px;
}

.quiz-submit {
  min-width: 190px;
}

.result-actions,
.review-heading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.review-heading {
  justify-content: space-between;
  margin-bottom: 24px;
}

.review-heading h3 {
  margin: 7px 0 0;
  font-size: 24px;
}

.review-item.correct-review {
  border-left: 5px solid var(--success);
}

.review-item.wrong-review {
  border-left: 5px solid var(--danger);
}

.review-status {
  margin: 0 0 12px;
  font-weight: 800;
}

.correct-review .review-status {
  color: var(--success);
}

.wrong-review .review-status {
  color: var(--danger);
}

.review-answer {
  margin: 7px 0;
  color: #41566a;
  line-height: 1.55;
}

.review-explanation {
  margin: 14px 0 0;
  padding: 13px 14px;
  border-radius: 6px;
  background: #f3f7fa;
  color: #344b60;
  line-height: 1.6;
}

.pdf-download {
  width: max-content;
  margin: 28px auto 0;
}

.review-footer-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.review-footer-actions .pdf-download,
.review-footer-actions .back-top-page {
  width: max-content;
  margin: 0;
}

.grade-coming {
  min-height: 360px;
  padding: 48px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
  display: grid;
  place-content: center;
}

.grade-coming[hidden] {
  display: none;
}

.coming-badge {
  justify-self: center;
  padding: 7px 12px;
  border-radius: 20px;
  background: var(--sky);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.grade-coming h3 {
  margin: 18px 0 8px;
  font-size: 26px;
}

.grade-coming p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

@media (max-width: 800px) {
  .question-image {
    margin-bottom: 18px;
  }

  .item-answers {
    grid-template-columns: 1fr;
  }

  .quiz-item,
  .review-item {
    padding: 19px 16px;
  }

  .review-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* CASIO brand header */
.site-header {
  background: #003399;
}

.site-header .brand {
  color: #fff;
  display: inline-flex;
  align-items: center;
}

.site-header .brand img {
  display: block;
  width: 112px;
  height: auto;
}

.site-header .nav-row nav a {
  color: #fff;
}

.site-header .nav-row nav a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.site-header .lang {
  border-color: rgba(255, 255, 255, 0.7);
  margin-left: auto;
}

.header-social {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.site-header .nav-row .header-social {
  flex: 0 0 auto;
}

.header-social a {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  transition: background-color 160ms ease, opacity 160ms ease;
}

.header-social a:hover,
.header-social a:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.header-social svg {
  display: block;
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.footer-row.footer-compact {
  justify-content: flex-end;
}

.site-header .lang {
  margin-left: 0;
}

/* Topic selection and standalone quiz pages */
.topic-picker-layout {
  display: block;
}

.topic-picker {
  padding: 28px;
  background: #fbfcfd;
}

.topic-picker-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.topic-picker-heading h3 {
  margin: 0;
  color: #17334f;
  font-size: 22px;
}

.topic-picker-heading > p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 14px;
}

.topic-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.topic-button.topic-card {
  display: flex;
  min-height: 118px;
  align-items: stretch;
  justify-content: space-between;
  flex-direction: column;
  gap: 22px;
  margin: 0;
  padding: 20px;
  border: 1px solid #d8e2eb;
  border-radius: 8px;
  background: #fff;
  color: #243d55;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.topic-button.topic-card:hover,
.topic-button.topic-card:focus-visible {
  border-color: #6f9fc9;
  box-shadow: 0 10px 24px rgba(36, 67, 96, 0.09);
  transform: translateY(-2px);
  outline: none;
}

.topic-card strong {
  display: block;
  color: #17334f;
  font-size: 16px;
  line-height: 1.45;
}

.topic-card .topic-start {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.topic-card .topic-start b {
  font-size: 18px;
}

.quiz-page-main {
  min-height: calc(100vh - 76px - 105px);
  padding: 42px 0 70px;
  background: linear-gradient(180deg, #f1f7fc 0, #fff 260px);
}

.quiz-page-shell {
  width: min(980px, calc(100% - 48px));
}

.back-to-topics {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: #315a7e;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.back-to-topics:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.quiz-page-card {
  background: #fff;
}

.quiz-page-card .practice-top h1 {
  margin: 8px 0 0;
  color: #17334f;
  font-size: 25px;
  line-height: 1.4;
}

.calculator-guide {
  margin: 15px 0 20px;
  padding: 13px 15px;
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  background: #f7fafc;
}

.calculator-guide-label {
  display: block;
  margin-bottom: 9px;
  color: #5e7082;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.calculator-sequence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.solution-keylog {
  gap: 4px;
  margin: 2px 0 14px;
}

.solution-keylog .cw-key {
  min-width: 0;
  min-height: 0;
  font-size: 28px;
}

.cw-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 37px;
  min-height: 37px;
  color: #111;
  font-family: "CASIO ClassWiz CW01";
  font-size: 34px;
  line-height: 1;
}

.calculator-menu {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #aab8c5;
  border-radius: 5px;
  background: #fff;
  color: #24394d;
  font-size: 13px;
  font-weight: 700;
}

.calculator-arrow {
  color: #7a8997;
  font-size: 20px;
  line-height: 1;
}

.shop-offer {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) 1.2fr;
  gap: 34px;
  align-items: center;
  margin-top: 32px;
  padding: 26px 30px;
  overflow: hidden;
  border: 1px solid #c8dce8;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef8fc 0%, #fff 56%, #fff4e9 100%);
}

.shop-products {
  position: relative;
  min-height: 250px;
}

.shop-product {
  position: absolute;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(14, 32, 52, 0.16));
}

.shop-product.black {
  left: 0;
  bottom: 0;
  width: 72%;
  transform: rotate(-4deg);
}

.shop-product.pink {
  right: -3%;
  bottom: -2%;
  width: 61%;
  transform: rotate(5deg);
}

.b2s-logo {
  display: block;
  width: 118px;
  max-width: 42%;
  height: auto;
  margin: 0 0 12px;
}

.shop-kicker {
  display: inline-block;
  margin-bottom: 9px;
  color: #07618e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.shop-copy h4 {
  margin: 0 0 10px;
  color: #07577f;
  font-size: 23px;
  line-height: 1.35;
}

.shop-copy p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.voucher {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px dashed #aeb735;
  border-radius: 7px;
  background: #fbfceb;
}

.voucher span {
  color: #68720e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
}

.voucher strong {
  color: #172d43;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 17px;
  letter-spacing: 1px;
}

.b2s-link {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 18px;
  padding: 13px 19px;
  border-radius: 6px;
  background: #f57f29;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.b2s-link:hover {
  background: #d9681d;
}

@media (max-width: 680px) {
  .site-header .nav-row {
    gap: 12px;
  }

  .header-social {
    gap: 7px;
  }

  .header-social a {
    width: 28px;
    height: 28px;
  }

  .footer-row.footer-compact {
    align-items: flex-end;
  }

  .topic-picker {
    padding: 20px 16px;
  }

  .topic-picker-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .topic-card-grid {
    grid-template-columns: 1fr;
  }

  .topic-button.topic-card {
    min-height: 104px;
  }

  .quiz-page-main {
    padding: 28px 0 48px;
  }

  .quiz-page-shell {
    width: min(100% - 30px, 980px);
  }

  .quiz-page-card .practice-top h1 {
    font-size: 22px;
  }

  .shop-offer {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 18px;
  }

  .shop-products {
    min-height: 230px;
  }

  .shop-copy h4 {
    font-size: 21px;
  }
}

/* Responsive hardening for the standalone quiz and answer-review pages. */
.site-header .nav-row nav.header-social {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 680px) {
  .site-header .nav-row {
    height: 64px;
    gap: 10px;
  }

  .site-header .brand {
    flex: 0 0 auto;
  }

  .site-header .brand img {
    width: 104px;
  }

  .site-header .nav-row nav.header-social {
    display: flex;
    gap: 4px;
  }

  .header-social a {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .header-social svg {
    width: 20px;
    height: 20px;
  }

  .site-header .lang {
    min-height: 38px;
    flex: 0 0 auto;
    padding: 8px 10px;
  }

  .quiz-page-shell {
    width: min(100% - 20px, 980px);
  }

  .quiz-page-card {
    padding: 20px 12px;
  }

  .quiz-item,
  .review-item {
    min-width: 0;
    padding: 18px 13px;
  }

  .item-question {
    max-width: 100%;
    font-size: 17px;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }

  .choice,
  .review-choice,
  .review-answer,
  .solution-step {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .review-choice-list {
    padding-right: 4px;
    padding-left: 4px;
  }

  .solution-steps {
    min-width: 0;
    padding: 13px 11px;
  }

  .solution-steps-g12 .g12-role-detail,
  .solution-steps-g12 .g12-role-operation-detail,
  .solution-steps-g12 .g12-role-note {
    margin-left: .65rem;
  }

  .solution-steps-g12 .g12-role-subdetail,
  .solution-steps-g12 .solution-keylog {
    margin-left: 1.3rem;
  }

  .solution-steps-g12 .g12-images-operation,
  .solution-steps-g12 .g12-images-subheading,
  .solution-steps-g12 .g12-images-result {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .solution-steps-g12 .g12-images-detail,
  .solution-steps-g12 .g12-images-operation-detail,
  .solution-steps-g12 .g12-images-note {
    width: calc(100% - .65rem) !important;
    margin-left: .65rem !important;
  }

  .solution-steps-g12 .g12-images-subdetail,
  .solution-steps-g12 .solution-keylog + .g12-answer-images {
    width: calc(100% - 1.3rem) !important;
    margin-left: 1.3rem !important;
  }

  .answer-images.image-grid-3,
  .answer-images.image-size-standard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-table-scroll,
  math.math-formula {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .result-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .result-actions .primary,
  .result-actions .secondary,
  .review-heading .secondary,
  .pdf-download,
  .back-top-page {
    width: 100%;
    max-width: 100%;
  }

  .review-footer-actions {
    width: 100%;
    flex-direction: column;
  }

  .voucher {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }
}

@media (max-width: 380px) {
  .site-header .brand img {
    width: 94px;
  }

  .site-header .nav-row {
    gap: 7px;
  }

  .header-social a {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .site-header .lang {
    padding-right: 8px;
    padding-left: 8px;
  }

  .shop-products {
    min-height: 200px;
  }
}
