.preview-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 18px 32px;
  overflow: hidden;
}

.preview-scale {
  transform-origin: top center;
}

.page {
  width: var(--page-w);
  height: var(--page-h);
  padding: var(--page-pad);
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow: 0 10px 30px rgba(60, 50, 30, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid {
  display: grid;
  grid-auto-flow: column;
  direction: rtl;
  border: 2px solid var(--grid-outer);
  background: var(--paper);
}

.cell {
  direction: ltr;
  unicode-bidi: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--grid-line);
  font-family: var(--cell-font);
  font-weight: 400;
  font-synthesis: none;
  line-height: 1;
  overflow: hidden;
  color: var(--ink);
}

.cell.is-punct,
.cell.is-hang,
.cell.is-quote-open,
.cell.is-quote-close {
  position: relative;
}

.mark-punct,
.mark-punct-hang,
.mark-open,
.mark-close,
.mark-close-hang {
  position: absolute;
  width: 1em;
  height: 1em;
  line-height: 1;
}

.mark-punct {
  left: calc(78% - 0.16em);
  top: calc(18% - 0.81em);
}

.mark-punct-hang {
  left: calc(80% - 0.16em);
  top: calc(84% - 0.81em);
}

.mark-open {
  right: 0.02em;
  bottom: -0.39em;
  transform: rotate(90deg);
}

.mark-close {
  left: 0.02em;
  top: 0;
  transform: rotate(90deg);
}

.mark-close-hang {
  left: 0.02em;
  bottom: -0.45em;
  transform: rotate(90deg);
}

.cell.is-dash .cell-base {
  display: block;
  line-height: 1;
  font-size: 0.78em;
}

@page {
  size: A4 landscape;
  margin: 12mm;
}

@media print {
  html,
  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

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

  .preview-wrap {
    width: calc(297mm * 0.85);
    height: calc(210mm * 0.85) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  .preview-scale {
    width: 297mm;
    height: 210mm;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: transparent !important;
    transform: scale(0.85) !important;
    transform-origin: top left;
  }

  .page {
    width: 297mm;
    height: 210mm;
    margin: 0;
    border: none;
    box-shadow: none;
    background: #fff !important;
    overflow: hidden;
    break-after: avoid;
    page-break-after: avoid;
    print-color-adjust: economy;
    -webkit-print-color-adjust: economy;
  }

  .grid {
    background: #fff;
  }

  .grid,
  .cell {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
