:root {
  color-scheme: dark;
  --bg: #10151d;
  --panel: #18212d;
  --panel-2: #202c3b;
  --line: #334255;
  --text: #eef3f8;
  --muted: #91a0b2;
  --accent: #5dd6a0;
  --accent-strong: #2db57b;
  --danger: #ff8f86;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.topbar, .section-heading, .controls, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar { margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 1.5px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 4vw, 38px); letter-spacing: 0; }
h2 { margin-bottom: 5px; font-size: 18px; letter-spacing: 0; }
.workspace { display: grid; grid-template-columns: minmax(320px, .78fr) minmax(0, 1.22fr); gap: 18px; align-items: start; }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.muted, .hint { color: var(--muted); font-size: 13px; }
.muted { margin-bottom: 0; }
.field-label { display: block; margin: 22px 0 8px; color: #cbd6e2; font-size: 13px; font-weight: 700; }
textarea, input { width: 100%; color: var(--text); background: #111923; border: 1px solid var(--line); border-radius: 6px; outline: none; }
textarea { min-height: 190px; resize: vertical; padding: 14px; line-height: 1.6; }
input { height: 42px; padding: 0 12px; }
textarea:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(93, 214, 160, .12); }
.controls { align-items: end; margin-top: 20px; flex-wrap: wrap; }
.controls .field-label { margin-top: 0; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #111923; }
.mode-switch { margin-top: 0; }
.segment { min-width: 62px; border: 0; border-radius: 5px; padding: 9px 13px; color: var(--muted); background: transparent; }
.segment.active { color: #082417; background: var(--accent); font-weight: 800; }
.primary-button, .secondary-button, .download-button { border-radius: 6px; padding: 10px 16px; border: 1px solid transparent; font-weight: 800; text-decoration: none; }
.primary-button { color: #082417; background: var(--accent); }
.primary-button:hover { background: #79e5b5; }
.primary-button:disabled { cursor: wait; opacity: .55; }
.secondary-button { color: var(--text); background: transparent; border-color: var(--line); }
.icon-button, .close-button { border: 0; color: var(--muted); background: transparent; font-size: 22px; }
.icon-button:hover, .close-button:hover { color: var(--text); }
.hint { margin: 15px 0 0; line-height: 1.6; }
.image-field input[type="file"] { height: auto; padding: 10px 12px; }
.source-preview { display: block; width: min(100%, 320px); max-height: 240px; margin-top: 12px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #0c1118; }
.expiry-note { margin: 16px 0 0; color: #f2c879; font-size: 13px; font-weight: 700; }
.usage-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.usage-guide i { color: #56687d; font-style: normal; }
.fixed-input:disabled { cursor: not-allowed; color: #7f8c9c; background: #151c25; border-color: #293647; opacity: 1; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.status-dot.ready { background: var(--accent); }
.badge { border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; }
.badge.idle { color: var(--muted); background: var(--panel-2); }
.badge.processing { color: #f7d38b; background: #463923; }
.badge.completed { color: #072418; background: var(--accent); }
.badge.failed { color: #351314; background: var(--danger); }
.badge.waiting { color: #b7c4d3; background: #263344; }
.badge.submitting { color: #f7d38b; background: #463923; }
.status-message { min-height: 44px; margin: 22px 0 0; color: #cbd6e2; line-height: 1.6; white-space: pre-wrap; }
.progress { height: 4px; margin-top: 20px; overflow: hidden; border-radius: 99px; background: #273548; }
.progress span { display: block; width: 35%; height: 100%; border-radius: inherit; background: var(--accent); animation: progress 1.5s ease-in-out infinite; }
@keyframes progress { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.hidden { display: none !important; }
.image-wrap { margin-top: 14px; }
.image-wrap img { display: block; width: 100%; max-height: 560px; object-fit: contain; border-radius: 6px; background: #0c1118; }
.download-button { display: inline-block; margin-top: 14px; color: #082417; background: var(--accent); }
.concurrency-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.task-toolbar { display: flex; align-items: center; gap: 10px; }
.compact-button { border: 1px solid var(--line); border-radius: 5px; padding: 6px 9px; color: var(--muted); background: transparent; font-size: 12px; }
.compact-button:hover { color: var(--text); border-color: #53657b; }
.task-list { display: grid; gap: 12px; margin-top: 18px; }
.empty-state { display: grid; min-height: 220px; place-items: center; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); }
.empty-state p { margin: 0; }
.task-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: #141d28; }
.task-card-head, .task-title-wrap, .task-actions { display: flex; align-items: center; gap: 10px; }
.task-title-wrap { gap: 8px; flex-wrap: wrap; }
.task-card-head { justify-content: space-between; }
.task-number { font-size: 14px; font-weight: 800; }
.task-size { padding: 3px 7px; border-radius: 4px; color: var(--accent); background: rgba(93, 214, 160, .1); font-size: 11px; font-weight: 800; }
.task-mode { padding: 3px 7px; border-radius: 4px; color: #9fb3ca; background: #243143; font-size: 11px; font-weight: 800; }
.task-prompt { display: -webkit-box; margin: 13px 0 0; overflow: hidden; color: #d9e2ec; font-size: 13px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.task-message { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.task-progress { margin-top: 13px; }
.task-image { margin-top: 14px; }
.task-image img { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 6px; background: #0c1118; }
.task-actions { margin-top: 12px; }
.task-actions .download-button { margin-top: 0; }
.task-actions .secondary-button { padding: 10px 14px; }
dialog { width: min(440px, calc(100% - 28px)); padding: 0; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
dialog::backdrop { background: rgba(5, 8, 12, .72); }
.settings-form { padding: 22px; }
.settings-form .field-label { margin-top: 18px; }
.dialog-actions { justify-content: flex-end; margin-top: 22px; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 600px); padding-top: 16px; }
  .workspace { grid-template-columns: 1fr; }
  .panel { padding: 17px; }
  textarea { min-height: 150px; }
  .controls { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
}
