/* Answer sheet (index.html #sheet): a real board answer booklet. The booklet (.doc) always uses
   document tokens (never the staff dark theme), prints on white A4, and keeps every test selector
   app.js renders: #sheet-body section.q-block, .q-title, li.line .margin .ts .txt [data-clip]
   [data-reply], u.unsure, code.hash, .integrity, .audit tbody tr. */
.sheet-screen { min-height: 100vh; background: var(--paper); }
.doc {
  --d-paper: #FFFEFA; --d-ink: #141C44; --d-text: #16171D; --d-muted: #4A4F66;
  --d-rule: #C9D4E6;           /* ruled answer lines: light blue, like a real booklet */
  --d-margin: #D2675C;         /* the red margin rule */
  --d-line: #2A2F45;           /* box borders */
  --d-soft: #F4F0E6;
  --d-accent: #E59A00;
  --d-ok: #16703E; --d-bad: #B0241C; --d-warn: #875000;
  color: var(--d-text);
  color-scheme: light;
}

/* ---------- on-screen tools (never printed) */
.sheet-tools { max-width: 900px; margin: 0 auto; padding: var(--s-6) var(--s-6) 0; }
.done-banner {
  --tone: var(--ok); --tone-tint: var(--ok-tint);
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-2) var(--s-4); align-items: center;
  padding: var(--s-5) var(--s-6); background: var(--paper-card); border: 1px solid var(--rule); border-radius: var(--r-3); box-shadow: var(--shadow-1);
  position: relative; overflow: hidden;
}
.done-banner[data-tone="warn"] { --tone: var(--warn); --tone-tint: var(--warn-tint); }
.done-banner[data-tone="bad"]  { --tone: var(--bad); --tone-tint: var(--bad-tint); border-color: var(--bad); }
.done-banner[data-tone="wait"] { --tone: var(--ink-3); --tone-tint: var(--paper-sunk); }
.done-banner::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tone); }
.done-banner .seal { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--tone-tint); color: var(--tone); }
.done-banner .seal .ico { width: 28px; height: 28px; }
.db-t { font-size: var(--t-20); font-weight: 750; line-height: 1.3; color: var(--ink); }
.db-d { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-2); font-size: var(--t-14); margin-top: 2px; line-height: 1.6; }
.db-d:empty { display: none; }
.db-d > span { display: inline-flex; align-items: center; gap: 5px; }
.db-d .ico { width: 16px; height: 16px; flex: none; }
.db-d .ok { color: var(--ok); font-weight: 700; }
.db-d .warn { color: var(--warn); font-weight: 700; }
.db-d .bad { color: var(--bad); font-weight: 700; }
.db-d code { font-family: var(--mono); font-size: .92em; }
.db-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--rule); }
.db-actions .spacer { flex: 1; }
.sheet-msg { font-size: var(--t-13); color: var(--ink-2); flex-basis: 100%; }
.sheet-msg:empty { display: none; }

/* ---------- the booklet */
.paper {
  max-width: 900px; margin: var(--s-5) auto var(--s-12); padding: 44px 52px 40px;
  background: var(--d-paper); color: var(--d-text);
  border-radius: 4px; box-shadow: 0 1px 0 rgba(20,28,68,.06), 0 22px 50px -22px rgba(20,28,68,.35);
  font-size: 15.5px; line-height: 1.55; overflow-wrap: anywhere;
}
.paper :lang(hi) { line-height: 1.65; }
.doc .ico { -webkit-print-color-adjust: exact; print-color-adjust: exact; }   /* mask icons are backgrounds */
.doc .nil { color: var(--d-muted); font-weight: 500; font-style: italic; }
.doc .nf h1 { font-size: 26px; font-weight: 800; color: var(--d-ink); }
.doc .nf p { margin-top: 10px; color: var(--d-text); }
.doc .nf .btn { margin-top: 8px; }

