/* ─── Print preview (on-screen) ─── */
@media screen {
  #tab-print {
    overflow-x: hidden;
  }
}

#print-content {
  display: flex;
  flex-direction: column;
  gap: 48px;
  align-items: center;
}

.print-page {
  background: #fff;
  color: #000;
  width: 210mm;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  font-family: Arial, Helvetica, sans-serif;
}

.print-sheet {
  height: 148.5mm;
  box-sizing: border-box;
  padding: 10mm 15mm 8mm;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.print-page .print-sheet:not(:last-child) {
  border-bottom: 1px dashed #bbb;
}

/* ─── Sheet header ─── */
.sheet-header {
  text-align: center;
  border-bottom: 2px solid #000;
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .3px;
}

.sheet-player {
  font-size: 22px;
  font-weight: 900;
  margin-top: 3px;
  letter-spacing: .5px;
}

/* ─── Print grid ─── */
.print-grid-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.print-grid {
  flex: 1;
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.print-grid tbody {
  height: 100%;
}

.print-grid td {
  border: 2px solid #000;
  text-align: center;
  vertical-align: middle;
  position: relative;
  overflow: hidden;
}

.print-grid .free-cell {
  background: #e8e8e8;
  font-weight: 900;
  font-size: inherit;
  letter-spacing: 1px;
}

.print-grid .cell-label {
  display: block;
  line-height: 1.25;
  word-break: break-word;
  hyphens: auto;
}

.print-grid .cell-points {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: .85em;
  color: #555;
  font-weight: 700;
  background: rgba(255,255,255,.8);
  padding: 0 2px;
  line-height: 1;
}

.print-grid .cell-points.cell-gage-ref {
  color: #4f46e5;
}

/* ─── HP gauge ─── */
.hp-section {
  border-top: 1px solid #bbb;
  padding-top: 8px;
}

.hp-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
}

.hp-gauge {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.hp-box {
  width: 16px;
  height: 16px;
  border: 1.5px solid #000;
  display: inline-block;
  flex-shrink: 0;
}

/* ─── Rules section ─── */
.rules-section {
  border-top: 1px solid #bbb;
  padding-top: 8px;
}

.rules-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 6px;
}

.rules-table td {
  padding: 2px 12px 2px 0;
  vertical-align: top;
}

.rules-note {
  font-size: 10px;
  color: #444;
  line-height: 1.5;
}

/* ─── Gage sheet ─── */
.gage-intro {
  font-size: 12px;
  margin-bottom: 12px;
  color: #333;
  font-style: italic;
}

.gage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.gage-table th {
  background: #f0f0f0;
  border: 1.5px solid #000;
  padding: 7px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.gage-table td {
  border: 1px solid #ccc;
  padding: 8px 10px;
  vertical-align: middle;
}

.gage-table .gage-num {
  text-align: center;
  color: #666;
  font-size: 11px;
}

.gage-table .gage-hp-val {
  text-align: center;
  font-weight: 700;
  color: #000;
  font-size: 14px;
}

.gage-table tbody tr:nth-child(even) td { background: #f8f8f8; }

/* ─── Combo gages (mode gage) ─── */
.combo-gages-print {
  margin-top: 18px;
  border-top: 2px solid #000;
  padding-top: 10px;
}

.combo-gages-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.combo-gages-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.combo-gages-table td {
  border: 1px solid #ccc;
  padding: 7px 10px;
}

.combo-gages-table .combo-type {
  width: 130px;
  font-weight: 700;
  background: #f0f0f0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ─── Gage page: full A4, no crop ─── */
.gage-page {
  height: auto;
  min-height: 297mm;
}

.gage-sheet {
  height: auto;
  overflow: visible;
  flex: 1;
}

/* ─── @media print ─── */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-page {
    zoom: 1 !important;
  }

  header,
  .print-controls,
  .no-print {
    display: none !important;
  }

  main {
    padding: 0 !important;
    max-width: none !important;
  }

  .tab-panel              { display: none !important; }
  #tab-print              { display: block !important; }

  #print-content {
    gap: 0;
    align-items: stretch;
  }

  .print-page {
    width: 100%;
    height: 297mm;
    box-shadow: none;
    overflow: hidden;
    page-break-after: always;
    break-after: page;
  }

  .print-page.gage-page {
    height: auto;
    overflow: visible;
  }

  .print-page:last-child {
    page-break-after: avoid;
    break-after: avoid;
  }

  .print-sheet {
    box-shadow: none;
  }
}
