:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa2b1;
  --brand: #4c8dff;
  --brand-soft: rgba(76, 141, 255, 0.15);
  --ok: #37c07a;
  --warn: #e6a23c;
  --danger: #f0616d;
  --radius: 12px;
  --gap: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 32px 20px 64px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0.5px;
}

.hero .sub {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---- 控件行 ---- */
.controls {
  display: flex;
  align-items: flex-end;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: var(--gap);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12.5px;
  color: var(--muted);
}

select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  min-width: 130px;
}

select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn {
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  opacity: 0.88;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn.ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.link {
  background: none;
  border: none;
  color: var(--brand);
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* ---- 拖拽区 ---- */
.drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px 18px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop.over {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.drop-title {
  margin: 0 0 8px;
  font-size: 15px;
}

.drop-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  word-break: break-all;
}

/* ---- 任务列表 ---- */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.list-head h2 {
  margin: 0;
  font-size: 16px;
}

.muted {
  color: var(--muted);
  font-size: 12.5px;
}

.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.job-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.job-name {
  font-size: 14px;
  word-break: break-all;
}

.job-state {
  flex: none;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(154, 162, 177, 0.15);
  color: var(--muted);
}

.job-state.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.job-state.is-done {
  background: rgba(55, 192, 122, 0.15);
  color: var(--ok);
}

.job-state.is-failed {
  background: rgba(240, 97, 109, 0.15);
  color: var(--danger);
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(154, 162, 177, 0.16);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--brand);
  transition: width 0.25s ease;
}

.job.is-done .bar-fill {
  background: var(--ok);
}

.job.is-failed .bar-fill {
  background: var(--danger);
}

/* 时长未知时走不确定进度条 */
.bar.indeterminate .bar-fill {
  width: 35% !important;
  animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}

.job-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.job-meta .error {
  color: var(--danger);
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.job-actions:empty {
  display: none;
}

.job-actions audio {
  flex: 1 1 260px;
  height: 34px;
  min-width: 220px;
}

.empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 14px 0;
}

.empty.hidden {
  display: none;
}

@media (max-width: 560px) {
  body {
    padding: 20px 14px 48px;
  }

  .controls {
    align-items: stretch;
  }

  .field,
  select {
    width: 100%;
  }
}
