/*
 * Print rules.
 *
 * @page margin is 0 because the sheet itself carries the A4 page size and the
 * 15 mm / 12 mm margins. That keeps one .sheet on exactly one page and avoids
 * the double-margin problem that shrinks or splits printouts.
 */

@page {
  size: A4 portrait;
  margin: 0;
}

/* The print root is the only thing that survives printing. On screen it is
   kept out of the flow; print.html opts back in because it renders PDFs. */
#printRoot {
  display: none;
}

@media print {
  html,
  body {
    margin: 0;
    padding: 0;
    background: #ffffff;
  }

  body {
    font-size: 11pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Only the printable stage survives. */
  body > *:not(#printRoot) {
    display: none !important;
  }

  #printRoot {
    display: block !important;
    margin: 0;
    padding: 0;
  }

  #printRoot .sheet {
    margin: 0;
    border: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

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

  .ans {
    color: var(--answer) !important;
    font-weight: 700 !important;
  }
}
