@font-face {
  font-family: "PhysicsHub Sans";
  src: url("../assets/fonts/Arimo-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "PhysicsHub Sans";
  src: url("../assets/fonts/Arimo-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: "PhysicsHub Sans";
  src: url("../assets/fonts/Arimo-Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "PhysicsHub Sans";
  src: url("../assets/fonts/Arimo-BoldItalic.ttf") format("truetype");
  font-style: italic;
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: "PhysicsHub Math";
  src: url("../assets/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

:root {
  --page-w: 210mm;
  --page-h: 297mm;
  --margin-x: 4.5mm;
  --content-top: 6.5mm;
  --content-bottom: 6.5mm;
  --marks-gutter: 15mm;
  --label-width: 24px;
  --indent-step: 22px;
  --indent-level-1: 22px;
  --indent-level-2: calc(var(--indent-level-1) + var(--indent-step));
  --indent-level-3: calc(var(--indent-level-2) + var(--indent-step));
  --indent-level-4: calc(var(--indent-level-3) + var(--indent-step));
  --continuation-indent-0: 22px;
  --continuation-indent-1: calc(var(--indent-level-1) + var(--label-width));
  --continuation-indent-2: calc(var(--indent-level-2) + var(--label-width));
  --continuation-indent-3: calc(var(--indent-level-3) + var(--label-width));
  --indent-a: var(--continuation-indent-1);
  --indent-b: var(--continuation-indent-2);
  --seq-slot: 22px;
  --seq-gap: 12px;
  --figure-max-width: 142mm;
  --figure-max-scale: 70%;
  --line-height: 1.36;
  --answer-row-h: 9.2mm;
  --calculation-step-h: 7mm;
  --working-space-margin-top: 2.2mm;
  --working-space-lg: 16mm;
  --working-space-md: 10mm;
  --working-space-sm: 7mm;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: #fff;
  color: #111;
  font-family: "PhysicsHub Sans", Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: var(--line-height);
  text-rendering: optimizeLegibility;
}

.exam-doc {
  background: #fff;
  font-family: "PhysicsHub Sans", Arial, Helvetica, sans-serif;
}

.mcq-doc {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    column-gap: 6px;
    width: 100%;
    color: #111;
    font-family: "PhysicsHub Sans", Arial, sans-serif;
    font-size: var(--preview-body-size, 14px);
    line-height: 1.45;
    break-inside: avoid;
    page-break-inside: avoid;
}

.question.is-mcq {
    break-inside: avoid;
    page-break-inside: avoid;
}

.mcq-doc.is-numberless {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.mcq-question-number,
.mcq-option-label {
    font-weight: 700;
    line-height: 1.45;
}

.mcq-question-lead {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.mcq-print-question-lead {
    display: none;
}

.mcq-question-head {
    display: block;
}

.mcq-question-head-content {
    min-width: 0;
}

.mcq-answer-choice {
    display: none;
}

.mcq-question-main,
.mcq-stem,
.mcq-option-content {
    min-width: 0;
}

.mcq-option-content {
    line-height: 0;
}

.mcq-text {
    margin: 0 0 9px;
    max-width: 100%;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.mcq-equation {
    margin: 8px 0 10px;
    max-width: 100%;
    text-align: center;
    line-height: 1.35;
}

.mcq-text sup,
.mcq-text sub {
    position: relative;
    vertical-align: baseline;
    font-size: 0.72em;
    line-height: 0;
}

.mcq-text sup {
    top: -0.48em;
}

.mcq-text sub {
    top: 0.2em;
}

.mcq-options {
    display: grid;
    gap: 7px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.mcq-options.is-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 18px;
    row-gap: 6px;
}

.mcq-options.is-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
    row-gap: 10px;
}

.mcq-options.is-stack {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
}

.mcq-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 4px;
    align-items: start;
}

.mcq-option-content > :last-child,
.mcq-stem > :last-child {
    margin-bottom: 0;
}

.mcq-stem > :first-child,
.mcq-fixed-option-group > :first-child {
    margin-top: 0;
}

.mcq-figure {
    margin: 10px auto;
    text-align: center;
}

.mcq-figure img {
    display: inline-block;
    width: auto;
    max-width: min(100%, 620px);
    max-height: 390px;
    object-fit: contain;
}

.mcq-figure.has-display-width img {
    width: min(var(--mcq-figure-width), 100%);
}

.mcq-figure.is-source-fragment {
    text-align: left;
}

.mcq-figure.is-source-fragment img {
    width: var(--mcq-source-width-relative, var(--mcq-source-width, auto));
    max-width: 100%;
    max-height: none;
    margin: 0;
}

.mcq-stem > .mcq-figure img {
    max-width: min(100%, 320px);
    max-height: 140px;
}

.mcq-stem > .mcq-figure.is-source-fragment img {
    width: var(--mcq-source-width-relative, var(--mcq-source-width, auto));
    max-width: 100%;
    max-height: none;
}

.mcq-option .mcq-figure {
    margin: 0;
    text-align: left;
}

.mcq-option .mcq-figure:not(.is-source-fragment) {
    margin-top: -6px;
}

.mcq-option .mcq-figure img {
    display: block;
    max-width: 180px;
    max-height: 150px;
}

.mcq-option .mcq-figure.is-source-fragment img {
    width: var(--mcq-source-width-relative, var(--mcq-source-width, auto));
    max-width: 100%;
    max-height: none;
}

.mcq-options.is-two .mcq-option,
.mcq-options.is-four .mcq-option {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 3px;
}

.mcq-options.is-two .mcq-figure:not(.is-source-fragment) {
    text-align: center;
}

.mcq-options.is-two .mcq-figure.is-source-fragment {
    text-align: left;
}

@media print {
    .mcq-doc:not(.is-numberless) {
        display: block;
        padding-left: 0;
    }

    .mcq-doc:not(.is-numberless) > .mcq-question-lead {
        display: none;
    }

    .mcq-doc:not(.is-numberless) .mcq-question-head {
        display: flex;
        align-items: baseline;
        padding-left: 0;
    }

    .mcq-print-question-lead {
        display: grid;
        grid-template-columns: 44px 20px;
        flex: 0 0 68px;
        align-items: baseline;
        width: 68px;
        margin-left: 0;
        white-space: nowrap;
        page-break-inside: avoid;
        break-inside: avoid-page;
    }

    .mcq-question-head-content {
        flex: 1 1 auto;
        min-width: 0;
    }

    .mcq-question-main > .mcq-options,
    .mcq-question-main > .mcq-fixed-option-group,
    .mcq-question-main > .mcq-stem-visual-tail,
    .mcq-question-main > .mcq-option-tail {
        margin-left: 68px;
    }

    .mcq-print-answer-choice {
        display: inline-flex;
        align-items: baseline;
        justify-content: start;
        font-family: "PhysicsHub Sans", Arial, sans-serif;
        font-size: 15px;
        font-weight: 400;
        line-height: 1.45;
        page-break-inside: avoid;
        break-inside: avoid-page;
    }

    .mcq-print-answer-space {
        display: block;
        flex: 0 0 34px;
        width: 34px;
    }

    .mcq-print-lead-number {
        display: block;
        min-width: 20px;
        padding-right: 4px;
        text-align: right;
        font-family: "PhysicsHub Sans", Arial, sans-serif;
        font-size: 14px;
        font-weight: 700;
        line-height: 1.45;
    }


    .mcq-question-head::after {
        display: none;
    }

    .mcq-question-main {
        min-width: 0;
    }

    /* Canonical display widths preserve the official 14 px source scale on
       screen. In print, compact only larger retained source visuals so tables,
       diagrams and 2x2 option groups use A4 space efficiently without making
       already-small labels harder to read. */
    .mcq-figure.is-source-fragment img {
        width: var(--mcq-source-width-print-relative, var(--mcq-source-width-relative, var(--mcq-source-width, auto)));
    }


    .mcq-answer-choice {
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        white-space: nowrap;
        font-weight: 400;
        font-size: 15px;
        line-height: 1;
    }

    .mcq-answer-choice-paren {
        display: inline-block;
        line-height: 1;
    }

    .mcq-answer-choice-blank {
        display: inline-block;
        width: 32px;
        min-width: 32px;
    }
}

.mcq-fixed-option-group {
    margin-top: 10px;
    max-width: 100%;
    overflow: hidden;
}

.mcq-fixed-option-group .mcq-figure {
    margin: 0;
    text-align: left;
}

@media screen and (max-width: 620px) {
    .mcq-options.is-four,
    .mcq-options.is-two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.mcq-table {
    border-collapse: collapse;
    margin: 5px 0;
    font-size: 0.94em;
}

.mcq-table th,
.mcq-table td {
    border: 1px solid #555;
    padding: 4px 7px;
    text-align: center;
    vertical-align: middle;
}

.mcq-frac {
    display: inline-grid;
    grid-template-rows: auto auto;
    vertical-align: middle;
    margin: 0 0.12em;
    line-height: 1.05;
    text-align: center;
}

.mcq-frac > span:first-child {
    border-bottom: 1px solid currentColor;
}

.card-ms-panel.mcq-answer-panel {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-height: 0;
    padding: 8px 10px;
    border: 0;
    border-left: 3px solid #5b9f94;
    border-radius: 0 7px 7px 0;
    background: #f3f7f6;
    color: #475569;
}

.mcq-answer-panel > span {
    font-size: 11px;
    font-weight: 650;
}

.mcq-answer-panel > strong {
    color: #0f5f58;
    font-size: 15px;
    font-weight: 850;
    line-height: 1;
}

.preview-mcq-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.preview-mcq-answer {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 8px;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid #a7d7cc;
    border-radius: 8px;
    background: #e9f7f3;
    color: #115e59;
}

.preview-mcq-answer-title {
    color: #0f766e;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .06em;
}

.preview-mcq-answer-current,
.preview-mcq-answer-source {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0;
    background: transparent;
    font-size: 11px;
    white-space: nowrap;
}

.preview-mcq-answer-current b {
    color: #0f5f58;
    font-size: 13px;
}

.preview-mcq-answer-source {
    padding-left: 8px;
    border-left: 1px solid #b7dcd4;
    color: #64748b;
}

.preview-mcq-answer-source b {
    color: #334155;
}

.preview-mcq-answer.is-unavailable {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}

.preview-mcq-toolbar button {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    padding: 4px 6px;
    font-size: 9px;
    cursor: pointer;
}

.preview-mcq-order-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.preview-mcq-fixed-note {
    margin-top: 9px;
    padding: 9px 10px;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    line-height: 1.45;
}

.preview-mcq-fixed-note strong {
    display: block;
    margin-bottom: 2px;
    color: #0f172a;
    font-size: 12px;
}

.preview-mcq-fixed-preview {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.preview-mcq-fixed-preview .mcq-figure {
    margin: 0;
    text-align: left;
}

.preview-mcq-options {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

.preview-mcq-option {
    position: relative;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 74px;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.18s ease, transform 0.3s cubic-bezier(0.2, 0.82, 0.24, 1), filter 0.18s ease, box-shadow 0.24s ease, border-color 0.24s ease, background-color 0.24s ease;
}

.preview-mcq-current-label {
    min-width: 40px;
    display: grid;
    grid-template-columns: 14px 18px;
    align-items: center;
    gap: 3px;
}

.preview-mcq-current-label > strong {
    width: 18px;
    color: #0f172a;
    font-size: 13px;
    text-align: center;
}

.preview-mcq-option:active {
    cursor: grabbing;
}

.preview-mcq-option.dragging {
    opacity: 0.22;
    filter: saturate(0.75);
    box-shadow: none;
}

.preview-mcq-option.drag-valid {
    border-color: #22c55e;
    background: #ecfdf5;
    box-shadow: 0 14px 28px rgba(34, 197, 94, 0.2);
}

.preview-mcq-drag-ghost {
    position: fixed !important;
    top: -10000px !important;
    left: -10000px !important;
    z-index: 9999;
    opacity: 0.96;
    transform: rotate(0.7deg) scale(1.025);
    border-color: #99d9d1;
    background: #fff;
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.22), 0 3px 10px rgba(15, 118, 110, 0.12);
    pointer-events: none;
}

.preview-mcq-option.drop-before::before,
.preview-mcq-option.drop-after::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    height: 4px;
    border-radius: 999px;
    background: #0f766e;
}

.preview-mcq-option.drop-before::before {
    top: -5px;
}

.preview-mcq-option.drop-after::after {
    bottom: -5px;
}

.preview-mcq-option.drop-before,
.preview-mcq-option.drop-after {
    border-color: #7dd3c7;
}

.preview-mcq-option-content .mcq-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.42;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-mcq-option-content {
    min-width: 0;
    overflow: hidden;
}

.preview-mcq-option-content .mcq-figure {
    height: 44px;
    margin: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.preview-mcq-option-content .mcq-figure img {
    width: auto !important;
    max-width: 100%;
    max-height: 44px;
    object-fit: contain;
}

.preview-mcq-option-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.preview-mcq-source-badge {
    border-radius: 999px;
    padding: 3px 7px;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 750;
}

.preview-mcq-source-badge {
    background: #eef2f7;
    color: #475569;
}

.preview-mcq-correct-check {
    display: inline-grid;
    place-items: center;
    width: 14px;
    height: 14px;
    color: transparent;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.preview-mcq-correct-check.is-active {
    color: #15803d;
}

.preview-mcq-drag-handle {
    color: #94a3b8;
    font-size: 15px;
    letter-spacing: -3px;
    cursor: grab;
}

.mcq-print-answer-key {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    margin: 7px 0 2px 40px;
    padding: 3px 0 2px;
    border: 0;
    border-bottom: 1px solid #777;
    background: #fff;
    color: #111;
    font-size: 11px;
    line-height: 1.25;
    break-inside: avoid;
}

.mcq-print-answer-key b {
    display: inline-block;
    min-width: 12px;
    text-align: center;
}

/* Scientific notation such as an antiquark must retain its semantic
   overline in the Builder, Edit Paper view and every HTML-based export. */
.overline {
  display: inline-block;
  line-height: 1;
  text-decoration-line: overline;
  text-decoration-thickness: 1px;
  text-decoration-skip-ink: none;
}

.math-relation {
  display: inline-block;
  font-family: "PhysicsHub Math", "Cambria Math", "STIX Two Math", "Times New Roman", serif;
  font-style: normal;
  font-weight: 400;
  font-size: 1.08em;
  line-height: 1;
  vertical-align: -0.03em;
}

.math-proportional {
  min-width: 0.9em;
  text-align: center;
}

/* The assembled-paper host uses a generous reading line-height. Keep the
   training-paper renderer compact without changing the host page itself. */
.sheet.runtime-exam .exam-doc,
.sheet.runtime-exam .exam-doc .row,
.sheet.runtime-exam .exam-doc .row-text,
.sheet.runtime-exam .exam-doc .part-label,
.sheet.runtime-exam .exam-doc .fig-caption {
  line-height: var(--line-height);
}

.page {
  width: min(100%, var(--page-w));
  min-height: auto;
  margin: 0 auto;
  position: relative;
  padding: var(--content-top) var(--margin-x) var(--content-bottom);
  overflow: visible;
  page-break-after: auto;
  break-after: auto;
  page-break-inside: auto;
  break-inside: auto;
  background: #fff;
}

.page:last-child {
  margin-bottom: 0;
}

.header {
  position: absolute;
  top: 6mm;
  left: var(--margin-x);
  right: var(--margin-x);
  text-align: center;
  font-size: 12px;
  line-height: 1;
}

.footer {
  position: absolute;
  left: var(--margin-x);
  right: var(--margin-x);
  bottom: 5.5mm;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  font-size: 10px;
  line-height: 1;
}

.footer .mid {
  text-align: center;
}

.footer .right {
  text-align: right;
}

.turn-over {
  letter-spacing: 0.02em;
}

.question-number {
  margin-top: 10.5mm;
}

.row {
  position: relative;
  padding-right: 0;
  padding-left: var(--row-indent, 0);
  margin-top: 1.15mm;
}

.row.has-terminal-marks {
  padding-right: var(--marks-gutter);
}

.row.has-terminal-marks > .marks {
  position: absolute;
  right: 0;
  top: 0;
  min-width: 10mm;
  text-align: right;
}

.row.with-seq {
  min-height: 1.35em;
  display: flex;
  align-items: baseline;
}

.seq-number {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--indent-level-1);
  text-align: left;
  padding-right: 0;
  font-size: inherit;
  font-weight: 600;
  line-height: inherit;
  flex: 0 0 var(--seq-slot);
}

/* Keep assembled-paper numbering on the same typographic baseline as its stem. */
.exam-doc .row.with-seq > .seq-number {
  font-size: inherit;
  line-height: inherit;
}

.row-main {
  display: flex;
  align-items: baseline;
  width: 100%;
  min-width: 0;
}

.row.with-seq > .row-main {
  flex: 1 1 auto;
  width: auto;
  margin-left: var(--indent-level-1);
}

.row-text {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.row.spaced-options .row-text {
  white-space: pre-wrap;
  word-spacing: 0.28em;
}

.exam-doc.mode-browse .row.spaced-options {
  margin-top: 1.8mm;
}

.part-label {
  display: inline-block;
  width: var(--label-width);
  min-width: var(--label-width);
  margin-right: 0;
  font-weight: 600;
  vertical-align: top;
  flex: 0 0 var(--label-width);
}

.marks {
  display: inline-block;
  white-space: nowrap;
}

.row.level-1 {
  --row-indent: var(--indent-level-1);
}

.row.level-0 {
  --row-indent: 0px;
}

.row.level-2 {
  --row-indent: var(--indent-level-2);
}

.row.level-3 {
  --row-indent: var(--indent-level-3);
}

.row.level-4 {
  --row-indent: var(--indent-level-4);
}

/* New semantic hierarchy classes (Rule 1) */
.row.sub-part {
  --row-indent: var(--indent-level-1);
}

.row.sub-sub-part {
  --row-indent: var(--indent-level-2) !important;
}

.row.sub-sub-sub-part {
  --row-indent: var(--indent-level-3);
}

.row.continuation-0 {
  --row-indent: var(--continuation-indent-0);
}

.row.continuation-1 {
  --row-indent: var(--continuation-indent-1);
}

.row.continuation-2 {
  --row-indent: var(--continuation-indent-2);
}

.row.continuation-3 {
  --row-indent: var(--continuation-indent-3);
}

.block-gap {
  margin-top: 2.8mm;
}

.tight-gap {
  margin-top: 1.2mm;
}

.figure {
  width: 100%;
  margin: 1.4mm 0 1.4mm;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  page-break-inside: auto;
  break-inside: auto;
}

.figure img {
  width: auto;
  max-width: 100%;
  max-height: 250px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Audited source crops already carry a physical display width derived from
   their render DPI. Do not shrink tall crops a second time, because that also
   makes the embedded source caption smaller than the surrounding exam text. */
.figure.embedded-source img {
  max-height: none;
}

.figure-art {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.fig-caption {
  display: block;
  flex: 0 0 auto;
  min-height: 1.36em;
  margin-top: 0.35mm;
  font-size: inherit;
  font-weight: 600;
  line-height: var(--line-height);
}

.figure-mark {
  align-self: stretch;
  margin-top: 0.35mm;
  text-align: right;
  font-size: 1em;
  line-height: var(--exam-line-height);
  font-weight: 400;
  white-space: nowrap;
}

.figure.normalized-caption .fig-caption {
  margin-top: 0;
}

.figure + .row {
  margin-top: 1.2mm;
}

.embedded-caption-mask {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: min(12em, 100%);
  height: 1.8em;
  background: #fff;
  transform: translateX(-50%);
  pointer-events: none;
}

.answer-lines {
  margin: 0 0 0 var(--continuation-indent-1);
  padding-right: 0.5mm;
  overflow: visible;
  page-break-inside: avoid;
  break-inside: avoid-page;
}

.working-lines {
  margin: 1mm 0 0 var(--continuation-indent-1);
  padding-right: 0.5mm;
  overflow: visible;
  page-break-inside: auto;
  break-inside: auto;
}

.row:has(+ .answer-lines) {
  page-break-after: avoid;
  break-after: avoid-page;
}

.row + .answer-lines {
  page-break-before: avoid;
  break-before: avoid-page;
}

/* Keep a calculation prompt with its answer blank, just as explanation
   prompts already stay with their first answer line. */
.row:has(+ .final-answer),
.row:has(+ .working-space) {
  page-break-after: avoid;
  break-after: avoid-page;
}

.row + .final-answer,
.row + .working-space {
  page-break-before: avoid;
  break-before: avoid-page;
}

/* A calculation may use flexible working space, but its final answer line
   should remain attached to that space instead of becoming an orphan. */
.working-space:has(+ .final-answer) {
  page-break-after: avoid;
  break-after: avoid-page;
}

.working-space + .final-answer {
  page-break-before: avoid;
  break-before: avoid-page;
}

/* A total is the closing line of the preceding answer area, never a
   stand-alone heading for the next page. */
.answer-lines:has(+ .total),
.working-space:has(+ .total),
.final-answer:has(+ .total) {
  page-break-after: avoid;
  break-after: avoid-page;
}

.total {
  page-break-before: avoid;
  break-before: avoid-page;
}

.keep-together {
  page-break-inside: avoid;
  break-inside: avoid-page;
}

.inline-prompt-mark {
  display: inline-block;
  margin-left: 0.35em;
  line-height: 1;
  font-weight: 400;
  white-space: nowrap;
  vertical-align: baseline;
}

/* Marks use the same type size as the question text for print legibility. */
.exam-doc .marks,
.exam-doc .inline-prompt-mark,
.exam-doc .inline-line-mark,
.exam-doc .space-mark {
  font-size: 1em;
}

/* The preview host declares its own mark size; this selector keeps exports and
   the on-screen assembled paper on the same scale. */
.sheet.runtime-exam .exam-doc .marks,
.sheet.runtime-exam .exam-doc .inline-prompt-mark,
.sheet.runtime-exam .exam-doc .inline-line-mark,
.sheet.runtime-exam .exam-doc .space-mark {
  font-size: 1em;
}

.answer-lines.with-inline-mark {
  position: relative;
  padding-right: 0;
}

.answer-lines.sub-indent,
.working-lines.sub-indent {
  margin-left: var(--continuation-indent-2);
}

.working-lines {
  margin-left: var(--continuation-indent-2);
  margin-top: 3.1mm;
}

.answer-lines .line {
  position: relative;
  height: var(--answer-row-h);
  line-height: var(--answer-row-h);
  overflow: hidden;
  border-bottom: 0;
}

.working-lines .line {
  position: relative;
  height: var(--answer-row-h);
  line-height: var(--answer-row-h);
  overflow: hidden;
  border-bottom: 0;
}

.answer-lines .line.with-inline-mark {
  display: flex;
  align-items: flex-end;
  gap: 0;
  border-bottom: 0;
  height: var(--answer-row-h);
}

.answer-lines .line.with-inline-mark .line-fill {
  position: relative;
  flex: 1 1 auto;
  height: 1em;
  overflow: hidden;
  border-bottom: 0;
}

.answer-lines .line.with-inline-mark .inline-line-mark {
  white-space: nowrap;
  line-height: 1.5;
}

.working-space {
  margin-left: var(--continuation-indent-2);
  margin-top: var(--working-space-margin-top);
  min-height: var(--working-space-lg);
  position: relative;
  overflow: visible;
  page-break-inside: auto;
  break-inside: auto;
}

.working-space.has-rows {
  height: auto;
}

.working-space.sm {
  height: var(--working-space-sm);
}

.working-space.md {
  height: var(--working-space-md);
}

.working-space.browse-collapsed {
  height: 4mm;
  margin-top: 1.2mm;
}

.working-space {
  /* Pure blank space - no border, no background */
}

.working-space .space-mark {
  position: absolute;
  right: 0;
  bottom: 0;
  white-space: nowrap;
}

.final-answer {
  margin: 2.2mm 0 0 var(--continuation-indent-2);
  white-space: nowrap;
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0;
}

.final-answer-lhs,
.final-answer-rhs {
  display: inline;
  white-space: nowrap;
}

.final-answer sup,
.inline-answer-right sup {
  position: relative;
  top: -0.42em;
  font-size: 0.72em;
  line-height: 0;
  vertical-align: baseline;
}

.final-answer sub,
.inline-answer-right sub {
  position: relative;
  bottom: -0.2em;
  font-size: 0.72em;
  line-height: 0;
  vertical-align: baseline;
}

.final-answer .marks {
  position: static;
  min-width: 0;
  margin-left: 6px;
}

.final-answer-line {
  position: relative;
  display: inline-block;
  width: 56mm;
  height: 1em;
  overflow: hidden;
  border-bottom: 0;
  transform: translateY(0.22em);
  margin: 0 4px 0 7px;
}

.inline-answer-right {
  margin-top: 2.2mm;
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  white-space: nowrap;
}

.inline-answer-right.align-left {
  justify-content: flex-start;
  margin-left: var(--continuation-indent-1);
}

.inline-answer-right.source-response-line {
  justify-content: flex-start;
  margin-left: var(--continuation-indent-2);
}

.inline-answer-right.source-response-line .inline-mark {
  margin-left: auto;
}

.inline-answer-right.full-response-line .blank {
  flex: 1 1 auto;
  width: auto;
}

.inline-answer-right .blank {
  position: relative;
  display: inline-block;
  width: 58mm;
  height: 1em;
  overflow: hidden;
  border-bottom: 0;
  transform: translateY(0.22em);
  margin: 0 4px 0 7px;
}

/* Cambridge answer rules are typeset period glyphs rather than CSS borders.
   Keeping every answer surface on this shared glyph leader makes PDF output
   vector-sharp and gives explanation, calculation and inline blanks the same
   dot size and spacing. */
.answer-lines .line:not(.with-inline-mark)::after,
.working-lines .line::after,
.answer-lines .line.with-inline-mark .line-fill::after,
.final-answer-line::after,
.inline-answer-right .blank::after,
.exam-doc.mode-browse .browse-response-line::after,
.exam-doc.mode-browse .browse-calculation-line::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  color: #111;
  font: inherit;
  line-height: 1;
  white-space: nowrap;
  content: "................................................................................................................................................................................................................................................";
}

.inline-answer-right .inline-mark {
  margin-left: 6px;
}

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1.05;
  margin: 0 0.12em;
}

.frac .num {
  border-bottom: 1px solid #111;
  padding: 0 0.22em 0.06em;
}

.frac .den {
  padding-top: 0.08em;
}

.eq-line {
  padding-left: 0;
  margin-top: 1.7mm;
  text-align: center;
}

.eq-line.has-terminal-marks {
  padding-right: 0;
}

.table-wrap {
  margin: 4.2mm 0 0 var(--continuation-indent-1);
  overflow: visible;
  page-break-inside: auto;
  break-inside: auto;
}

.table-title {
  text-align: center;
  margin-bottom: 2mm;
  font-weight: 600;
}

.table {
  border-collapse: collapse;
  width: 100%;
  max-width: 132mm;
  table-layout: fixed;
  font-size: 12px;
}

.table-marks {
  width: 100%;
  max-width: 132mm;
  margin-top: 0.8mm;
  text-align: right;
  font-size: var(--exam-font-size);
  line-height: var(--exam-line-height);
}

.table th,
.table td {
  border: 1px solid #999;
  padding: 2.2mm 2mm;
  text-align: center;
  vertical-align: middle;
  height: 10mm;
}

.table th:first-child,
.table td:first-child {
  width: 18mm;
}

.table-wrap.aligned-data {
  margin-top: 2.4mm;
  margin-left: calc(var(--continuation-indent-1) + 15mm);
}

.table.aligned-data {
  width: 96mm;
  table-layout: auto;
  font-size: var(--exam-font-size);
}

.table.aligned-data th,
.table.aligned-data td {
  height: auto;
  padding: 0.25mm 1mm;
  border: 0;
  text-align: left;
  white-space: nowrap;
}

.table.aligned-data th:first-child,
.table.aligned-data td:first-child {
  width: 66mm;
}

.exam-doc.mode-browse .answer-lines,
.exam-doc.mode-browse .working-lines {
  display: none;
}

/* Question Bank is a reading surface, not an answer sheet. Collapse prose
   answer areas and retain only the mark value. These rules never apply to
   exam mode or exported PDFs. */

.exam-doc.mode-browse .browse-answer-mark,
.exam-doc.mode-browse .browse-answer-mark-only {
  font-size: 1em;
  line-height: 1.1;
}

.exam-doc.mode-browse .browse-answer-mark-only {
  min-height: 1.1em;
  margin: 0.15mm 0 0.45mm;
  text-align: right;
}

.exam-doc.mode-browse .browse-calculation-answer {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 4px;
  min-height: 1.2em;
  margin: 0.4mm 0 0.7mm var(--continuation-indent-2);
  white-space: nowrap;
}

.exam-doc.mode-browse .browse-calculation-line {
  position: relative;
  flex: 0 0 38mm;
  height: 1em;
  overflow: hidden;
  border-bottom: 0;
  transform: translateY(0.22em);
}

.exam-doc.mode-browse .browse-calculation-answer .browse-answer-mark {
  margin-left: 3px;
}

.exam-doc.mode-browse .table-wrap {
  margin-top: 1.8mm;
}

.exam-doc.mode-browse .table th,
.exam-doc.mode-browse .table td {
  height: 6mm;
  padding: 1mm 1.4mm;
}

.mark-scheme-panel {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
}

.mark-scheme-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #111;
}

.mark-scheme-intro,
.mark-scheme-item,
.mark-scheme-empty {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.6;
}

.mark-scheme-label {
  display: inline-block;
  min-width: 42px;
  font-weight: 700;
  color: #111;
}

.mark-scheme-text {
  color: #111;
}

.mark-scheme-structured .mark-scheme-items {
  display: grid;
  gap: 7px;
}

.mark-scheme-module {
  border-top: 1px solid #b8b8b8;
  padding-top: 6px;
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.mark-scheme-module-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  font-size: 12px;
}

.mark-scheme-topics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 4px;
}

.mark-scheme-topic {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  max-width: 230px;
  padding: 1px 6px;
  overflow: hidden;
  border: 1px solid var(--syllabus-topic-border, #a8a8a8);
  border-radius: 999px;
  background: var(--syllabus-topic-bg, #f5f5f5);
  color: var(--syllabus-topic-fg, #222);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* One canonical syllabus-unit palette is shared by question-card knowledge
   tags and structured Mark Scheme topic chips. */
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch01"] { --syllabus-topic-bg: #e0f2fe; --syllabus-topic-fg: #075985; --syllabus-topic-border: #7dd3fc; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch02"] { --syllabus-topic-bg: #dcfce7; --syllabus-topic-fg: #166534; --syllabus-topic-border: #86efac; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch03"] { --syllabus-topic-bg: #fef3c7; --syllabus-topic-fg: #92400e; --syllabus-topic-border: #fcd34d; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch04"] { --syllabus-topic-bg: #ffedd5; --syllabus-topic-fg: #9a3412; --syllabus-topic-border: #fdba74; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch05"] { --syllabus-topic-bg: #fee2e2; --syllabus-topic-fg: #991b1b; --syllabus-topic-border: #fca5a5; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch06"] { --syllabus-topic-bg: #fce7f3; --syllabus-topic-fg: #9d174d; --syllabus-topic-border: #f9a8d4; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch07"] { --syllabus-topic-bg: #ede9fe; --syllabus-topic-fg: #5b21b6; --syllabus-topic-border: #c4b5fd; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch08"] { --syllabus-topic-bg: #e0e7ff; --syllabus-topic-fg: #3730a3; --syllabus-topic-border: #a5b4fc; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch09"] { --syllabus-topic-bg: #ccfbf1; --syllabus-topic-fg: #115e59; --syllabus-topic-border: #5eead4; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch10"] { --syllabus-topic-bg: #cffafe; --syllabus-topic-fg: #155e75; --syllabus-topic-border: #67e8f9; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch11"] { --syllabus-topic-bg: #fae8ff; --syllabus-topic-fg: #86198f; --syllabus-topic-border: #f0abfc; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch12"] { --syllabus-topic-bg: #dbeafe; --syllabus-topic-fg: #1d4ed8; --syllabus-topic-border: #93c5fd; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch13"] { --syllabus-topic-bg: #e0f2fe; --syllabus-topic-fg: #0369a1; --syllabus-topic-border: #7dd3fc; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch14"] { --syllabus-topic-bg: #fee2e2; --syllabus-topic-fg: #b91c1c; --syllabus-topic-border: #fca5a5; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch15"] { --syllabus-topic-bg: #ffedd5; --syllabus-topic-fg: #c2410c; --syllabus-topic-border: #fdba74; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch16"] { --syllabus-topic-bg: #fef3c7; --syllabus-topic-fg: #b45309; --syllabus-topic-border: #fcd34d; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch17"] { --syllabus-topic-bg: #ede9fe; --syllabus-topic-fg: #6d28d9; --syllabus-topic-border: #c4b5fd; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch18"] { --syllabus-topic-bg: #dcfce7; --syllabus-topic-fg: #15803d; --syllabus-topic-border: #86efac; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch19"] { --syllabus-topic-bg: #ccfbf1; --syllabus-topic-fg: #0f766e; --syllabus-topic-border: #5eead4; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch20"] { --syllabus-topic-bg: #fce7f3; --syllabus-topic-fg: #be185d; --syllabus-topic-border: #f9a8d4; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch21"] { --syllabus-topic-bg: #e0e7ff; --syllabus-topic-fg: #4338ca; --syllabus-topic-border: #a5b4fc; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch22"] { --syllabus-topic-bg: #fae8ff; --syllabus-topic-fg: #a21caf; --syllabus-topic-border: #f0abfc; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch23"] { --syllabus-topic-bg: #ffe4e6; --syllabus-topic-fg: #be123c; --syllabus-topic-border: #fda4af; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch24"] { --syllabus-topic-bg: #d1fae5; --syllabus-topic-fg: #047857; --syllabus-topic-border: #6ee7b7; }
:where(.tag.knowledge, .mark-scheme-topic)[data-unit-id="ch25"] { --syllabus-topic-bg: #f3e8ff; --syllabus-topic-fg: #7e22ce; --syllabus-topic-border: #d8b4fe; }

/* Chemistry uses the four syllabus domains as a stable semantic palette.
   AS and A Level continuations keep the same colour instead of assigning
   arbitrary per-topic colours. */
:where(.tag.knowledge, .mark-scheme-topic):is(
  [data-unit-id="chem-u01"], [data-unit-id="chem-u02"], [data-unit-id="chem-u03"], [data-unit-id="chem-u04"],
  [data-unit-id="chem-u05"], [data-unit-id="chem-u06"], [data-unit-id="chem-u07"], [data-unit-id="chem-u08"],
  [data-unit-id="chem-u23"], [data-unit-id="chem-u24"], [data-unit-id="chem-u25"], [data-unit-id="chem-u26"]
) { --syllabus-topic-bg: #e0f2fe; --syllabus-topic-fg: #075985; --syllabus-topic-border: #7dd3fc; }
:where(.tag.knowledge, .mark-scheme-topic):is(
  [data-unit-id="chem-u09"], [data-unit-id="chem-u10"], [data-unit-id="chem-u11"], [data-unit-id="chem-u12"],
  [data-unit-id="chem-u27"], [data-unit-id="chem-u28"]
) { --syllabus-topic-bg: #dcfce7; --syllabus-topic-fg: #166534; --syllabus-topic-border: #86efac; }
:where(.tag.knowledge, .mark-scheme-topic):is(
  [data-unit-id="chem-u13"], [data-unit-id="chem-u14"], [data-unit-id="chem-u15"], [data-unit-id="chem-u16"],
  [data-unit-id="chem-u17"], [data-unit-id="chem-u18"], [data-unit-id="chem-u19"], [data-unit-id="chem-u20"],
  [data-unit-id="chem-u21"], [data-unit-id="chem-u29"], [data-unit-id="chem-u30"], [data-unit-id="chem-u31"],
  [data-unit-id="chem-u32"], [data-unit-id="chem-u33"], [data-unit-id="chem-u34"], [data-unit-id="chem-u35"],
  [data-unit-id="chem-u36"]
) { --syllabus-topic-bg: #f3e8ff; --syllabus-topic-fg: #6b21a8; --syllabus-topic-border: #d8b4fe; }
:where(.tag.knowledge, .mark-scheme-topic):is(
  [data-unit-id="chem-u22"], [data-unit-id="chem-u37"]
) { --syllabus-topic-bg: #fef3c7; --syllabus-topic-fg: #92400e; --syllabus-topic-border: #fcd34d; }

.mark-scheme-module-marks {
  color: #333;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.mark-scheme-points {
  margin-top: 4px;
}

.mark-scheme-answer-image-wrap {
  padding: 5px 27px 5px 49px;
}

.mark-scheme-answer-image {
  display: block;
  width: min(100%, var(--mark-scheme-answer-image-width, 250px));
  max-width: 100%;
  height: auto;
  filter: grayscale(1);
}

.mark-scheme-point {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  padding: 3px 0 3px 49px;
  font-size: 12px;
  line-height: 1.45;
}

.mark-scheme-point-meta {
  display: inline-flex;
  align-items: center;
  align-self: start;
  justify-content: flex-end;
  min-width: 0;
  gap: 7px;
}

@media screen and (max-width: 620px) {
  .mark-scheme-point {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding-left: 32px;
  }

  .mark-scheme-topic {
    max-width: min(230px, calc(100vw - 145px));
  }
}

.mark-scheme-point + .mark-scheme-point {
  border-top: 1px dotted #d1d1d1;
}

.mark-scheme-code {
  min-width: 27px;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}

.mark-scheme-official-pages {
  margin-top: 6px;
}

.mark-scheme-official {
  page-break-inside: avoid;
  break-inside: avoid-page;
}

.mark-scheme-official .mark-scheme-head {
  page-break-after: avoid;
  break-after: avoid-page;
}

.mark-scheme-official-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  filter: grayscale(1);
  page-break-inside: avoid;
  break-inside: avoid-page;
}

.mark-scheme-official-image + .mark-scheme-official-image {
  margin-top: 5px;
}

.total {
  margin-top: 2mm;
  text-align: right;
  padding-right: 2mm;
}

@media print {
  @page {
    /* Override the preview host's generous reading margins for compact A4
       training papers while retaining a practical printer-safe edge. */
    size: A4;
    margin: 9mm 8mm 8mm !important;
  }

  /* Printed MS is an answer/marking aid, not a syllabus audit. The B1/C1/A1
     codes already carry the mark allocation, so omit duplicate topics and
     per-module totals to keep training-paper exports compact. */
  .mark-scheme-topics,
  .mark-scheme-module-marks {
    display: none !important;
  }

  .mark-scheme-module-head {
    grid-template-columns: auto;
    gap: 0;
  }

  /* Keep the answer-key heading with at least its first marking module. */
  .mark-scheme-head {
    page-break-after: avoid;
    break-after: avoid-page;
  }

  /* The outer frame must not create an empty fragment before a page break.
     The heading and first module form one indivisible leading group; later
     modules remain independently breakable so the paper stays compact. */
  .mark-scheme-panel {
    padding: 0;
    border: 0;
    page-break-inside: auto;
    break-inside: auto;
  }

  .mark-scheme-leading {
    padding: 8px;
    border: 1px solid #111;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .mark-scheme-structured .mark-scheme-items {
    display: block;
    gap: 0;
  }

  .mark-scheme-items > .mark-scheme-module {
    padding: 4px 8px;
    border: 1px solid #111;
    border-top: 0;
  }

  /* Put the subpart label beside its first marking point. A separate heading
     row wastes one line per module in printed answer keys. */
  .mark-scheme-module {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: start;
    column-gap: 7px;
    padding-top: 4px;
  }

  .mark-scheme-module-head {
    grid-column: 1;
    grid-row: 1;
  }

  .mark-scheme-points {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
  }

  .mark-scheme-point {
    padding: 1px 0;
  }

  html,
  body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  .exam-doc {
    width: auto;
    margin: 0;
  }

  .question.is-mcq,
  .mcq-doc {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  /* Leading MCQ wording, an independent stem reference figure/table and the
     A-D group may each use the next available page space. Fixed composites
     that include the stem never receive this class. */
  .question.is-mcq:has(> .mcq-doc.is-print-splittable),
  .mcq-doc.is-print-splittable {
    page-break-inside: auto;
    break-inside: auto;
  }

  .mcq-doc.is-print-splittable .mcq-question-head,
  .mcq-doc.is-print-splittable .mcq-stem-visual-tail,
  .mcq-doc.is-print-splittable .mcq-option-tail {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  /* Four independent visual options displayed as A/B over C/D may split only
     between those two complete rows. This lets A/B use the remaining page
     space while C/D continues on the next page; no individual option or fixed
     table/shared visual is fragmentable. */
  .mcq-doc.is-print-splittable .mcq-option-tail:has(> .mcq-options.is-print-row-splittable),
  .mcq-options.is-print-row-splittable {
    page-break-inside: auto;
    break-inside: auto;
  }

  .mcq-options.is-print-row-splittable .mcq-option {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .page {
    margin: 0;
    width: 100%;
    min-height: auto;
    padding: 0;
    position: static;
    overflow: visible;
    page-break-after: auto;
    break-after: auto;
    page-break-inside: auto;
    break-inside: auto;
  }

  .page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .header,
  .footer {
    display: none;
  }

  .question-number {
    margin-top: 0.8mm;
    padding-top: 0.2mm;
  }

  .row {
    margin-top: 0.7mm;
  }

  .row.with-seq {
    min-height: 0;
  }

  .row.with-seq > .row-main {
    margin-left: 0;
  }

  .seq-number {
    position: static;
    display: inline-block;
    flex: 0 0 var(--indent-level-1);
    width: var(--indent-level-1);
    min-width: var(--indent-level-1);
    margin-right: 0;
    padding-right: 0;
    text-align: left;
    vertical-align: top;
  }

  .row.has-terminal-marks > .marks {
    top: 0;
  }

  .block-gap {
    margin-top: 1.8mm;
  }

  .tight-gap {
    margin-top: 0.8mm;
  }

  .figure,
  .table-wrap,
  .table,
  .inline-answer-right,
  .final-answer {
    page-break-inside: avoid;
    break-inside: avoid-page;
  }

  .row + .table-wrap {
    page-break-before: avoid;
    break-before: avoid-page;
  }

  .working-space {
    overflow: visible;
  }
}
