:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #111210;
  color: #f2f4ef;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #111210; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
h1 { margin: 0; font-size: 24px; font-weight: 650; }
.topbar p { margin: 4px 0 0; color: #a5aaa1; font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #54c779; box-shadow: 0 0 0 4px #1b3523; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid #30332e; margin-bottom: 24px; }
.tab { min-width: 84px; height: 40px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #a5aaa1; }
.tab.active { color: #f2f4ef; border-bottom-color: #54c779; }
.panel { display: none; }
.panel.active { display: block; }

.tool { padding: 20px 0 24px; border-bottom: 1px solid #30332e; }
label { display: block; color: #c9cdc4; font-size: 13px; margin-bottom: 14px; }
textarea, select, input[type="text"] {
  width: 100%; border: 1px solid #373a35; border-radius: 6px; background: #1a1c19; color: #f2f4ef;
}
textarea { min-height: 104px; padding: 12px; resize: vertical; margin-top: 7px; }
select { height: 40px; padding: 0 10px; margin-top: 7px; }
textarea:focus, select:focus { border-color: #54c779; outline: 2px solid #203d29; }
input[type="file"] { display: block; width: 100%; color: #a5aaa1; margin: 7px 0 14px; }
input[type="file"]::file-selector-button {
  height: 34px; border: 1px solid #3a3e37; border-radius: 6px; background: #242722; color: #e9ece5; margin-right: 10px;
}

.fields { display: grid; gap: 12px; margin-top: 18px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.primary { height: 42px; min-width: 150px; padding: 0 18px; border: 0; border-radius: 6px; background: #54c779; color: #0d1a10; font-weight: 650; }
.primary:hover { background: #69d58a; }
.primary:disabled { cursor: wait; opacity: .55; }
.secondary { height: 32px; padding: 0 11px; border: 1px solid #3a3e37; border-radius: 6px; background: #242722; color: #e9ece5; }
.secondary:hover { border-color: #54c779; color: #75d895; }
.secondary:disabled { cursor: wait; opacity: .55; }

.segmented { display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #1a1c19; border: 1px solid #343731; border-radius: 7px; margin-bottom: 18px; }
.segmented button { min-width: 88px; height: 34px; border: 0; border-radius: 5px; background: transparent; color: #a5aaa1; }
.segmented button.active { background: #ecefe9; color: #171916; }

.preview { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0 16px; }
.preview img { width: 176px; aspect-ratio: 1; object-fit: cover; border: 1px solid #373a35; border-radius: 6px; }
.icon-button { width: 34px; height: 34px; border: 1px solid #49312f; border-radius: 6px; background: #2d1d1b; color: #ff9d92; font-size: 20px; line-height: 1; }

.history { padding-top: 24px; }
.history h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; color: #c9cdc4; }
.task-list { display: grid; gap: 10px; }
.task { border: 1px solid #30332e; border-radius: 7px; background: #171916; padding: 14px; }
.task-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.task-prompt { min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.badge { flex: none; padding: 3px 8px; border-radius: 999px; font-size: 11px; }
.badge.pending { color: #f1ca6d; background: #332a16; }
.badge.done { color: #79dc98; background: #173322; }
.badge.failed { color: #ff9d92; background: #381d1a; }
.meta { color: #8f948b; font-size: 12px; margin-top: 7px; }
.error { color: #ff9d92; font-size: 12px; margin-top: 8px; overflow-wrap: anywhere; }
.progress { height: 5px; overflow: hidden; border-radius: 3px; background: #2a2d28; margin-top: 10px; }
.progress span { display: block; height: 100%; background: #54c779; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.media-grid img, video { display: block; width: 100%; border-radius: 6px; background: #080908; }
.download { display: inline-block; margin-top: 8px; color: #75d895; font-size: 12px; text-decoration: none; }
.task-actions, .media-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.media-actions .download { margin-top: 0; }
.empty { color: #73786f; font-size: 13px; padding: 18px 0; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 920px); padding-top: 20px; }
  .fields.two, .fields.three { grid-template-columns: 1fr; gap: 2px; }
  .primary { width: 100%; }
  .preview img { width: 132px; }
}
