@font-face {
  font-family: "Nanxiang BangBang";
  src: url("/fonts/nanxiangbangbang-regular.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Yilin BangBang";
  src: url("/fonts/EnYiLinBangBang.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: light;
  --bg: #e9e5dc;
  --paper: #fffefa;
  --panel: #f6f3ec;
  --ink: #183039;
  --muted: #68777b;
  --line: #c8c4ba;
  --accent: #a84a3f;
  --accent-dark: #80362e;
  --guide: #9bb8c1;
  --guide-strong: #5e8894;
  --guide-opacity: 0.8;
  --trace-opacity: 0.28;
  --letter-spacing: 0.045em;
  --word-gap: 6mm;
  --global-vertical-shift: -1.39em;
  --yilin-height-scale: 0.89;
  --yilin-vertical-shift: -0.02em;
  --practice-row-step: 11.67mm;
  --glyph-baseline-y: 14.08mm;
  --word-picture-size: 26mm;
  --practice-font-size: 5.55625mm;
  font-family:
    "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgb(24 48 57 / 3%) 1px, transparent 1px),
    var(--bg);
  background-size: 100% 28px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
input,
select,
textarea,
.choice,
.switch-row {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(168 74 63 / 30%);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 12px;
  color: #fff;
  background: var(--accent-dark);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 10px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 254 250 / 94%);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.app-logo {
  display: block;
  width: auto;
  height: 48px;
  object-fit: contain;
}

.brand-product strong,
.brand-product small {
  display: block;
}

.brand-product strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand-product small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b5935f;
}

.is-loading .status-dot {
  animation: status-pulse 1.2s ease-in-out infinite;
}

.is-ready .status-dot {
  background: #64806f;
}

.has-font-error .status-dot {
  background: var(--accent);
}

@keyframes status-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.78);
  }
}

.workspace {
  display: grid;
  min-height: calc(100dvh - 72px);
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
}

.editor-panel {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100dvh - 72px);
  overflow-y: auto;
  padding: 36px clamp(22px, 3vw, 40px) 46px;
  border-right: 1px solid var(--line);
  background: rgb(246 243 236 / 92%);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.editor-intro h1,
.preview-toolbar h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.editor-intro h1 {
  max-width: 13ch;
  font-size: clamp(2rem, 3vw, 2.8rem);
  font-weight: 760;
  line-height: 1.06;
}

.editor-intro > p:last-child {
  max-width: 38ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.75;
}

.editor-intro b {
  color: var(--ink);
}

