

:root {
  --black: #111111;
  --white: #ffffff;
  --soft: #f6f6f6;
  --line: #dedede;
  --muted: #666666;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--white); color: var(--black); }
body { font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-shell { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: 100vh; background: var(--white); }

.control-panel {
  height: 100vh;
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: #c7c7c7 transparent;
}

.brand-block { min-height: 160px; padding: 22px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.brand-identity { width: 100%; }
.brand-logo { display: block; width: 100%; height: auto; }
.xiaohongshu-link { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin-top: 15px; color: var(--black); font-size: 12px; line-height: 1.45; text-align: center; text-decoration: none; }
.xiaohongshu-link:hover { opacity: .72; text-decoration: none; }
.xiaohongshu-icon { flex: 0 0 auto; display: block; width: 28px; height: 28px; border-radius: 7px; }

.upload-button { margin: 22px 28px 12px; width: calc(100% - 56px); border: 1px solid var(--black); border-radius: 6px; background: var(--black); color: var(--white); padding: 13px 16px; cursor: pointer; font-size: 14px; font-weight: 600; transition: background .15s ease, color .15s ease; }
.upload-button:hover { background: var(--white); color: var(--black); }
.upload-button span { font-size: 18px; vertical-align: -1px; margin-right: 5px; }
.file-meta { margin: 0 28px 20px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.file-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta b { font-weight: 400; white-space: nowrap; }

.control-section, .export-section { padding: 24px 28px 26px; border-top: 1px solid var(--line); }
.section-title { margin-bottom: 20px; }
.section-title h2 { margin: 0; font-size: 17px; line-height: 1.2; font-weight: 700; }

.slider-field { display: block; margin: 18px 0; }
.slider-field > span { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 14px; }
.slider-field b { font-weight: 500; }
.slider-field output { color: var(--muted); font-family: var(--font-geist-mono), monospace; font-size: 12px; font-weight: 500; }
input[type="range"] { appearance: none; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: #bdbdbd; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border: 2px solid var(--black); border-radius: 50%; background: var(--white); }

.select-field { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 12px; margin: 14px 0; font-size: 14px; }
.select-field select { min-width: 0; width: 100%; padding: 10px 32px 10px 11px; border: 1px solid #c9c9c9; border-radius: 5px; background: var(--white); font-size: 13px; }
.palette-row { display: flex; height: 34px; border: 1px solid var(--line); border-radius: 5px 5px 0 0; overflow: hidden; margin: 9px 0 0; }
.palette-row label { flex: 1; position: relative; cursor: pointer; }
.palette-row label + label { border-left: 1px solid rgba(0,0,0,.18); }
.palette-row input { opacity: 0; position: absolute; inset: 0; width: 100%; cursor: pointer; }
.shuffle-button { width: 100%; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 5px 5px; background: var(--white); padding: 10px; cursor: pointer; font-size: 12px; }
.shuffle-button:hover { border-color: var(--black); background: var(--soft); }
.check-field { display: flex; align-items: center; gap: 10px; margin: 17px 0; font-size: 14px; cursor: pointer; }
.check-field input { appearance: none; width: 17px; height: 17px; border: 1px solid var(--black); border-radius: 3px; display: grid; place-items: center; }
.check-field input:checked::after { content: ""; width: 9px; height: 9px; border-radius: 1px; background: var(--black); }
.color-field { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; font-size: 14px; }
.color-field input[type="color"] { appearance: none; -webkit-appearance: none; width: 48px; height: 32px; overflow: hidden; border: 1px solid #c9c9c9; border-radius: 4px; padding: 0; background: transparent; cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; }
.color-field input[type="color"]::-moz-color-swatch { border: 0; }

.segmented { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--black); border-radius: 5px; overflow: hidden; margin-bottom: 16px; }
.segmented button { border: 0; border-right: 1px solid var(--black); background: var(--white); padding: 10px; font-family: var(--font-geist-mono), monospace; font-size: 12px; font-weight: 600; cursor: pointer; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--black); color: var(--white); }
.export-button { width: 100%; display: flex; justify-content: space-between; border: 1px solid var(--black); border-radius: 6px; background: var(--black); color: var(--white); padding: 14px 16px; cursor: pointer; font-size: 14px; font-weight: 600; }
.export-button:hover { background: #303030; }
.export-section > p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 12px 0 0; }

.workspace { min-width: 0; height: 100vh; display: grid; grid-template-rows: 68px minmax(0, 1fr) 42px; background: var(--white); }
.workspace-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 26px; border-bottom: 1px solid var(--line); background: var(--white); font-size: 13px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--black); margin-right: 9px; }
.workspace-actions { display: flex; gap: 8px; }
.workspace-actions button { border: 1px solid #c9c9c9; border-radius: 5px; background: var(--white); padding: 9px 12px; cursor: pointer; font-size: 13px; }
.workspace-actions button:hover { border-color: var(--black); background: var(--soft); }
.workspace-actions .compare-button { border-color: var(--black); background: var(--black); color: var(--white); }
.workspace-actions .compare-button:hover { background: #303030; }

.canvas-area { min-height: 0; position: relative; display: grid; place-items: center; padding: 34px 42px 46px; overflow: hidden; background: var(--white); }
.canvas-area.is-dragging { background: var(--soft); }
.canvas-area.is-dragging::after { content: ""; position: absolute; inset: 20px; border: 2px dashed var(--black); border-radius: 8px; pointer-events: none; }
.canvas-stage { position: relative; display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.canvas-stage canvas { display: block; max-width: min(100%, 940px); max-height: calc(100vh - 190px); width: auto; height: auto; border: 1px solid #e2e2e2; background: var(--white); }
.canvas-stage .original { position: absolute; inset: 0; opacity: 0; transition: opacity .12s ease; pointer-events: none; }
.canvas-stage .original.visible { opacity: 1; }
.drop-message { position: absolute; inset: 20px; border: 2px dashed var(--white); border-radius: 6px; background: rgba(17,17,17,.9); color: var(--white); display: grid; place-content: center; text-align: center; z-index: 3; }
.drop-message b { font-size: 23px; margin-bottom: 10px; }
.drop-message span { font-size: 13px; }
.drop-hint { position: absolute; bottom: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.workspace-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 22px; border-top: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 330px minmax(0, 1fr); }
  .control-section, .export-section { padding-inline: 22px; }
  .upload-button { margin-inline: 22px; width: calc(100% - 44px); }
  .file-meta { margin-inline: 22px; }
  .canvas-area { padding-inline: 28px; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .control-panel { height: auto; border-right: 0; }
  .brand-block { min-height: 94px; position: sticky; top: 0; z-index: 5; background: var(--white); }
  .workspace { height: auto; min-height: 720px; grid-template-rows: auto minmax(620px, 72vh) 42px; }
  .workspace-bar { min-height: 68px; position: sticky; top: 0; z-index: 4; padding-inline: 16px; }
  .workspace-bar > div:first-child { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .canvas-stage canvas { max-height: 62vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.brand-caption{display:flex;justify-content:space-between;font-size:11px;margin-top:18px;color:#666}.brand-caption span:last-child{font-family:monospace;font-size:10px;letter-spacing:.7px}.brand-block{min-height:160px}.source-section{padding:22px 28px 20px}.upload-button{display:block;text-align:center;margin:0;width:100%}.upload-button input{display:none}.upload-button.over{background:#fff;color:#111}.file-meta{margin:12px 0 0;font-size:11px}.text-btn{border:0;background:none;padding:0;font-size:11px;cursor:pointer;color:#666}.text-btn:hover{color:#111;text-decoration:underline}.section-title{display:flex;justify-content:space-between;align-items:center}.presets{display:grid;grid-template-columns:repeat(3,1fr);margin-bottom:16px;border:1px solid #111;border-radius:5px;overflow:hidden}.presets button{background:#fff;border:0;border-right:1px solid #111;padding:10px 3px;font-size:12px;cursor:pointer}.presets button:last-child{border:0}.presets button.active{background:#111;color:#fff}.colors{display:flex;gap:0}.colors label{flex:1;min-width:0}.colors input{width:100%;height:35px;border:0;background:none;padding:0;cursor:pointer}.colors input::-webkit-color-swatch-wrapper{padding:0}.colors input::-webkit-color-swatch{border:0}.colors label:first-child input::-webkit-color-swatch{border-radius:4px 0 0 0}.colors label:last-child input::-webkit-color-swatch{border-radius:0 4px 0 0}.colors span{display:inline-block;font-size:10px;margin-top:8px}.colors small{display:block;font-size:9px;color:#666;font-family:monospace;margin:3px 0 10px}.shuffle-button{border-top:1px solid #dedede;border-radius:5px}.seed-button{width:100%;margin-top:9px;border:1px solid #dedede;border-radius:5px;padding:10px;background:#fff;font-size:12px;cursor:pointer}.seed-button:hover{border-color:#111;background:#f6f6f6}.slider-field label{display:flex;justify-content:space-between;margin-bottom:8px;font-size:14px}.slider-field{margin:18px 0}.secondary{display:flex;justify-content:space-between;width:100%;margin-top:9px;padding:13px 16px;border:1px solid #111;border-radius:6px;background:#fff;cursor:pointer;font-size:14px}.secondary:hover{background:#f6f6f6}.workspace-actions button.active{background:#111;color:#fff;border-color:#111}.live{display:flex;align-items:center;gap:9px}.live i{height:7px;width:7px;border-radius:50%;background:#111}.canvas-area{display:flex;justify-content:center;align-items:center}.artboard{width:100%;height:100%;display:flex;justify-content:center;align-items:center;position:relative;min-height:0;gap:12px}.render{height:100%;max-width:100%;display:flex;align-items:center;justify-content:center;min-width:0}.render svg{height:100%;max-width:100%;width:auto;border:1px solid #e2e2e2}#original{display:none;height:100%;max-width:100%;object-fit:contain}.artboard.original .render{display:none}.artboard.original #original{display:block}.artboard.compare .render,.artboard.compare #original{display:flex;width:50%;height:100%;object-fit:contain}.artboard.compare .render svg{width:100%;height:auto;max-height:100%}.view-label{position:absolute;top:15px;left:26px;font-size:9px;color:#888;font-family:monospace;letter-spacing:1px}.busy{display:none;position:absolute;padding:12px 20px;background:#111;color:#fff;border-radius:5px;font-size:12px}.busy.show{display:block}.canvas-area.over{background:#f6f6f6;outline:2px dashed #111;outline-offset:-18px}button:disabled{opacity:.4;cursor:wait}.workspace-footer{gap:20px;font-size:11px}.workspace-footer span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}dialog{border:1px solid #111;border-radius:8px;max-width:490px;padding:36px;color:#111;background:#fff}dialog::backdrop{background:#0006}dialog h2{font-size:24px;margin:14px 0}dialog p{font-size:13px;line-height:1.9;color:#666}.eyebrow{font-size:10px;letter-spacing:1px}.close{position:absolute;top:10px;right:12px;background:none;border:0;font-size:24px;cursor:pointer}.toast{display:none;position:fixed;bottom:24px;left:50%;transform:translateX(-50%);padding:12px 20px;background:#111;color:#fff;border-radius:5px;font-size:12px;z-index:10}
@media(max-width:980px){.source-section{padding-inline:22px}.workspace-bar{padding-inline:20px}.workspace-actions{gap:4px}.workspace-actions button{padding:8px 10px}}
@media(max-width:720px){.app-shell{display:flex;flex-direction:column}.control-panel{display:contents}.brand-block{order:0;position:relative;min-height:100px;border-bottom:1px solid #dedede;padding:20px 22px}.brand-identity{display:flex;align-items:center;justify-content:space-between;gap:25px}.brand-logo{width:155px}.brand-caption{display:block;font-size:11px;margin:0;text-align:right}.brand-caption span{display:block;margin:5px 0}.source-section{order:1;padding:16px 22px}.workspace{order:2;height:65vh;min-height:420px;grid-template-rows:58px minmax(0,1fr) 36px}.workspace-bar{min-height:58px;position:relative}.canvas-area{padding:30px 22px 38px}.drop-hint{font-size:10px;bottom:9px}.view-label{font-size:8px;top:9px;left:22px}.control-section{order:3;padding:24px 22px}.export-section{order:4;padding:24px 22px}.workspace-footer{font-size:9px;padding:0 16px;gap:8px}.workspace-footer span:last-child{flex-shrink:0}.select-field{grid-template-columns:90px 1fr}.brand-block .brand-logo{height:auto}}
.render{width:100%}.render svg{width:auto;height:auto;max-height:100%;max-width:100%}
/* A shared image stage keeps original pixels and vector geometry aligned. */
.image-stage{position:relative;flex:none;max-width:100%;--split:50%}
.image-stage .render{position:absolute;inset:0;width:100%;height:100%;display:block}
.image-stage .render svg{display:block;width:100%;height:100%;max-width:none;max-height:none;border:0}
.image-stage #original{position:absolute;inset:0;width:100%;height:100%;max-width:none;object-fit:fill;pointer-events:none;user-select:none}
.artboard.original .image-stage .render{display:none}
.artboard.original .image-stage #original{display:block}
.artboard.compare .image-stage .render{display:block;width:100%;height:100%}
.artboard.compare .image-stage .render svg{width:100%;height:100%;max-height:none}
.artboard.compare .image-stage #original{display:block;width:100%;height:100%;clip-path:inset(0 calc(100% - var(--split)) 0 0)}
.artboard.compare .image-stage{touch-action:none;cursor:ew-resize;user-select:none}
.compare-handle{display:none;position:absolute;left:var(--split);top:0;height:100%;width:44px;padding:0;transform:translateX(-50%);border:0;background:transparent;cursor:ew-resize;touch-action:none;z-index:2}
.compare-handle::before{content:'';position:absolute;top:0;bottom:0;left:21px;width:2px;background:#fff;box-shadow:0 0 0 1px #0004}
.compare-handle span{position:absolute;left:4px;top:50%;transform:translateY(-50%);width:36px;height:36px;border:1px solid #ddd;border-radius:50%;background:#fff;color:#111;box-shadow:0 2px 8px #0003;display:grid;place-items:center;font-size:21px;line-height:1}
.compare-handle:focus-visible{outline:0}.compare-handle:focus-visible span{outline:2px solid #111;outline-offset:3px}
.compare-label{display:none;position:absolute;top:12px;z-index:1;background:#111b;color:#fff;padding:5px 8px;border-radius:3px;font-size:10px;pointer-events:none}
.original-label{left:12px}.processed-label{right:12px}
.artboard.compare .compare-handle,.artboard.compare .compare-label{display:block}
[hidden]{display:none!important}.mode-section{padding:24px 28px;border-top:1px solid var(--line)}.mode-switch{margin-bottom:0}.control-note{color:#777;font-size:11px;line-height:1.8;margin:12px 0 0}.brush-tools{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.brush-tools button,.edit-actions button{border:1px solid #dedede;border-radius:4px;background:#fff;padding:9px 5px;font-size:12px;cursor:pointer}.brush-tools button.active{color:#fff;background:#111;border-color:#111}.edit-actions{display:flex;gap:8px;margin-top:16px}.edit-actions button{flex:1;font-size:11px}.brush-tools button:hover,.edit-actions button:hover{border-color:#111}.rubbing-mode .image-stage.transparent{background-color:#fff;background-image:linear-gradient(45deg,#e8e8e8 25%,transparent 25%),linear-gradient(-45deg,#e8e8e8 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e8e8e8 75%),linear-gradient(-45deg,transparent 75%,#e8e8e8 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0}.image-stage.editing{touch-action:none;cursor:crosshair}.brush-cursor{display:none;position:absolute;pointer-events:none;z-index:5;border:1px solid #fff;box-shadow:0 0 0 1px #1119;border-radius:50%;transform:translate(-50%,-50%)}.rubbing-mode .colors label{flex:1}.rubbing-mode .colors label:nth-child(2) input::-webkit-color-swatch{border-radius:0 4px 0 0}.control-section .check-field{font-size:12px}.rubbing-mode .view-label{color:#666}#brushOptions{margin-top:8px}@media(max-width:980px){.mode-section{padding-inline:22px}}@media(max-width:720px){.mode-section{order:1;padding:18px 22px}.mode-section .section-title{margin-bottom:12px}.control-note{font-size:11px}.brush-tools button{padding:12px 5px}.rubbing-mode .image-stage.editing{touch-action:none}}

.mode-switch{grid-template-columns:repeat(3,1fr)}.mode-switch button{padding:11px 3px;font-size:11px}.text-field{display:block;margin-bottom:9px;font-size:13px}#typeText{width:100%;resize:vertical;min-height:85px;max-height:180px;padding:12px;border:1px solid #ccc;border-radius:5px;font:16px Georgia,"Songti SC",serif;line-height:1.5}#typeText:focus-visible{outline:2px solid #111;outline-offset:2px}.type-mode .colors label{flex:1}.image-stage.transparent{background-color:#fff;background-image:conic-gradient(#e8e8e8 25%,#fff 0 50%,#e8e8e8 0 75%,#fff 0);background-size:16px 16px}@media(max-width:720px){#typeControls{order:1}.type-mode .workspace{order:2}}
.font-library{padding:14px 0 4px;border-block:1px solid #eee;margin:16px 0}.font-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px}.font-actions .seed-button{margin:0}.font-import{display:flex;align-items:center;justify-content:center;border:1px solid #dedede;border-radius:5px;font-size:12px;cursor:pointer}.font-import:hover{background:#f6f6f6;border-color:#111}.font-import input{display:none}#fontSearch{width:100%;margin-top:12px;border:1px solid #ccc;border-radius:5px;padding:10px;font-size:12px}.font-list{max-height:220px;overflow:auto;display:grid;gap:6px;margin-top:10px}.font-card{display:block;width:100%;text-align:left;padding:9px 12px;border:1px solid #e0e0e0;border-radius:4px;background:#fff;cursor:pointer}.font-card.active{border-color:#111;background:#f6f6f6}.font-name{display:block;font:10px Arial,sans-serif;color:#777;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.font-sample{display:block;margin-top:5px;font-size:25px;line-height:1.4;white-space:pre-line;max-height:78px;overflow:hidden}.font-preview{border:1px solid #ddd;border-radius:5px;padding:16px 12px;font-size:32px;white-space:pre-line;line-height:1.4;overflow:hidden;max-height:190px;background:#f9f8f5}.font-library .select-field{grid-template-columns:65px 1fr}

#svgCode{width:100%;resize:vertical;min-height:160px;max-height:360px;padding:12px;border:1px solid #ccc;border-radius:5px;font:11px/1.7 monospace;tab-size:2}#svgCode:focus-visible{outline:2px solid #111;outline-offset:2px}.svg-import-actions{display:flex;align-items:center;gap:12px}.svg-import-actions .seed-button{flex:1}.svg-import-actions .text-btn{white-space:nowrap}#typeSourceSwitch{margin-bottom:20px}

.mode-switch{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.mode-switch button{width:100%}

.mode-switch button:nth-child(even){border-right:0}.mode-switch button:nth-child(n+3){border-top:1px solid var(--black)}

.xiaohongshu-link{display:flex;align-items:center;justify-content:center;gap:9px;width:100%;margin-top:15px;color:var(--black);font-size:12px;line-height:1.45;text-align:center;text-decoration:none}.xiaohongshu-link:hover{opacity:.72}.xiaohongshu-icon{flex:0 0 auto;display:block;width:28px;height:28px;border-radius:7px}@media(max-width:720px){.brand-identity{display:block}.brand-logo{width:100%;max-width:300px;margin:auto}.xiaohongshu-link{margin-top:12px}}

/* A stage-only gradient guide; exports contain generated dot paths alone. */
.dot-gradient-axis{position:absolute;inset:0;z-index:7;pointer-events:none;overflow:visible}.dot-gradient-axis>svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}.dot-gradient-axis line{vector-effect:non-scaling-stroke}.dot-gradient-axis .axis-under{stroke:#fff;stroke-width:4}.dot-gradient-axis .axis-line{stroke:#111;stroke-width:1}.dot-gradient-axis .axis-handle{position:absolute;width:17px;height:17px;min-width:0;padding:0;border:2px solid #fff;border-radius:50%;background:#111;box-shadow:0 0 0 1px #111;transform:translate(-50%,-50%);pointer-events:auto;touch-action:none;cursor:move}.dot-gradient-axis .axis-start{background:#fff;border-color:#111;box-shadow:0 0 0 1px #fff}.dot-gradient-axis .axis-center{width:12px;height:12px;border:1px solid #111;border-radius:0;background:#fff;box-shadow:0 0 0 1px #fff;transform:translate(-50%,-50%) rotate(45deg)}.dot-gradient-axis .axis-handle:focus-visible{outline:2px solid #4865ff;outline-offset:4px}#dotGradientControls .seed-button{margin-top:5px}#dotGradientControls .control-note{margin-bottom:16px}
.dot-gradient-axis .axis-line{pointer-events:stroke;cursor:move;touch-action:none}
