/*
 * 紙ベースの結果リスト。
 *
 * ⚠ 帳票の部分 (.report-*) は管理ソフトの記録レポートの «マラソン結果» の帳票
 *   (marathon-admin-tool の apps/gui/src/print/marathonResults.ts) の CSS を写したもの。
 *   向こうは px で書いて macOS で 1px = 1pt の PDF にしているので、ここでは同じ数を pt で書く
 *   (ブラウザの px は 1/96 インチ。px のままだと A4 の 75% の大きさで刷られる)。
 * ⚠ 字体: 管理ソフトはヒラギノ明朝 ProN を同梱しているが、web では配らない (Web フォントの許諾が別)。
 *   見る人の PC にある明朝体を使う (Mac・iPhone はヒラギノ明朝、Windows は游明朝 / MS 明朝)。
 */

body {
  margin: 0;
  background-color: #f0f0f0;
  color: #000;
}

/* 操作の帯 (印刷しない) */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 15px;
  background-color: #f5f5f5;
}

/* 帳票を並べる場所。スマホでは帳票ごと縮める (print.blade.php の zoom) */
.report-viewport {
  padding: 20px 0 40px;
  overflow-x: hidden;
}

.report-sheets {
  width: max-content;
  margin: 0 auto;
}

/* ---- 帳票 (A4 縦) ---- */

.report-sheet {
  box-sizing: border-box;
  width: 595pt;
  min-height: 842pt;
  padding: 28pt 28pt 24pt 28pt;
  position: relative;
  background-color: #fff;
  font-family: 'Hiragino Mincho ProN', 'ヒラギノ明朝 ProN', 'Yu Mincho', 'YuMincho', '游明朝', 'MS PMincho', 'ＭＳ Ｐ明朝', serif;
  font-size: 9pt;
  line-height: 1.2;
  color: #000;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.report-sheet * {
  box-sizing: border-box;
}

.report-header {
  margin-bottom: 8pt;
}

.report-title {
  font-size: 16pt;
  font-weight: bold;
  text-align: center;
  margin-bottom: 6pt;
}

.report-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.report-category {
  font-size: 12pt;
  font-weight: bold;
}

.report-event-info {
  text-align: right;
  font-size: 9pt;
  color: #555;
  line-height: 1.4;
}

.report-record {
  font-size: 9pt;
  color: #333;
  margin-top: 4pt;
  padding: 2pt 6pt;
  background: #fafafa;
  border: 1pt solid #ddd;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.report-table th {
  border: 1pt solid #000;
  padding: 2pt 4pt;
  font-size: 9pt;
  font-weight: bold;
  background: #f0f0f0;
}

.report-table td {
  border-left: 1pt solid #aaa;
  border-right: 1pt solid #aaa;
  padding: 1pt 4pt;
  font-size: 10pt;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-table tr.top-row td {
  border-top: 1pt solid #000;
}

.report-table tr.last-row td {
  border-bottom: 1pt solid #000;
}

/* 10 位ごと (10・20・30 位…) の行の下に太線 */
.report-table tr.separator td {
  border-bottom: 1.5pt solid #000;
}

/* 列の幅 (管理ソフトの帳票と同じ) */
.report-table .col-rank { width: 6%; text-align: right; }
.report-table .col-time { width: 11%; text-align: right; }
.report-table .col-no { width: 7%; text-align: right; }
.report-table .col-name { width: 24%; }
.report-table .col-region { width: 9%; }
.report-table .col-affiliation { width: 28%; }
.report-table .col-note { width: 15%; font-size: 9pt; }

/* 出身地の列を出さないときは、その幅を所属へ回す */
.report-table--no-region .col-affiliation { width: 37%; }

/* 順位・記録・No.: 数字の桁をそろえる */
.report-table td.num {
  font-variant-numeric: tabular-nums;
}

/* 氏名の上にふりがな (2 段) */
.report-table .col-name .kana {
  font-size: 6.5pt;
  line-height: 7.5pt;
  height: 7.5pt;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-table .col-name .name {
  line-height: 12pt;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-table .col-note.mark-new {
  font-weight: bold;
  color: #d32f2f;
}

.report-no-data {
  text-align: center;
  padding: 60pt 0;
  font-size: 11pt;
  color: #888;
}

.report-footer {
  position: absolute;
  bottom: 8pt;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 8pt;
  color: #666;
}

/* ---- 画面で見るとき ---- */

@media screen {
  .report-sheet {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }

  .report-sheet + .report-sheet {
    margin-top: 20px;
  }
}

/* ---- 印刷 ---- */

@media print {
  @page {
    size: A4;
    margin: 0;
  }

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

  body {
    background: #fff;
  }

  .report-viewport {
    padding: 0;
  }

  /* ⚠ 画面の幅に合わせた縮小は印刷に効かせない */
  .report-sheets {
    zoom: 1 !important;
    width: auto;
    margin: 0;
  }

  /* ⚠ 高さは A4 (297mm) ちょうどにする。842pt は A4 (841.89pt) をわずかに超え、
   *   ページごとに白紙が挟まることがある */
  .report-sheet {
    width: 210mm;
    height: 297mm;
    min-height: 0;
    overflow: hidden;
    break-after: page;
  }

  .report-sheet:last-child {
    break-after: auto;
  }
}