.ab-mast { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px; padding-bottom: 12px; border-bottom: 3px solid var(--d-ink); position: relative; }
.ab-mast::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; border-bottom: 1px solid var(--d-ink); }
.ab-mast .kicker { font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--d-muted); }
.ab-mast .kicker :lang(hi) { letter-spacing: 0; }
.ab-mast h1 { font-size: 34px; font-weight: 800; font-stretch: 90%; line-height: 1.15; letter-spacing: -.01em; color: var(--d-ink); display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ab-mast h1 .hi { font-weight: 700; color: var(--d-ink); font-size: .86em; }
.ab-mast .sub { font-size: 13.5px; color: var(--d-muted); margin-top: 2px; }
.sheet-no { border: 1.5px solid var(--d-line); border-radius: 4px; padding: 6px 12px; text-align: right; }
.sheet-no span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--d-muted); }
.sheet-no code { font-family: var(--mono); font-size: 13.5px; font-weight: 700; color: var(--d-ink); }

.not-verified { margin-top: 22px; padding: 12px 16px; border: 2px solid var(--d-bad); background: #FBE7E4; color: var(--d-bad); font-weight: 800; border-radius: 6px; display: flex; gap: 10px; align-items: flex-start; line-height: 1.45;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.not-verified .ico { width: 20px; height: 20px; flex: none; margin-top: 1px; }

.ab-cover { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px 20px; margin-top: 24px; align-items: stretch; }
.ab-cover .ab-meta { grid-column: 1 / -1; }
.ab-cover.wide-ex { grid-template-columns: minmax(0, 1fr); }

/* Ruled meta grid. Cells are laid out by span (s1..s4, set by app.js so every row fills); each cell
   draws its top and left rule and is pulled 1px up and left, so the outer frame hides the rules on
   the edges whatever the layout (4 columns here, 2 on a phone). */
.ab-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1.5px solid var(--d-line); border-radius: 4px; margin: 0; overflow: hidden; }
.ab-meta > div { padding: 8px 12px 10px; margin: -1px 0 0 -1px; border-top: 1px solid var(--d-line); border-left: 1px solid var(--d-line); min-width: 0; }
.ab-meta > .s2 { grid-column: span 2; }
.ab-meta > .s3 { grid-column: span 3; }
.ab-meta > .s4 { grid-column: span 4; }
.ab-meta dt { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--d-muted); line-height: 1.5; }
.ab-meta dt .hi { letter-spacing: 0; text-transform: none; font-size: 12px; font-weight: 700; margin-left: 4px; color: var(--d-muted); }
.ab-meta dd { margin: 0; font-weight: 650; color: var(--d-text); font-size: 15px; line-height: 1.45; }
.ab-meta dd small { display: block; font-weight: 500; color: var(--d-muted); font-size: 12.5px; }
.roll { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 24px; margin-top: 3px; border: 1.5px solid var(--d-line); }
.roll span { height: 28px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 15px; border-left: 1px solid var(--d-line); }
.roll span:first-child { border-left: 0; }

/* examiner's grid */
.ex-box { border: 1.5px solid var(--d-line); border-radius: 4px; break-inside: avoid; }
.ex-box h2 { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 7px 10px; border-bottom: 1.5px solid var(--d-line); background: var(--d-soft); color: var(--d-ink); line-height: 1.4;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ex-box h2 .hi { display: block; letter-spacing: 0; text-transform: none; font-size: 12px; font-weight: 700; color: var(--d-muted); }
.ex-box table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ex-box th { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--d-muted); padding: 5px 8px; border-bottom: 1px solid var(--d-line); text-align: center; }
.ex-box td { padding: 0 8px; height: 30px; border-bottom: 1px solid var(--d-line); text-align: center; font-variant-numeric: tabular-nums; }
.ex-box td + td, .ex-box th + th { border-left: 1px solid var(--d-line); }
.ex-box tr.tot td { font-weight: 800; height: 38px; border-bottom: 0; border-top: 1.5px solid var(--d-line); }
.ex-box .sig { padding: 22px 10px 8px; font-size: 11.5px; color: var(--d-muted); border-top: 1.5px solid var(--d-line); }
.ex-box .sig i { display: block; border-bottom: 1px solid var(--d-line); margin-bottom: 4px; height: 1px; }
/* long papers: a full-width strip, 10 questions per band */
.ex-box.wide .ex-grid { display: grid; gap: 10px; padding: 10px; }
.ex-box.wide table { table-layout: fixed; }
.ex-box.wide th, .ex-box.wide td { border: 1px solid var(--d-line); }
.ex-box.wide th { width: 86px; text-align: left; background: var(--d-soft); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ex-box.wide td { height: 28px; padding: 0 2px; }
.ex-box.wide tr.qn td { font-weight: 800; color: var(--d-ink); font-size: 12.5px; height: 24px; }
.ex-box.wide tr.aw td { height: 34px; }
.ex-box.wide td.pad { border: none; background: none; }
.ex-foot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: end; padding: 4px 10px 10px; }
.ex-total { display: flex; align-items: flex-end; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--d-ink); }
.ex-total i { display: block; width: 72px; height: 34px; border: 1.5px solid var(--d-line); border-radius: 3px; }
.ex-box.wide .ex-foot .sig { border-top: 0; padding: 0; }

