/* A4 paper exam — matches the approved model (exam/build_html.py). */
@font-face { font-family: 'TradAr'; src: local('Traditional Arabic Bold'), local('TraditionalArabic-Bold'), local('Traditional Arabic'); font-weight: bold; }
.pages { direction: rtl; color: #000 }
.page { width: 210mm; height: 297mm; padding: 9mm 10mm; background: #fff; position: relative; margin: 0 auto 8mm; box-shadow: 0 2px 12px rgba(0,0,0,.18); font-family: 'TradAr', 'Traditional Arabic', 'Amiri', serif; font-weight: bold; break-after: page; overflow: hidden }
.page * { box-sizing: border-box }
.frame { border: 2px solid #000; height: 100%; padding: 4mm; position: relative; display: flex; flex-direction: column }
.frame .body { flex: 1; overflow: hidden; min-height: 0; margin-bottom: 12mm } /* extra room keeps the Word copy on the same pages */
.page table { border-collapse: collapse; width: 100% }
.page td, .page th { border: 1.5px solid #000; padding: 1mm 2mm; vertical-align: middle; font-weight: bold }
.hdr td { font-size: 14pt; height: 9mm }
.hdr .logo { text-align: center; width: 30% }
.hdr .logo img { height: 27mm; max-width: 100%; object-fit: contain }
.title td { text-align: center; font-size: 14pt; height: 9mm }
.marks td { font-size: 13pt; height: 8mm }
.student { margin-top: 2mm }
.student td { font-size: 14pt; height: 10mm }
.bar { display: flex; align-items: stretch; margin: 4mm 0 2mm; border: 1.5px solid #000 }
.bar .t { flex: 1; background: #d9e8f5; font-size: 16pt; padding: 1mm 3mm; -webkit-print-color-adjust: exact; print-color-adjust: exact }
.bar .m { width: 28mm; border-right: 1.5px solid #000; text-align: center; font-size: 14pt; padding: 1mm }
.q { border: 1.5px solid #000; margin-bottom: 2mm; display: flex }
.q .qn { width: 11mm; flex: none; border-left: 1.5px solid #000; display: flex; align-items: center; justify-content: center; font-size: 17pt; background: #f2f2f2; -webkit-print-color-adjust: exact; print-color-adjust: exact }
.q .qmain { flex: 1; min-width: 0 }
.q .stem { display: flex; align-items: center; font-size: 17pt; padding: 1mm 3mm; min-height: 10mm; gap: 3mm }
.q .stem .tx { flex: 1 }
.qimg { max-width: 72mm; object-fit: contain; display: block }
.qm { font-size: 12pt; white-space: nowrap }
.q .opts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1.5px solid #000 }
.q .opts.two { grid-template-columns: repeat(2, 1fr) }
.q .opts div { font-size: 17pt; padding: 1mm 3mm; border-left: 1.5px solid #000 }
.q .opts:not(.two) div:nth-child(4n) { border-left: 0 }
.q .opts.two div:nth-child(2n) { border-left: 0 }
.q .opts.two div:nth-child(-n+2) { border-bottom: 1.5px solid #000 }
.ok { background: #c8ecc8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact }
.tf { table-layout: fixed; margin-top: -1.5px }
.tf td { font-size: 17pt; height: 13mm }
.tf th { font-size: 15pt; background: #eee; height: 9mm; -webkit-print-color-adjust: exact; print-color-adjust: exact }
.tf .n { width: 11mm; text-align: center }
.tf .ans { width: 30mm; text-align: center }
.tfx { display: flex; align-items: center; justify-content: space-between; gap: 3mm }
.closing { text-align: center; font-size: 17pt; margin-top: 10mm; line-height: 1.8 }
.foot { position: absolute; bottom: 2.5mm; left: 0; right: 0; text-align: center; font-size: 13pt }
.keybar { background: #2e7d32; color: #fff; text-align: center; font-size: 15pt; padding: 1mm; margin-bottom: 2mm; -webkit-print-color-adjust: exact; print-color-adjust: exact }
.quickwrap { display: flex; gap: 6mm; align-items: flex-start }
.quick th, .quick td { text-align: center; font-size: 14pt; height: 8mm }
.quick th { background: #eee }

@media print {
  @page { size: A4; margin: 0 }
  .page { margin: 0; box-shadow: none }
}
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; margin: 0 1mm; font-size: .85em }
.frac > span:first-child { border-bottom: 1.5px solid #000; padding: 0 1mm }
