@page {
  size: A4;
  margin: 18mm 14mm;
}

* {
  box-sizing: border-box;
}


/* body {
  background: #fff;
  color: #000;
  font-family: "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.25;
  margin: 0;
  padding: 0;
} */

/* .a4-preview {
  width: 100%;
  background: #fff;
  color: #000;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: 14px;
  line-height: 1.25;
} */

.preview-header {
  display: none !important;
}

/* Header */
.paper-header {
  text-align: center;
  margin-bottom: 8px;
}

.paper-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: bold;
  text-transform: uppercase;
}

.paper-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 4px;
}

hr {
  border: none;
  border-top: 1px solid #000;
  margin: 8px 0;
}

/* Instructions */
.general-instructions {
  margin: 8px 0 12px;
  font-size: 13px;
  line-height: 1.2;
}

.general-instructions ol,
.general-instructions ul {
  margin: 4px 0 0 16px;
  padding-left: 12px;
}

.general-instructions li {
  margin-bottom: 2px;
}

.general-instructions p {
  margin: 0;
}

/* Sections */
.section-heading {
  margin: 14px 0 6px;
  padding-bottom: 3px;
  text-align: left;
  font-weight: bold;
  font-size: 16px;
  border-bottom: 1.5px solid #000;
}

.section-instructions {
  font-style: italic;
  margin-bottom: 8px;
  font-size: 13px;
}

.group-heading {
  margin: 10px 0 6px;
  font-weight: bold;
  font-size: 14px;
  border-bottom: 1px dashed #999;
  padding-bottom: 3px;
}

/* Questions */
.preview-question {
  margin-bottom: 8px;
  page-break-inside: avoid;
  break-inside: avoid;
}

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

.question-number,
.question-body,
.marks-box {
  display: table-cell;
  vertical-align: top;
}

.question-number {
  width: 40px;
  font-weight: bold;
  white-space: nowrap;
  padding-top: 1px;
}

.question-body {
  padding-right: 8px;
  line-height: 1.25;
}

.question-html p,
.question-body p {
  margin: 0 0 4px;
}

.marks-box {
  width: 70px;
  text-align: right;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  padding-top: 1px;
}

.question-image {
  margin: 6px 0;
  border: 1px solid #ddd;
  max-width: 260px;
}

/* MCQ */
.mcq-options {
  margin-top: 6px;
  display: grid;
  column-gap: 22px;
  row-gap: 4px;
  width: 100%;
}

.four-column {
  grid-template-columns: repeat(4, 1fr);
}

.two-column {
  grid-template-columns: repeat(2, 1fr);
}

.one-column {
  grid-template-columns: 1fr;
}

.mcq-option {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  min-height: 20px;
  break-inside: avoid;
}

.option-label {
  flex: 0 0 22px;
  font-weight: bold;
  line-height: 1.25;
}

.option-text {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.option-text p {
  margin: 0;
  display: inline;
}

.option-image {
  margin-top: 4px;
  border: 1px solid #ddd;
}

/* Match Column */
.match-column {
  display: block;
  width: 100%;
  clear: both;
  margin-top: 8px;
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  width: 100%;
}

.match-row {
  margin-top: 4px;
  line-height: 1.3;
}

/* KaTeX */
.katex {
  font-size: 1.02em;
}

.katex-display {
  margin: 4px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Print safety */
@media print {
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .preview-question,
  .mcq-option,
  .match-column {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}