/* Printed cards. All sizes in mm so cells are exactly as big on paper as planned.
   The same markup is used for the on-screen preview (scaled) and for printing.
   Themes add frames and symbols in themes/<id>/print.css, scoped under body[data-theme]. */

#printArea { display: none; }

.sheet {
  position: relative; box-sizing: border-box; background: #fff; color: #000;
  width: 210mm; height: 297mm; padding: 10mm;
  display: grid; grid-template-columns: repeat(var(--slot-cols, 1), minmax(0, 1fr)); grid-template-rows: repeat(var(--slot-rows, 1), minmax(0, 1fr));
  font-family: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  overflow: hidden;
}
.sheet.landscape { width: 297mm; height: 210mm; }
.sheet-foot {
  position: absolute; left: 10mm; right: 10mm; bottom: 3.5mm;
  display: flex; justify-content: space-between; font-size: 7.5pt; color: #555;
}

/* One slot per card; the dashed lines are where to cut. */
.slot { display: grid; place-items: center; border: .25mm dashed #9a9a9a; margin: -.125mm; min-width: 0; min-height: 0; }

.pcard {
  --cell: 25mm;
  display: inline-grid; border: .8mm solid #000; border-radius: 2.5mm; overflow: hidden; background: #fff;
}
.pcard-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 3mm;
  padding: calc(var(--cell) * .06) calc(var(--cell) * .12);
  border-bottom: .5mm solid #000;
  font-size: max(8pt, calc(var(--cell) * .19)); line-height: 1.1;
}
.pcard-top strong { font-weight: 800; font-size: 1.15em; letter-spacing: .02em; }
.pcard-grid { display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); }
.phead {
  height: calc(var(--cell) * .58); display: grid; place-items: center;
  font-weight: 800; font-size: calc(var(--cell) * .44); border-bottom: .6mm solid #000;
}
.pcell {
  width: var(--cell); height: var(--cell); display: grid; place-items: center;
  border-right: .3mm solid #000; border-bottom: .3mm solid #000;
  font-weight: 800; font-size: calc(var(--cell) * .5); font-variant-numeric: tabular-nums; line-height: 1;
}
.pcard-grid > .pcell:nth-child(5n) { border-right: 0; }          /* 75er: last column */
.pcard[data-v="90"] .pcell:nth-child(5n) { border-right: .3mm solid #000; }
.pcard[data-v="90"] .pcell:nth-child(9n) { border-right: 0; }
.pcard[data-v="30"] .pcell:nth-child(5n) { border-right: .3mm solid #000; }
.pcard[data-v="30"] .pcell:nth-child(3n) { border-right: 0; }
.pcard-grid > .pcell.last-row { border-bottom: 0; }
.pcell.empty { background: repeating-linear-gradient(45deg, #fff 0 1.1mm, #e2e2e2 1.1mm 1.5mm); }
.pcell.free svg { width: 62%; height: 62%; }
.pcell.free { font-size: calc(var(--cell) * .2); }

/* Sheet for the person leading the game */
.leader-sheet { display: block; padding: 22mm 20mm; }
.leader-sheet h1 { font-size: 26pt; margin: 0 0 6mm; }
.leader-code { font-size: 54pt; font-weight: 800; letter-spacing: .12em; border: 1mm solid #000; border-radius: 4mm; display: inline-block; padding: 2mm 8mm; margin: 2mm 0 8mm; }
.leader-sheet dl { display: grid; grid-template-columns: max-content 1fr; gap: 2.5mm 8mm; font-size: 15pt; margin: 0 0 10mm; }
.leader-sheet dt { font-weight: 700; }
.leader-sheet dd { margin: 0; }
.leader-sheet ol { font-size: 15pt; line-height: 1.45; padding-left: 7mm; margin: 0; }
.leader-sheet li { margin-bottom: 3mm; }

/* On-screen preview: a real-size sheet, scaled down by ui/print.js */
.preview-frame { position: relative; overflow: hidden; }
.preview-frame .sheet { position: absolute; top: 0; left: 0; transform-origin: 0 0; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }

@media print {
  @page { margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea .sheet { break-after: page; page-break-after: always; box-shadow: none; }
  #printArea .sheet:last-child { break-after: auto; page-break-after: auto; }
}

/* Measuring line on the leader sheet: shows whether the printer scaled the page */
.leader-ruler { margin-top: 12mm; font-size: 11pt; display: grid; gap: 2mm; }
.ruler-bar { display: block; width: 100mm; height: 4mm; border: .4mm solid #000; border-top: 0;
  background: repeating-linear-gradient(90deg, #000 0 .3mm, transparent .3mm 10mm); background-size: 100mm 2mm; background-repeat: no-repeat; background-position: bottom left;
  print-color-adjust: exact; -webkit-print-color-adjust: exact; }
