:root {
  --canvas: #f7f8fa; --surface: #fff; --ink: #15171c; --muted: #667085; --line: #d9dee7; --soft: #f1f4f8;
  --blue: #1f78e8; --blue-text: #0f63c9; --aqua: #34bca4; --ok-wash: #e1f7ef; --err: #c2413b; --err-wash: #fff0ef;
  --warn: #9a6700; --warn-wash: #fff8df; --result: #151b26;
  --font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Monaco, Consolas, monospace;
  --r-sm: .5rem; --r-md: .75rem; --r-lg: 1rem; --shadow: 0 20px 60px rgb(35 52 78 / 10%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0f1218; --surface: #171b23; --ink: #e8ecf2; --muted: #9aa5b5; --line: #2a313d; --soft: #1e2430;
    --blue-text: #6aa8ff; --ok-wash: #12352c; --err-wash: #3a1a1a; --warn-wash: #33290f; --warn: #e2b44c;
    --shadow: 0 20px 60px rgb(0 0 0 / 35%); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.55 var(--font); }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
a { color: var(--blue-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; border-radius: var(--r-sm); padding: 10px 16px; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; }
button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
button.small { padding: 7px 12px; font-size: 13px; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(15 99 201 / 35%); }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; }
textarea { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: 13px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
h1, h2, h3, p { margin-top: 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; }
.brand em { font-style: normal; font-weight: 500; color: var(--muted); }
.key { display: flex; gap: 8px; width: min(420px, 55vw); }

main { max-width: 1120px; margin: 0 auto; padding: 40px 32px 24px; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.12; letter-spacing: -.02em; max-width: 820px; margin-bottom: 12px; }
.lede { color: var(--muted); font-size: 17px; max-width: 720px; }

.pipelines { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 28px 0 32px; }
.pipe { text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; font-weight: 400; display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.pipe:hover { border-color: var(--blue); }
.pipe[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.pipe h3 { font-size: 16px; margin: 0; }
.pipe p { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.45; }
.pipe .serve { margin-top: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dot.live { color: #1f8f70; } .dot.live::before { background: var(--aqua); }
.dot.down::before { background: var(--err); }

.workspace { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); background: var(--soft); }
.tabs button { background: transparent; color: var(--muted); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--surface); }
.panel { padding: 24px; }
.notice { margin: 16px 24px 0; padding: 10px 14px; border-radius: var(--r-sm); background: var(--warn-wash); color: var(--warn); font-size: 14px; }
.notice.error { background: var(--err-wash); color: var(--err); }
.notice.ok { background: var(--ok-wash); color: #1f8f70; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.row > button, .row > .status { flex: 0 0 auto; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.classes { display: grid; gap: 10px; }
.class { display: grid; grid-template-columns: 200px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px dashed var(--line); border-radius: var(--r-sm); }
.class .count { font-size: 13px; color: var(--muted); }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.thumbs img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--soft); }
.status.ready { background: var(--ok-wash); color: #1f8f70; }
.status.failed { background: var(--err-wash); color: var(--err); }
.status.training, .status.queued { background: var(--warn-wash); color: var(--warn); }

.result { background: var(--result); color: #e8ecf2; border-radius: var(--r-md); padding: 18px; min-height: 160px; }
.result h3 { font-size: 13px; color: #9aa5b5; text-transform: uppercase; letter-spacing: .05em; }
.bar { display: grid; grid-template-columns: 140px 1fr 56px; gap: 10px; align-items: center; font-size: 14px; margin: 6px 0; }
.bar .track { height: 8px; background: #2a313d; border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--aqua); border-radius: 99px; }
.bar.lead .fill { background: #4f9cff; }
.bar .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .num { text-align: right; font-family: var(--mono); font-size: 12px; }
.preview img { max-width: 100%; max-height: 220px; border-radius: var(--r-sm); }
pre { background: var(--result); color: #e8ecf2; padding: 16px; border-radius: var(--r-md); overflow-x: auto; white-space: pre; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }

footer { max-width: 1120px; margin: 0 auto; padding: 8px 32px 40px; color: var(--muted); font-size: 13px; }

.card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; }
.card > h3 { margin-bottom: 12px; }
.card > * + * { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--soft); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; font-size: 13px; font-weight: 500; text-decoration: none; }
.chip b { margin-left: 4px; }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ex { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ex-body { min-height: 60px; }
.ex img { width: 100%; height: 110px; object-fit: cover; border-radius: 4px; background: var(--soft); }
.ex img:not([src]) { visibility: hidden; }
.ex audio { width: 100%; }
.ex .row > * { min-width: 0; }
.clip { display: block; max-height: 90px; overflow: hidden; white-space: pre-wrap; word-break: break-all; font-size: 11px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats div { background: var(--soft); border-radius: var(--r-sm); padding: 10px 12px; }
.stats b { display: block; font-size: 20px; }
.stats span { font-size: 12px; color: var(--muted); }
button.quiet { background: transparent; color: var(--muted); padding: 4px 8px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .pipelines { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .class { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .top { flex-direction: column; align-items: stretch; padding: 12px 16px; position: static; }
  .key { width: 100%; }
  main { padding: 24px 16px; }
  footer { padding: 8px 16px 32px; }
  .pipelines { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .tabs { overflow-x: auto; }
  .bar { grid-template-columns: 90px 1fr 48px; }
}