/* verification stamp (this is the .integrity block the tests read) */
.integrity {
  --v: var(--d-ok);
  margin: 0; display: grid; align-content: start; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; padding: 14px 16px;
  border: 2px solid var(--v); border-radius: 6px; position: relative; break-inside: avoid;
}
.integrity[data-state="bad"], .integrity[data-state="none"] { --v: var(--d-bad); }
.integrity[data-state="unknown"] { --v: var(--d-warn); }
.integrity .stamp { grid-row: 1 / span 2; width: 78px; height: 78px; border-radius: 50%; border: 2px solid var(--v); color: var(--v); display: grid; place-content: center; text-align: center; transform: rotate(-8deg); padding: 4px; }
.integrity .stamp .ico { width: 24px; height: 24px; margin: 0 auto 1px; }
.integrity .stamp b { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; line-height: 1.15; white-space: nowrap; }
.integrity:not([data-state="ok"]) .stamp { width: 86px; height: 86px; }
.integrity:not([data-state="ok"]) .stamp b { font-size: 8.5px; letter-spacing: .03em; }
.integrity .stamp b + b { font-size: 10.5px; letter-spacing: 0; font-weight: 700; }
.integrity h2 { font-size: 15px; font-weight: 800; color: var(--v); line-height: 1.35; }
.integrity h2 .hi { font-weight: 700; margin-left: 6px; color: var(--v); }
.v-checks { display: grid; gap: 6px; font-size: 13px; color: var(--d-text); margin-top: 4px; padding: 0; list-style: none; }
.v-checks li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: start; line-height: 1.45; }
.v-checks .ico { width: 16px; height: 16px; margin-top: 2px; color: var(--d-ok); }
.v-checks li.bad { color: var(--d-bad); }
.v-checks li.bad .ico { color: var(--d-bad); }
.v-checks li.info .ico { color: var(--d-muted); }
.v-checks b { font-weight: 750; margin-right: 6px; }
.v-code { grid-column: 1 / -1; margin-top: 6px; font-size: 11.5px; color: var(--d-muted); display: flex; gap: 4px 8px; align-items: baseline; flex-wrap: wrap; }
.doc code.hash { font-family: var(--mono); font-size: 11px; color: var(--d-text); background: var(--d-soft); padding: 1px 6px; border-radius: 3px; word-break: break-all; }

.howto { break-inside: avoid; margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 26px; font-size: 13.5px; color: var(--d-muted); }
.howto .promise { color: var(--d-text); font-size: 14px; }
.howto .promise b { color: var(--d-ink); }
.howto .legend { display: grid; gap: 4px; }
.howto .legend > span { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.howto .legend .k { color: var(--d-text); font-weight: 700; text-align: right; }
.howto .legend .k.q { color: var(--d-bad); font-weight: 900; }
.paper-instructions { margin-top: 16px; padding: 10px 14px; border-left: 3px solid var(--d-accent); background: var(--d-soft); font-size: 14px; white-space: pre-line;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.paper-instructions b { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--d-muted); display: block; white-space: normal; }

/* answers */
.ans-title { break-after: avoid; margin-top: 30px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 1.5px solid var(--d-line); padding-bottom: 6px; }
.ans-title h2 { font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--d-ink); }
.ans-title h2 .hi { letter-spacing: 0; text-transform: none; font-size: 14px; margin-left: 6px; color: var(--d-muted); }
.ans-title > span { font-size: 12px; color: var(--d-muted); }

