:root {
  color-scheme: light;
  --ink: #1e2924;
  --muted: #475950;
  --green: #174f3b;
  --line: #d9dfd7;
  background: #f4f5ef;
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p, fieldset { margin: 0; }
a { color: var(--green); text-underline-offset: .23em; }
:focus-visible { outline: 3px solid #36794f; outline-offset: 4px; }
main { width: min(100% - 32px, 950px); margin-inline: auto; padding-block: 44px; }
h1 { font-size: clamp(2rem, 5.7vw, 3rem); line-height: 1.18; letter-spacing: -.045em; }
.language-switch { display: flex; justify-content: flex-end; }
.language-switch a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; }
header > p { margin-top: 10px; color: var(--muted); line-height: 1.65; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, .94fr);
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}
.controls { padding: clamp(19px, 5vw, 35px); }
fieldset { border: 0; padding: 0; min-inline-size: 0; }
legend { padding: 0; font-weight: 700; margin-bottom: 8px; }
.widths { display: flex; width: min(100%, 250px); gap: 5px; padding: 4px; background: #eef1ea; border-radius: 10px; }
.widths label { position: relative; flex: 1; }
.widths input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.widths span { display: grid; place-items: center; min-height: 44px; padding: 4px 8px; border-radius: 7px; white-space: nowrap; }
.widths input:checked + span { background: var(--green); color: white; font-weight: 700; }
.widths input:focus-visible + span { outline: 3px solid #36794f; outline-offset: 3px; }
.print {
  min-height: 45px;
  margin-top: 16px;
  padding: 8px 19px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.print:hover { background: #0c3a29; }
.print:disabled, fieldset:disabled .widths { opacity: .55; }
.instructions { margin: 14px 0 0; padding-left: 21px; color: var(--muted); line-height: 1.65; }
.instructions li + li { margin-top: 5px; }
.instructions code { color: var(--ink); white-space: nowrap; }
.script-warning { margin-top: 12px; color: var(--muted); }
.preview { display: grid; justify-items: center; align-content: center; padding: 24px 10px; background: #e9ede5; border-radius: 0 17px 17px 0; }
.paper {
  --page-width: 58mm;
  --content-width: 48mm;
  width: min(var(--page-width), 100%);
  padding: 3mm min(5mm, 6%) 5mm;
  background: white;
  color: black;
  box-shadow: 0 3px 12px #172c2214;
  font: 10.5px/1.38 "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;
  font-variant-numeric: tabular-nums;
}
.paper[data-width="80"] { --page-width: 80mm; --content-width: 72mm; padding-inline: min(4mm, 6%); }
.ticket-heading { padding: 7px 0 6px; text-align: center; }
.ticket-heading h2 { font-size: 15px; letter-spacing: .1em; }
.ticket-heading p { margin-top: 3px; font-size: 9px; }
.gauge { height: 8px; border: 1px solid; border-bottom: 0; }
.gauge:last-child { border: 1px solid; border-top: 0; margin-top: 6px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 4px 2px; text-align: left; vertical-align: top; }
th { border-block: 1px dashed; font-size: 9px; }
th:nth-child(2), td:nth-child(2) { width: 27px; text-align: right; }
th:last-child, td:last-child { width: 45px; text-align: right; }
td:first-child { overflow-wrap: anywhere; }
.total { display: flex; justify-content: space-between; padding: 5px 2px; border-top: 1px dashed; font-weight: 700; }
.qr { display: grid; justify-items: center; padding-top: 4px; font-size: 9px; }
.qr img { width: 22mm; height: 22mm; image-rendering: pixelated; }
footer { margin-top: 16px; line-height: 1.65; color: var(--muted); }
.purchase-links { display: flex; flex-wrap: wrap; column-gap: 20px; }
.purchase-links a { display: inline-flex; align-items: center; min-height: 44px; }
.report-sample {
  max-width: 640px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.report-sample summary {
  min-height: 44px;
  padding: 8px 14px;
  color: var(--green);
  font-weight: 600;
  cursor: pointer;
}
.report-body { padding: 0 14px 14px; }
.report-body > p { font-size: .875rem; }
.report-body dl { margin: 12px 0 0; }
.report-body dt { color: var(--ink); font-weight: 600; }
.report-body dd { margin: 0; }
.report-body dd + dt { margin-top: 8px; }
@media (max-width: 680px) {
  main { padding-block: 26px; }
  .workspace { display: block; }
  .preview { border-radius: 0 0 17px 17px; }
}
@media print {
  :root, body { background: white; }
  main, .workspace, .preview { display: block; width: auto; margin: 0; padding: 0; border: 0; background: white; }
  main > header, .controls, footer { display: none; }
  .paper, .paper[data-width="80"] { width: var(--content-width); margin: 3mm 0 0 5mm; padding: 0; box-shadow: none; break-inside: avoid; }
  .paper[data-width="80"] { margin-left: 4mm; }
}
