:root {
  color-scheme: light;
  --page: #f6f6fa;
  --white: #fff;
  --ink: #202030;
  --body: #525166;
  --muted: #636278;
  --line: #e6e5ee;
  --purple: #6042de;
  --purple-dark: #5031ca;
  --purple-light: #eee9ff;
  --radius: 16px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--page); color: var(--ink); margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, select, input[type="checkbox"], input[type="color"] { cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, p, dl, dd { margin: 0; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: block; width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.shell { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner { height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.header-actions .nav-button { min-height: 36px; font-size: 13px; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 800; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: var(--purple); color: var(--white); }
.brand-mark .icon { width: 23px; height: 23px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; background: transparent; padding: 0; border-radius: 8px; white-space: nowrap; font-weight: 600; }
.help-button { min-height: 38px; padding-inline: 12px; color: var(--body); }
.help-button:hover, .text-button:hover, .icon-button:hover { background: var(--purple-light); color: var(--purple-dark); }
.help-button .icon, .text-button .icon { width: 16px; height: 16px; }

.intro { position: relative; min-height: 161px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 27px 30px; }
.intro h1 { font-size: clamp(31px, 4vw, 47px); letter-spacing: -.065em; font-weight: 800; line-height: 1.2; }
.intro p { margin-top: 13px; font-size: 15px; line-height: 1.65; color: var(--body); }
.intro-mark { display: grid; place-items: center; width: 182px; height: 78px; align-self: center; position: relative; margin-right: 15px; }
.intro-mark::before { content: ""; position: absolute; inset: 0; border: 1px solid #cfc4fb; border-radius: 4px; mask: conic-gradient(at 16px 16px, transparent 75%, #000 0) 0 0 / calc(100% - 16px) calc(100% - 16px); }
.intro-mark span { width: 124px; height: 35px; margin-top: -4px; color: #a995f1; opacity: .7; background: linear-gradient(90deg, currentColor 3%, transparent 3% 6%, currentColor 6% 8%, transparent 8% 11%, currentColor 11% 17%, transparent 17% 20%, currentColor 20% 23%, transparent 23% 25%, currentColor 25% 27%, transparent 27% 30%, currentColor 30% 34%, transparent 34% 38%, currentColor 38% 42%, transparent 42% 45%, currentColor 45% 47%, transparent 47% 49%, currentColor 49% 52%, transparent 52% 55%, currentColor 55% 61%, transparent 61% 64%, currentColor 64% 66%, transparent 66% 69%, currentColor 69% 73%, transparent 73% 77%, currentColor 77% 79%, transparent 79% 82%, currentColor 82% 86%, transparent 86% 88%, currentColor 88% 90%, transparent 90% 94%, currentColor 94% 100%); }
.intro-mark i { position: absolute; width: 128px; height: 1px; background: #c8baf5; bottom: 15px; }

.workspace-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.tabs { display: inline-flex; padding: 4px; border: 1px solid #e6e2f0; background: #eeedf4; border-radius: 11px; gap: 4px; }
.tab { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 36px; min-width: 122px; padding: 0 12px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--body); font-weight: 600; }
.tab:hover { color: var(--purple-dark); }
.tab[aria-selected="true"] { color: var(--purple-dark); background: #fff; border-color: #e9e3fa; box-shadow: 0 1px 3px #29204f0e; }
.tab .icon { width: 17px; height: 17px; }
.local-note { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.local-note .icon { width: 15px; height: 15px; color: var(--purple); }

.workspace { display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1.52fr); align-items: start; gap: 22px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 8px #29204f05; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; min-height: 65px; padding: 0 23px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; gap: 9px; align-items: center; }
.panel-title > .icon { color: var(--purple); width: 20px; height: 20px; }
.panel-title h2 { font-size: 17px; font-weight: 750; line-height: 1.4; }
.text-button { padding: 5px 7px; min-height: 31px; font-size: 12px; color: var(--muted); }
form#config { display: grid; gap: 16px; padding: 20px 23px 22px; }
.field { min-width: 0; }
.field label, .label-row label { font-size: 13px; font-weight: 650; display: inline-block; margin-bottom: 7px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.link-button { color: var(--purple-dark); font-size: 12px; }
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.field input:not([type="checkbox"]), .field textarea, .field select, .preview-meta select {
  width: 100%;
  border: 1px solid #dad9e6;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 11px;
  background: #fff;
}
.field :is(input, textarea, select):hover, .preview-meta select:hover { border-color: #b7afd1; }
.field textarea { display: block; padding-block: 9px; resize: vertical; line-height: 1.55; min-height: 82px; }
.field input[type="color"] { padding: 5px 7px; }
.field textarea::placeholder, .field input::placeholder { color: #747387; }
.field :is(input, textarea)[aria-invalid="true"] { border-color: #bb354c; }
.code-input, .unit-input input, .preview-meta, .zoom span { font-family: "Cascadia Mono", Consolas, "Microsoft YaHei UI", monospace; }
.hint { margin-top: 6px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.validation { font-size: 12px; line-height: 1.6; color: #a5243c; background: #fdf0f2; border-radius: 6px; padding: 8px 10px; }
.select-wrap, .unit-input { position: relative; }
.select-wrap select { appearance: none; padding-right: 33px; }
.select-wrap .icon { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.config-divider { border-top: 1px solid var(--line); }
.settings-heading { font-weight: 700; font-size: 14px; margin-bottom: -4px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.unit-input input { appearance: textfield; padding-right: 36px !important; }
.unit-input input::-webkit-inner-spin-button { appearance: none; }
.unit-input span { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.toggle-row { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
input[type="checkbox"][role="switch"] { appearance: none; position: relative; margin: 0; width: 38px; height: 22px; flex: 0 0 auto; border: 0; border-radius: 12px; background: #d9d6e5; }
input[type="checkbox"][role="switch"]::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px #29204f29; }
input[type="checkbox"][role="switch"]:checked { background: var(--purple); }
input[type="checkbox"][role="switch"]:checked::after { left: 19px; }
details { border-block: 1px solid var(--line); }
summary { display: flex; align-items: center; justify-content: space-between; min-height: 46px; color: var(--body); font-weight: 650; font-size: 13px; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary:hover { color: var(--purple-dark); }
summary .icon { width: 15px; height: 15px; }
details[open] summary .icon { rotate: 180deg; }
.advanced-content { display: grid; gap: 12px; padding-bottom: 16px; }
.primary-button { color: white; background: var(--purple); border-color: var(--purple); min-height: 43px; padding-inline: 15px; }
.primary-button:not(:disabled):hover { background: var(--purple-dark); border-color: var(--purple-dark); }
.generate-button { width: 100%; }
.button:disabled, select:disabled { opacity: .5; }

.format-badge { border-radius: 6px; padding: 4px 9px; color: var(--purple-dark); background: var(--purple-light); font: 600 12px/1.45 "Cascadia Mono", Consolas, "Microsoft YaHei UI", monospace; }
.preview-body { padding: 21px 22px 22px; }
.stage { position: relative; min-width: 0; height: 318px; border: 1px solid #e2e0ee; border-radius: 11px; background-color: #f6f5fa; background-image: radial-gradient(circle, #d6d1e9 1px, transparent 1px); background-size: 17px 17px; overflow: hidden; }
.stage-viewport { display: flex; align-items: safe center; justify-content: safe center; position: absolute; inset: 16px 15px 53px; padding: 12px; overflow: auto; }
.barcode-paper { display: grid; place-items: center; flex: 0 0 auto; padding: 15px 17px; border: 1px solid #e7e4ef; border-radius: 4px; background-color: #fff; box-shadow: 0 8px 20px #30205013, 0 1px 2px #30205016; }
.barcode-paper.is-transparent { background-color: #fff; background-image: conic-gradient(#efedf4 25%, #fff 0 50%, #efedf4 0 75%, #fff 0); background-size: 14px 14px; }
.barcode-paper svg { display: block; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 10px; color: var(--muted); line-height: 1.6; }
.empty-state .icon { width: 37px; height: 37px; color: #8980a6; }
.zoom { display: flex; align-items: center; position: absolute; right: 11px; bottom: 11px; padding: 3px; border: 1px solid #e1deeb; border-radius: 8px; background: #fff; color: var(--body); box-shadow: 0 1px 4px #29204f0a; }
.icon-button { width: 29px; height: 29px; flex-shrink: 0; }
.icon-button .icon { width: 16px; height: 16px; }
.zoom span { display: inline-block; text-align: center; min-width: 42px; font-size: 11px; font-variant-numeric: tabular-nums; }
.zoom-fit { margin-left: 3px; border-left-color: var(--line); border-radius: 0 6px 6px 0; }
.preview-meta { min-height: 46px; font-size: 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); }
.preview-meta label { display: flex; align-items: center; gap: 6px; font-family: "Microsoft YaHei UI", sans-serif; padding-block: 4px; }
.preview-meta select { min-height: 30px; width: auto; max-width: 160px; padding-inline: 5px; }
.output-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.export-controls { display: flex; align-items: stretch; gap: 0; }
.export-controls .primary-button { border-radius: 8px 0 0 8px; }
.export-format { display: flex; align-items: stretch; }
.export-format select { background: #fbfaff; border: 1px solid #d7ccfb; border-left: 0; border-radius: 0 8px 8px 0; padding-left: 10px; font-weight: 650; font-size: 12px; color: var(--purple-dark); }
.export-format .icon { width: 13px; color: var(--purple); }
.secondary-button { min-height: 43px; padding-inline: 13px; border-color: #e0deeb; background: #fff; color: var(--body); }
.secondary-button:not(:disabled):hover { background: #f7f4ff; border-color: #d7ccfb; color: var(--purple-dark); }
.secondary-button .icon { width: 17px; height: 17px; }
.output-note, .feedback { margin-top: 13px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.feedback { color: var(--purple-dark); }
.feedback[data-error="true"] { color: #a5243c; }
.site-footer { display: flex; justify-content: space-between; margin: 24px 0 0; padding: 15px 0 19px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

dialog { width: min(490px, calc(100% - 32px)); padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); box-shadow: 0 20px 70px #21174a30; }
dialog::backdrop { background: #21174a60; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.dialog-heading h2 { font-size: 21px; }
.help-list { display: grid; gap: 14px; }
.help-list dt { font-weight: 750; margin-bottom: 3px; }
.help-list dd { color: var(--body); line-height: 1.65; }

@media (max-width: 900px) {
  .shell { width: calc(100% - 40px); }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; }
  .panel-heading { padding-inline: 17px; }
  form#config, .preview-body { padding-inline: 16px; }
  .stage { height: 307px; }
}
@media (max-width: 680px) {
  .shell { width: calc(100% - 28px); }
  .header-inner { height: 59px; }
  .help-button { padding-inline: 6px; }
  .intro { min-height: 132px; padding-block: 26px 23px; }
  .intro h1 { letter-spacing: -.045em; }
  .intro p { font-size: 13px; margin-top: 9px; }
  .intro-mark { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .tab { min-width: 0; padding-inline: 10px; font-size: 13px; }
  .local-note { font-size: 11px; }
  .panel-heading { min-height: 56px; }
  .stage { height: 251px; }
}

@media (max-width: 520px) {
  .header-inner { height: auto; min-height: 59px; flex-wrap: wrap; gap: 6px 10px; padding-block: 8px; }
  .header-actions { flex-wrap: wrap; gap: 5px; }
  .header-actions .nav-button { padding-inline: 7px; min-height: 32px; font-size: 12px; }
  .header-actions .nav-button .icon { width: 14px; height: 14px; }
  .header-actions .help-button { min-height: 32px; font-size: 12px; }
}

#print-area { display: none; }
@media print {
  body > :not(#print-area) { display: none !important; }
  body { background: white; }
  #print-area { display: block; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  #print-area svg { display: block; max-width: 100%; height: auto; }
}