.q-block { padding: 16px 0 6px; border-bottom: 1px solid var(--d-line); break-inside: auto; }
.q-block.is-empty { padding: 12px 0 6px; display: grid; grid-template-columns: minmax(0, 1fr) 164px; column-gap: 18px; align-items: start; break-inside: avoid; }
.q-block.is-empty .q-head { display: contents; }   /* one compact row: title + "No answer" left, the marks box right */
.q-block.is-empty .q-score { grid-column: 2; grid-row: 1 / span 2; }
.q-block.is-empty .empty { grid-column: 1; margin: 0; }
.q-head { display: grid; grid-template-columns: minmax(0, 1fr) 164px; gap: 18px; align-items: start; break-after: avoid; break-inside: avoid; }
.q-title { font-weight: 750; font-size: 15.5px; color: var(--d-ink); display: grid; grid-template-columns: 44px minmax(0, 1fr); margin: 0; line-height: 1.55; }
.q-title.other { grid-template-columns: minmax(0, 1fr); }
.q-title .qn { font-weight: 800; color: var(--d-ink); font-variant-numeric: tabular-nums; }
.q-score { display: grid; grid-template-columns: 1fr 1.2fr; border: 1.5px solid var(--d-line); border-radius: 3px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--d-muted); }
.q-score > span { display: grid; gap: 1px; padding: 4px 8px 5px; }
.q-score > span + span { border-left: 1.5px solid var(--d-line); }
.q-score b { font-size: 18px; letter-spacing: 0; color: var(--d-text); font-weight: 800; line-height: 1.2; }
.q-score .box { height: 22px; }

.doc .lines {
  --lh: 32px;
  margin: 8px 0 4px; padding: 0; list-style: none; line-height: var(--lh);
  background-image: linear-gradient(to bottom, transparent calc(var(--lh) - 1px), var(--d-rule) calc(var(--lh) - 1px));
  background-size: 100% var(--lh);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  position: relative;
}
.doc .lines::before { content: ""; position: absolute; left: 92px; top: 0; bottom: 0; border-left: 1.5px solid var(--d-margin); }
.doc .lines :lang(hi), .doc .lines:lang(hi) { line-height: var(--lh); }
.doc .line { display: grid; grid-template-columns: 22px 62px minmax(0, 1fr) auto; column-gap: 8px; align-items: start; position: relative; break-inside: avoid; }
.doc .line.has-clip { cursor: pointer; }
.doc .line .margin { font-weight: 900; color: var(--d-bad); text-align: center; font-size: 17px; }
.doc .line .ts { font-family: var(--mono); font-size: 12px; color: var(--d-muted); text-align: left; }
.doc .line .txt { padding-left: 14px; font-size: 16.5px; color: var(--d-text); }
.doc .line.skipped .txt { font-style: italic; color: var(--d-muted); }
.doc .line .play { align-self: start; margin-top: 2px; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--d-line); background: var(--d-paper); color: var(--d-ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.doc .line .play .ico { width: 13px; height: 13px; }
.doc .line .play:hover { background: var(--d-ink); color: var(--d-paper); }
.doc .line .play:focus-visible { outline: 2px solid var(--d-ink); outline-offset: 2px; }
.doc .line.has-clip:hover .txt { text-decoration: underline; text-decoration-color: var(--d-rule); text-underline-offset: 6px; }
.doc .line.playing { background: rgba(255, 214, 102, .32); }
.doc .line.playing .play { background: var(--d-ink); color: var(--d-paper); }
.doc .line .status { grid-column: 3; grid-row: 2; padding-left: 14px; font-size: 12.5px; font-weight: 700; color: var(--d-ink); line-height: 32px; }
.doc u.unsure { text-decoration: underline; text-decoration-color: var(--d-accent); text-decoration-thickness: 2.5px; text-underline-offset: 5px; text-decoration-skip-ink: none; }
.doc .empty { margin: 8px 0 4px; height: 32px; line-height: 32px; padding-left: 106px; color: var(--d-muted); font-style: italic; font-size: 14px; position: relative;
  background-image: linear-gradient(to bottom, transparent 31px, var(--d-rule) 31px); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc .empty::before { content: ""; position: absolute; left: 92px; top: 0; bottom: 0; border-left: 1.5px solid var(--d-margin); }
.q-tools { display: flex; gap: 8px; margin: 2px 0 6px 106px; }
.q-tools .btn { min-height: 32px; font-size: 12.5px; color: var(--d-ink); }

/* end of answers: total + signatures + certificate */
.ab-end { margin-top: 22px; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 22px; align-items: stretch; break-inside: avoid; }
.total-box { border: 2px solid var(--d-ink); border-radius: 4px; padding: 10px 14px; display: grid; gap: 6px; align-content: start; }
.total-box > span:first-child { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--d-muted); }
.total-box > span:first-child :lang(hi) { letter-spacing: 0; }
.total-box .tv { display: flex; align-items: flex-end; gap: 8px; font-size: 30px; font-weight: 800; color: var(--d-ink); line-height: 1.1; }
.total-box .tv i { display: block; width: 92px; height: 44px; border: 1.5px solid var(--d-line); border-radius: 3px; }
.total-box .sig { margin-top: 16px; font-size: 11.5px; color: var(--d-muted); border-top: 1px solid var(--d-line); padding-top: 4px; }
.cert { border: 1.5px solid var(--d-line); border-radius: 4px; padding: 12px 16px; font-size: 13.5px; display: grid; gap: 10px; }
.cert h2 { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--d-ink); }
.cert h2 .hi { letter-spacing: 0; text-transform: none; font-size: 12.5px; margin-left: 6px; color: var(--d-muted); }
.cert p { color: var(--d-text); }
.sig-row { display: grid; grid-template-columns: 1.4fr 1fr .8fr; gap: 16px; margin-top: 18px; }
.sig-row span { border-top: 1px solid var(--d-line); padding-top: 4px; font-size: 11.5px; color: var(--d-muted); }

