:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Inter, system-ui, sans-serif;
  font-size: 13px;
  background: #f5f6f8;
  color: #202838;
  --panel: #fff;
  --line: #e4e7ed;
  --muted: #717c8f;
  --accent: #5654d6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:not(:disabled), select:not(:disabled) { cursor: pointer; }
button:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 2px solid #8c8aee; outline-offset: 3px; }
.topbar { height: 62px; display: flex; align-items: center; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.brand img { border-radius: 8px; }
.brand span { font-size: 12px; color: var(--muted); font-weight: 400; border-left: 1px solid var(--line); padding-left: 14px; margin-left: 4px; }
.topbar nav { margin-left: auto; color: var(--muted); font-size: 12px; }
.account { padding: 7px 12px; background: #f3f4f7; border: 1px solid var(--line); border-radius: 20px; max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main { height: calc(100dvh - 62px); min-height: 580px; padding: 0 16px 16px; display: flex; flex-direction: column; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.tool-tabs { display: flex; align-items: center; gap: 6px; }
.tool-tabs button { padding: 9px 17px; border-radius: 7px; background: transparent; border: 1px solid transparent; font-weight: 600; }
.tool-tabs button:hover { background: #eceef4; }
.tool-tabs button[aria-pressed="true"] { color: var(--accent); background: #eae9fc; border-color: #e2e0fa; }
.page-actions, .canvas-actions, .button-row { display: flex; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 12px; border: 1px solid #dfe3ec; border-radius: 7px; background: #fff; color: #354056; font-size: 12px; font-weight: 600; white-space: nowrap; }
.button:hover:not(:disabled) { background: #f3f4fa; border-color: #babfe0; }
.button[aria-pressed="true"] { color: var(--accent); border-color: #8986e3; background: #f0efff; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: #4543bf; border-color: #4543bf; color: white; }
.small { min-height: 30px; padding: 4px 9px; font-size: 11px; }
.wide { width: 100%; }
.button.wide + .button.wide { margin-top: 8px; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 326px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; box-shadow: 0 3px 15px #29365b04; }
.editor { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.panel-bar { display: flex; min-height: 53px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.document-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.document-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; max-width: 36vw; }
.image-upload-guide { flex-shrink: 0; display: grid; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--line); color: #65728a; background: #fafbfe; font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
#image-upload-result { color: #3d5682; }
#psd-size-note { color: #808a9b; font-size: 10px; }
#psd-aspect-warning { color: #ad5f21; }
.view-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.zoom-control select { font-size: 11px; width: 92px; min-height: 30px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; color: #536079; background: #fff; }
.stage { position: relative; display: flex; flex: 1; min-height: 240px; overflow: auto; padding: 24px; background: #f2f4f8; }
.stage.dragging { outline: 2px dashed #8582e2; outline-offset: -8px; background: #eeedff; }
.welcome { width: min(100%, 490px); margin: auto; display: flex; flex-direction: column; align-items: center; gap: 13px; text-align: center; }
.welcome h1 { font-size: 20px; line-height: 1.6; font-weight: 600; letter-spacing: .01em; }
.welcome p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.welcome small { color: #969faf; font-size: 11px; }
.welcome .button { margin: 6px 0 0; padding-inline: 25px; }
.upload-symbol { display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid #deddf3; border-radius: 17px; color: #6966d5; background: #eeedfc; font-size: 28px; margin-bottom: 3px; }
.artboard { flex: 0 0 auto; margin: auto; align-self: flex-start; box-shadow: 0 3px 20px #26335a16; background: repeating-conic-gradient(#fff 0% 25%, #e9ecf1 0% 50%) 50% / 18px 18px; line-height: 0; }
canvas, #result-preview { display: block; width: 100%; height: auto; touch-action: none; }
.stage-footer { display: flex; align-items: center; gap: 12px; min-height: 37px; padding: 7px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.5; }
#dimensions { flex-shrink: 0; }
#status { margin-left: auto; text-align: right; overflow-wrap: anywhere; }
#status[data-error] { color: #b34748; }
.editor[aria-busy="true"] .view-label::before { content: ""; display: inline-block; width: 8px; height: 8px; border: 2px solid #cbc8f4; border-top-color: var(--accent); border-radius: 50%; margin-right: 6px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inspector { min-width: 0; min-height: 0; overflow: auto; padding: 20px; border-left: 1px solid var(--line); }
.inspector-heading h2 { font-size: 15px; margin-bottom: 7px; }
.inspector-heading p { color: var(--muted); font-size: 12px; line-height: 1.8; margin-bottom: 20px; }
.inline-notice { padding: 10px 12px; border: 1px solid #e1e4f4; background: #f6f7fd; border-radius: 7px; color: #727a98; font-size: 12px; line-height: 1.7; margin: 12px 0; }
.section-label, h3 { font-size: 12px; font-weight: 650; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 10px; }
.text-button { border: 0; background: transparent; color: var(--accent); font-size: 11px; padding: 3px; }
.hint { display: block; margin: 8px 0; color: var(--muted); font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.properties { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 8px; }
.properties label, .field { display: grid; gap: 7px; margin: 13px 0; min-width: 0; font-size: 12px; color: #526078; }
.properties input, .properties textarea, .properties select, .field select { width: 100%; min-width: 0; min-height: 35px; padding: 7px 9px; background: #fff; color: #27354c; border: 1px solid #dce1ea; border-radius: 6px; font: inherit; }
.properties textarea { resize: vertical; line-height: 1.7; }
.properties .check { display: flex; align-items: center; }
.properties .check input { width: auto; min-height: auto; accent-color: var(--accent); }
.property-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.compact { border: 0; margin-top: 6px; }
#cutout-options label { display: flex; justify-content: space-between; margin-bottom: 2px; }
#tolerance { accent-color: var(--accent); width: 100%; padding: 0; min-height: 22px; border: 0; }
.button-row > .button { flex: 1; padding-inline: 8px; }
#ai-inpaint { margin-top: 8px; }
.panel-submit { margin-top: 18px; min-height: 39px; }
.layer-list { max-height: 210px; overflow: auto; }
.layer { display: flex; align-items: center; gap: 6px; margin: 5px 0; border: 1px solid #e9ebf1; border-radius: 6px; background: #f8f9fb; }
.layer.active { border-color: #c1bdf0; background: #f0effb; }
.layer-select { flex: 1; min-width: 0; padding: 9px 8px; border: 0; background: transparent; display: flex; gap: 7px; align-items: center; text-align: left; }
.layer-select span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.layer .button { margin-right: 5px; font-size: 10px; }
.layer-mark { flex: 0 0 21px; text-align: center; color: #8b89a2; }
.local-fonts { margin: 14px 0; color: var(--muted); font-size: 11px; }
.local-fonts summary { cursor: pointer; }
.danger { color: #b44b50; }
.segmented { display: flex; gap: 3px; background: #f2f3f7; padding: 4px; border-radius: 7px; margin-bottom: 14px; }
.segmented button { flex: 1; border: 0; border-radius: 5px; background: transparent; color: var(--muted); padding: 9px 5px; font-size: 12px; }
.segmented button[aria-pressed="true"] { color: #343858; background: #fff; box-shadow: 0 1px 5px #33355e12; font-weight: 600; }
.model-options { display: grid; gap: 9px; margin: 12px 0; }
.model-option { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 13px 11px; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-align: left; }
.model-option[aria-pressed="true"] { border-color: #aaa6e9; background: #f8f7ff; }
.model-option strong { display: block; font-size: 12px; font-weight: 600; }
.model-option small { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; }
.model-option [data-psd-price] { white-space: pre-line; color: var(--accent); font-size: 11px; flex-shrink: 0; max-width: 118px; text-align: right; line-height: 1.65; }
.price-note { padding-top: 8px; color: var(--accent); font-size: 12px; }
.result-section { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.result-section .section-heading { margin-top: 0; }
.result-section .button { margin-top: 9px; }
.result-tag { color: #78809a; font-size: 10px; padding: 3px 6px; background: #f0f2f7; border-radius: 4px; }
.flat-notice { margin-top: 10px; padding: 10px 12px; border: 1px solid #dcdaf7; border-radius: 7px; background: #f4f3ff; color: #4843a5; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.flat-notice[data-state="working"]::before { content: ""; display: inline-block; width: 11px; height: 11px; border: 2px solid #cbc8f4; border-top-color: var(--accent); border-radius: 50%; margin-right: 7px; vertical-align: -1px; animation: spin .8s linear infinite; }
.flat-notice[data-state="success"] { color: #176a49; background: #edf9f2; border-color: #bfe5d1; }
.flat-notice[data-state="error"] { color: #a53838; background: #fff2f1; border-color: #f1c8c5; }
.flat-result { margin-top: 12px; padding: 13px; border: 1px solid #cfcbee; border-radius: 8px; background: #faf9ff; }
.flat-result .section-heading { margin-bottom: 10px; }
.flat-result .result-tag { color: #4d47a6; background: #eae7fc; }
.flat-preview { display: block; width: 100%; max-height: 150px; object-fit: contain; border: 1px solid var(--line); border-radius: 5px; background: #f0f2f7; }
.flat-import { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
dialog { width: min(480px, calc(100vw - 32px)); max-height: 85dvh; overflow: auto; padding: 22px; color: #263149; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 20px 90px #20284433; }
dialog::backdrop { background: #1c253177; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-top h2 { font-size: 17px; }
.options, .asset-list, #asset-login { margin-top: 15px; }
.tool { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 9px; margin: 5px 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; text-align: left; font-size: 13px; }
.tool:hover { background: #f6f5fe; }
.tool-icon { display: grid; place-items: center; width: 32px; height: 32px; color: var(--accent); background: #eeedfc; border-radius: 6px; }
.tool small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; line-height: 1.6; }
.asset-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.asset { min-width: 0; padding: 5px; border: 1px solid var(--line); background: #f7f8fa; border-radius: 7px; text-align: left; }
.asset img { display: block; width: 100%; height: 85px; object-fit: cover; border-radius: 4px; }
.asset span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; padding: 6px 1px; }
.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; }
.recent-task { flex-shrink: 0; text-align: left; padding: 8px 12px; margin-bottom: 10px; color: #514aa6; background: #eeedfc; border: 1px solid #dfdcf7; border-radius: 7px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tasks-dialog { width: min(680px, calc(100vw - 24px)); }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.task-row strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.task-row div > span { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
.task-row p { margin-top: 5px; color: #ac4148; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.task-status { font-size: 11px; color: var(--muted); white-space: nowrap; }
.task-status[data-state="running"], .task-status[data-state="queued"] { color: var(--accent); }
.task-status[data-state="succeeded"] { color: #17734d; }
.task-status[data-state="failed"] { color: #ac4148; }
.task-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 15px; font-size: 11px; }
.task-pagination > button:first-child { margin-right: auto; }
@media (max-width: 400px) { .page-actions { gap: 5px; } .page-actions .button { padding-inline: 8px; font-size: 11px; } #tasks-dialog { padding: 14px; } .task-row { gap: 7px; } }
@media (max-width: 1050px) { .workspace { grid-template-columns: minmax(0, 1fr) 290px; } .inspector { padding: 17px; } .tool-tabs button { padding-inline: 12px; } }
@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 14px; gap: 12px; }
  .brand { font-size: 14px; }
  .brand span { display: none; }
  .topbar nav { font-size: 11px; }
  .account { max-width: 94px; padding: 6px 8px; font-size: 11px; }
  main { height: auto; min-height: calc(100dvh - 56px); padding: 0 10px 14px; }
  .workspace-heading { flex-wrap: wrap; gap: 8px; padding: 12px 0; }
  .tool-tabs { width: 100%; gap: 3px; }
  .tool-tabs button { flex: 1; padding: 8px 4px; font-size: 12px; }
  .page-actions { margin-left: auto; }
  .workspace { display: flex; flex-direction: column; }
  .stage { min-height: 330px; height: 44dvh; flex: none; padding: 16px; }
  .panel-bar { padding: 9px 10px; gap: 5px; }
  .document-name { max-width: 27vw; }
  .view-label { display: none; }
  .canvas-actions { gap: 5px; }
  .canvas-actions .button { font-size: 10px; }
  .zoom-control select { width: 84px; font-size: 10px; }
  .welcome h1 { font-size: 17px; }
  .welcome p { font-size: 11px; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 18px; }
  .stage-footer { flex-wrap: wrap; gap: 4px; padding: 8px 10px; }
  .inspector-heading p { margin-bottom: 13px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; } }

.properties h2 { font-size: 12px; margin: 6px 0; }

.psd-element-limit { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 6px; font-size: 12px; color: #526078; }
.psd-element-limit input { width: 76px; min-height: 34px; padding: 6px 9px; border: 1px solid #cbd0db; border-radius: 6px; color: #27354c; background: #fff; }
.psd-plan { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e3e5eb; }
.psd-plan-row { display: flex; gap: 8px; align-items: end; margin: 10px 0; }
.psd-plan-row label { display: grid; flex: 1; gap: 5px; min-width: 0; font-size: 11px; color: #5b6475; }
.psd-plan-row input { min-width: 0; width: 100%; box-sizing: border-box; padding: 8px; border: 1px solid #cbd0db; border-radius: 7px; font: inherit; font-size: 12px; color: #263044; background: #fff; }
.psd-plan-row .button { flex: 0 0 auto; padding: 8px 10px; }
.psd-plan .section-heading { margin: 0 0 8px; }
.psd-plan .section-heading h3 { margin: 0; }
