/* Practice papers: the page around the paper (practice-common.css does the header, hero, content and footer) and the paper
   itself, which looks like a school paper on screen and prints like one. */
:root { --hero: linear-gradient(120deg, #1B2A4A, #23497a 55%, #2f6f8f); --accent: #23497a; --accent-soft: #e9f0f8; --btn: #ffd88a; --btn-hover: #ffc85c; --related: #eef3f9; --related-line: #cfdbea; }
body { background: #eef2f6; }
.hero h1 { font-size: clamp(25px, 5vw, 38px); margin: 0 auto 12px; line-height: 1.2; max-width: 860px; }
.hero p { font-size: clamp(15px, 2.4vw, 18px); max-width: 700px; margin: 0 auto; line-height: 1.6; }
.badge { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.5); border-radius: 20px; padding: 6px 14px; font-size: 13px; }
.crumbs { max-width: 900px; margin: 14px auto 0; padding: 0 16px; font-size: 14px; color: #556; }
.crumbs a { color: var(--accent); }

/* the tool bar above the paper */
.bar { position: sticky; top: 0; z-index: 5; background: #fff; border-radius: 0 0 14px 14px; box-shadow: 0 6px 18px -10px rgba(20,40,70,.5); padding: 10px 12px; margin: 18px 0 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar .btn { padding: 9px 13px; font-size: 14.5px; min-height: 42px; }
.bar label.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #334; padding: 0 4px; min-height: 42px; }
.bar label.chk input { width: 18px; height: 18px; }
.bar label.count select { font-size: 15px; padding: 6px 8px; min-height: 40px; }
#timerShow { font: 700 20px/1 ui-monospace, Menlo, Consolas, monospace; color: #0C7B5F; background: #e3f6ee; padding: 8px 12px; border-radius: 8px; margin-left: auto; }
#timerShow.low { color: #b42318; background: #fdecea; }
#timerShow[hidden] { display: none; }

/* the paper */
#paperSheet { background: #fff; border: 1px solid #cfd8e3; border-radius: 6px; box-shadow: 0 8px 26px -14px rgba(20,40,70,.45); padding: 26px 30px 30px; font-family: Arial, "Helvetica Neue", sans-serif; color: #111; font-size: 17px; line-height: 1.55; }
.ph { border: 2px solid #111; padding: 12px 14px; display: grid; gap: 8px; }
.ph-title { display: flex; flex-direction: column; text-align: center; }
.ph-title b { font-size: 21px; }
.ph-title span { font-size: 15.5px; }
.ph-meta, .ph-name { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; font-size: 15px; }
.ph-name span { flex: 1 1 150px; display: flex; gap: 6px; }
.ph-name i, .ph-score i { flex: 1; border-bottom: 1px solid #111; min-width: 60px; font-style: normal; text-align: center; }
.ph-score { justify-self: end; display: flex; gap: 6px; font-weight: 700; min-width: 160px; }
.ph-how { margin: 14px 0 6px 22px; font-size: 14.5px; color: #333; }
.psec { margin-top: 22px; }
.psec h3 { font-size: 18px; border-bottom: 2px solid #111; padding-bottom: 4px; margin-bottom: 6px; }
.psec h3 small { font-weight: 400; font-size: 14px; }
.psec-note { font-size: 14.5px; color: #444; font-style: italic; margin-bottom: 8px; }
.pq { padding: 12px 0 14px; border-bottom: 1px dashed #c8d0da; break-inside: avoid; }
.pq:last-child { border-bottom: none; }
.pq-top { display: flex; gap: 10px; align-items: flex-start; }
.pq-n { font-weight: 700; min-width: 26px; }
.pq-text { flex: 1; }
.pq-marks { font-size: 14px; color: #333; white-space: nowrap; }
.pq-text .gap { display: inline-block; min-width: 46px; border: 1.5px solid #111; text-align: center; font-weight: 700; }
.pq-text .blank { letter-spacing: 1px; }
.pq-text .seq { display: inline-block; margin-top: 6px; font-weight: 700; word-spacing: 3px; }
.pq-fig { margin: 10px 0 4px 36px; }
.vsum { display: inline-block; font: 700 24px/1.45 ui-monospace, Menlo, Consolas, monospace; }
.vsum .r { display: flex; }
.vsum .r span, .vsum .r b { width: 1.25em; text-align: center; }
.vsum .op { width: 1.25em; }
.vsum .tot { border-top: 2px solid #111; border-bottom: 4px double #111; }
.vsum .box { border: 2px solid #111; border-radius: 3px; font-size: 16px; line-height: 1.6; margin: 2px 1px; }
/* fractions written one number over the other */
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 3px; font-weight: 700; line-height: 1.15; }
.fr > span:first-child { border-bottom: 1.6px solid currentColor; padding: 0 3px; }
.fr .gap { min-width: 30px; padding: 0 2px; font-size: 14px; }
.fr-eq { display: inline-flex; align-items: center; gap: 4px; font-size: 19px; }
/* WA3: two-box answers (__ km __ m), pairs of lines, mixed numbers, number lines, scales, beakers, balances */
.ans-cu input { width: 70px; }
.ans-wide input { width: 170px; }
.mixed { display: inline-flex; align-items: center; font-weight: 700; }
.pic-nl, .pic-dial, .pic-beaker, .pic-balance, .pic-fig { display: block; max-width: 100%; height: auto; }
@media print { .pic-nl, .pic-dial, .pic-beaker, .pic-balance, .pic-fig { break-inside: avoid; } .ans.ans-cu input { width: 18mm; } .ans.ans-wide input { width: 45mm; } }
/* WA2 pictures */
.pic-graph, .pic-grid, .pic-shape, .pic-frac { display: block; max-width: 100%; height: auto; }
.pic-angles { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pic-angles .ang { margin: 0; text-align: center; }
.pic-angles figcaption { font-weight: 700; font-size: 16px; margin-top: -8px; }
@media print { .pic-graph, .pic-grid, .pic-shape, .pic-frac, .pic-angles { break-inside: avoid; } }
/* pictures (our own drawings, made from each question's numbers) */
.pic { margin: 4px 0; }
.pic-money { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border: 1.5px solid #9aa6b4; border-radius: 8px; max-width: 640px; }
.pic-money svg { display: block; }
.pic-items { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.pic-items .item { margin: 0; display: flex; flex-direction: column; align-items: center; width: 104px; text-align: center; }
.pic-items figcaption { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 14.5px; }
.pic-items .tag { border: 2px solid #111; border-radius: 4px 12px 12px 4px; padding: 1px 9px; font-weight: 700; font-size: 16px; }
.pic-menu { border-collapse: collapse; font-size: 15.5px; min-width: 260px; }
.pic-menu caption { font-weight: 700; padding-bottom: 4px; text-align: left; }
.pic-menu th, .pic-menu td { border: 1.5px solid #333; padding: 4px 12px; text-align: left; }
.pic-menu th { background: #eef1f5; }
.pic-menu td:last-child { text-align: right; font-weight: 700; }
.pic-groups { display: flex; flex-wrap: wrap; gap: 10px; }
.pic-sym .eq { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; margin: 4px 0; }
.pic-sym .sym { vertical-align: middle; }
.strip { display: inline-flex; flex-wrap: wrap; }
.strip .cell { min-width: 70px; padding: 8px 6px; border: 2px solid #111; margin-left: -2px; text-align: center; font-weight: 700; font-size: 18px; }
.strip .cell.q { color: #23497a; }
.num-cards .card.wide { width: auto; min-width: 74px; padding: 0 10px; font-size: 22px; }
.pq-mcq .pq-fig + .pq-opts { margin-top: 6px; }
@media print { .pic-money, .pic-items, .pic-menu, .pic-groups, .strip { break-inside: avoid; } }
.cards { display: flex; flex-wrap: wrap; gap: 10px; }
.card { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 58px; border: 2px solid #111; border-radius: 6px; font: 700 26px/1 Arial, sans-serif; background: #fff; }
.pq-text .seq .gap { margin: 0 2px; }
.pq-opts.long { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pq-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; margin: 10px 0 0 36px; }
.opt { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1.5px solid #d4dbe4; border-radius: 8px; cursor: pointer; min-height: 44px; }
.opt input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.opt .on { font-weight: 700; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: #1a7f37; background: #e6f6ea; }
.opt.wrong { border-color: #c62828; background: #fdecea; }
.pq-bracket { display: none; }
.pq-part { margin: 10px 0 0 36px; }
.pq-ptext .pl { font-weight: 700; }
.work { display: none; }
.pq-ans-row { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: flex-end; margin-top: 8px; }
.pq-part .ans { display: flex; justify-content: flex-end; margin-top: 6px; }
.ans { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.ans input { font: inherit; font-weight: 700; width: 130px; padding: 6px 8px; border: 1.5px solid #9fb0c4; border-radius: 6px; min-height: 40px; }
.ans input:focus { outline: 3px solid #9cc3ef; border-color: var(--accent); }
.ans input.right { border-color: #1a7f37; background: #e6f6ea; }
.ans input.wrong { border-color: #c62828; background: #fdecea; }
.ans .unit { font-weight: 400; }
.pq-result { font-size: 15px; margin: 8px 0 0 36px; }
.pq-result:empty { display: none; }
.pq-result .tick { color: #1a7f37; }
.pq-result .cross { color: #c62828; }
.pq-result .wk { display: block; color: #445; font-size: 14px; margin-top: 2px; }
.pend { text-align: center; font-weight: 700; margin-top: 22px; }

#markResult { background: #fff; border-radius: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.08); padding: 20px; margin: 16px 0; text-align: center; }
#markResult[hidden] { display: none; }
#markScore { font-size: 44px; font-weight: 800; color: #0C7B5F; }
#answerKey { background: #fff; border-radius: 10px; padding: 18px; margin: 16px 0; }
#answerKey[hidden] { display: none; }
#answerKey h2 { font-size: 20px; margin-bottom: 10px; color: #1B2A4A; }
.key-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.key-table th, .key-table td { border: 1px solid #cfd8e3; padding: 6px 8px; text-align: left; vertical-align: top; }
.key-table th { background: #1B2A4A; color: #fff; }
.key-note { font-size: 13.5px; color: #555; margin-top: 10px; }

/* the section page: terms of the school year */
.terms { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 8px; }
.term { background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 3px 12px rgba(20,40,70,.08); border-top: 6px solid var(--c, #23497a); display: flex; flex-direction: column; gap: 6px; }
.term h3 { font-size: 17px; color: #1B2A4A; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.term h3 .test { font-size: 12.5px; font-weight: 700; color: var(--c, #23497a); border: 1.5px solid var(--c, #23497a); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.term .when { font-size: 13px; color: #667; min-height: 2.6em; }
.term a.paper, .term span.paper { display: block; flex: 1; border-radius: 10px; padding: 10px; font-weight: 700; text-decoration: none; font-size: 15px; }
.term a.paper .go { white-space: nowrap; }
.term a.paper { background: var(--accent); color: #fff; }
.term a.paper:hover { background: #1B2A4A; }
.term a.paper small, .term span.paper small { display: block; font-weight: 400; font-size: 12.5px; opacity: .9; }
.term span.paper { background: #eef1f5; color: #667; }
.term ul { margin: 2px 0 0 18px; font-size: 13.5px; color: #445; line-height: 1.5; }
.level-h { font-size: 21px; color: #1B2A4A; margin: 26px 0 0; }

@media (max-width: 760px) {
  /* on a phone the tools wrap to several rows: let them scroll away instead of covering the paper */
  .bar { position: static; border-radius: 14px; }
  #paperSheet { padding: 16px 12px 20px; font-size: 16px; }
  .pq-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-left: 0; }
  .pq-fig, .pq-part, .pq-result { margin-left: 0; }
  .terms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #timerShow { margin-left: 0; }
}
@media (max-width: 440px) { .terms { grid-template-columns: 1fr; } .term .when { min-height: 0; } .ans input { width: 110px; } }

/* printing: only the paper (and the answer key on its own page when chosen), like a real paper */
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  body { background: #fff; }
  body > *:not(main), main > *:not(.wrap), .wrap > *:not(#paperSheet):not(#answerKey) { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  #paperSheet { border: none; box-shadow: none; padding: 0; font-size: 12.5pt; }
  .pq { border-bottom: none; padding: 8pt 0 10pt; }
  .opt { border: none; padding: 0; min-height: 0; }
  .opt input { display: none; }
  .pq-bracket { display: block; text-align: right; font-weight: 700; margin-top: 2pt; }
  .work { display: block; min-height: 40mm; border: 1px solid #999; border-radius: 3px; margin: 4pt 0; position: relative; }
  .work span { position: absolute; top: 3pt; left: 6pt; font-size: 9pt; color: #777; }
  .ans input { border: none; border-bottom: 1.2pt solid #111; border-radius: 0; background: none !important; width: 38mm; padding: 0 2pt; min-height: 0; }
  .ans input::placeholder { color: transparent; }
  .pq-result, .opt.right, .opt.wrong { background: none !important; }
  body:not(.print-marked) .pq-result { display: none; }
  #answerKey { display: none !important; }
  body.print-key #answerKey { display: block !important; break-before: page; padding: 0; }
  .psec { break-inside: auto; }
  /* a problem sum may split between its parts, never inside one; a heading stays with what follows */
  .pq-problem, .pq.has-parts { break-inside: auto; }
  .pq.has-parts .pq-top { break-after: avoid; }
  .pq-fig { break-inside: avoid; }
  .pq-problem .pq-top, .pq-part { break-inside: avoid; }
  .pq-problem .pq-top { break-after: avoid; }
  .psec h3, .psec-note { break-after: avoid; }
  .pq-opts.long { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* drawing questions (print only): a note on screen, the right line in the key and after marking */
.pq-draw-note { margin: 8px 0 0 36px; padding: 8px 12px; background: #fff7e0; border: 1px solid #f0d58a; border-radius: 8px; font-size: 14.5px; }
.pq-result .self { color: #8a5a00; display: block; }
.key-fig svg { display: block; max-width: 100%; height: auto; margin-top: 6px; }
.key-table .key-fig svg { max-width: 230px; }
@media print { .pq-draw-note, .pq-result .key-fig { display: none; } .key-fig svg { break-inside: avoid; } }

/* end-of-year pictures: clock faces, figures of squares, rectangles with their sides, picture graphs */
.pic-clock, .pic-area, .pic-rect, .pic-pgraph { max-width: 100%; height: auto; }
@media print { .pic-clock, .pic-area, .pic-rect, .pic-pgraph { break-inside: avoid; } }

/* ── English papers ── */
.plead { margin: 12px 0 6px; }
.psg-title { font-weight: 700; text-align: center; margin: 4px 0 8px; }
/* a comprehension passage with line numbers every 5 lines, as on the school papers */
.psg { border: 1.5px solid #111; padding: 12px 16px 12px 8px; font-size: 16.5px; line-height: 1.7; }
.psg-l { display: flex; gap: 10px; }
.psg-l .ln { flex: 0 0 26px; text-align: right; font-size: 12.5px; color: #444; padding-top: 3px; }
.psg-gap { height: 10px; }
.cloze { line-height: 2.1; font-size: 16.5px; }
.cloze .czn { font-weight: 700; }
.cloze .czl { display: inline-block; width: 70px; border-bottom: 1.5px solid #111; margin: 0 4px; vertical-align: -3px; }
.cloze .given { font-style: italic; }
.wbox { border: 1.5px solid #111; border-radius: 6px; padding: 8px 12px; margin: 6px 0 10px; }
.wbox ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px 12px; }
.wbox .wl { font-weight: 700; }
/* editing: each mistake has a numbered box above it */
.editing { line-height: 2.8; }
.ed { position: relative; display: inline-block; line-height: 1.3; }
.ed-s { text-decoration: underline; text-underline-offset: 3px; }
.ed-g { font-weight: 700; }
.ed-p { font-style: italic; text-decoration: underline dotted; text-underline-offset: 3px; }
.ed-box { position: absolute; left: 50%; transform: translateX(-50%); top: -1.5em; font-size: 12px; line-height: 1.2; border: 1.2px solid #111; padding: 0 3px; background: #fff; white-space: nowrap; }
.ed-box .czn { font-weight: 700; }
.pq-grid { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 0 8px; }
.pq.pq-compact { border-bottom: none; padding: 4px 0; }
.pq-compact .pq-top { display: none; }
.pq-compact .ans-l { display: none; }
.pq-compact { display: flex; align-items: center; gap: 6px; }
.pq-compact::before { content: "(" attr(data-n) ")"; font-weight: 700; }
.pq-compact .pq-result { flex-basis: 100%; }
.en-parts { margin: 8px 0 2px 36px; display: grid; gap: 8px; }
.pq-compact .en-parts { margin: 0; }
.en-p { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.en-l { font-weight: 700; }
.pks { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; }
.pk { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid #9aa6b4; border-radius: 8px; padding: 3px 9px; cursor: pointer; min-height: 34px; }
.pk input { width: 17px; height: 17px; margin: 0; }
.pk.right { border-color: #0C7B5F; background: #e3f6ee; }
.pk.wrong { border-color: #b42318; background: #fdecea; }
.en-parts textarea { width: 100%; max-width: 640px; font: inherit; font-size: 16px; padding: 6px 8px; border: 1.5px solid #9aa6b4; border-radius: 6px; }
.sent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.sent input { flex: 1 1 260px; font: inherit; font-size: 16px; padding: 6px 8px; border: 1.5px solid #9aa6b4; border-radius: 6px; }
.en-parts textarea.right, .sent input.right, .ord select.right { border-color: #0C7B5F; background: #e3f6ee; }
.en-parts textarea.wrong, .sent input.wrong, .ord select.wrong { border-color: #b42318; background: #fdecea; }
.ord { display: grid; gap: 6px; }
.ord-r { display: flex; gap: 10px; align-items: center; }
.ord select { font: inherit; width: 54px; min-height: 36px; text-align: center; border: 1.5px solid #111; border-radius: 4px; }
.syn-a, .syn-b { margin: 2px 0; }
.syn-w { font-weight: 700; border-bottom: 1.5px solid #111; padding: 0 4px; }
table.tf { border-collapse: collapse; margin: 6px 0; width: 100%; max-width: 680px; font-size: 15.5px; }
table.tf th, table.tf td { border: 1.5px solid #333; padding: 5px 8px; }
table.tf th { background: #eef1f5; }
table.tf td:not(:first-child), table.tf th:not(:first-child) { width: 70px; text-align: center; }
table.tf tr.ex td { color: #444; }
table.tf .pk { border: none; padding: 0; justify-content: center; }
table.tf .pk.right { background: #e3f6ee; } table.tf .pk.wrong { background: #fdecea; }
.selfchk { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.btn-s { font: inherit; font-size: 14px; border-radius: 8px; padding: 5px 12px; cursor: pointer; border: 1.5px solid #333; background: #fff; }
.btn-s.yes { border-color: #0C7B5F; color: #0C7B5F; } .btn-s.no { border-color: #b42318; color: #b42318; }
/* the poster for the visual-text questions (our own design) */
.poster { border: 3px solid #23497a; border-radius: 14px; padding: 14px; max-width: 560px; background: #fffaf0; font-size: 15.5px; line-height: 1.45; }
.po-top { display: flex; gap: 12px; align-items: center; }
.po-icon { font-size: 44px; }
.po-name { font-size: 24px; font-weight: 800; color: #23497a; }
.po-what { font-style: italic; }
.po-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.po-grid > div { border: 1.5px solid #c9b88a; border-radius: 8px; padding: 6px 8px; background: #fff; }
.po-grid b { display: block; font-size: 13.5px; color: #6b5420; }
.po-acts ul { margin: 4px 0 8px 20px; }
.po-early { background: #ffe58a; border-radius: 8px; padding: 6px 10px; font-weight: 700; }
.po-foot { font-size: 13.5px; margin-top: 8px; }
@media (max-width: 560px) { .po-grid { grid-template-columns: 1fr; } .en-parts { margin-left: 0; } .psg { padding-right: 8px; font-size: 15.5px; } }
@media print {
  .psg, .wbox, .poster, table.tf { break-inside: avoid; }
  .pk { border: none; padding: 0 4px; }
  .en-parts textarea { border: none; border-bottom: 1px solid #111; border-radius: 0; resize: none; min-height: 3.2em; background: repeating-linear-gradient(transparent 0 1.55em, #111 1.55em calc(1.55em + 1px)); }
  .sent input { border: none; border-bottom: 1px solid #111; border-radius: 0; }
  .ord select { appearance: none; -webkit-appearance: none; background: #fff; }
  .selfchk { display: none; }
  .poster { background: #fff; }
}

/* ── Science: rows of drawings, tables, picture options, statement lists, option tables ── */
.sci-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; margin: 4px 0 8px; }
.sci-fig { margin: 0; text-align: center; }
.sci-fig figcaption { font-weight: 700; font-size: 15px; margin-top: 2px; }
svg.sci-art, svg.sci-chart, svg.sci-bar { max-width: 100%; height: auto; display: block; margin: 0 auto; }
table.sci-table { border-collapse: collapse; margin: 8px 0; font-size: 15px; max-width: 100%; }
table.sci-table th, table.sci-table td { border: 1.5px solid #333; padding: 5px 10px; text-align: center; }
table.sci-table th { background: #eef1f5; }
table.sci-table td:first-child { font-weight: 600; }
table.sci-table.ticks td { min-width: 54px; font-size: 17px; }
ol.sci-st { margin: 8px 0 4px 1.4em; padding-left: 1.2em; }
ol.sci-st li { margin: 3px 0; padding-left: 4px; }
.pq-opts.pics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pq-opts.pics .opt { align-items: flex-start; }
.opt-pic { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.opt-pic small { font-size: 14px; }
table.pq-otable { border-collapse: collapse; margin: 10px 0 0 36px; font-size: 15px; }
table.pq-otable th, table.pq-otable td { border: 1.5px solid #333; padding: 4px 10px; text-align: center; }
table.pq-otable .opt { border: none; min-height: 0; padding: 0; }
table.tf.grid td:not(:first-child), table.tf.grid th:not(:first-child) { width: 110px; }
.pq-part .pq-fig { margin-left: 0; }
@media (max-width: 600px) { .pq-opts.pics { grid-template-columns: repeat(2, minmax(0, 1fr)); } table.pq-otable { margin-left: 0; } table.sci-table { font-size: 13.5px; } table.sci-table th, table.sci-table td { padding: 4px 5px; } table.sci-table.ticks td { min-width: 36px; } }
@media print { .sci-row, svg.sci-chart, svg.sci-bar, table.sci-table, ol.sci-st { break-inside: avoid; } .pq-opts.pics .opt-pic svg { max-width: 34mm; } }
/* Science answer key: explanations are sentences, so they get the wider column */
table.key-table.key-sci th:nth-child(2), table.key-table.key-sci td:nth-child(2) { width: 38%; }
table.key-table.key-sci th:nth-child(3), table.key-table.key-sci td:nth-child(3) { width: 50%; }
/* written answers print as two plain ruled lines (a repeating gradient can print as a dark smear) */
@media print {
  .pq-part .en-parts textarea, .en-parts textarea { border: none !important; background: linear-gradient(#111, #111) 0 1.55em / 100% 1px no-repeat, linear-gradient(#111, #111) 0 3.1em / 100% 1px no-repeat !important; min-height: 3.3em; }
}

/* ── Chinese papers (华文): a Kai or Song font where the device has one, pinyin over hard characters, paragraphs
   indented two characters as in Chinese books, numbered so "第二段" is easy to find ── */
#paperSheet.zh, #paperSheet.zh .pq-opts, #paperSheet.zh .tf td { font-family: "KaiTi", "STKaiti", "Kaiti SC", "BiauKai", "Noto Serif SC", "Songti SC", "SimSun", serif; }
#paperSheet.zh .ph, #paperSheet.zh .pq-n, #paperSheet.zh .pq-marks, #paperSheet.zh input, #paperSheet.zh textarea { font-family: inherit; }
#paperSheet.zh .pq-text, #paperSheet.zh .pq-opts { font-size: 17px; line-height: 1.8; }
.zh-blank { display: inline-block; min-width: 3em; border-bottom: 1.5px solid #111; margin: 0 2px; }
.zh-psg { padding-left: 30px; }
.zh-para { margin: 0 0 6px; text-indent: 2em; position: relative; }
.zh-pn { position: absolute; left: -22px; text-indent: 0; font-size: 11px; color: #777; font-family: Arial, sans-serif; top: 4px; }
.zh-psg ruby rt { font-size: 10px; font-family: Arial, sans-serif; color: #333; }
.dp-list { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 18px; font-size: 17px; }
.dp-list .czn { margin-right: 4px; }
.gx-how { font-weight: 700; margin-bottom: 4px; }
.gx-a, .gx-b { margin: 2px 0 2px 1em; }
.zh .ord-r span, .zh table.tf td { font-size: 16.5px; }
.zh .pq .sent input { width: min(100%, 520px); font-size: 17px; }
@media print { .zh-psg, .dp-list, .zh-box { break-inside: avoid; } .zh-psg ruby rt { font-size: 8px; } }

/* 试卷一 composition (the Chinese end-of-year paper): four pictures, the words, hints and 方格 squares (print only) */
.zh-p1 { border-bottom: 3px double #111; padding-bottom: 14px; margin-bottom: 18px; }
.zc-screen { background: #fff7e0; border: 1px solid #f0d58a; border-radius: 8px; padding: 8px 12px; font-size: 14.5px; font-family: system-ui, sans-serif; }
.zc-h { font-size: 18px; border-bottom: 2px solid #111; padding-bottom: 4px; margin: 14px 0 6px; }
.zc-h small { font-weight: 400; font-size: 13px; }
.zc-task { font-size: 17px; line-height: 1.8; }
.zc-pics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 8px 0 12px; }
.zc-pics figure { margin: 0; border: 1.5px solid #111; padding: 4px; position: relative; }
.zc-pics img { display: block; width: 100%; height: auto; }
.zc-pics figcaption { position: absolute; top: 4px; left: 8px; font-size: 20px; font-weight: 700; background: rgba(255,255,255,.85); border-radius: 50%; line-height: 1; }
.zc-words ol { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.zc-hints ol { margin: 4px 0 0; padding-left: 1.6em; font-size: 16px; line-height: 1.7; }
.zc-paper { display: none; }
.zc-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.zc-grid { display: grid; grid-template-columns: repeat(20, 1fr); row-gap: 2.6mm; }
.zc-grid i { display: block; aspect-ratio: 1; border: 0.8px solid #444; margin-left: -0.8px; position: relative; }
.zc-grid i:nth-child(20n + 1) { margin-left: 0; }
.zc-grid i[data-n]::after { content: attr(data-n); position: absolute; right: -6mm; bottom: 0; font-size: 7pt; color: #555; font-style: normal; font-family: Arial, sans-serif; }
.zc-key { margin-top: 18px; }
.zc-model { border: 1px solid #ccc; border-radius: 8px; padding: 10px 14px; margin-top: 10px; font-family: "KaiTi", "STKaiti", "Kaiti SC", serif; font-size: 16px; line-height: 1.8; }
.zc-model p { text-indent: 2em; margin: 4px 0; }
@media (max-width: 560px) { .zc-pics { grid-template-columns: 1fr; } .zc-words ol { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print {
  .zc-screen { display: none; }
  .zh-p1 { border: none; margin: 0; padding: 0; break-after: page; }
  .zc-pics { gap: 4mm 5mm; }
  .zc-pics figure, .zc-words, .zc-hints { break-inside: avoid; }
  .zc-paper { display: block; break-before: page; padding-right: 7mm; }
  .zc-key, .zc-model { break-inside: avoid; }
}

/* 口试 oral (the Chinese end-of-year paper, print): the passage to read, the picture and its questions, the talk */
.zh-oral { border-top: 3px double #111; padding-top: 14px; margin-top: 18px; }
.zo-read { border: 1.5px solid #111; padding: 10px 16px; font-size: 19px; line-height: 2.1; }
.zo-read p { text-indent: 2em; margin: 0; }
.zo-pic { border: 1.5px solid #111; padding: 4px; max-width: 560px; margin: 6px auto 8px; }
.zo-pic img { display: block; width: 100%; height: auto; }
.zo-qs { font-size: 17px; line-height: 1.9; padding-left: 1.8em; margin: 4px 0 10px; }
.zo-pat ul { margin: 4px 0 0; padding-left: 1.4em; font-size: 16px; line-height: 1.7; }
.zo-key ol { padding-left: 1.6em; } .zo-key li { margin: 4px 0; }
@media print {
  .zh-oral { border: none; padding: 0; margin: 0; break-before: page; }
  .zo-read, .zo-pic, .zo-pat { break-inside: avoid; }
  .zo-key { break-before: page; }
}
.zh-head { text-align: center; font-size: 14px; color: #333; margin: -4px 0 8px; }

/* Chinese papers in print: bigger characters (a school paper is about 15pt), and as many questions on a page as a school
   paper: the answer bracket ( ) on the options line, less space between questions, smaller pictures */
@media print {
  #paperSheet.zh { font-size: 18pt; line-height: 1.45; }
  #paperSheet.zh .pq-text, #paperSheet.zh .pq-opts, #paperSheet.zh .tf td, #paperSheet.zh .dp-list, #paperSheet.zh .wbox, #paperSheet.zh .pq textarea, #paperSheet.zh .sent { font-size: 18pt; line-height: 1.45; }
  #paperSheet.zh .psg, #paperSheet.zh .zo-read { font-size: 17pt; line-height: 1.7; }
  #paperSheet.zh .zc-task, #paperSheet.zh .zo-qs, #paperSheet.zh .zc-hints ol, #paperSheet.zh .gx-how, #paperSheet.zh .ph-how { font-size: 17pt; }
  #paperSheet.zh .pq { padding: 4pt 0 5pt; }
  #paperSheet.zh .pq-mcq { position: relative; }
  #paperSheet.zh .pq-mcq .pq-opts { margin: 3pt 22mm 0 36px; gap: 2pt 10px; }
  #paperSheet.zh .pq-mcq .pq-bracket { position: absolute; right: 0; bottom: 5pt; margin: 0; }
  #paperSheet.zh .pq-fig svg { max-height: 24mm; width: auto; }
  #paperSheet.zh .psec h3 { margin: 8pt 0 2pt; }
  #paperSheet.zh .psec-note { margin: 0 0 2pt; }
  #paperSheet.zh .ph-how { margin: 4pt 0; }
}
/* word-box answers on paper: the number goes on the blank line, so the tap-to-choose circles are left off */
@media print { body:not(.print-marked) #paperSheet.zh .zh-write .en-parts, body:not(.print-marked) #paperSheet.zh .pq-grid:has(.zh-write) { display: none; } }
/* 组句成段 on paper, as in school: a bracket before each sentence for its number, no columns of circles */
@media print {
  body:not(.print-marked) #paperSheet.zh .zh-order table.tf { border: none; }
  body:not(.print-marked) #paperSheet.zh .zh-order table.tf tr:first-child,
  body:not(.print-marked) #paperSheet.zh .zh-order table.tf td:not(:first-child) { display: none; }
  body:not(.print-marked) #paperSheet.zh .zh-order table.tf td { border: none; padding: 3pt 0; }
  body:not(.print-marked) #paperSheet.zh .zh-order table.tf td:first-child::before { content: "（　　）"; font-weight: 700; margin-right: 4pt; }
}
@media print { #paperSheet.zh .psec h3, #paperSheet.zh .zc-h { font-size: 17pt; } #paperSheet.zh .psec-note { font-size: 14pt; font-style: normal; } }
/* the Chinese answer key: the answers, model sentences, 范文 and oral sample answers as big as the paper (Chinese font) */
#answerKey.zh .key-table td { font-family: "KaiTi", "STKaiti", "Kaiti SC", "BiauKai", "Noto Serif SC", "SimSun", serif; }
@media print {
  #answerKey.zh h2 { font-size: 18pt; }
  #answerKey.zh .key-table { font-size: 15pt; line-height: 1.5; }
  #answerKey.zh .key-table th { font-size: 12pt; }
  #answerKey.zh .zc-key h3 { font-size: 16pt; }
  #answerKey.zh .zc-model { font-size: 16pt; line-height: 1.75; }
  #answerKey.zh .key-note { font-size: 12pt; }
}
@media print {
  #answerKey.zh > .key-table td:nth-child(1) { width: 6%; }
  #answerKey.zh > .key-table td:nth-child(2) { width: 42%; }
  #answerKey.zh .zc-key .key-table td:nth-child(1) { width: 14%; } #answerKey.zh .zc-key .key-table td:nth-child(3) { width: 9%; }
  #answerKey.zh > .key-table td:nth-child(4) { width: 7%; }
  #answerKey.zh .zc-key, #answerKey.zh .zc-model { break-inside: auto; }
  #answerKey.zh .zc-model li { break-inside: avoid; }
}

/* ── P1 Maths: pictures to count, number cards, number bonds, base-ten blocks, groups, unit strips, picture graphs,
   and the boxes of the school layout (□ ○ □ = □) ── */
.p1-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 6px 0 4px 36px; }
.p1-frame { display: inline-block; border: 1.5px solid #333; border-radius: 10px; padding: 6px 8px; background: #fff; }
.p1-flabel { font-weight: 700; text-align: center; margin-bottom: 4px; }
.pq-fig > .p1-frame, .pq-fig > svg.p1-pic, .pq-fig > .p1-groups, .pq-fig > .p1-cards, .pq-fig > .p1-queue, .pq-fig > table, .pq-fig > .p1-key { margin-left: 36px; }
.p1-pic { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; }
.p1-op { font-size: 30px; font-weight: 700; }
.p1-cards { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px 36px; }
.p1-card { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 48px; padding: 0 8px; border: 2px solid #333; border-radius: 14px; font-size: 22px; font-weight: 700; background: #fffbe8; }
.p1-card.q { background: #fff; border-style: dashed; color: #8a5a00; }
.p1-bag { display: inline-flex; align-items: center; justify-content: center; width: 110px; height: 96px; border: 2px solid #5a3417; border-radius: 12px 12px 26px 26px; background: #f3e3cf; font-weight: 700; text-align: center; padding: 6px; }
.p1-ten { display: inline-block; border: 2px dashed #555; border-radius: 8px; padding: 4px; }
.p1-groups { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 6px 0 4px 36px; }
.p1-shapes { gap: 8px; }
.p1-queue { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 4px 36px; }
.p1-queue .kid { border: 2px solid #333; border-radius: 10px; padding: 6px 10px; font-weight: 700; background: #eef5ff; }
.p1-queue .end { font-size: 13px; color: #555; font-style: italic; }
table.p1-graph { border-collapse: collapse; margin: 6px 0 2px 36px; }
table.p1-graph caption { font-weight: 700; text-align: left; padding-bottom: 4px; }
table.p1-graph th { text-align: left; padding: 4px 12px 4px 6px; border: 1px solid #999; font-weight: 700; }
table.p1-graph td { padding: 2px 6px; border: 1px solid #999; min-width: 230px; }
table.p1-graph svg { margin-right: 2px; vertical-align: middle; }
.p1-key { margin: 2px 0 0 36px; font-size: 14px; }
.p1-key svg { vertical-align: middle; }
table.p1-col { border-collapse: collapse; margin: 6px 0 4px 36px; font-size: 24px; font-weight: 700; font-family: "Courier New", monospace; }
table.p1-col th { font-size: 14px; color: #555; padding: 0 10px; }
table.p1-col td { width: 34px; height: 36px; text-align: center; }
table.p1-col tr.sum td { border-top: 2.5px solid #111; }
table.p1-col td.miss { color: #8a5a00; border: 2px dashed #8a5a00; }
.fill { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; }
.fill input.fbox { width: 3.2em; height: 42px; font-size: 20px; text-align: center; border: 2px solid #333; border-radius: 6px; }
.fill input.fword { width: 10em; height: 42px; font-size: 18px; border: 2px solid #333; border-radius: 6px; padding: 0 6px; }
.fill select.fop { width: 52px; height: 42px; font-size: 22px; text-align: center; border: 2px solid #333; border-radius: 50%; background: #fff; }
.fill .right { background: #e5f6ea; border-color: #2f7d4f; } .fill .wrong { background: #fde8e6; border-color: #b0312b; }
@media print {
  .fill input.fbox, .fill input.fword { background: #fff !important; }
  .fill select.fop { -webkit-appearance: none; appearance: none; color: transparent; }
  .p1-frame, .p1-groups, table.p1-graph, .p1-cards, .p1-row { break-inside: avoid; }
}

/* P1 English: word tiles to put in order, the box for a punctuation mark, a picture beside a vocabulary question */
.p1-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 2px; }
.p1-tile { border: 2px solid #333; border-radius: 8px; padding: 4px 10px; font-weight: 700; background: #fffbe8; }
.p1-markbox { display: inline-block; width: 1.4em; height: 1.4em; border: 2px solid #111; border-radius: 4px; vertical-align: middle; margin: 0 2px; }
.p1-vpic { margin: 4px 0 2px 36px; }
.p1-vpic svg { max-height: 90px; width: auto; }
@media print { .p1-tiles, .p1-vpic { break-inside: avoid; } .p1-vpic svg { max-height: 24mm; } }

/* ── P1 Chinese (term reviews): a big character to count strokes of, pinyin over the gap, the initial to fill, pinyin
   word and sentence boxes (Latin font), word cards with a number box under each (组词成句) ── */
.zh-big { display: block; font-size: 46px; line-height: 1.2; margin: 2px 0 0 1em; }
.zh-pygap { display: inline-flex; flex-direction: column; align-items: center; vertical-align: bottom; margin: 0 2px; }
.zh-py1, .zh-ini { font-family: Arial, "Helvetica Neue", sans-serif; }
.zh-py1 { font-size: 14px; line-height: 1.1; }
.zh-ini { display: block; font-size: 24px; margin: 4px 0 0 1em; letter-spacing: 1px; }
.zh-pbr { font-size: 17px; }
#paperSheet.zh .zh-box.zh-py li, #paperSheet.zh .zh-box.zh-py { font-family: Arial, "Helvetica Neue", sans-serif; }
.zh-box.zh-pys ol { grid-template-columns: 1fr; }
#paperSheet.zh .zh-pyq .pq-opts { font-family: Arial, "Helvetica Neue", sans-serif; }
.zh-zc .ord { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 6px; }
.zh-zc .ord-r { flex-direction: column-reverse; gap: 4px; }
.zh-zc .ord-r span { border: 1.5px dashed #555; border-radius: 6px; padding: 2px 10px; font-size: 18px; }
@media print {
  #paperSheet.zh .zh-big { font-size: 30pt; }
  #paperSheet.zh .zh-ini { font-size: 18pt; }
  #paperSheet.zh .zh-py1 { font-size: 11pt; }
  #paperSheet.zh .zh-zc .ord-r span { font-size: 16pt; }
  #paperSheet.zh .zh-zc .ord select { width: 12mm; min-height: 9mm; }
}
/* tiles side by side: P1 Chinese pictures (a bracket for the number) and big characters (a box for the strokes) */
.pq-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; margin: 4px 0 10px; }
.pq-tiles > .pq { margin: 0; padding: 6px 4px; }
.pq-tiles .pq-fig { text-align: center; margin: 2px 0; }
.pq-tiles .zh-big { margin: 0; text-align: center; }
.pq-tiles .zh-sbh .en-parts, .pq-tiles .zh-sbh .fill { justify-content: center; text-align: center; }
.zh-tl { display: none; }
@media print {
  #paperSheet .pq-tiles { grid-template-columns: repeat(3, 1fr); }
  #paperSheet.zh .pq-tiles .zh-sbh ~ .zh-sbh, #paperSheet .pq-tiles { break-inside: avoid; }
  #paperSheet.zh .plead.zh-pbox { break-after: avoid; }
  #paperSheet.zh .pq-tiles .pq-fig svg { max-height: 22mm; }
}
/* P1 Chinese: the worked example (例) under a section's instructions */
.psec-ex { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 16px; margin: 0 0 8px; color: #333; }
.psec-ex .ex-pic svg { height: 40px; width: auto; vertical-align: middle; }
.zh-exa { color: #1d4f91; font-weight: 700; }
.zh-exbig { font-size: 26px; }
.zh-circ, .zh-py2 { font-family: Arial, "Helvetica Neue", sans-serif; }
.zh-circ { border: 1.5px solid #1d4f91; border-radius: 50%; padding: 0 7px; color: #1d4f91; }
.zh-ini.zh-exi { display: inline; font-size: 17px; margin: 0; }
/* written on paper as in school: 填写汉字 and 填写声母 (the choices are for the screen only), 组词成句 on a line with the
   first word given (the number menus are for the screen only) */
.zh-zcline { display: none; }
.zh-scr { display: block; font-size: 14px; color: #555; }
@media print {
  body:not(.print-marked) #paperSheet.zh .zh-wr .pq-opts, body:not(.print-marked) #paperSheet.zh .zh-wr .pq-bracket { display: none; }
  body:not(.print-marked) #paperSheet.zh .zh-zc .en-parts { display: none; }
  body:not(.print-marked) #paperSheet.zh .zh-zcline { display: block; margin-top: 2pt; font-size: 16pt; }
  #paperSheet.zh .zh-zccards { display: flex; flex-wrap: wrap; gap: 6pt 14pt; margin: 2pt 0 8pt; }
  #paperSheet.zh .zh-card { border: 1.2px dashed #555; border-radius: 5px; padding: 1pt 8pt; }
  #paperSheet.zh .zh-zcw { display: flex; align-items: flex-end; gap: 4pt; }
  body:not(.print-marked) #paperSheet.zh .zh-pyq:not(.zh-wr) .pq-bracket { display: none; }
  #paperSheet.zh .zh-line { flex: 1; border-bottom: 1.2px solid #111; height: 1.6em; }
  #paperSheet.zh .zh-scr { display: none; }
  #paperSheet.zh .psec-ex { font-size: 14pt; }
  #paperSheet.zh .zh-exbig { font-size: 20pt; }
  #paperSheet.zh .psec-ex .ex-pic svg { height: 12mm; }
}

/* 完成句子: a box of whole clauses, two to a row so each stays on one line */
.zh-cbox ol { grid-template-columns: repeat(2, 1fr) !important; }

/* P1 pictures shrink to fit a phone (the ribbon strips are 330px wide) */
#paperSheet svg.p1-pic { max-width: 100%; height: auto; }
@media (max-width: 600px) { .pq-fig > .p1-frame, .pq-fig > svg.p1-pic, .pq-fig > .p1-groups, .pq-fig > .p1-cards, .pq-fig > .p1-queue, .pq-fig > table, .pq-fig > .p1-key { margin-left: 0; } }

/* complete the picture graph: the empty row is a dashed space to draw in */
.p1-graph td.p1-draw { min-width: 180px; height: 30px; border: 1.5px dashed #888; }

/* P1 English: a story picture beside the title; the preposition scene */
.psg.has-pic .psg-pic { float: right; margin: 0 0 6px 12px; }
.psg.has-pic .psg-pic svg { width: 110px; height: auto; }
@media print { .psg.has-pic .psg-pic svg { width: 30mm; } }
svg.p1-prep { max-width: 100%; height: auto; }
.p1-vpic svg.p1-prep, #paperSheet .p1-vpic svg.p1-prep { width: 300px; max-width: 100%; height: auto; max-height: none; }
@media print { #paperSheet .p1-vpic svg.p1-prep { width: 80mm; max-height: none; } }
