:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --ink: #252331;
  color: var(--ink);
  background: #f6f6f9;
  --accent: #55437d;
  --muted: #625e70;
  --line: #dfdde7;
  --accent-soft: #eeebf8;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, select, input[type=checkbox], input[type=color], summary { cursor: pointer; }
button { background: white; border: 1px solid var(--line); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid #6552a5; outline-offset: 2px; }
button:disabled { opacity: .55; cursor: default; }
[hidden] { display: none !important; }
.wrap { width: min(1460px, 100%); margin: auto; padding: 0 clamp(16px, 3.1vw, 52px); }
.usage-notice { padding: 22px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.7; }
.usage-notice h2 { color: var(--ink); font-size: 14px; margin-bottom: 6px; }
.usage-notice strong { color: #79473e; }
.masthead { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 13px; align-items: center; min-height: 68px; }
.brand-mark { display: grid; place-items: center; flex: none; width: 36px; height: 36px; background: #994535; border-radius: 7px 4px; border: 2px solid #994535; box-shadow: inset 0 0 0 1px #f9e6d8; color: #fff8ed; font: bold 24px/1 "SimSun","Songti SC",serif; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: 21px; font-weight: 650; letter-spacing: .025em; }
h2 { font-size: 18px; line-height: 1.35; font-weight: 650; }
h3 { font-size: 15px; }
.templates { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 14px 24px; padding: 18px 20px; margin: 0 0 18px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.template-heading { min-width: 0; }
.template-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 0; }
.template-groups button { border: 1px solid transparent; background: transparent; padding: 5px 12px; border-radius: 18px; color: var(--muted); font-size: 13px; }
.template-groups button:hover { color: var(--accent); background: var(--accent-soft); }
.template-groups button[aria-pressed=true] { background: var(--accent); color: white; }
#template-picker { display: none; }
.template-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.template { display: flex; align-items: center; justify-content: flex-start; min-width: 0; gap: 11px; padding: 6px 12px; min-height: 49px; border-radius: 8px; font-size: 14px; }
.template canvas { width: 40px; height: 40px; pointer-events: none; flex: none; }
@media(min-width:1180px) {
  .template-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
}
.template:hover { border-color: #a49ac4; }
.tool-switch { display:flex; flex-wrap:wrap; gap:3px; padding:4px; margin:20px 0 14px; border:1px solid #dedce7; border-radius:10px; background:#ecebf2; width:fit-content; max-width:100%; }
.tool-switch button { padding:9px 18px; border:1px solid transparent; border-radius:6px; background:transparent; color:#514b63; font-size:14px; }
.tool-switch [aria-pressed=true] { background:white; border-color:#d8d3e6; color:#453575; font-weight:650; box-shadow:0 1px 3px #30245514; }
.batch-workspace { display:grid; grid-template-columns:minmax(270px,340px) minmax(0,1fr); gap:18px; align-items:start; padding-bottom:35px; }
.batch-controls { display:grid; gap:12px; padding:16px 19px 20px; }
.batch-stamp { display:flex; align-items:center; gap:10px; }
.batch-stamp canvas { width:46px; height:46px; flex:none; }
.batch-stamp span { color:var(--muted); font-size:12px; }
.batch-stamp strong { display:block; margin-top:3px; font-size:14px; color:#282634; }
.batch-stamp button { margin-left:auto; }
.file-drop { display:grid; gap:3px; justify-items:center; padding:15px; background:#faf9fd; border:1px dashed #a59abb; border-radius:7px; color:var(--accent); }
.file-drop strong { font-size:15px; }
.file-drop span,.batch-caption,.batch-local { font-size:12px; color:var(--muted); line-height:1.6; }
.file-drop:hover,.file-drop.dragging { background:var(--accent-soft); border-color:var(--accent); }
.batch-queue { display:grid; gap:4px; max-height:205px; overflow:auto; }
.batch-queue:empty { display:none; }
.batch-file { display:grid; grid-template-columns:minmax(0,1fr) 30px; gap:3px; }
.batch-file button { padding:6px; border-radius:4px; font-size:13px; }
.batch-file button:first-child { text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.batch-file [aria-pressed=true] { color:var(--accent); background:var(--accent-soft); border-color:#afa2ce; }
.batch-file small { grid-column:1/-1; color:#903c33; font-size:12px; }
.batch-options { display:grid; gap:8px; border-top:1px solid var(--line); padding-top:12px; }
.batch-options .field { display:grid; grid-template-columns:1fr auto; align-items:center; font-size:13px; }
.batch-options .field input,.batch-options .field select { grid-column:1/-1; }
.batch-options .field input { height:20px; }
.batch-options output { color:var(--muted); font:12px Consolas,monospace; }
.batch-angle span { display:inline-flex; align-items:center; gap:3px; color:var(--muted); }
.batch-options .batch-angle input[type=number] { width:5em; height:27px; border:1px solid var(--line); border-radius:4px; text-align:center; }
.batch-options .check { padding:7px 0 2px; font-weight:600; }
.batch-seam-options { display:grid; gap:8px; padding:10px; background:#f7f5fb; border-radius:5px; }
.batch-message { color:var(--accent); font-size:13px; overflow-wrap:anywhere; }
.batch-message:empty { display:none; }
.batch-pages { display:flex; gap:10px; align-items:center; font-size:13px; }
.batch-pages button { width:30px; height:28px; border-radius:4px; }
.batch-pages button:disabled { opacity:.4; cursor:default; }
.batch-stage { display:grid; place-items:center; min-height:330px; padding:15px; background:#eeedf2; overflow:hidden; }
.batch-stage p { color:var(--muted); font-size:14px; }
#batch-preview { display:block; max-width:100%; max-height:70vh; width:auto; height:auto; background:white; box-shadow:0 1px 6px #30245533; touch-action:none; cursor:crosshair; }
.batch-caption { padding:11px 16px; }
@media(max-width:740px) {
  .tool-switch { display:grid; width:100%; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tool-switch button { padding:7px 2px; font-size:13px; }
  .batch-workspace { grid-template-columns:minmax(0,1fr); gap:12px; }
  .batch-controls { gap:9px; }
  .batch-stage { min-height:220px; padding:9px; }
}
.template[aria-pressed=true] { border-color: var(--accent); color: #453575; background: var(--accent-soft); box-shadow: inset 0 0 0 .5px var(--accent); font-weight: 650; }
.workspace { display: grid; grid-template-columns: minmax(285px, .83fr) minmax(0,2fr); gap: 18px; align-items: start; padding-bottom: 35px; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 6px #231e3906; }
.panel-heading { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); min-height: 62px; }
.readout { padding: 3px 8px; border-radius: 5px; background: #f3f2f7; color: var(--muted); white-space: nowrap; font: 12px/1.5 Consolas, monospace; }
.preview { position: sticky; top: 12px; }
.stage { margin: 18px 18px 0; border: 1px solid #e3e2ea; border-radius: 8px; background: radial-gradient(circle,#d9d5e2 .8px,transparent .9px) 0 0 / 10px 10px #f7f6fa; min-height: 245px; height: clamp(245px,calc(100vh - 615px),330px); display: grid; place-items: center; padding: 14px; }
.stage.checker { background-color: white; background-image: conic-gradient(#efeff2 25%, transparent 0 50%, #efeff2 0 75%, transparent 0); background-size: 16px 16px; }
.stage canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; min-width: 0; min-height: 0; }
.preview-tools { display: flex; align-items: center; justify-content: space-between; padding: 11px 19px 17px; gap: 6px; color: var(--muted); font-size: 12px; }
.preview-tools label,.check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
input[type=checkbox] { margin: 0; width: 15px; height: 15px; accent-color: var(--accent); }
.actions { padding: 16px 18px 18px; border-top: 1px solid var(--line); }
.mode-group { display: flex; padding: 3px; border-radius: 5px; background: #f1eff6; margin-bottom: 10px; gap: 3px; }
.mode-group button { flex: 1; border: 1px solid transparent; border-radius: 4px; background: transparent; padding: 7px 3px; font-size: 13px; }
.mode-group button[aria-pressed=true] { color: var(--accent); font-weight: bold; background: white; border-color: #d9d5e8; }
.download,.confirm { color: #fff; background: var(--accent); border-color: var(--accent); }
.download { width: 100%; padding: 11px; font-size: 14px; font-weight: 650; border-radius: 4px; }
.download:hover,.confirm:hover { background: #463879; }
.status { display: block; text-align: center; font-size: 12px; color: var(--accent); line-height: 1.6; }
.status:not(:empty) { margin-top: 8px; }
[data-feedback] {
  --feedback-ink: #403b51;
  --feedback-fill: #f3f2f7;
  --feedback-line: #c6c2d2;
  --feedback-symbol: "i";
}
[data-feedback="success"] {
  --feedback-ink: #126239;
  --feedback-fill: #eaf7ee;
  --feedback-line: #72b88b;
  --feedback-symbol: "✓";
}
[data-feedback="error"] {
  --feedback-ink: #982d2b;
  --feedback-fill: #fff0ef;
  --feedback-line: #dc8e87;
  --feedback-symbol: "!";
}
[data-feedback]:not(:empty) {
  display: block;
  padding: 9px 12px;
  border: 1px solid var(--feedback-line);
  border-inline-start: 4px solid var(--feedback-ink);
  border-radius: 7px;
  background: var(--feedback-fill);
  color: var(--feedback-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  text-align: start;
  overflow-wrap: anywhere;
}
[data-feedback]:not(:empty)::before {
  content: var(--feedback-symbol) / "";
  display: inline-grid;
  place-items: center;
  inline-size: 1.15em;
  block-size: 1.15em;
  margin-inline-end: .45em;
  border-radius: 50%;
  background: var(--feedback-ink);
  color: white;
  font: bold .9em/1 system-ui, sans-serif;
}
.feedback-tag[data-feedback]:not(:empty) {
  display: inline-block;
  padding: 2px 7px;
  border-width: 1px;
  border-radius: 5px;
  font-size: 12px;
}
.text-button { border: 0; padding: 4px 0 4px 8px; color: var(--accent); font-size: 13px; }
.text-button:hover { text-decoration: underline; }
.layers { padding: 0 20px; }
.frame-select { max-width: 280px; margin: 16px 0; }
.layer { padding: 13px 0; border-bottom: 1px solid #e9e8ee; }
.layer:last-child { border-bottom: 0; }
.layer-main { display: grid; grid-template-columns: minmax(140px,2.1fr) minmax(90px,1fr) minmax(90px,.9fr) minmax(60px,.7fr) auto; align-items: end; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field>span:first-child,.sub-field-label { font-size: 12px; line-height: 1.4; color: var(--muted); }
.text-field>span:first-child { font-size: 13px; color: #282634; font-weight: 650; }
input[type=text],select,.stepper,.color-control { width: 100%; background: #fff; height: 34px; border: 1px solid #d2d0dc; border-radius: 4px; font-size: 13px; }
input[type=text],select { padding: 0 8px; }
.field:focus-within > span:first-child { color: var(--accent); }
input[type=text]::placeholder { color: #757180; font-size: 12px; }
.stepper { display: flex; align-items: stretch; overflow: hidden; }
.stepper button { flex: 0 0 22px; border: 0; background: #f7f6fa; font-family: Arial,sans-serif; font-size: 14px; padding: 0; }
.stepper button:hover { background: #ebe8f3; }
.stepper input { width: 100%; min-width: 0; padding: 0 1px; text-align: center; border: 0; background: transparent; font: 13px Consolas,monospace; appearance: textfield; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button,.stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.more { color: var(--accent); font-size: 12px; border: 0; padding: 0 2px; min-height: 34px; }
.more[aria-expanded=true] { font-weight: bold; }
.fine-options,.inline-fields,.common-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.fine-options { margin-top: 10px; padding: 10px 12px; background: #f7f6fa; border-radius: 4px; }
.fine-options .field,.inline-fields .field { width: 87px; }
.appearance { padding: 16px 20px; border-top: 1px solid var(--line); }
.appearance h3 { margin-bottom: 12px; }
.common-controls { margin-bottom: 12px; gap: 14px; }
.color-control { display: inline-flex; align-items: center; gap: 7px; width: auto; padding: 4px 8px 4px 4px; }
#ink { width: 27px; height: 25px; padding: 0; border: 0; background: transparent; }
#ink::-webkit-color-swatch-wrapper { padding: 1px; }
#ink::-webkit-color-swatch { border-radius: 2px; border: 0; }
#hex { font: 12px Consolas,monospace; }
#size { width: auto; min-width: 126px; }
.effect { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 11px 0; border-top: 1px solid #e8e7ee; }
.effect:last-child { padding-bottom: 2px; }
.check { font-size: 13px; }
.inline-fields .range-field { width: 110px; }
input[type=range] { width: 100%; height: 32px; margin: 0; accent-color: var(--accent); }
dialog { width: min(360px,90vw); border: 1px solid var(--line); border-radius: 8px; color: inherit; padding: 22px; }
dialog::backdrop { background: #211b3b59; }
dialog p { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 12px 0 20px; }
#reset-dialog form { display: flex; justify-content: flex-end; gap: 8px; }
dialog button { padding: 7px 16px; border-radius: 4px; }
@media(max-width:1120px) {
  .workspace { grid-template-columns: minmax(275px,.8fr) minmax(0,1.7fr); gap: 12px; }
  .layer-main { grid-template-columns: minmax(118px,1.6fr) minmax(58px,.8fr) minmax(86px,.75fr) minmax(54px,.6fr) auto; gap: 6px; }
  .stepper { height: 40px; }
  .stepper button { flex-basis: 28px; }
  .template { gap: 6px; padding: 5px 7px; }
  .panel-heading,.appearance { padding-left: 15px; padding-right: 15px; }
  .layers { padding: 0 15px; }
}
@media(max-width:850px) {
  .template-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .workspace { grid-template-columns: minmax(225px,.65fr) minmax(0,1.35fr); }
  .layer-main { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .text-field { grid-column: 1 / 3; }
  .layer-main .more { grid-column: 3; grid-row: 1; text-align: right; }
  .stage { margin: 12px 12px 0; height: 235px; min-height: 0; padding: 10px; }
}
@media(max-width:650px) {
  .layer-main > .field:has(.stepper) { min-width: 83px; }
  .wrap { padding: 0 12px; }
  .brand { min-height: 54px; gap: 9px; }
  h1 { font-size: 18px; }
  .brand-mark { width: 28px; height: 28px; font-size: 21px; }
  h2 { font-size: 16px; }
  .templates { display: block; padding: 12px; margin-bottom: 12px; }
  .tool-switch { margin: 12px 0; }
  .template-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
  .template-groups { flex-wrap: nowrap; overflow-x: auto; padding: 3px; gap: 2px; margin-bottom: 6px; }
  .template-groups button { flex: none; padding: 4px 9px; font-size: 12px; }
  .templates h2 { margin: 0; }
  #template-picker { display: block; width: auto; max-width: 59%; height: 30px; }
  .template-grid { grid-auto-flow: column; grid-template-rows: repeat(2,auto); grid-template-columns: none; grid-auto-columns: 127px; overflow-x: auto; padding: 1px 1px 7px; scroll-snap-type: x proximity; gap: 5px; }
  .template { scroll-snap-align: start; min-height: 37px; font-size: 12px; }
  .template canvas { width: 27px; height: 27px; }
  .workspace { display: flex; flex-direction: column; gap: 12px; }
  .panel { width: 100%; }
  .preview { position: static; }
  .panel-heading { min-height: 44px; padding: 11px 14px; }
  .stage { height: 218px; margin: 10px 12px 0; }
  .preview-tools { padding: 8px 14px; }
  .actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .mode-group { flex: 1.25; margin: 0; }
  .mode-group button { font-size: 12px; }
  .download { flex: 1; width: auto; font-size: 13px; padding: 8px; }
  .status:not(:empty) { width: 100%; margin: 0; }
  .layer-main { grid-template-columns: 1fr .9fr .8fr; gap: 7px; }
  .appearance { padding-bottom: 16px; }
}
