:root {
  --bg: #0f1720;
  --panel: #17222e;
  --border: #263444;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #3fb1ce;
  --accent-strong: #2c8ba3;
  --ok: #3fca7f;
  --err: #e5534b;
  --warn: #d9a441;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

header h1 { margin: 0 0 6px; font-size: 28px; }
.sub { color: var(--muted); line-height: 1.5; margin: 0 0 10px; }
.sub-note { color: var(--muted); line-height: 1.5; margin: 0 0 28px; font-size: 13px; }
.sub-note strong { color: var(--text); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.card h2 { margin: 0 0 14px; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label small { color: #6b7684; font-weight: 400; line-height: 1.3; }

input, select {
  background: #0d151d;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

input[type="text"], input[type="file"] { width: 100%; }

button {
  background: var(--accent);
  color: #06222b;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
}
button:hover { background: var(--accent-strong); }
button:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.small { padding: 5px 10px; font-size: 12px; margin: 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: none; color: var(--muted); border: none; border-radius: 0;
  padding: 8px 14px; margin: 0; font-weight: 500;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panel.hidden { display: none; }
.tab-panel p { color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 0; }
.notice { color: var(--warn) !important; }
.error-text { color: var(--err); font-size: 13px; margin-top: 8px; }

.jobs-header { display: flex; justify-content: space-between; align-items: center; }
.jobs-header h2 { margin: 0; }
.jobs-empty { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; }

.badge { padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-queued, .badge-downloading, .badge-processing { background: #2a3040; color: var(--warn); }
.badge-done { background: #16332355; color: var(--ok); }
.badge-error { background: #3a1f1f; color: var(--err); }

.progress-track {
  width: 100%;
  min-width: 100px;
  height: 6px;
  background: #0d151d;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .2s ease;
}

.episode-row, .candidate-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.episode-row span, .candidate-row span { font-size: 13px; }
.episode-row .meta, .candidate-row .meta { color: var(--muted); font-size: 12px; }

footer { color: var(--muted); font-size: 12px; text-align: center; margin-top: 12px; line-height: 1.6; }
footer a { color: var(--accent); }
