/* 縦書き原稿 PDF: 紙面の見た目と印刷(画面と PDF が同じになるよう、長さは mm で決める) */
.sheets-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin: 28px 0 12px; }
.sheets-head .total { font-size: 15px; color: var(--ink-soft); }
.sheets-head .total strong { font-family: var(--serif); font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sheets-head .total .sub { margin-left: 10px; font-size: 13px; color: var(--muted); }
.sheets { position: relative; width: 100%; }
.sheets .placeholder { padding: 48px 20px; text-align: center; color: #9aa39b; font-size: 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; }
.sheet-box { position: relative; margin: 0 auto 20px; overflow: hidden; }
.sheet {
  position: absolute; left: 0; top: 0;
  background: #fff; color: #111;
  box-shadow: 0 1px 2px rgba(37, 59, 51, .08), 0 8px 24px rgba(37, 59, 51, .12);
  transform-origin: 0 0;
  overflow: hidden;
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: 400;
  font-feature-settings: normal;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  -webkit-font-smoothing: antialiased;
}
.sheet .block { position: absolute; }
.gline {
  position: absolute; top: 0;
  width: var(--cell); height: calc(var(--cols) * var(--cell));
  display: grid; grid-auto-rows: var(--cell); grid-template-columns: var(--cell); align-content: start;
}
/* 400字詰め原稿用紙のマス目の線(背景ではなく枠線で描く: 印刷の「背景のグラフィック」が OFF でも消えない) */
.gline.boxed { --gl: #b9b2a4; border: 0.15mm solid var(--gl); }
.gline.boxed .cell { border-top: 0.15mm solid var(--gl); }
.gline.boxed .cell:first-child, .gline.boxed .cell.hang { border-top: 0; }
.cell {
  position: relative;
  display: block; width: var(--cell); height: var(--cell);
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: var(--cell); line-height: var(--cell);
  text-align: center; white-space: pre; overflow: visible;
  letter-spacing: 0;
}
.cell.tcy > span { -webkit-text-combine: horizontal; text-combine-upright: all; }
/* 傍点: text-emphasis だとマスの中に圏点が入り字が押し出されるので、ルビと同じくマスの右の空きに描く(枠線で描くので印刷でも消えない) */
.emdot {
  position: absolute; left: calc(var(--cell) + 0.15mm + 0.06em); width: 0; height: 0;
  border: solid #111; border-width: 0.17em 0.12em; border-radius: 50%;
  transform: translateY(-50%) rotate(28deg);
}
/* ダッシュ: 字は透明にして、中央に途切れない縦線を引く(隣のマスとつながる)。線は枠線で描く(印刷で消えないように) */
.cell.dash { color: transparent; }
.cell.dash::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 0.08em solid #111; margin-left: -0.04em; }
.cell.hang { position: absolute; left: 0; top: 100%; }
/* ルビ: マスの右側の空きに置く */
.rt {
  position: absolute; left: calc(var(--cell) + 0.15mm);
  writing-mode: vertical-rl; text-orientation: mixed;
  line-height: 1; text-align: center; white-space: nowrap; letter-spacing: 0;
}
.pageno { position: absolute; left: 0; right: 0; bottom: 7mm; text-align: center; font-size: 3.5mm; line-height: 1; color: #111; font-variant-numeric: tabular-nums; }

/* 表紙 */
.sheet.cover { display: flex; flex-direction: row-reverse; justify-content: center; gap: 12mm; padding: 30mm 30mm 36mm; }
.sheet.cover .cover-title, .sheet.cover .cover-author { writing-mode: vertical-rl; text-orientation: mixed; height: 100%; margin: 0; letter-spacing: .12em; line-height: 1.4; }
.sheet.cover .cover-title { font-size: 9mm; font-weight: 700; text-align: center; }
.sheet.cover .cover-author { font-size: 5mm; text-align: end; padding-top: 30%; }
.sheet.cover .cover-title:empty::before { content: '(無題)'; color: #999; }

@media print {
  @page { margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body > *:not(main), main > *:not(.tool), .tool > *:not(.sheets-wrap), .sheets-wrap > *:not(.sheets), .sheets .placeholder { display: none !important; }
  .wrap { width: auto !important; padding: 0 !important; margin: 0 !important; }
  .tool, .sheets-wrap, .sheets { padding: 0 !important; margin: 0 !important; width: auto !important; }
  .sheet-box { height: auto !important; margin: 0 !important; overflow: visible !important; }
  .sheet-box + .sheet-box { break-before: page; page-break-before: always; }
  .sheet { position: relative !important; transform: none !important; box-shadow: none !important; margin: 0 !important; }
  /* iPhone / iPad の Safari は印刷の余白を外せず、紙いっぱいの紙面だと 2 ページ目にあふれる。
     紙面の箱を低くし、中身を少し縮めて 1 枚に収める(値はシミュレーターで 1 枚に収まることを確認したもの) */
  @supports (-webkit-touch-callout: none) {
    .sheet { transform: scale(0.9) !important; transform-origin: 0 0; }
    .sheet.landscape { height: 175mm !important; }
    .sheet.portrait { height: 247mm !important; }
    .pageno { bottom: 12mm; }
  }
}
