/* 西文全部本地：五款来自已有项目，Archivo 与 Spline Mono 在 ./fonts/ 里（本项目新本地化）。
   仓库里原本没有等宽西文，而吊牌上的货号、批号、条码数字、规格表最需要它。 */
@font-face { font-family: "OC Bodoni Moda"; src: url("../desktop-moodboard-generator/fonts/BodoniModa-Latin.woff2") format("woff2"); font-style: normal; font-weight: 400 900; font-display: swap; }
@font-face { font-family: "OC Cormorant"; src: url("../desktop-moodboard-generator/fonts/CormorantGaramond-Latin.woff2") format("woff2"); font-style: normal; font-weight: 300 700; font-display: swap; }
@font-face { font-family: "OC Special Elite"; src: url("../desktop-moodboard-generator/fonts/SpecialElite-Latin.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "OC Meddon"; src: url("../desktop-moodboard-generator/fonts/Meddon-Latin.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "OC IM Fell"; src: url("../oc-timeline-generator/fonts/IMFellEnglish-Italic.ttf") format("truetype"); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  --ui-accent: #5c6b62;
  --ui-accent-dark: #38443d;
  --ui-accent-soft: #e4ebe6;
  --ui-bg: #e6e6e2;
  --ui-panel: #f6f6f3;
  --ui-card: #fcfcfa;
  --ui-line: #cbcbc4;
  --ui-line-strong: #a9a9a0;
  --ui-text: #26282a;
  --ui-muted: #666a6c;
  --topbar-height: 64px;
  --font-ui: "OC Archivo","OC Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif;
  --font-serif: "OC Noto Serif SC","Noto Serif SC","Songti SC",serif;
  --font-mono: "OC Spline Mono",Consolas,"Courier New",monospace;
  font-family: var(--font-ui);
}
* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body { width: 100%; height: 100vh; height: 100dvh; min-width: 320px; margin: 0; overflow: hidden; display: grid; grid-template-rows: var(--topbar-height) minmax(0,1fr); color: var(--ui-text); background: var(--ui-bg); }
body.is-export-busy,body.is-export-busy button { cursor: progress; }
button,input,textarea,select { font: inherit; color: inherit; }
button,.file-button { -webkit-tap-highlight-color: transparent; }
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,[tabindex]:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
button:active,.file-button:active { transform: translateY(1px); }
[hidden] { display: none !important; }

/* ================= 编辑器外壳 ================= */
.topbar { height: 100%; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-bottom: 1px solid var(--ui-line); background: rgba(250,250,248,.98); position: relative; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 250px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 5px; background: var(--ui-accent); color: #fff; font-family: var(--font-serif); font-size: 22px; font-weight: 800; box-shadow: 4px 4px 0 #d3d5d1; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy b { font-family: var(--font-serif); font-size: 17px; line-height: 1.2; }
.brand-copy small { color: var(--ui-muted); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.project-field { flex: 1; max-width: 420px; display: grid; grid-template-columns: auto minmax(160px,1fr); align-items: center; gap: 8px; }
.project-field span { color: var(--ui-muted); font-size: 12px; font-weight: 700; }
.project-field input { height: 40px; min-width: 0; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 6px; background: #fff; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.button,.preview-actions button { min-height: 38px; padding: 0 13px; border: 1px solid var(--ui-line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; font-weight: 750; white-space: nowrap; }
.button:hover,.preview-actions button:hover { border-color: var(--ui-accent); }
.button.primary { border-color: var(--ui-accent); background: var(--ui-accent); color: #fff; }
.button.quiet { background: transparent; }
.button.compact { min-height: 34px; padding-inline: 10px; font-size: 12px; }
.button:disabled { opacity: .4; cursor: default; }
.file-button { position: relative; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.text-button { padding: 4px 0; border: 0; background: transparent; color: var(--ui-accent-dark); cursor: pointer; font-size: 12px; font-weight: 750; }
.workspace { min-height: 0; display: grid; grid-template-columns: 348px minmax(430px,1fr) 366px; }
.editor-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); background: var(--ui-panel); }
.content-panel { border-right: 1px solid var(--ui-line); }
.style-panel { border-left: 1px solid var(--ui-line); }
.panel-heading { min-height: 70px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--ui-line); background: #f9f9f7; }
.panel-heading > span { padding: 4px 8px; border-radius: 4px; background: var(--ui-accent-soft); color: var(--ui-accent-dark); font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.panel-heading h1 { margin: 0; font-family: var(--font-serif); font-size: 17px; }
.panel-heading p { margin: 2px 0 0; color: var(--ui-muted); font-size: 11px; }
.panel-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px; scrollbar-gutter: stable; }
.editor-card { margin-bottom: 14px; padding: 14px; border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-card); box-shadow: 0 1px 0 rgba(38,40,42,.03); }
.card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h2 { margin: 0; font-family: var(--font-serif); font-size: 15px; }
.card-title p { margin: 3px 0 0; color: var(--ui-muted); font-size: 11px; line-height: 1.5; }
.card-title > span { padding: 3px 7px; border: 1px solid var(--ui-line); border-radius: 4px; color: var(--ui-muted); font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.field { min-width: 0; display: grid; gap: 5px; margin-bottom: 10px; }
.field > span { color: var(--ui-muted); font-size: 11px; font-weight: 750; }
.field input,.field select { min-height: 38px; min-width: 0; padding: 8px 10px; border: 1px solid var(--ui-line); border-radius: 5px; background: #fff; font-size: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.image-control { display: grid; grid-template-columns: 104px minmax(0,1fr); align-items: center; gap: 12px; margin-bottom: 12px; }
.image-control b { font-size: 12px; }
.image-control p { margin: 3px 0 6px; color: var(--ui-muted); font-size: 11px; line-height: 1.5; }
.upload-preview { width: 104px; min-height: 104px; display: grid; place-items: center; padding: 4px; border-radius: 7px; background: #eeeeea; color: var(--ui-muted); font-size: 10px; }
/* 这个小窗按当前版式图位的比例与形状画，图也用同一套裁切参数，所见即所得 */
.photo-slot { position: relative; overflow: hidden; display: grid; place-items: center;
  border: 1px dashed var(--ui-line-strong); background: #e4e4df; }
.photo-slot.has-image { border-style: solid; }
.photo-slot img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-slot > span { padding: 0 4px; color: var(--ui-muted); font-size: 9px; text-align: center; }
.inline-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.style-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.style-button { min-width: 0; min-height: 62px; display: grid; grid-template-columns: 30px minmax(0,1fr); align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--ui-line); border-radius: 6px; background: #fff; text-align: left; cursor: pointer; }
.style-button.active { border-color: var(--ui-accent); background: var(--ui-accent-soft); }
.style-swatch { width: 30px; height: 42px; border: 1px solid rgba(0,0,0,.15); border-radius: 3px; background: linear-gradient(180deg,var(--sw-s) 0 44%,var(--sw-a) 44% 62%,var(--sw-m) 62% 74%,var(--sw-i) 74%); }
.style-button b { display: block; font-size: 11px; line-height: 1.35; }
.style-button small { display: block; margin-top: 2px; color: var(--ui-muted); font-size: 9px; line-height: 1.32; }
.color-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.color-field { min-width: 0; display: grid; grid-template-columns: 30px minmax(0,1fr); align-items: center; gap: 7px; padding: 7px; border: 1px solid var(--ui-line); border-radius: 5px; background: #fff; }
.color-field > span { font-size: 11px; font-weight: 750; }
.color-field .clr-field { width: 100%; }
.color-field input { width: 100%; min-width: 0; height: 32px; border: 0; background: transparent; }
.check-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.check-row label,.check-field { min-height: 38px; display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--ui-line); border-radius: 5px; background: #fff; font-size: 12px; font-weight: 700; }
.check-field { margin-top: 8px; }
.check-row input,.check-field input { accent-color: var(--ui-accent); }
.range-row { display: grid; grid-template-columns: minmax(0,1fr) 52px; align-items: center; gap: 10px; margin-bottom: 10px; }
.range-row.labeled { grid-template-columns: 44px minmax(0,1fr) 52px; }
.range-row.labeled > span { color: var(--ui-muted); font-size: 11px; font-weight: 750; }
.range-row input[type="range"] { width: 100%; accent-color: var(--ui-accent); }
.range-row output { text-align: right; color: var(--ui-muted); font-size: 11px; font-weight: 750; }
.hint-note { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--ui-line-strong); background: #f2f2ee; color: var(--ui-muted); font-size: 11px; line-height: 1.6; }
.export-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.export-grid .button { min-height: 42px; }
.preview-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 48px minmax(0,1fr); background: #d5d6d1; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 0 11px; border-bottom: 1px solid var(--ui-line); background: #f4f4f1; }
.preview-toolbar > div { display: flex; align-items: center; gap: 9px; }
.preview-toolbar strong { font-size: 13px; }
.preview-toolbar #save-state { color: var(--ui-muted); font-size: 11px; }
.preview-actions { display: flex; gap: 5px; }
.preview-actions button { min-height: 34px; padding: 0 10px; font-size: 12px; }
.preview-actions button.active { border-color: var(--ui-accent); background: var(--ui-accent); color: #fff; }
.preview-viewport { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.preview-stage { position: relative; margin: 34px auto; }

/* ================= 吊牌基座 =================
   一套标记，十二套版式靠 [data-template] 覆盖。每套只有五个色槽：
   底 --s / 文 --i / 强 --a / 次 --m / 线 --l，其余一律由这五个推算。
   零件在 DOM 里的顺序由版式的 front / back 清单决定，所以多数版式
   只要写内边距和对齐，不用逐个绝对定位。                                    */
.tag-stage {
  position: relative; overflow: hidden; flex: none;
  width: var(--tw,150px); min-height: var(--th,292px);
  background: var(--s); color: var(--i);
  --s: #f7f6f3; --i: #1a1a1a; --a: #1a1a1a; --m: #8e8b85; --l: #d8d5cf;
  --hx: 50%; --hy: 17px; --hr: 5px;
  --hole: radial-gradient(circle at var(--hx) var(--hy), transparent var(--hr), #000 calc(var(--hr) + .7px));
  -webkit-mask-image: var(--hole); mask-image: var(--hole);
  display: flex; flex-direction: column;
  font-size: 10px; line-height: 1.5; font-variant-numeric: tabular-nums;
  transform-origin: top left;
}
/* 洗水唛是缝在衣服里的织唛，本来就没有穿绳孔 */
.tag-stage[data-hole="off"] { -webkit-mask-image: none; mask-image: none; }
.tg-eyelet { position: absolute; left: var(--hx); top: var(--hy); transform: translate(-50%,-50%);
  width: calc(var(--hr) * 2 + 8px); height: calc(var(--hr) * 2 + 8px); border-radius: 50%; border: 1.5px solid var(--l); }
.tag-stage dl,.tag-stage dd,.tag-stage p { margin: 0; }
.tag-stage * { min-width: 0; overflow-wrap: anywhere; }
.tg-deco { position: absolute; inset: 0; pointer-events: none; }
.tg-deco > i { position: absolute; display: block; }

/* 商品图位：没上传时画一个带斜叉的占位框 */
.tg-ph { position: relative; flex: none; overflow: hidden; display: grid; place-items: center; }
.tg-ph.is-empty { border: 1px solid var(--l);
  background:
    linear-gradient(45deg,transparent calc(50% - .5px),color-mix(in srgb,var(--l) 62%,transparent) calc(50% - .5px) calc(50% + .5px),transparent calc(50% + .5px)),
    linear-gradient(-45deg,transparent calc(50% - .5px),color-mix(in srgb,var(--l) 62%,transparent) calc(50% - .5px) calc(50% + .5px),transparent calc(50% + .5px)); }
.tg-ph > span { font-size: 7px; letter-spacing: .14em; color: color-mix(in srgb, var(--i) 62%, var(--s)); background: var(--s); padding: 1px 4px; }
.tg-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 条码：EAN-13 的条纹由 JS 按位算好写进 --bars，这里只负责画 */
.tg-bar { flex: none; }
.tg-bar > i { display: block; height: 20px; }
.tg-bar svg { display: block; width: 100%; height: 100%; }
.tg-bar > span { display: block; margin-top: 3px; text-align: center; font: 400 6.5px/1 var(--lat-mono); letter-spacing: .2em; }

/* 洗涤符号：内联 SVG，颜色跟 currentColor，导出时不用处理外部资源 */
.tg-care { flex: none; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.tg-care svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.tg-kv { flex: none; display: grid; gap: 8px; }
.tg-kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tg-kv dt { flex: none; color: var(--m); font-size: 8px; }
.tg-kv dd { font-size: 9px; font-weight: 500; text-align: right; }
.tg-push { margin-top: auto; }

/* 台面：孔是真挖穿的，透出来的就是这块底 */
.preview-stage { background: repeating-conic-gradient(#cdcec9 0% 25%, #d7d8d3 0% 50%) 0 0/16px 16px; box-shadow: 0 10px 30px rgba(40,44,40,.18); }
.tag-stage { box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.tag-stage.is-exporting { box-shadow: none; }

/* ================= 01 极简买手店 ================= */
.tag-stage[data-template="mn"] { --tw:150px; --th:292px; --s:#f7f6f3; --i:#1a1a1a; --a:#1a1a1a; --m:#8e8b85; --l:#d8d5cf;
  --lat:"OC Archivo","OC Noto Sans SC",sans-serif; --lat-mono:"OC Spline Mono","OC Noto Sans SC",monospace;
  font-family: var(--lat); padding: 34px 15px 14px; align-items: center; text-align: center; }
.tag-stage[data-template="mn"] .tg-ph { width: 118px; height: 118px; margin-top: 6px; }
.tag-stage[data-template="mn"] .tg-brand { margin-top: 22px; font-size: 13.5px; font-weight: 500; letter-spacing: .4em; text-indent: .4em; }
.tag-stage[data-template="mn"] .tg-en::before { content: ""; display: block; width: 24px; height: 1px; margin: 13px auto; background: var(--l); }
.tag-stage[data-template="mn"] .tg-en { font: 400 7px/1 var(--lat-mono); letter-spacing: .34em; text-indent: .34em; color: var(--m); }
.tag-stage[data-template="mn"] .tg-sku { margin-top: auto; font: 400 7.5px/1 var(--lat-mono); letter-spacing: .12em; color: var(--m); }
.tag-stage[data-template="mn"] .tg-kv { width: 100%; margin-top: 24px; }
.tag-stage[data-template="mn"] .tg-kv dt { font-family: var(--lat-mono); font-size: 6.5px; letter-spacing: .12em; text-transform: uppercase; }
.tag-stage[data-template="mn"] .tg-bar { width: 100%; margin-top: auto; }

/* ================= 02 街头潮牌 ================= */
.tag-stage[data-template="st"] { --tw:165px; --th:278px; --s:#101010; --i:#f2f2f2; --a:#d8ff3e; --m:#7a7a7a; --l:#f2f2f2;
  --hx:26px; --hy:26px; --hr:7px;
  --lat:"OC Archivo","WDXL Lubrifont SC",sans-serif; --lat-mono:"OC Spline Mono","WDXL Lubrifont SC",monospace;
  font-family: var(--lat); padding: 46px 0 0;
  clip-path: polygon(0 0,100% 0,100% calc(100% - 20px),calc(100% - 20px) 100%,0 100%); }
.tag-stage[data-template="st"] .tg-ph { width: 100%; height: 102px; border-left: 0; border-right: 0; border-color: color-mix(in srgb,var(--l) 30%,transparent); }
.tag-stage[data-template="st"] .tg-big { margin: 10px 14px 0; font: 800 var(--big-size,46px)/.84 var(--lat); letter-spacing: -.035em; }
.tag-stage[data-template="st"] .tg-size { margin-top: 4px; text-align: center; }
.tag-stage[data-template="st"] .tg-size span { display: block; font: 600 7px/1 var(--lat); letter-spacing: .4em; text-indent: .4em; color: var(--m); }
.tag-stage[data-template="st"] .tg-size b { display: block; margin-top: 4px; font: 800 var(--size-size,76px)/.84 var(--lat); }
.tag-stage[data-template="st"] .tg-sub { margin: 7px 14px 0; font: 400 7.5px/1.7 var(--lat-mono); letter-spacing: .04em; color: var(--m); }
.tag-stage[data-template="st"] .tg-band { margin-top: auto; padding: 7px 14px 8px; background: var(--a); color: #101010;
  display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tag-stage[data-template="st"] .tg-band b { font: 400 10px/1.4 "WDXL Lubrifont SC",sans-serif; letter-spacing: .05em; }
.tag-stage[data-template="st"] .tg-band em { font: 700 7px/1 var(--lat); font-style: normal; letter-spacing: .16em; }
.tag-stage[data-template="st"] .tg-bar { margin-top: auto; padding: 9px 14px 10px; background: #f2f2f2; color: #101010; }

/* ================= 03 牛皮手作 ================= */
.tag-stage[data-template="kr"] { --tw:155px; --th:282px; --s:#c8ab7e; --i:#3d2f21; --a:#6f5035; --m:#645440; --l:#6b543c;
  --hy:22px; --hr:6px;
  --lat:"OC Meddon","Huiwen-ZhengKai",cursive; --lat-mono:"OC Spline Mono","Huiwen-ZhengKai",monospace;
  font-family: var(--lat); border-radius: 77px 77px 5px 5px; padding: 42px 16px 15px;
  align-items: center; text-align: center; }
.tag-stage[data-template="kr"] .tg-ph { width: 76px; height: 76px; border-radius: 50%; margin-top: 8px; }
.tag-stage[data-template="kr"] .tg-product { margin-top: 13px; font-size: 16px; line-height: 1.5; }
.tag-stage[data-template="kr"] .tg-note { margin-top: auto; font: 400 7.5px/1.7 var(--lat-mono); letter-spacing: .1em; color: var(--m); }
.tag-stage[data-template="kr"] .tg-stamp { margin-top: 6px; width: 64px; height: 64px; position: relative;
  border: 1.5px solid var(--l); border-radius: 50%; display: grid; place-items: center; }
.tag-stage[data-template="kr"] .tg-stamp::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--l); border-radius: 50%; opacity: .5; }
.tag-stage[data-template="kr"] .tg-stamp b { font: 400 15px/1 "Huiwen-ZhengKai",serif; letter-spacing: .1em; text-indent: .1em; }
.tag-stage[data-template="kr"] .tg-kv { width: 100%; margin-top: 12px; text-align: left; }
.tag-stage[data-template="kr"] .tg-kv > div { border-bottom: 1px dotted var(--l); padding-bottom: 3px; }
.tag-stage[data-template="kr"] .tg-price { margin-top: auto; font: 400 12px/1.5 var(--lat-mono); color: var(--m); }

/* ================= 04 烫金礼盒 ================= */
.tag-stage[data-template="lx"] { --tw:145px; --th:298px; --s:#1c2620; --i:#ece5d6; --a:#b8975a; --m:#7d8a80; --l:#b8975a;
  --hy:20px; --hr:4px;
  --lat:"OC Bodoni Moda","Xiangcui-W15",serif; --lat-mono:"OC Spline Mono","Xiangcui-W15",monospace;
  font-family: var(--lat); padding: 32px 11px 11px; }
.tag-stage[data-template="lx"] .tg-deco { inset: 32px 11px 11px; border: 1px solid var(--a); }
.tag-stage[data-template="lx"] .tg-deco::before { content: ""; position: absolute; inset: 2px; border: 1px solid color-mix(in srgb,var(--a) 55%,transparent); }
.tag-stage[data-template="lx"] .tg-deco > i { width: 4px; height: 4px; background: var(--a); transform: rotate(45deg); }
.tag-stage[data-template="lx"] .tg-deco > i:nth-child(1) { left: 5px; top: 5px; }
.tag-stage[data-template="lx"] .tg-deco > i:nth-child(2) { right: 5px; top: 5px; }
.tag-stage[data-template="lx"] .tg-deco > i:nth-child(3) { left: 5px; bottom: 5px; }
.tag-stage[data-template="lx"] .tg-deco > i:nth-child(4) { right: 5px; bottom: 5px; }
.tag-stage[data-template="lx"] > *:not(.tg-deco):not(.tg-eyelet) { margin-inline: 14px; align-self: center; text-align: center; }
.tag-stage[data-template="lx"] .tg-ph { width: 92px; height: 70px; margin-top: 19px; border-color: color-mix(in srgb,var(--a) 60%,transparent); }
.tag-stage[data-template="lx"] .tg-brand { margin-top: 18px; font: 400 17px/1 "Xiangcui-W15",serif; letter-spacing: .2em; text-indent: .2em; color: var(--a); }
.tag-stage[data-template="lx"] .tg-en::before { content: ""; display: block; width: 34px; height: 1px; margin: 11px auto; background: var(--a); opacity: .7; }
.tag-stage[data-template="lx"] .tg-en { font: 400 6.5px/1 var(--lat); letter-spacing: .3em; text-indent: .3em; color: var(--m); }
.tag-stage[data-template="lx"] .tg-sku { margin-top: auto; margin-bottom: 4px; font: 400 6.5px/1 var(--lat-mono); letter-spacing: .22em; color: var(--m); }
.tag-stage[data-template="lx"] .tg-kv { width: calc(100% - 28px); margin-top: 36px; gap: 0; }
.tag-stage[data-template="lx"] .tg-kv > div { display: block; padding: 7px 0; border-bottom: 1px solid color-mix(in srgb,var(--a) 32%,transparent); text-align: center; }
.tag-stage[data-template="lx"] .tg-kv dt { font: 400 6px/1 var(--lat-mono); letter-spacing: .22em; text-transform: uppercase; }
.tag-stage[data-template="lx"] .tg-kv dd { margin-top: 4px; font-size: 9.5px; text-align: center; }
.tag-stage[data-template="lx"] .tg-price { margin-top: auto; margin-bottom: 4px; font-size: 16px; color: var(--a); letter-spacing: .05em; }

/* ================= 05 日系杂货 ================= */
.tag-stage[data-template="jp"] { --tw:200px; --th:214px; --s:#fbfaf7; --i:#2b2b2b; --a:#918571; --m:#8d8a83; --l:#cfcac0;
  --hx:24px; --hy:20px; --hr:4.5px;
  --lat:"OC Archivo","Huiwen-mincho",sans-serif; --lat-mono:"OC Spline Mono","Huiwen-mincho",monospace;
  font-family: var(--lat); padding: 34px 57px 13px 15px; }
.tag-stage[data-template="jp"] .tg-brand { position: absolute; right: 15px; top: 34px; bottom: 13px;
  writing-mode: vertical-rl; padding-left: 9px; border-left: 1px solid var(--l);
  font: 400 11.5px/1 "Huiwen-mincho",serif; letter-spacing: .24em; }
.tag-stage[data-template="jp"] .tg-ph { width: 100%; height: 74px; }
.tag-stage[data-template="jp"] .tg-product { margin-top: 8px; font-size: 9.5px; line-height: 1.6; }
.tag-stage[data-template="jp"] .tg-price { margin-top: auto; font: 600 27px/1 var(--lat); letter-spacing: -.02em; }
.tag-stage[data-template="jp"] .tg-note { margin-top: 2px; font-size: 7.5px; color: var(--m); }
.tag-stage[data-template="jp"] .tg-kv { margin-top: 4px; gap: 6px; }
.tag-stage[data-template="jp"] .tg-kv > div { justify-content: flex-start; gap: 10px; }
.tag-stage[data-template="jp"] .tg-kv dd { text-align: left; }
.tag-stage[data-template="jp"] .tg-sku { margin-top: auto; padding-top: 6px; border-top: 1px dotted var(--l);
  font: 400 7px/1 var(--lat-mono); letter-spacing: .1em; color: var(--m); }

/* ================= 06 工业铭牌 ================= */
.tag-stage[data-template="id"] { --tw:300px; --th:160px; --s:#b9bcc0; --i:#1e2226; --a:#c8451f; --m:#5b6066; --l:#4a5058;
  --hx:21px; --hy:80px; --hr:6px;
  --lat:"OC Spline Mono","OC Noto Sans SC",monospace; --lat-mono:"OC Spline Mono","OC Noto Sans SC",monospace;
  font-family: var(--lat); padding: 8px 13px 0 40px; }
.tag-stage[data-template="id"] .tg-deco > i:nth-child(1) { left: 0; right: 0; top: 0; height: 8px;
  background: repeating-linear-gradient(45deg,var(--a) 0 6px,var(--i) 6px 12px); }
.tag-stage[data-template="id"] .tg-deco > i:nth-child(n+2) { width: 4px; height: 4px; border-radius: 50%; background: var(--l); opacity: .85; }
.tag-stage[data-template="id"] .tg-deco > i:nth-child(2) { left: 8px; top: 14px; }
.tag-stage[data-template="id"] .tg-deco > i:nth-child(3) { right: 8px; top: 16px; }
.tag-stage[data-template="id"] .tg-deco > i:nth-child(4) { left: 8px; bottom: 8px; }
.tag-stage[data-template="id"] .tg-deco > i:nth-child(5) { right: 8px; bottom: 8px; }
.tag-stage[data-template="id"] .tg-kv { flex: none; margin-top: 6px; margin-right: 104px; gap: 0;
  border: 1px solid var(--l); align-content: start; }
.tag-stage[data-template="id"] .tg-kv > div { display: grid; grid-template-columns: 56px minmax(0,1fr);
  align-items: stretch; border-bottom: 1px solid var(--l); gap: 0; }
.tag-stage[data-template="id"] .tg-kv > div:last-child { border-bottom: 0; }
.tag-stage[data-template="id"] .tg-kv dt { padding: 4px 7px; border-right: 1px solid var(--l); font-size: 8px; letter-spacing: .04em; }
.tag-stage[data-template="id"] .tg-kv dd { padding: 4px 7px; font-size: 8px; font-weight: 500; text-align: left;
  font-family: "OC Archivo","OC Noto Sans SC",sans-serif; }
.tag-stage[data-template="id"] .tg-ph { position: absolute; right: 13px; top: 20px; width: 82px; height: 48px; }
.tag-stage[data-template="id"] .tg-big { position: absolute; right: 13px; top: 76px; width: 82px; text-align: right; }
.tag-stage[data-template="id"] .tg-big::before { content: "MODEL"; display: block; font-size: 6.5px; letter-spacing: .2em; color: var(--m); }
.tag-stage[data-template="id"] .tg-big { font: 600 var(--big-size,15px)/1.5 var(--lat-mono); letter-spacing: -.02em; }
.tag-stage[data-template="id"] .tg-bar { position: absolute; right: 13px; top: 24px; width: 92px; }
.tag-stage[data-template="id"] .tg-note { margin-top: auto; padding: 5px 0 7px; border-top: 1px solid var(--l);
  display: flex; justify-content: space-between; gap: 8px; font-size: 6.5px; letter-spacing: .08em; color: var(--m); }

/* ================= 07 洗水唛 ================= */
.tag-stage[data-template="cw"] { --tw:92px; --th:250px; --s:#fdfdfb; --i:#33332f; --a:#33332f; --m:#8f8f88; --l:#c9c9c2;
  --lat:"OC Spline Mono","OC Noto Sans SC",monospace; --lat-mono:"OC Spline Mono","OC Noto Sans SC",monospace;
  font-family: var(--lat); padding: 17px 9px; align-items: center; text-align: center; }
.tag-stage[data-template="cw"] .tg-brand { font-size: 8px; font-weight: 600; letter-spacing: .26em; text-indent: .26em; }
.tag-stage[data-template="cw"] .tg-care { margin: 9px 0; padding: 9px 0; width: 100%; border-block: 1px solid var(--l); }
.tag-stage[data-template="cw"] .tg-sub { font-size: 7.5px; line-height: 1.9; }
.tag-stage[data-template="cw"] .tg-sub em { font-style: normal; color: var(--m); }
.tag-stage[data-template="cw"] .tg-note { margin-top: auto; font-size: 6.5px; letter-spacing: .12em; color: var(--m); }

/* ================= 08 复古百货 ================= */
.tag-stage[data-template="vt"] { --tw:160px; --th:302px; --s:#efe3cd; --i:#3a2b22; --a:#8f3b34; --m:#897963; --l:#a9906c;
  --hy:24px; --hr:6px;
  --lat:"OC Cormorant","Xiangcui-W40",serif; --lat-mono:"OC Spline Mono","Xiangcui-W40",monospace;
  font-family: var(--lat); padding: 42px 15px 14px; align-items: center; text-align: center; }
.tag-stage[data-template="vt"] .tg-deco { inset: 7px; border: 1px solid var(--l); }
.tag-stage[data-template="vt"] .tg-deco::before { content: ""; position: absolute; inset: 3px; border: 1px dotted var(--l); opacity: .75; }
.tag-stage[data-template="vt"] .tg-brand { font-size: 9px; letter-spacing: .26em; text-indent: .26em; color: var(--m); }
.tag-stage[data-template="vt"] .tg-ph { width: 108px; height: 76px; margin-top: 10px; }
.tag-stage[data-template="vt"] .tg-product { margin-top: 12px; font-size: 15.5px; line-height: 1.5; letter-spacing: .06em; }
.tag-stage[data-template="vt"] .tg-price { margin-top: 10px; font: 600 30px/1 var(--lat); letter-spacing: .02em; color: var(--a); }
.tag-stage[data-template="vt"] .tg-stamp { margin-top: auto; width: 44px; height: 44px; border: 1px solid var(--a); border-radius: 50%;
  display: grid; place-items: center; color: var(--a); font: 400 6px/1.4 var(--lat-mono); letter-spacing: .06em; }
.tag-stage[data-template="vt"] .tg-kv { width: 100%; margin-top: 16px; gap: 10px; text-align: left; }
.tag-stage[data-template="vt"] .tg-kv > div { border-bottom: 1px dotted var(--l); padding-bottom: 3px; }
.tag-stage[data-template="vt"] .tg-kv dt { font-size: 8.5px; }
.tag-stage[data-template="vt"] .tg-kv dd { font-size: 9px; }
.tag-stage[data-template="vt"] .tg-note { margin-top: auto; font-size: 7.5px; color: var(--m); line-height: 1.7; }

/* ================= 09 药房处方 ================= */
.tag-stage[data-template="ap"] { --tw:160px; --th:300px; --s:#f4f4ef; --i:#1f1f1f; --a:#b03a2e; --m:#77776f; --l:#1f1f1f;
  --hy:16px; --hr:4.5px;
  --lat:"OC Special Elite","OC Noto Sans SC",monospace; --lat-mono:"OC Spline Mono","OC Noto Sans SC",monospace;
  font-family: var(--lat); padding: 28px 0 0; }
.tag-stage[data-template="ap"] .tg-band { padding: 5px 12px 6px; background: var(--i); color: var(--s);
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tag-stage[data-template="ap"] .tg-band b { font: 700 9px/1.4 "OC Noto Sans SC",sans-serif; letter-spacing: .1em; }
.tag-stage[data-template="ap"] .tg-band em { font: 400 5.5px/1 var(--lat); font-style: normal; letter-spacing: .1em; opacity: .85; }
.tag-stage[data-template="ap"] .tg-ph { margin: 10px 12px 0; height: 64px; }
.tag-stage[data-template="ap"] .tg-product { padding: 9px 12px 8px; border-bottom: 2px solid var(--l);
  font: 700 12px/1.4 "OC Noto Sans SC",sans-serif; letter-spacing: .03em; }
.tag-stage[data-template="ap"] .tg-kv { gap: 0; }
.tag-stage[data-template="ap"] .tg-kv > div { display: grid; grid-template-columns: 58px minmax(0,1fr); align-items: stretch; gap: 0;
  padding: 5px 12px; border-bottom: 1px solid color-mix(in srgb,var(--l) 20%,transparent); }
.tag-stage[data-template="ap"] .tg-kv dt { font-size: 8.5px; letter-spacing: .04em; }
.tag-stage[data-template="ap"] .tg-kv dd { font-size: 8.5px; text-align: left; }
.tag-stage[data-template="ap"] .tg-care { margin: 12px 12px 0; }
.tag-stage[data-template="ap"] .tg-note { margin-top: auto; padding: 8px 12px 10px; border-top: 1px solid var(--l);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 8px;
  font: 400 6.5px/1.7 var(--lat-mono); letter-spacing: .06em; color: var(--m); text-align: left; }
.tag-stage[data-template="ap"] .tg-note::after { content: "!"; flex: none; width: 16px; height: 14px;
  color: var(--s); font: 700 7px/14px "OC Archivo",sans-serif; text-align: center;
  clip-path: polygon(50% 0,100% 100%,0 100%); background: var(--a); }
.tag-stage[data-template="ap"] .tg-bar { margin: auto 12px 10px; }

/* ================= 10 标本签 ================= */
.tag-stage[data-template="sp"] { --tw:300px; --th:172px; --s:#f2ece0; --i:#33302a; --a:#5c6b4f; --m:#8c8677; --l:#b9b2a1;
  --hx:18px; --hy:18px; --hr:4.5px;
  --lat:"OC Special Elite","Huiwen-Fangsong",monospace; --lat-mono:"OC Spline Mono","Huiwen-Fangsong",monospace;
  font-family: var(--lat); padding: 21px 24px 20px 42px; }
.tag-stage[data-template="sp"] .tg-deco { inset: 9px; border: 1px solid var(--l); }
.tag-stage[data-template="sp"] .tg-deco::before { content: ""; position: absolute; inset: 2px; border: 1px solid var(--l); }
.tag-stage[data-template="sp"] .tg-sku { position: absolute; left: 20px; top: 24px; writing-mode: vertical-rl;
  font: 400 7px/1 var(--lat-mono); letter-spacing: .18em; color: var(--m); }
.tag-stage[data-template="sp"] .tg-ph { position: absolute; left: 42px; top: 21px; bottom: 20px; width: 72px; }
.tag-stage[data-template="sp"] > *:not(.tg-deco):not(.tg-eyelet):not(.tg-sku):not(.tg-ph) { margin-left: 84px; }
.tag-stage[data-template="sp"] .tg-sci { font: italic 400 17px/1.2 "OC IM Fell","Huiwen-Fangsong",serif; color: var(--a); }
.tag-stage[data-template="sp"] .tg-product { margin-top: 3px; font-size: 10px; letter-spacing: .14em; }
.tag-stage[data-template="sp"] .tg-kv { margin-top: 10px; gap: 6px; }
.tag-stage[data-template="sp"] .tg-kv > div { justify-content: flex-start; gap: 8px; }
.tag-stage[data-template="sp"] .tg-kv dt { width: 40px; }
.tag-stage[data-template="sp"] .tg-kv dd { flex: 1; text-align: left; font-size: 8.5px; font-weight: 400;
  border-bottom: 1px dotted var(--l); padding-bottom: 2px; }
.tag-stage[data-template="sp"] .tg-note { margin-top: auto; text-align: right; font-size: 7px; color: var(--m); }
.tag-stage[data-template="sp"] .tg-kv { margin-bottom: 16px; }
.tag-stage[data-template="sp"][data-side="front"] .tg-note span::after { content: ""; display: inline-block; width: 76px; margin-left: 6px; border-bottom: 1px solid var(--l); }
.tag-stage[data-template="sp"] .tg-bar { margin-top: 10px; width: 120px; }

/* ================= 11 赛博机能 ================= */
.tag-stage[data-template="tc"] { --tw:158px; --th:300px; --s:#0a0e12; --i:#cfe0e8; --a:#63b8ae; --m:#6c7f88; --l:#2b3a42;
  --hy:18px; --hr:5px;
  --lat:"OC Spline Mono","OC Noto Sans SC",monospace; --lat-mono:"OC Spline Mono","OC Noto Sans SC",monospace;
  font-family: var(--lat); padding: 32px 13px 13px;
  clip-path: polygon(0 0,100% 0,100% 100%,17px 100%,0 calc(100% - 17px)); }
.tag-stage[data-template="tc"] .tg-deco > i:nth-child(1) { inset: 0;
  background: repeating-linear-gradient(180deg,rgba(255,255,255,.055) 0 1px,transparent 1px 3px); }
.tag-stage[data-template="tc"] .tg-band { margin-top: 6px; display: flex; gap: 3px; align-items: center; }
.tag-stage[data-template="tc"] .tg-band i { height: 5px; background: var(--a); flex: none; }
.tag-stage[data-template="tc"] .tg-band i:nth-child(1) { width: 16px; }
.tag-stage[data-template="tc"] .tg-band i:nth-child(2) { width: 5px; }
.tag-stage[data-template="tc"] .tg-band i:nth-child(3) { width: 9px; opacity: .5; }
.tag-stage[data-template="tc"] .tg-band em { margin-left: auto; font-style: normal; font-size: 6px; letter-spacing: .16em; color: var(--m); }
.tag-stage[data-template="tc"] .tg-ph { width: 100%; height: 84px; margin-top: 9px; border-color: var(--l); }
.tag-stage[data-template="tc"] .tg-big { margin-top: 12px; font: 600 var(--big-size,20px)/1.1 var(--lat-mono); letter-spacing: -.02em; }
.tag-stage[data-template="tc"] .tg-kv { margin-top: 9px; gap: 5px; }
.tag-stage[data-template="tc"] .tg-kv > div { justify-content: flex-start; gap: 6px; }
.tag-stage[data-template="tc"] .tg-kv dt { font-size: 7px; }
.tag-stage[data-template="tc"] .tg-kv dd { font-size: 7px; font-weight: 400; color: var(--a); text-align: left; }
.tag-stage[data-template="tc"] .tg-matrix { margin-top: auto; width: 52px; height: 52px; position: relative;
  background: conic-gradient(var(--i) 25%,transparent 0 50%,var(--i) 0 75%,transparent 0) 0 0/14px 14px,
              conic-gradient(transparent 25%,var(--i) 0 50%,transparent 0 75%,var(--i) 0) 3px 3px/8px 8px; }
.tag-stage[data-template="tc"] .tg-matrix i { position: absolute; width: 14px; height: 14px; border: 2.5px solid var(--i);
  background: var(--s); box-shadow: inset 0 0 0 2px var(--s),inset 0 0 0 4.5px var(--i); }
.tag-stage[data-template="tc"] .tg-matrix i:nth-child(1) { left: 0; top: 0; }
.tag-stage[data-template="tc"] .tg-matrix i:nth-child(2) { right: 0; top: 0; }
.tag-stage[data-template="tc"] .tg-matrix i:nth-child(3) { left: 0; bottom: 0; }
.tag-stage[data-template="tc"] .tg-bar { margin-top: auto; }

/* ================= 12 玩具糖果 ================= */
.tag-stage[data-template="ty"] { --tw:210px; --th:246px; --s:#fdf3e3; --i:#35281f; --a:#e2765c; --m:#d9b48b; --l:#35281f;
  --hy:20px; --hr:6px;
  --lat:"OC Archivo","OC Noto Sans SC",sans-serif; --lat-mono:"OC Spline Mono","OC Noto Sans SC",monospace;
  font-family: var(--lat); border-radius: 18px 18px 0 0; padding: 36px 17px 26px; align-items: center; text-align: center; }
.tag-stage[data-template="ty"] .tg-deco > i { color: var(--a); font-size: 10px; line-height: 1; }
.tag-stage[data-template="ty"] .tg-deco > i:nth-child(1) { left: 16px; top: 60px; }
.tag-stage[data-template="ty"] .tg-deco > i:nth-child(2) { right: 18px; top: 50px; }
.tag-stage[data-template="ty"] .tg-deco > i:nth-child(3) { right: 28px; bottom: 52px; }
.tag-stage[data-template="ty"] .tg-ph { width: 92px; height: 92px; border-radius: 50%; }
.tag-stage[data-template="ty"] .tg-ph.is-empty { border-width: 2px; }
.tag-stage[data-template="ty"] .tg-product { margin-top: 11px; font-size: 21px; font-weight: 900; line-height: 1.3; letter-spacing: .04em; }
.tag-stage[data-template="ty"] .tg-en { margin-top: 6px; font-size: 8.5px; opacity: .7; }
.tag-stage[data-template="ty"] .tg-note { margin-top: auto; border: 2px solid var(--i); border-radius: 999px;
  padding: 2px 11px; font: 800 9px/1.5 var(--lat); letter-spacing: .04em; }
.tag-stage[data-template="ty"] .tg-band { margin-top: 11px; display: flex; width: 100%; height: 8px; border-radius: 4px; overflow: hidden; }
.tag-stage[data-template="ty"] .tg-band i { flex: 1; }
.tag-stage[data-template="ty"] .tg-band i:nth-child(1) { background: var(--a); }
.tag-stage[data-template="ty"] .tg-band i:nth-child(2) { background: var(--m); }
.tag-stage[data-template="ty"] .tg-band i:nth-child(3) { background: var(--i); }
.tag-stage[data-template="ty"] .tg-kv { width: 100%; margin-top: 12px; gap: 9px; text-align: left; }
.tag-stage[data-template="ty"] .tg-kv dt { font-size: 8px; opacity: .6; }
.tag-stage[data-template="ty"] .tg-kv dd { font-size: 9px; font-weight: 700; }
.tag-stage[data-template="ty"] .tg-bar { width: 100%; margin-top: auto; }

/* ================= 裁切弹窗 ================= */
.crop-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; }
.crop-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(28,30,28,.72); backdrop-filter: blur(4px); cursor: default; }
.crop-dialog { position: relative; width: min(720px,100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 18px; border-radius: 14px; background: var(--ui-card); box-shadow: 0 24px 90px rgba(0,0,0,.4); }
.crop-dialog header,.crop-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.crop-dialog header small { color: var(--ui-accent); font: 800 9px/1 var(--font-mono); letter-spacing: .12em; }
.crop-dialog h2 { margin: 4px 0 0; font-family: var(--font-serif); font-size: 18px; }
.crop-dialog > p { margin: 10px 0 14px; color: var(--ui-muted); font-size: 12px; line-height: 1.6; }
.crop-stage { position: relative; display: grid; place-items: center; min-height: 180px; overflow: hidden; border: 1px solid var(--ui-line-strong); border-radius: 10px; background: #23262a; }
.crop-stage canvas { display: block; width: 100%; max-height: min(56dvh,560px); object-fit: contain; cursor: grab; touch-action: none; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-stage > span { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 5px 8px; border-radius: 999px; background: rgba(22,24,22,.72); color: #fff; font-size: 10px; pointer-events: none; }
.crop-zoom { display: grid; grid-template-columns: 108px 1fr; align-items: center; gap: 12px; margin: 14px 0; font-size: 11px; font-weight: 750; }
.crop-zoom output { display: block; margin-top: 4px; color: var(--ui-accent); font: 800 10px/1 var(--font-mono); }
.crop-zoom input { width: 100%; accent-color: var(--ui-accent); }
.crop-dialog footer { justify-content: flex-end; }
body.crop-modal-open { overflow: hidden; }

.mobile-resizer,.mobile-main-tabs { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 140; max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 6px; background: var(--ui-accent-dark); color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%,16px); transition: .16s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width:900px) {
  :root { --topbar-height:62px; }
  .topbar { gap:8px; padding:0 10px; }
  .brand { min-width:44px; }
  .brand-copy,.project-field,.desktop-action { display:none; }
  .brand-mark { width:40px; height:40px; }
  .top-actions { width:calc(100% - 50px); justify-content:flex-end; gap:6px; }
  .top-actions .button { min-height:40px; padding:0 12px; }
  .workspace { --mobile-preview-height:42%; height:auto; min-height:0; grid-template-columns:1fr; grid-template-rows:var(--mobile-preview-height) 20px 48px minmax(0,1fr); grid-template-areas:"preview" "resizer" "tabs" "panel"; }
  .preview-panel { grid-area:preview; grid-template-rows:42px minmax(0,1fr); border-bottom:0; }
  .preview-toolbar { padding:0 8px; }
  .preview-viewport { overflow:auto; }
  .preview-stage { margin:16px auto; }
  .mobile-resizer { grid-area:resizer; display:grid; place-items:center; border-top:1px solid var(--ui-line); border-bottom:1px solid var(--ui-line); background:#eff0ec; cursor:row-resize; touch-action:none; user-select:none; z-index:12; }
  .mobile-resizer span { width:112px; height:5px; border-radius:4px; background:var(--ui-line-strong); pointer-events:none; }
  .mobile-main-tabs { grid-area:tabs; display:grid; grid-template-columns:1fr 1fr; border-top:1px solid var(--ui-line); border-bottom:1px solid var(--ui-line); background:#f6f6f3; z-index:14; }
  .mobile-main-tabs button { border:0; border-right:1px solid var(--ui-line); background:transparent; font-size:13px; font-weight:850; }
  .mobile-main-tabs button:last-child { border-right:0; }
  .mobile-main-tabs button.active { background:var(--ui-accent-soft); box-shadow:inset 0 -3px var(--ui-accent); }
  .editor-panel { grid-area:panel; min-height:0; border:0; display:grid; grid-template-rows:minmax(0,1fr); }
  .panel-heading { display:none; }
  .panel-scroll { padding:12px 10px calc(20px + env(safe-area-inset-bottom)); scrollbar-gutter:auto; }
  body[data-active-mobile-panel="content"] .style-panel,body[data-active-mobile-panel="style"] .content-panel { display:none; }
  .editor-card { padding:13px; }
  .field input,.field select { min-height:42px; }
  .toast { bottom:calc(20px + env(safe-area-inset-bottom)); }
}
@media (max-width:600px) {
  .crop-dialog { padding:14px; }
  .crop-stage canvas { max-height:50dvh; }
  .crop-zoom { grid-template-columns:1fr; gap:6px; }
}
@media (max-width:520px) {
  .top-actions .button { padding-inline:9px; font-size:12px; }
  .field-grid { grid-template-columns:1fr; gap:0; }
  .color-grid,.style-grid,.check-row,.export-grid { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition-duration:.01s !important; animation-duration:.01s !important; scroll-behavior:auto !important; } }

/* ================= 贴纸 =================
   自由摆放的一层，压在版式零件之上。位置用画面百分比存，尺寸用逻辑像素存，
   所以换版式（尺寸不同）时贴纸仍落在相对位置上，不会跑到画面外。 */
.sticker-layer { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.canvas-sticker { position: absolute; left: var(--x); top: var(--y); width: var(--w); min-height: var(--h);
  transform: translate(-50%,-50%) rotate(var(--r)); display: grid; pointer-events: auto; cursor: grab; touch-action: none; }
.canvas-sticker.is-locked { cursor: default; }
.canvas-sticker.is-hidden { display: none; }
.canvas-sticker.is-selected { outline: 1.5px dashed var(--ui-accent); outline-offset: 2px; }
.sticker-body { width: 100%; min-height: 100%; display: flex; align-items: center; overflow: hidden;
  box-sizing: border-box; word-break: break-word; }
.sticker-body img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sticker-body.fit-cover img { object-fit: cover; }
.sticker-body.fit-stretch img { object-fit: fill; }
.sticker-font-sans { font-family: var(--lat); }
.sticker-font-serif { font-family: "OC Noto Serif SC","Songti SC",serif; }
.sticker-font-mono { font-family: var(--lat-mono); }
.sticker-handle { position: absolute; width: 14px; height: 14px; border: 2px solid var(--ui-accent);
  border-radius: 50%; background: #fff; opacity: 0; pointer-events: none; touch-action: none; }
.canvas-sticker.is-selected .sticker-handle { opacity: 1; pointer-events: auto; }
.canvas-sticker.is-locked .sticker-handle { display: none; }
.resize-handle { right: -9px; bottom: -9px; cursor: nwse-resize; }
.rotate-handle { left: 50%; top: -24px; margin-left: -7px; cursor: grab; }
.rotate-handle::after { content: ""; position: absolute; left: 5px; top: 12px; width: 2px; height: 12px; background: var(--ui-accent); }
/* 导出时牌面是成品：选中描边、手柄一律不出现 */
.tag-stage.is-exporting .canvas-sticker { outline: 0 !important; }
.tag-stage.is-exporting .sticker-handle { display: none !important; }

.preset-sticker-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 10px; }
.preset-sticker-grid button { min-height: 32px; padding: 0 6px; border: 1px solid var(--ui-line); border-radius: 5px;
  background: #fff; cursor: pointer; font-size: 11px; font-weight: 700; }
.preset-sticker-grid button:hover { border-color: var(--ui-accent); }
.sticker-list { display: grid; gap: 6px; }
.sticker-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px;
  padding: 7px 9px; border: 1px solid var(--ui-line); border-radius: 5px; background: #fff; cursor: grab; }
.sticker-row.active { border-color: var(--ui-accent); background: var(--ui-accent-soft); }
.sticker-row b { display: block; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sticker-row small { display: block; margin-top: 2px; color: var(--ui-muted); font-size: 10px; }
.sticker-row-actions { display: flex; gap: 4px; }
.sticker-row-actions button { width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--ui-line); border-radius: 4px; background: #fff; cursor: pointer; font-size: 11px; }
.sticker-row-actions button.on { border-color: var(--ui-accent); color: var(--ui-accent-dark); }
.sticker-editor-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 10px; }
.empty-note { margin: 4px 0; color: var(--ui-muted); font-size: 11px; }
