:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #f0eee9; --line: #e2dfd8;
  --text: #1d1c1a; --muted: #6b6760; --accent: #6a4cf0; --accent-ink: #ffffff;
  --ok: #1f8a4c; --warn: #b26a00; --bad: #c0392b; --run: #2f6fdb;
  --radius: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .04);
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --surface: #1b1b1f; --surface-2: #232328; --line: #2f2f36;
    --text: #ecebe8; --muted: #9b98a3; --accent: #9b85ff; --accent-ink: #120f1f;
    --ok: #4cc27f; --warn: #e0a040; --bad: #ff6b5b; --run: #6aa1ff;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
a { color: var(--accent); }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 980px; margin: 0 auto; padding: 18px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.me { color: var(--muted); font-size: 13px; text-align: right; overflow-wrap: anywhere; }
main { max-width: 980px; margin: 0 auto; padding: 0 16px 24px; }
.foot { max-width: 980px; margin: 0 auto; padding: 16px 16px 40px; color: var(--muted); font-size: 12px; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 28px 0 10px; color: var(--muted); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); }
textarea, input[type="number"], input[type="file"], input.text {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.grow { flex: 1 1 280px; }
#dur-field { flex: 0 0 140px; }
.hint { color: var(--muted); font-size: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-bottom: 14px; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
button {
  font: inherit; border-radius: 10px; padding: 9px 16px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button:disabled { opacity: .55; cursor: progress; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); }
.quota { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); min-height: 1em; margin: 10px 0 0; font-size: 14px; }
.upload { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.jobs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.jobs li a {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.jobs li a:hover { border-color: var(--accent); }
.jobs .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobs .s { grid-row: span 2; align-self: center; }
.jobs .d { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.done { color: var(--ok); } .chip.failed { color: var(--bad); } .chip.running, .chip.queued { color: var(--run); }
.chip.running::before, .chip.queued::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .chip::before { animation: none !important; } }
.back { display: inline-block; margin-bottom: 12px; font-size: 14px; }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.job-head h1 { margin-bottom: 4px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; font-size: 13px; max-height: 260px; overflow: auto; }
.timeline li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 4px 0; border-top: 1px dashed var(--line); }
.timeline time { color: var(--muted); font-family: var(--mono); }
.timeline .composer { color: var(--muted); font-style: italic; }
.variants { display: grid; gap: 16px; margin-top: 18px; }
.variant h3 { margin: 0 0 6px; font-size: 17px; }
.variant .why { white-space: pre-line; color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.variant video, .variant audio { width: 100%; border-radius: 10px; background: #000; }
.variant audio { background: transparent; }
.metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.metrics span { font-size: 12px; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); }
.metrics .warn { color: var(--warn); }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.downloads a { font-size: 13px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.downloads a:hover { border-color: var(--accent); }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details img { width: 100%; margin-top: 8px; border-radius: 8px; border: 1px solid var(--line); }
.import { margin-top: 10px; display: grid; gap: 10px; }
.import .row > label { flex: 1 1 220px; }
.changes { font-size: 13px; margin: 10px 0 0; padding-left: 18px; }
.changes .ign { color: var(--warn); }
@media (max-width: 560px) {
  .card { padding: 16px; }
  .jobs li a { grid-template-columns: 1fr; }
  .jobs .s { grid-row: auto; }
}
