/* Standalone paper layout: home and Killer must not depend on the Coach bundle. */
#printSheet { display: none !important; }

@media print {
  /* Put the safe paper inset in the document so browser URL/date headers have no margin area. */
  @page { size: A4 portrait; margin: 0; }

  html:has(body.zudoku-print-ready),
  body.zudoku-print-ready {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }
  body.zudoku-print-ready { box-sizing: border-box; padding: 8mm !important; }

  body.zudoku-print-ready > :not(#printSheet) { display: none !important; }
  body.zudoku-print-ready::before,
  body.zudoku-print-ready::after { display: none !important; }
  body.zudoku-print-ready #printSheet {
    display: block !important;
    margin: 0;
    padding: 0;
    color: #222;
    background: #fff;
    font-family: Arial, sans-serif;
  }
  #printSheet * { box-sizing: border-box; }

  .print-page {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    /* Fits A4 and Letter at 8 mm margins, without depending on viewport units. */
    height: 260mm;
    min-height: 0;
    margin: 0;
    padding: 4mm;
    border: 0.4mm solid #30362e;
    break-inside: avoid;
    page-break-inside: avoid;
    background: #fff;
  }
  .print-page::before {
    content: "";
    position: absolute;
    inset: 1.2mm;
    border: 0.15mm solid #90968a;
    pointer-events: none;
  }
  .print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5mm;
    flex: 0 0 auto;
    padding: 1mm 1mm 0;
  }
  .print-brand { display: flex; align-items: center; gap: 2.5mm; }
  .print-brand img { display: block; width: 13mm; height: 13mm; object-fit: contain; }
  .print-brand strong { display: block; font-size: 19pt; font-weight: 800; letter-spacing: 0.5pt; line-height: 1; }
  .print-brand span { display: block; margin-top: 1mm; font-size: 6pt; font-weight: 600; letter-spacing: 1.1pt; text-transform: uppercase; }
  .print-site { font-size: 8pt; color: #5c6357; }
  .print-board-frame { flex: 0 0 auto; width: 100%; margin: auto 0; padding: 0; }
  .print-board {
    display: grid;
    width: 100%;
    aspect-ratio: 1;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    grid-template-rows: repeat(9, minmax(0, 1fr));
    border: 0.65mm solid #181c17;
    background: #fff;
    break-inside: avoid;
  }
  .print-cell {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    border-right: 0.18mm solid #777d72;
    border-bottom: 0.18mm solid #777d72;
  }
  .print-cell:nth-child(3n) { border-right: 0.65mm solid #181c17; }
  .print-cell:nth-child(9n) { border-right: 0; }
  .print-cell:nth-child(n+19):nth-child(-n+27),
  .print-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 0.65mm solid #181c17; }
  .print-cell:nth-child(n+73) { border-bottom: 0; }
  .print-cell-value { color: #171b15; font: 500 26pt/1 Arial, sans-serif; }

  /* Keep cage boundaries separate from the normal box/grid lines. */
  .print-killer-cell::before {
    content: "";
    position: absolute;
    inset: 1.2mm;
    border: 0 dashed #555;
    pointer-events: none;
  }
  .print-cage-top::before { border-top-width: 0.25mm; }
  .print-cage-right::before { border-right-width: 0.25mm; }
  .print-cage-bottom::before { border-bottom-width: 0.25mm; }
  .print-cage-left::before { border-left-width: 0.25mm; }
  .print-cage-sum { position: absolute; top: 0.8mm; left: 1.7mm; z-index: 1; padding: 0 0.5mm; color: #222; background: #fff; font: 700 8pt/1.1 Arial, sans-serif; }
}