.editor-form {
  display: grid;
  gap: 24px;
  margin-top: 34px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.field label,
.field legend {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 760;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field-label-row output {
  color: var(--muted);
  font-size: 0.72rem;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  border: 1px solid #aaa79f;
  border-radius: 0;
  color: var(--ink);
  background: var(--paper);
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.field input[type="text"] {
  height: 44px;
  padding: 0 12px;
}

.field textarea {
  min-height: 178px;
  padding: 12px;
  resize: vertical;
  font-family: "Avenir Next", Avenir, sans-serif;
  font-size: 0.92rem;
  line-height: 1.7;
}

.field input[type="text"]:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: #fff;
}

.field-help,
.input-message {
  margin: 0;
  font-size: 0.69rem;
  line-height: 1.5;
}

.field-help {
  color: var(--muted);
}

.input-message {
  min-height: 1.05em;
  color: var(--accent-dark);
}

.choice-field {
  grid-template-columns: 1fr 1fr;
}

.choice-field legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.choice {
  position: relative;
  display: grid;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgb(255 254 250 / 55%);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: #fff8f3;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice b,
.choice small {
  display: block;
}

.choice b {
  font-size: 0.76rem;
}

.choice small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.4;
}

.range-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.trace-opacity-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 9px;
  align-items: center;
}

.range-ends {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.62rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch-row {
  min-height: 54px;
  cursor: pointer;
}

.switch-row b,
.switch-row small {
  display: block;
}

.switch-row b {
  font-size: 0.76rem;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.65rem;
}

.switch-row input {
  width: 36px;
  height: 20px;
  accent-color: var(--accent);
}

.tuning-stack {
  display: grid;
  gap: 10px;
}

.image-panel {
  margin: 0;
}

.image-panel-body {
  padding: 0 12px 12px;
}

.image-editor-list {
  display: grid;
  max-height: 310px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: #b7aaa2 transparent;
}

.image-editor-row {
  display: grid;
  min-height: 68px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #ddd8cd;
}

.image-panel-note {
  margin: 0 0 4px;
}

.image-editor-details {
  min-width: 0;
}

.image-editor-details > strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-job-status {
  display: block;
  min-height: 1.3em;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.image-job-status.is-submitting,
.image-job-status.is-queued,
.image-job-status.is-running,
.image-job-status.is-saving {
  color: var(--accent-dark);
}

.image-job-status.is-failed,
.image-job-status.is-unavailable {
  color: #954137;
}

.image-editor-preview {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #aaa79f;
  color: #9b6d64;
  background: #fff;
  font-family: "Yilin BangBang", sans-serif;
  font-size: 1.15rem;
}

.image-editor-preview.has-image {
  border-style: solid;
}

.image-editor-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-editor-actions {
  display: flex;
  max-width: 132px;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.image-ai-button,
.image-upload-button,
.image-remove-button {
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid #aaa79f;
  color: var(--ink);
  background: #fff;
  font-size: 0.63rem;
  font-weight: 720;
  cursor: pointer;
}

.image-ai-button {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.image-ai-button:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.image-ai-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.image-upload-button {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.image-upload-button:hover,
.image-remove-button:hover {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.image-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.image-upload-button:focus-within {
  outline: 3px solid rgb(168 74 63 / 30%);
  outline-offset: 2px;
}

.image-remove-button {
  color: var(--accent-dark);
}

.image-editor-empty {
  margin: 0;
  padding: 14px 2px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.tuning-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgb(255 254 250 / 42%);
}

.tuning-panel summary {
  display: grid;
  min-height: 58px;
  grid-template-columns: 1fr auto 14px;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.tuning-panel summary::-webkit-details-marker {
  display: none;
}

.tuning-panel summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
  text-align: right;
}

.tuning-panel[open] summary::after {
  content: "–";
}

.tuning-panel summary b,
.tuning-panel summary small {
  display: block;
}

.tuning-panel summary b {
  font-size: 0.76rem;
}

.tuning-panel summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 520;
}

.tuning-panel summary output {
  color: var(--accent-dark);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.65rem;
  font-weight: 760;
  white-space: nowrap;
}

.tuning-body {
  display: grid;
  gap: 10px;
  padding: 2px 12px 14px;
}

.tuning-row {
  display: grid;
  grid-template-columns: 68px minmax(70px, 1fr) 68px;
  gap: 9px;
  align-items: center;
}

.tuning-row > label {
  color: #40545a;
  font-size: 0.68rem;
  font-weight: 700;
}

.tuning-row > input[type="range"] {
  min-width: 0;
  accent-color: var(--accent);
}

.select-tuning-row select {
  min-width: 0;
  height: 32px;
  padding: 0 28px 0 9px;
  border: 1px solid #aaa79f;
  border-radius: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 0.68rem;
  font-weight: 720;
}

.select-hint {
  color: var(--muted);
  font-size: 0.58rem;
  text-align: right;
}

.number-unit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid #aaa79f;
  background: var(--paper);
}

.number-unit input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 3px 0 7px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.7rem;
  font-weight: 720;
}

.number-unit span {
  padding-right: 6px;
  color: var(--muted);
  font-size: 0.59rem;
}

.tuning-message {
  min-height: 1em;
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.64rem;
  line-height: 1.45;
}

.parameter-export {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed #aaa79f;
}

.parameter-export p,
.parameter-export output,
.parameter-export > span {
  margin: 0;
  font-size: 0.64rem;
  line-height: 1.5;
}

.parameter-export p {
  color: var(--muted);
}

.parameter-export output {
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.parameter-export > span {
  min-height: 1em;
  color: var(--accent-dark);
}

.button-copy {
  min-height: 36px;
  color: var(--accent-dark);
  border-color: #b78278;
  background: #fff8f3;
}

.button-copy:hover {
  color: #fff;
  background: var(--accent);
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: 0.76rem;
  font-weight: 780;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 120ms ease;
}

.button:active {
  transform: scale(0.98);
}

.button-quiet {
  color: var(--ink);
  background: transparent;
}

.button-quiet:hover {
  color: #fff;
  background: var(--ink);
}

.button-print {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.button-print:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button-print:disabled {
  color: #9f9b92;
  border-color: #c8c4ba;
  background: #e2ded5;
  cursor: wait;
}

.button-print svg {
  width: 17px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
}

.preview-panel {
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 44px) 70px;
}

.preview-toolbar {
  display: flex;
  max-width: 210mm;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 auto 22px;
}

.preview-toolbar h2 {
  font-size: 1.8rem;
  line-height: 1;
}

.preview-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.page-summary {
  color: var(--muted);
  font-size: 0.72rem;
}

.preview-scroll {
  position: relative;
  min-height: 70dvh;
  overflow-x: auto;
  padding: 0 0 28px;
}

.pages {
  display: grid;
  width: max-content;
  min-width: 100%;
  gap: 30px;
  justify-items: center;
}

.sheet {
  position: relative;
  display: grid;
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  grid-template-rows: auto auto 1fr auto;
  padding: 12mm;
  overflow: hidden;
  color: #1b3037;
  background: var(--paper);
  box-shadow: 0 22px 55px rgb(35 38 37 / 16%);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.sheet-header {
  display: grid;
  grid-template-columns: 1fr 61mm;
  gap: 10mm;
  align-items: center;
}

.sheet-branding {
  display: grid;
  min-width: 0;
  grid-template-columns: 32mm minmax(0, 1fr);
  gap: 4mm;
  align-items: center;
}

.sheet-logo {
  display: block;
  width: 32mm;
  height: auto;
}

.sheet-header h2 {
  margin: 0;
  font-size: 21pt;
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.sheet-header dl {
  display: grid;
  gap: 3mm;
  margin: 0 0 1mm;
}

.sheet-header dl > div {
  display: grid;
  grid-template-columns: 9mm 1fr;
  align-items: end;
}

.sheet-header dt {
  color: #5d6b6f;
  font-size: 6.5pt;
  font-weight: 750;
}

.sheet-header dd {
  height: 5mm;
  margin: 0;
  border-bottom: 0.35mm solid #7c8789;
}

.sheet-rule {
  height: 0.8mm;
  margin-top: 5mm;
  background: #1b3037;
}

.practice-list {
  display: flex;
  flex-direction: column;
  margin-top: 6mm;
}

.practice-block {
  flex: 0 0 auto;
  break-inside: avoid;
  page-break-inside: avoid;
}

.practice-block.has-layout-error .practice-band {
  box-shadow: inset 0 0 0 0.35mm rgb(159 48 40 / 42%);
}

.sheet.has-layout-error {
  outline: 0.5mm solid rgb(159 48 40 / 48%);
  outline-offset: -0.5mm;
}

.practice-body {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}

.practice-body.has-picture-column {
  grid-template-columns: var(--word-picture-size) minmax(0, 1fr);
  gap: 3mm;
}

.practice-bands {
  min-width: 0;
}

.practice-body.has-picture-column .practice-bands {
  grid-row: 1;
  grid-column: 2;
}

.word-picture {
  display: grid;
  width: var(--word-picture-size);
  height: var(--word-picture-size);
  margin: 0;
  place-items: center;
  align-self: center;
  overflow: hidden;
  border: 0.25mm solid #d4d0c6;
  background: #fff;
  grid-row: 1;
  grid-column: 1;
}

.word-picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.practice-band {
  position: relative;
  height: var(--practice-row-step);
  overflow: visible;
  border-right: 0.25mm solid #d3dee1;
  border-left: 0.25mm solid #d3dee1;
  background: transparent;
}

.practice-band + .practice-band {
  margin-top: 0;
}

.guide-line {
  position: absolute;
  z-index: 0;
  right: 0;
  left: 0;
  height: 0.25mm;
  background: var(--guide);
  opacity: var(--guide-opacity);
}

.guide-line:nth-child(3) {
  height: 0.4mm;
  background: var(--guide-strong);
}

.pages[data-middle-guide-style="dashed"] .guide-line:nth-child(2) {
  background:
    repeating-linear-gradient(
      90deg,
      var(--guide) 0 1.2mm,
      transparent 1.2mm 2mm
    );
}

.pages[data-middle-guide-style="dashed"] .guide-line:nth-child(3) {
  background:
    repeating-linear-gradient(
      90deg,
      var(--guide-strong) 0 1.2mm,
      transparent 1.2mm 2mm
    );
}

.glyph-baseline {
  position: absolute;
  z-index: 1;
  top: var(--glyph-baseline-y);
  right: 3mm;
  left: 4mm;
  height: 0;
  color: var(--ink);
  font-size: var(--practice-font-size);
  font-weight: 400;
  line-height: 0;
  white-space: nowrap;
}

.trace-sequence {
  display: flex;
  gap: var(--word-gap);
  align-items: baseline;
  justify-content: flex-start;
  line-height: 0;
}

.mixed-word {
  display: inline-block;
  flex: 0 0 auto;
  color: rgb(27 48 55 / var(--trace-opacity));
  font-family: "Nanxiang BangBang", sans-serif;
  letter-spacing: var(--letter-spacing);
  font-feature-settings:
    "kern" 0,
    "liga" 0,
    "calt" 0;
  font-kerning: none;
  font-variant-ligatures: none;
  line-height: 1;
  transform: translateY(calc(-0.68em + var(--global-vertical-shift)));
  transform-origin: 0 100%;
}

.measurement-host {
  position: fixed;
  z-index: -1;
  top: -200vh;
  left: 0;
  visibility: hidden;
  font-size: var(--practice-font-size);
  line-height: 0;
  white-space: nowrap;
  pointer-events: none;
}

.mixed-word.is-model {
  color: #1b3037;
}

.patched-glyph {
  display: inline-block;
  color: inherit;
  font-family: "Yilin BangBang", sans-serif;
  font-size: 1.01em;
  line-height: 1;
  transform-origin: 50% 64%;
}

.patched-p {
  margin-right: -0.03em;
  transform:
    translateY(calc(-0.01em + var(--yilin-vertical-shift)))
    scaleY(var(--yilin-height-scale));
}

.patched-q {
  margin-right: -0.04em;
  transform:
    translateY(calc(-0.01em + var(--yilin-vertical-shift)))
    scaleY(var(--yilin-height-scale));
}

.patched-y {
  margin-right: -0.02em;
  transform:
    translateY(calc(-0.03em + var(--yilin-vertical-shift)))
    scaleY(var(--yilin-height-scale));
}

.sheet-footer {
  display: flex;
  align-self: end;
  justify-content: flex-end;
  margin-top: 3mm;
  padding-top: 2.5mm;
  border-top: 0.25mm solid #cfcbc1;
  color: #68777b;
  font-size: 6pt;
}

.preview-loading,
.empty-state {
  width: min(100%, 520px);
  margin: 80px auto 0;
  text-align: center;
}

.preview-loading {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.loading-line {
  width: 170px;
  height: 3px;
  margin: auto;
  background:
    linear-gradient(90deg, var(--accent) 50%, #d6d1c7 50%) 0 0 / 200% 100%;
  animation: loading-slide 1.1s linear infinite;
}

@keyframes loading-slide {
  to {
    background-position: -200% 0;
  }
}

.empty-state > span {
  color: var(--accent);
  font-family: "Yilin BangBang", sans-serif;
  font-size: 4rem;
}

.empty-state h3 {
  margin: 8px 0 4px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

noscript {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  padding: 12px;
  color: #fff;
  background: var(--accent-dark);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .editor-intro h1 {
    max-width: 18ch;
  }
}

@media (max-width: 620px) {
  .app-header {
    position: static;
    align-items: flex-start;
  }

  .header-status {
    max-width: 115px;
    justify-content: flex-end;
    text-align: right;
  }

  .brand small {
    display: none;
  }

  .preview-toolbar {
    align-items: flex-start;
  }

  .preview-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .page-summary {
    order: 2;
  }

  .choice-field {
    grid-template-columns: 1fr;
  }

  .choice-field legend {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    width: 210mm;
    min-width: 210mm;
    margin: 0;
    background: #fff;
  }

  .app-header,
  .editor-panel,
  .preview-toolbar,
  .preview-loading,
  .empty-state,
  .skip-link,
  noscript {
    display: none !important;
  }

  .workspace,
  .preview-panel,
  .preview-scroll,
  .pages {
    display: block;
    width: 210mm;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: #fff;
  }

  .sheet {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    margin: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

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