:root {
  color-scheme: light;
  --background: #f6f7f2;
  --surface: #fff;
  --surface-muted: #f7f8f3;
  --ink: #19221d;
  --muted: #576459;
  --line: #e2e7dd;
  --green: #225a3c;
  --green-dark: #17432c;
  --green-soft: #ebf4e9;
  --green-light: #cce9aa;
  --negative: #9c312c;
  --shadow: 0 18px 48px rgba(36, 53, 41, .055);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--background); color: var(--ink); }
body { margin: 0; min-width: 280px; font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
h1, h2, p, ul { margin: 0; }
:focus-visible { outline: 3px solid #64a875; outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: 1280px;
  min-height: 74px;
  padding: 0 42px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.brand, .account { display: flex; align-items: center; }
.brand { flex: 0 0 auto; gap: 12px; font-size: 17px; font-weight: 720; text-decoration: none; }
.brand-icon {
  position: relative;
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 11px;
  background: #263d31;
}
.brand-icon i { width: 13px; height: 13px; transform: rotate(45deg); border-radius: 3px; background: var(--green-light); }
.brand-icon::after {
  position: absolute;
  content: "";
  width: 6px;
  height: 6px;
  border: 1px solid var(--green-light);
  border-radius: 1px;
  top: 7px;
  right: 7px;
  transform: rotate(45deg);
}
.account { min-width: 0; gap: 12px; }
.node { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; }
.node span { flex: 0 0 7px; width: 7px; height: 7px; background: #9aa398; border-radius: 100%; }
.node.online span { background: #599349; box-shadow: 0 0 0 3px #e8f1df; }
.node strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.button {
  min-height: 41px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 680;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button-secondary:hover { background: var(--surface-muted); border-color: #bfcabc; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); }
.button:disabled { cursor: wait; opacity: .65; }

.shell { max-width: 1280px; padding: 43px 42px 56px; margin: auto; }
h1 { font-size: clamp(26px, 4vw, 37px); line-height: 1.18; font-weight: 770; letter-spacing: -.035em; }
.modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 25px 0 22px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  width: fit-content;
  background: #edf0e9;
}
.mode {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-content: center;
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 640;
  font-size: 14px;
  color: #4b574d;
  background: transparent;
}
.mode:hover { background: #f5f7f2; }
.mode[aria-pressed="true"] { background: var(--surface); border-color: #dce5d8; color: var(--green-dark); box-shadow: 0 2px 5px #3045320b; }
.mode-icon { position: relative; width: 17px; height: 17px; flex: 0 0 17px; display: grid; place-items: center; }
.icon-picture::before { content: ""; position: absolute; inset: 2px 1px; border: 1.5px solid; border-radius: 4px; }
.icon-picture::after { content: ""; position: absolute; width: 5px; height: 5px; bottom: 4px; left: 5px; border-top: 1.5px solid; border-left: 1.5px solid; transform: rotate(45deg); }
.icon-text { font: 800 16px Georgia, serif; }
.icon-batch::before, .icon-batch::after { content: ""; position: absolute; width: 10px; height: 9px; border: 1.5px solid; border-radius: 3px; }
.icon-batch::before { top: 1px; right: 0; }
.icon-batch::after { bottom: 1px; left: 0; background: #edf0e9; }
.mode[aria-pressed="true"] .icon-batch::after { background: var(--surface); }
.icon-fusion::before, .icon-fusion::after { content: ""; position: absolute; width: 9px; height: 9px; border: 1.5px solid; border-radius: 50%; }
.icon-design { font-size: 18px; }
.icon-fusion::before { left: 0; }
.icon-fusion::after { right: 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 21px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 19px; box-shadow: var(--shadow); min-width: 0; }
.card-heading { padding: 24px 25px 20px; }
.card-heading h2, dialog h2 { font-size: 20px; font-weight: 750; line-height: 1.3; }
.card-heading p { font-size: 14px; color: var(--muted); margin-top: 6px; }
.form-fields { display: grid; gap: 18px; padding: 0 25px 22px; }
.field { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.field label, .field legend { display: block; margin: 0 0 7px; padding: 0; font-size: 13px; font-weight: 690; }
.dropzone {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 13px;
  min-height: 65px;
  border: 1px dashed #c8d6c7;
  border-radius: 11px;
  background: var(--surface-muted);
}
.dropzone.dragging, .dropzone:has(input:focus-visible) { border-color: #589565; background: var(--green-soft); }
.field label.file-picker { margin: 0; display: flex; cursor: pointer; align-items: center; gap: 9px; min-width: 0; }
.file-picker strong { color: var(--green); }
.drag-hint, .upload-caption { font-size: 12px; font-weight: 450; color: var(--muted); }
.upload-icon { display: grid; flex: 0 0 25px; height: 25px; place-items: center; border-radius: 7px; background: #e8efe4; color: var(--green); font-size: 18px; line-height: 1; }
.upload-caption { font-size: 10px; white-space: nowrap; }
.file-actions { display: flex; flex-wrap: wrap; margin-top: 8px; gap: 5px; }
.file-actions .button { min-height: 28px; padding: 3px 8px; font-size: 11px; }
.file-actions .button:disabled { cursor: default; }
.files { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 0; }
.files:not(:empty) { margin-top: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 3px 4px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  font-size: 11px;
}
.file-item img { display: block; width: 24px; height: 24px; object-fit: cover; border-radius: 3px; }
.file-item span { max-width: 130px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-item button { padding: 0 5px; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1.3; }
.file-item button:hover { color: var(--green-dark); }
.file-item .file-toggle { display: flex; min-width: 0; align-items: center; padding: 0; gap: 6px; text-align: left; font-size: 11px; }
.file-item.selected { border-color: #78a882; background: var(--green-soft); }
.file-item .file-index { font-weight: 730; margin-left: 2px; }
.file-item .file-remove:hover { color: var(--negative); }
textarea, select, dialog input {
  width: 100%;
  border: 1px solid #dce4db;
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}
textarea { min-height: 112px; display: block; resize: vertical; line-height: 1.6; }
textarea::placeholder { color: #657264; }
select { height: 44px; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.plan-note { margin-top: 7px; color: var(--muted); font-size: 12px; }
.plan details { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.plan summary { cursor: pointer; overflow-wrap: anywhere; font-size: 13px; font-weight: 670; }
.plan-fields { display: grid; gap: 8px; margin-top: 10px; }
.plan-fields select { height: 38px; padding: 6px 9px; }
.plan-fields textarea { min-height: 76px; font-size: 13px; }
.settings { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; }
.form-error { margin: 0 25px 15px; border-left: 3px solid #c3655c; background: #fff3f0; color: var(--negative); padding: 8px 10px; border-radius: 4px; font-size: 13px; overflow-wrap: anywhere; }
.actions { border-top: 1px solid var(--line); padding: 17px 25px 21px; }
.actions .button { min-height: 45px; width: 100%; font-size: 14px; }
#submit-icon { color: #d8eeb7; font-size: 17px; line-height: 1; }

.results { min-height: 544px; }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 78px; }
.results-heading .button { min-height: 34px; padding: 4px 10px; font-size: 12px; }
.empty-results {
  margin: 0 25px 25px;
  min-height: 438px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 17px;
  text-align: center;
  background: radial-gradient(#cfd9c9 0.8px, transparent .9px) 0 0 / 14px 14px, #f6f8f3;
  color: #59665a;
  font-size: 14px;
}
.empty-art { position: relative; width: 104px; height: 81px; }
.art-back, .art-front { position: absolute; width: 61px; height: 51px; border: 1px solid #a9c2a2; border-radius: 9px; }
.art-back { top: 14px; left: 15px; transform: rotate(-13deg); background: #e7f0e1; }
.art-front { top: 19px; left: 26px; background: #f9fcf7; transform: rotate(8deg); overflow: hidden; }
.art-front::before { content: ""; position: absolute; top: 9px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: #b5d4a4; }
.art-front::after, .art-front i { content: ""; position: absolute; top: 28px; left: 4px; width: 37px; height: 36px; border-radius: 5px; transform: rotate(45deg); background: #bcd3b6; }
.art-front i { left: 30px; top: 31px; background: #d8e5d1; }
.empty-art b { position: absolute; right: 4px; top: 1px; color: #579269; font-size: 22px; }
.results-list { display: grid; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); align-items: start; gap: 12px; padding: 0 25px 25px; }
.results-list:empty { display: none; }
.result { min-width: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.result-image { display: block; width: 100%; object-fit: contain; aspect-ratio: 1; background: var(--surface-muted); }
.result-body { padding: 12px; display: grid; gap: 7px; }
.result-title { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-status { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.result-status[data-state="failed"], .result-status[data-state="uncertain"] { color: var(--negative); }
.result-status[data-state="succeeded"] { color: var(--green); }
.result .button { width: fit-content; min-height: 32px; margin-top: 3px; padding: 4px 9px; font-size: 12px; }

dialog {
  width: min(420px, calc(100% - 28px));
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 20px 75px #12231c36;
  padding: 25px;
}
dialog::backdrop { background: #212c24a0; }
dialog p:not(.form-error) { margin: 8px 0 18px; color: var(--muted); font-size: 14px; }
dialog label { display: block; margin-bottom: 7px; font-weight: 650; font-size: 13px; }
dialog .form-error { margin: 9px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-actions .button { min-width: 70px; }

@media (max-width: 900px) {
  .header-inner, .shell { padding-inline: 24px; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 15px; }
  .card-heading { padding-inline: 18px; }
  .form-fields, .actions, .results-list { padding-inline: 18px; }
  .empty-results { margin-inline: 18px; }
  .composer .form-error { margin-inline: 18px; }
}
@media (max-width: 680px) {
  .header-inner { min-height: 62px; }
  .header-inner, .shell { padding-inline: 16px; }
  .shell { padding-top: 28px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 3px; margin-block: 18px 16px; }
  .mode { padding-inline: 3px; font-size: 12px; gap: 4px; }
  .mode-wide { grid-column: span 2; }
  .account { gap: 8px; }
  .results { min-height: 0; }
  .empty-results { min-height: 250px; }
}
@media (max-width: 350px) {
  .brand { font-size: 14px; gap: 7px; }
  .brand-icon { width: 31px; height: 31px; }
  .mode-icon { display: none; }
  .upload-caption { display: none; }
  .dropzone { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