.issuer { margin-top: 26px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--d-muted); border-top: 1px solid var(--d-line); padding-top: 8px; }
.issuer .brand-s { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--d-ink); }
.issuer .brand-s svg { width: 18px; height: 18px; }

/* audit appendix */
.audit { margin-top: 36px; padding-top: 18px; border-top: 3px double var(--d-line); }
.audit > h2 { font-size: 20px; font-weight: 800; color: var(--d-ink); }
.audit > h2 small { font-size: 13px; font-weight: 600; color: var(--d-muted); margin-left: 8px; }
.audit h3 { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--d-ink); margin: 20px 0 6px; break-after: avoid; }
.audit table { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit th { text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--d-muted); padding: 6px 8px; border-bottom: 1.5px solid var(--d-line); }
.audit td { padding: 6px 8px; border-bottom: 1px solid #DDD6C6; vertical-align: top; }
.audit tr { break-inside: avoid; }
.audit td.kind { font-weight: 700; white-space: nowrap; }
.audit td.t, .audit td.mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.audit td.mono { white-space: normal; word-break: break-all; }
.audit .none { color: var(--d-muted); font-style: italic; }
.audit .log-end { margin-top: 12px; }
.audit .log-end .mono { font-style: normal; word-break: break-all; }

/* ---------- phone (screen only: an A4 page is narrower than 760 CSS px, and must keep the desktop layout) */
@media screen and (max-width: 760px) {
  #sheet .appbar-in { padding: 10px var(--s-4) 0; gap: var(--s-3); min-height: 56px; flex-wrap: wrap; }
  #sheet .appbar .wordmark { font-size: 18px; }
  #sheet .appbar .wordmark .hi, #sheet .appbar .wordmark .bar { display: none; }
  #sheet .appbar .tabs { order: 3; width: 100%; overflow-x: auto; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-2); min-height: 44px; border-top: 1px solid var(--rule); scrollbar-width: none; }
  #sheet .appbar .tab { font-size: 13.5px; padding: 0 10px; }
  #sheet .appbar .tab .hi { display: none; }
  #sheet .appbar-end { display: none; }
  .sheet-tools { padding: var(--s-4) var(--s-4) 0; }
  .done-banner { padding: var(--s-4); }
  .db-t { font-size: 17px; }
  .db-actions .btn { flex: 1 1 auto; }
  .db-actions .spacer { display: none; }
  .paper { margin: var(--s-4) var(--s-3) var(--s-8); padding: 22px 16px 24px; font-size: 14.5px; }
  .ab-mast { grid-template-columns: 1fr; }
  .ab-mast h1 { font-size: 26px; }
  .sheet-no { text-align: left; justify-self: start; }
  .ab-cover { grid-template-columns: 1fr; }
  .ab-cover .ab-meta { grid-column: auto; }
  .ab-meta { grid-template-columns: 1fr 1fr; }
  .ab-meta > .s2, .ab-meta > .s3, .ab-meta > .s4, .ab-meta > .pw { grid-column: span 2; }
  .integrity { grid-template-columns: 1fr; }
  .integrity .stamp { grid-row: auto; width: 66px; height: 66px; }
  .integrity .stamp b { font-size: 8.5px; }
  .ex-box.wide .ex-grid { padding: 8px; gap: 8px; }
  .ex-box.wide th { width: 58px; font-size: 8.5px; letter-spacing: .04em; padding: 4px; }
  .ex-box.wide td { font-size: 12px; padding: 0; }
  .ex-box.wide tr.qn td { font-size: 11.5px; }
  .ex-foot { grid-template-columns: 1fr; gap: 14px; }
  .howto { grid-template-columns: 1fr; }
  .q-head { grid-template-columns: 1fr; gap: 8px; }
  .q-block.is-empty { display: block; }
  .q-block.is-empty .q-head { display: grid; }
  .q-block.is-empty .empty { margin-top: 8px; }
  .q-score { justify-self: start; min-width: 170px; }
  .doc .lines::before, .doc .empty::before { left: 30px; }
  .doc .line { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .doc .line .ts { grid-column: 2; grid-row: 1; justify-self: end; font-size: 11px; }
  .doc .line .txt { grid-column: 2; grid-row: 1; padding-left: 10px; padding-right: 54px; }
  .doc .line .status { grid-column: 2; padding-left: 10px; }
  .doc .empty { padding-left: 42px; height: auto; min-height: 32px; }
  .q-tools { margin-left: 42px; }
  .ab-end { grid-template-columns: 1fr; }
  .sig-row { grid-template-columns: 1fr; gap: 22px; }
  .audit table { font-size: 12px; min-width: 520px; }
  .audit td, .audit th { overflow-wrap: normal; }
  .audit td.mono { overflow-wrap: anywhere; }
  .audit .wide { display: block; overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
  .ans-title { flex-wrap: wrap; }
  .ans-title > span { flex-basis: 100%; }
}

/* ---------- print: white A4, tools hidden, clean page breaks */
@page { size: A4; margin: 14mm 14mm 18mm; }
@media print {
  :root { color-scheme: light; }
  .no-print, .appbar, .skip, #banner, #setup, #exam, .noscript { display: none !important; }
  html, body, .sheet-screen { background: #fff !important; min-height: 0; }
  .paper { max-width: none; margin: 0; padding: 0; box-shadow: none; border-radius: 0; background: #fff; font-size: 10.5pt; }
  .doc { --d-paper: #fff; }
  .q-block { break-inside: auto; }
  .q-head, .ans-title { break-after: avoid; break-inside: avoid; }
  .doc .line { break-inside: avoid; }
  /* keep a question's title with its first answer line (or its "No answer written" row) */
  .q-block .lines > li:first-child, .q-block .empty { break-before: avoid; }
  .ab-end, .integrity, .ex-box, .ab-mast, .ab-meta { break-inside: avoid; }
  .audit { break-before: page; border-top: 0; margin-top: 0; padding-top: 0; }
  .doc .line.playing { background: none; }
  .doc .line.has-clip:hover .txt { text-decoration: none; }
  .doc code.hash { background: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
