:root {
  color-scheme: dark;
  --bg: #10120f;
  --panel: #191c18;
  --panel-2: #20241f;
  --line: #343a31;
  --text: #f2f4ec;
  --muted: #a8afa1;
  --accent: #c8ff40;
  --danger: #ff7a6e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #26301b, var(--bg) 40%);
}
header, main { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 38px 0 24px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(30px, 4vw, 48px); letter-spacing: -.045em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 8px; }
.eyebrow { color: var(--accent); font-weight: 700; letter-spacing: .16em; font-size: 12px; margin-bottom: 10px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.header-actions input { width: min(270px, 42vw); }
.badge {
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}
.badge.ok { color: var(--accent); border-color: #617c25; }
.badge.warn { color: #ffc56e; border-color: #6e5426; }
.badge.error { color: var(--danger); border-color: #743d37; }
main { display: grid; gap: 20px; padding-bottom: 56px; }
.panel {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-radius: 18px;
  padding: 22px;
}
.section-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.section-title p { color: var(--muted); font-size: 12px; margin-top: 6px; }
.section-title .save-hint { color: #bfd779; font-size: 11px; }
.section-title > span { color: var(--muted); font-size: 13px; }
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 14px;
}
.folder-card-button {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 156px;
  padding: 22px 18px;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #252c20, #181c16);
  border-radius: 16px;
  color: var(--text);
  overflow: hidden;
}
.folder-card-button::before {
  content: "";
  position: absolute;
  inset: auto -35px -65px auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: #c8ff400b;
}
.folder-card-button:hover {
  border-color: #7d9f2f;
  transform: translateY(-2px);
  background: linear-gradient(145deg, #2b3324, #1b2018);
}
.folder-card-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.folder-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 62px;
  border-radius: 9px 13px 13px 13px;
  background: linear-gradient(145deg, #d9f68e, #809c43);
  box-shadow: inset 0 0 0 1px #efffc5, 0 10px 30px #0005;
  color: #25320e;
}
.folder-tab {
  position: absolute;
  top: -9px;
  left: 0;
  width: 36px;
  height: 14px;
  border-radius: 7px 8px 0 0;
  background: #bfdc71;
}
.folder-face {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #dcecaf;
  border-radius: 8px;
  background: #303a2c;
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
}
.folder-copy { display: grid; gap: 6px; min-width: 0; }
.folder-copy strong { font-size: 19px; }
.folder-copy span { color: var(--accent); font-size: 12px; font-weight: 700; }
.folder-copy small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.folder-open {
  position: absolute;
  right: 16px;
  bottom: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.folder-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.folder-path { display: flex; gap: 8px; color: var(--muted); font-size: 12px; }
.folder-path b { color: #596052; }
.folder-path strong { color: var(--accent); }
.workflow-picker-label {
  display: grid;
  grid-template-columns: auto minmax(220px, 520px);
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
}
.workflow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.workflow-item { position: relative; min-width: 0; }
.workflow-select {
  position: absolute;
  z-index: 2;
  top: 11px;
  left: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.workflow-select input { width: auto; accent-color: var(--accent); }
.workflow-item.selected .workflow-card { border-color: var(--accent); }
.workflow-item.selected .workflow-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 1px var(--accent) inset;
  pointer-events: none;
}
.workflow-card {
  position: relative;
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 150px;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #232920, #1a1e19);
  border-radius: 13px;
  padding: 38px 16px 16px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.collection-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151814;
}
.collection-toolbar > span {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}
.collection-toolbar .pot-button {
  min-width: 132px;
  padding: 10px 16px;
  font-size: 13px;
}
.batch-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #4c5b34;
  border-radius: 14px;
  background: #171d15;
}
.batch-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.batch-heading h3 { margin-bottom: 5px; }
.batch-heading p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.batch-heading .run-button { min-width: 176px; }
.batch-progress { display: grid; gap: 6px; }
.batch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #11140f;
  font-size: 12px;
}
.batch-state { color: var(--muted); }
.batch-state.working { color: #ffd98e; }
.batch-state.ready { color: var(--accent); }
.batch-state.error { color: var(--danger); }
.workflow-card:hover {
  border-color: #7d9f2f;
  background: linear-gradient(145deg, #293121, #1d221b);
  transform: translateY(-2px);
}
.workflow-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.workflow-card:disabled { opacity: .5; cursor: not-allowed; }
.card-top { display: flex; justify-content: space-between; gap: 12px; }
.card-top strong { font-size: 16px; line-height: 1.4; }
.card-arrow { color: var(--accent); font-size: 20px; }
.card-purpose { color: var(--muted); font-size: 13px; }
.workflow-card code { color: var(--accent); font-size: 12px; word-break: break-all; }
.card-footer { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.schema-state { color: #ffc56e; font-size: 11px; }
.schema-state.ready { color: #a9c86e; }
.card-action { align-self: end; margin-top: 6px; color: #d5ff77; font-size: 12px; font-weight: 700; }
.editor-panel { scroll-margin-top: 16px; }
.editor-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.workflow-id { color: var(--muted); font-family: Consolas, monospace; font-size: 12px; }
.editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.pot-workflow {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid #465236;
  border-radius: 14px;
  background: linear-gradient(135deg, #20271b, #171b15);
  margin-bottom: 18px;
}
.pot-copy { display: flex; align-items: flex-start; gap: 14px; }
.pot-copy h3 { margin-bottom: 5px; }
.pot-copy p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.step-number {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #334126;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
}
.pot-button {
  min-width: 150px;
  padding: 14px 22px;
  background: var(--accent);
  color: #1b2504;
  font-size: 16px;
}
.pot-status {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  padding-left: 52px;
}
.pot-status.working { color: #ffd98e; }
.pot-status.ready { color: var(--accent); }
.pot-status.error { color: var(--danger); }
.replace-preview {
  grid-column: 1 / -1;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0d0a;
  margin-top: 6px;
}
.compare-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}
.compare-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #11140f;
}
.compare-card figcaption {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.compare-frame {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 14px;
  background:
    linear-gradient(45deg, #1a1e18 25%, transparent 25%) 0 0 / 20px 20px,
    linear-gradient(-45deg, #1a1e18 25%, transparent 25%) 0 10px / 20px 20px,
    linear-gradient(45deg, transparent 75%, #1a1e18 75%) 10px -10px / 20px 20px,
    linear-gradient(-45deg, transparent 75%, #1a1e18 75%) -10px 0 / 20px 20px,
    #121510;
}
.compare-frame span { color: var(--muted); font-size: 12px; }
.compare-frame img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}
.notice {
  border: 1px solid #6d592d;
  background: #2c2517;
  color: #ffd98e;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 18px;
}
form { display: grid; gap: 22px; }
.form-section { border-top: 1px solid var(--line); padding-top: 20px; }
.form-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.form-section-title span { color: var(--muted); font-size: 12px; }
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.prompt-field { display: grid; gap: 8px; }
.field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-heading small { color: var(--muted); font-size: 11px; font-family: Consolas, monospace; }
label { color: var(--text); font-size: 13px; }
input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #11140f;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  font: inherit;
}
textarea { resize: vertical; line-height: 1.6; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.image-slot {
  display: grid;
  gap: 8px;
  border: 1px dashed #474f42;
  border-radius: 11px;
  padding: 13px;
  background: #171a16;
  transition: border-color .18s ease, background .18s ease;
}
.image-slot.has-file { border-color: #779528; background: #1d2418; }
.image-slot input[type=file] { padding: 8px; font-size: 12px; }
.current-image, .chosen-file { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.chosen-file { color: #d5ff77; }
.advanced { border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: #161914; }
.advanced summary { cursor: pointer; font-weight: 700; }
.advanced p { color: var(--muted); font-size: 12px; margin: 9px 0; }
.advanced textarea { font-family: Consolas, monospace; font-size: 12px; }
.run-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.run-zone p { color: var(--muted); font-size: 12px; max-width: 660px; }
button {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  background: var(--accent);
  color: #182000;
  cursor: pointer;
}
button.secondary { background: #30362c; color: var(--text); border: 1px solid var(--line); }
button.small { padding: 7px 11px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-shell {
  width: min(460px, calc(100% - 32px));
  padding: 40px 0;
}
.login-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  background: linear-gradient(145deg, #22291c, #151813);
  box-shadow: 0 28px 80px #0006;
}
.login-card h1 { font-size: 30px; }
.login-form { display: grid; gap: 10px; margin-top: 26px; }
.login-form label { margin-top: 6px; color: var(--muted); }
.login-form button {
  margin-top: 10px;
  padding: 13px 18px;
  font-size: 15px;
}
.login-message { min-height: 22px; color: var(--danger); font-size: 12px; }
.login-security {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.login-security strong { color: var(--accent); }
.run-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 176px;
  padding: 12px 22px 14px;
  background: linear-gradient(180deg, #ffc0ad, #ff8d70);
  color: #40140a;
  box-shadow: 0 0 0 1px #ffd4c7 inset, 0 10px 28px #ff7e5020;
}
.run-button span {
  position: absolute;
  top: -12px;
  right: 8px;
  background: #d53f1c;
  color: white;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 5px;
}
.run-button strong { margin-top: 5px; font-size: 24px; letter-spacing: .14em; }
.run-button.running { filter: saturate(.6); }
.message {
  min-height: 44px;
  white-space: pre-wrap;
  color: var(--muted);
  background: #11140f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 12px;
}
.loading { color: var(--muted); font-size: 13px; }
.job-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.job-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  background: #151814;
  color: var(--muted);
  font-size: 12px;
}
.job-filter b {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  border-radius: 999px;
  background: #292f25;
  color: var(--muted);
  font-size: 10px;
}
.job-filter:hover { border-color: #71863f; color: var(--text); }
.job-filter.active {
  border-color: #8eae3c;
  background: #25301b;
  color: var(--accent);
}
.job-filter.active b { background: var(--accent); color: #182000; }
.jobs { display: grid; gap: 10px; }
.result-category {
  display: grid;
  gap: 10px;
  border: 1px solid #30372c;
  border-radius: 14px;
  padding: 14px;
  background: #141713;
}
.result-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2b3128;
}
.result-category-head > div { display: flex; align-items: center; gap: 9px; }
.result-category-head > span { color: var(--muted); font-size: 11px; }
.result-folder-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(145deg, #d9f68e, #809c43);
  color: #25320e;
  font-size: 12px;
  font-weight: 800;
}
.result-category-head strong { font-size: 15px; }
.category-jobs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  align-items: start;
  gap: 10px;
}
.job { border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: var(--panel-2); }
.job-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.job-head > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
.job-folder {
  border: 1px solid #56663c;
  border-radius: 999px;
  padding: 3px 7px;
  color: #c8ff40;
  font-size: 10px;
  white-space: nowrap;
}
.job h3 { margin: 0; font-size: 14px; }
.status { border-radius: 999px; font-size: 11px; padding: 5px 9px; background: #30362c; white-space: nowrap; }
.status.COMPLETED { color: var(--accent); }
.status.FAILED, .status.SUBMISSION_UNCERTAIN, .status.BLOCKED, .status.LOGIN_REQUIRED { color: var(--danger); }
.status.RUNNING_TASK, .status.RUNNING, .status.QUEUED { color: #ffd98e; }
.job-meta { display: grid; gap: 5px; color: var(--muted); font-size: 12px; margin-top: 9px; line-height: 1.6; word-break: break-word; }
.job-meta a { color: #d5ff77; }
.job-error { color: var(--danger); }
.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 190px));
  justify-content: start;
  gap: 10px;
  margin-top: 10px;
}
.output-card {
  display: grid;
  gap: 9px;
  width: 190px;
  max-width: 100%;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #141713;
}
.category-jobs .output-card { width: 100%; max-width: 220px; }
.output-preview {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
.output-preview:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.output-preview:disabled { cursor: default; }
.output-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
  background: #0b0d0a;
}
.output-save-hint {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 5px 8px;
  border: 1px solid #dbff87;
  border-radius: 999px;
  background: #1b260cde;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease;
}
.output-preview:hover .output-save-hint,
.output-preview:focus-visible .output-save-hint {
  opacity: 1;
  transform: translateY(0);
}
.output-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.output-open {
  color: #d5ff77;
  font-size: 12px;
  text-decoration: none;
}
.output-save {
  padding: 7px 10px;
  border: 1px solid #7b9638;
  background: #28351c;
  color: var(--accent);
  font-size: 11px;
}
.output-save:hover { background: #34471f; }
@media (max-width: 760px) {
  header { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; width: 100%; }
  .header-actions input { width: 100%; }
  .workflow-picker-label { grid-template-columns: 1fr; }
  .folder-grid { grid-template-columns: 1fr; }
  .folder-topbar { align-items: flex-start; flex-direction: column; }
  .folder-path { flex-wrap: wrap; }
  .result-category-head { align-items: flex-start; flex-direction: column; }
  .job-filters { gap: 6px; }
  .category-jobs { grid-template-columns: 1fr; }
  .editor-heading, .run-zone, .pot-workflow, .batch-heading { flex-direction: column; align-items: stretch; }
  .pot-workflow { grid-template-columns: 1fr; }
  .pot-button { width: 100%; }
  .pot-status { padding-left: 0; }
  .run-button { width: 100%; }
}
@media (max-width: 520px) {
  .compare-grid { grid-template-columns: 1fr; }
  .output-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .output-card { width: 100%; }
}
@media (hover: none) {
  .output-save-hint { opacity: 1; transform: translateY(0); }
}
