@font-face {
  font-family: Caveat;
  src: url('/tools/zt/vendor/caveat-2.000/regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: Kalam;
  src: url('/tools/zt/vendor/kalam-2.001/regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Patrick Hand';
  src: url('/tools/zt/vendor/patrick-hand-1.003/regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: Handlee;
  src: url('/tools/zt/vendor/handlee-1.001/regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Short Stack';
  src: url('/tools/zt/vendor/short-stack-1.002/regular.woff2') format('woff2');
  font-display: swap;
}
.handwriting-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: start;
  gap: 16px 24px;
}
.handwriting-editor, .handwriting-result { min-width: 0; }
.handwriting-editor textarea { display: block; resize: vertical; }
.handwriting-editor .zt-ux-presets { flex-wrap: wrap; margin: 8px 0 0; }
.handwriting-editor .zt-ux-presets button[aria-pressed='true'] { background: var(--go-tint); border-color: var(--go); }
.handwriting-settings { margin-block: 8px; border-block: 1px solid var(--line); }
.handwriting-settings summary { cursor: pointer; min-height: 44px; padding-block: 10px; font-weight: 600; }
.handwriting-options, #handwriting-header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.handwriting-options { padding-block: 4px 12px; }
.handwriting-options button { align-self: end; }
.handwriting-settings :is(select, input) { width: 100%; min-width: 0; font-size: 1rem; min-height: 44px; }
#handwriting-header { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
#handwriting-header .zt-field:last-child { grid-column: 1 / -1; }
.handwriting-result { display: grid; padding: 12px; scroll-margin-block-start: 8px; }
.handwriting-result output { font-size: 1.125rem; line-height: 1.35; }
.handwriting-result .zt-explain { margin: 2px 0 8px; }
.handwriting-stage {
  display: grid; justify-items: center; min-width: 0; padding: 7px;
  background: #dce3e7; border-radius: 6px; container-type: inline-size;
}
.handwriting-stage > :is(button, .handwriting-paper) {
  display: block; inline-size: 100%; aspect-ratio: 794 / 1123;
  box-shadow: 0 2px 8px #17283a33;
}
#handwriting-enlarge { cursor: zoom-in; background: none; border: 0; padding: 0; }
#handwriting-preview { display: block; width: 100%; height: auto; }
.handwriting-paper {
  background: linear-gradient(90deg, transparent 7.3%, #cf838455 7.3% 7.55%, transparent 7.55%),
    repeating-linear-gradient(transparent 0 4.16%, #9ab4cc70 4.16% 4.27%), #fdfbf6;
  color: #1b427d; font: 5cqi/1.2 Caveat, cursive; padding: 2% 6% 0 10.3%; white-space: pre-wrap; overflow: hidden;
}
.handwriting-actions, .handwriting-pages { display: flex; gap: 8px; margin-bottom: 8px; }
.handwriting-actions button { flex: 1; min-width: 0; min-height: 44px; padding: 6px; }
.handwriting-pages { justify-content: space-between; align-items: center; font-size: 0.875rem; }
.handwriting-pages button { min-width: 44px; min-height: 44px; padding: 4px; }
.handwriting-next .zt-next { gap: 4px 8px; margin: 8px 0 0; }
.handwriting-next a { min-height: 44px; }
.handwriting-workspace [hidden] { display: none; }
#handwriting-zoom {
  padding: 10px; max-width: min(850px, 96vw); max-height: 94dvh; box-sizing: border-box;
  border: 0; border-radius: 8px; background: var(--paper, white); color: inherit;
}
#handwriting-zoom::backdrop { background: #162137b8; }
#handwriting-zoom form { display: flex; justify-content: end; margin: 0 0 8px; }
.handwriting-zoom-scroll {
  max-height: calc(94dvh - 80px); overflow: auto; overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}
#handwriting-full { display: block; width: 794px; max-width: none; cursor: grab; }
#handwriting-full:active { cursor: grabbing; }

@media (max-width: 640px) {
  .handwriting-workspace { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .handwriting-editor .zt-ux-presets { gap: 4px; }
  .handwriting-editor .zt-ux-presets button { padding-inline: 8px; font-size: 0.8125rem; }
  .handwriting-result { padding: 6px; }
  .handwriting-stage { padding: 4px; }
  #tool:has(.handwriting-workspace) .zt-do { margin-bottom: 4px; }
}
