:root {
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: #202b2a;
  background: #f2f5f4;
  font-size: 14px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { min-width: 360px; margin: 0; }
button, input, textarea, select { color: inherit; font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  height: 68px;
  align-items: center;
  gap: 24px;
  padding: 0 max(28px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid #e0e7e4;
  background: rgb(255 255 255 / 97%);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; background: #174d49; }
.brand-mark svg { width: 21px; fill: #fff; }
.brand strong { display: block; font-size: 14px; font-weight: 650; }
.brand small { display: block; margin-top: 2px; color: #86918e; font-size: 10px; }
.header-tools { display: flex; align-items: end; gap: 9px; margin-left: auto; }
.template-picker { display: flex; min-width: 220px; flex-direction: column; gap: 4px; color: #697570; font-size: 10px; font-weight: 600; }
.template-picker select { width: 100%; height: 36px; padding: 0 30px 0 10px; border: 1px solid #d3dcd9; border-radius: 5px; outline: none; background: #fff; font-size: 12px; }
.save-state { min-width: 106px; color: #73807b; font-size: 11px; text-align: right; }

main { width: min(1180px, calc(100% - 56px)); margin: 0 auto; padding: 38px 0 60px; }
.workspace-heading { margin-bottom: 25px; }
.eyebrow { color: #287c71; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin: 0; }
h1 { margin-top: 5px; font-size: 25px; font-weight: 650; line-height: 1.3; }
h2 { font-size: 14px; font-weight: 650; }
.workspace-heading p, .section-title p, .preview-heading p { margin-top: 5px; color: #7a8581; font-size: 12px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 348px; align-items: start; gap: 22px; }
.editor-column { display: grid; gap: 16px; }
.editor-section, .paste-section, .preview-column { border: 1px solid #dfe6e3; border-radius: 8px; background: #fff; box-shadow: 0 3px 12px rgb(26 53 47 / 3%); }
.editor-section, .paste-section { padding: 20px 22px; }
.section-title, .preview-heading > div { display: flex; align-items: center; gap: 11px; }
.section-title { margin-bottom: 18px; }
.step-number { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border: 1px solid #d9e8e3; border-radius: 50%; background: #eef6f3; color: #20766b; font-size: 11px; font-weight: 700; }
.field-label { display: flex; min-width: 0; flex-direction: column; gap: 7px; margin-top: 13px; color: #586560; font-size: 11px; font-weight: 600; }
.field-label:first-of-type { margin-top: 0; }
.field-label input, .field-label textarea { width: 100%; border: 1px solid #d5ddda; border-radius: 5px; outline: 0; background: #fff; color: #26312e; font-size: 12px; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
.field-label input { height: 37px; padding: 0 10px; }
.field-label textarea { min-height: 69px; resize: vertical; padding: 9px 10px; line-height: 1.5; }
.field-label textarea#template-url { min-height: 105px; font-family: ui-monospace, Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
.field-label input:focus, .field-label textarea:focus, .template-picker select:focus { border-color: #398e82; box-shadow: 0 0 0 3px rgb(57 142 130 / 12%); }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; align-items: end; gap: 14px; }
.remark-field { margin-top: 13px; }
.remark-field textarea { min-height: 58px; }
.color-field { margin-top: 13px; }
.color-control { display: flex; height: 37px; align-items: center; gap: 9px; }
.color-control input { width: 38px; height: 34px; padding: 2px; border: 1px solid #d5ddda; border-radius: 5px; background: #fff; cursor: pointer; }
.color-control code { color: #56625e; font-size: 11px; font-weight: 500; }
.paste-section { padding-bottom: 21px; }
.paste-section .section-title { margin-bottom: 14px; }
.paste-target { display: flex; min-height: 148px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 18px; border: 1px dashed #a9c4bc; border-radius: 7px; outline: none; background: #f8fbfa; text-align: center; transition: border-color .15s, background .15s, box-shadow .15s; }
.paste-target:hover, .paste-target:focus-visible { border-color: #34887c; background: #f2f8f5; box-shadow: inset 0 0 0 1px #34887c; }
.paste-target.decoding { border-color: #388e83; background: #edf7f3; }
.paste-icon { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 50%; background: #e5f1ec; }
.paste-icon svg { width: 23px; fill: none; stroke: #357b70; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.paste-target strong { color: #34413c; font-size: 12px; font-weight: 600; }
.paste-hint { color: #87918e; font-size: 10px; }
#decode-status { min-height: 14px; color: #287c71; font-size: 11px; }
.preview-column { position: sticky; top: 88px; padding: 19px; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preview-heading p { font-size: 10px; }
.live-indicator { display: flex; align-items: center; gap: 5px; color: #75817c; font-size: 10px; white-space: nowrap; }
.live-indicator i { width: 6px; height: 6px; border-radius: 50%; background: #37a17d; box-shadow: 0 0 0 3px #e5f4ed; }
.preview-stage { display: grid; min-height: 310px; max-height: 430px; overflow: auto; place-items: center; margin-top: 17px; padding: 15px; border: 1px solid #edf1ef; border-radius: 6px; background-color: #fafcfb; background-image: radial-gradient(#e3eae7 0.7px, transparent 0.7px); background-size: 13px 13px; }
.qr-preview { display: grid; width: 100%; place-items: center; }
.qr-preview canvas { display: block; width: min(100%, 280px); height: auto; padding: 8px; background: #fff; box-shadow: 0 2px 12px rgb(24 43 38 / 9%); }
.muted { color: #89938f; font-size: 11px; }
.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid #d1dad6; border-radius: 5px; background: #fff; color: #34403c; font-size: 11px; font-weight: 600; transition: background .15s, border-color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); border-color: #a9bbb5; background: #f8faf9; }
.button.primary { width: 100%; min-height: 42px; border-color: #176e65; background: #176e65; color: #fff; font-size: 12px; }
.button.primary:hover { border-color: #125c55; background: #125c55; }
.button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.add-button { height: 36px; white-space: nowrap; }
.add-button span { color: #217d71; font-size: 17px; font-weight: 400; }
.copy-button { margin-top: 12px; }
.preview-note { padding-top: 10px; color: #8a9590; font-size: 10px; text-align: center; }
.toast { position: fixed; z-index: 5; bottom: 24px; left: 50%; transform: translate(-50%, 12px); padding: 11px 16px; border-radius: 5px; background: #24312e; color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.error { color: #b42318; font-size: 12px; }

@media (max-width: 820px) {
  .topbar { padding: 0 20px; }
  main { width: calc(100% - 40px); }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
  .preview-column { padding: 15px; }
  .editor-section, .paste-section { padding: 17px; }
  .preview-stage { min-height: 270px; }
}
@media (max-width: 650px) {
  .topbar { height: auto; min-height: 62px; flex-wrap: wrap; gap: 10px; padding: 9px 14px; }
  .brand { margin-right: auto; }
  .header-tools { order: 3; width: 100%; align-items: end; margin: 0; }
  .template-picker { min-width: 0; flex: 1; }
  .template-picker select, .add-button { height: 34px; min-height: 34px; }
  .save-state { min-width: auto; font-size: 10px; }
  main { width: calc(100% - 28px); padding: 24px 0 40px; }
  .workspace-heading { margin-bottom: 17px; }
  h1 { font-size: 21px; }
  .workspace-heading p { max-width: 330px; font-size: 11px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .editor-column { gap: 11px; }
  .editor-section, .paste-section { padding: 15px; }
  .section-title { margin-bottom: 14px; }
  .field-row { grid-template-columns: minmax(0, 1fr) 105px; gap: 10px; }
  .paste-target { min-height: 135px; }
  .preview-column { position: static; padding: 15px; }
  .preview-stage { min-height: 250px; max-height: 360px; }
  .qr-preview canvas { width: min(100%, 260px); }
}
