:root {
  --ink: #102530;
  --paper: #f1eee6;
  --surface: #fffdf7;
  --signal: #f04d2f;
  --aqua: #1bb8ae;
  --line: #cfd3cd;
  --muted: #69777c;
  --deep: #09171e;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 20%, rgba(27, 184, 174, .12), transparent 24rem),
    linear-gradient(90deg, transparent 49.8%, rgba(16, 37, 48, .05) 50%, transparent 50.2%),
    var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-actions form { margin: 0; }

.logout-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}

.logout-button:hover { background: var(--ink); color: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.masthead {
  height: 78px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(16, 37, 48, .16);
  background: rgba(255, 253, 247, .82);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  color: white; background: var(--signal); font-weight: 900; transform: skew(-7deg);
  box-shadow: 6px 6px 0 rgba(27, 184, 174, .28);
}
.brand strong { display: block; font-size: 18px; letter-spacing: .04em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.health-badge {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px;
  color: var(--muted); background: var(--surface); font-size: 12px;
}
.health-badge.ready { color: #08736b; border-color: rgba(27,184,174,.5); }
.health-badge.error { color: #a52e1b; border-color: rgba(240,77,47,.5); }

.workspace {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(42px, 7vw, 92px) 0 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(30px, 4vw, 52px);
  align-items: start;
}
.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  column-gap: clamp(40px, 7vw, 110px);
  align-items: end;
}
.intro-panel .kicker, .pipeline-list { grid-column: 1 / -1; }
.kicker { margin: 0 0 18px; color: #378d87; font-size: 11px; font-weight: 900; letter-spacing: .2em; }
h1 { margin: 0; max-width: 820px; font-size: clamp(46px, 6vw, 82px); line-height: 1.04; letter-spacing: -.07em; }
.lede { max-width: 640px; margin: 0 0 8px; color: var(--muted); font-size: 16px; line-height: 1.9; }
.pipeline-list {
  padding: 0;
  margin: clamp(34px, 5vw, 58px) 0 0;
  list-style: none;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.pipeline-list li { display: flex; gap: 16px; padding: 16px 18px 16px 0; border-bottom: 1px solid var(--line); }
.pipeline-list li + li { padding-left: 18px; border-left: 1px solid var(--line); }
.pipeline-list b { color: var(--signal); font-family: Georgia, serif; }

.control-panel, .result-panel {
  background: rgba(255, 253, 247, .92);
  border: 1px solid rgba(16,37,48,.13);
  box-shadow: 20px 26px 70px rgba(16,37,48,.08);
  padding: clamp(24px, 4vw, 46px);
}
#jobForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
}
.field-block { margin: 0; min-width: 0; }
.option-grid, .advanced, .submit-button { grid-column: 1 / -1; }
.field-block > label:first-child, .advanced > label {
  display: block; margin-bottom: 10px; color: #456067; font-size: 11px; font-weight: 900; letter-spacing: .13em;
}
.drop-zone {
  min-height: 156px; padding: 24px; display: grid; place-items: center; text-align: center;
  border: 1.5px dashed #9eaaa9; background: linear-gradient(135deg, #fff, #f5f1e9);
  transition: border-color .2s, transform .2s, background .2s;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--aqua); background: #effaf7; transform: translateY(-2px); }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-icon { color: var(--signal); font: 38px/1 Georgia, serif; }
.drop-zone strong { margin-top: 6px; }
.drop-zone small { color: var(--muted); font-size: 11px; }
.local-preview { margin-top: 12px; border: 1px solid var(--line); background: var(--deep); overflow: hidden; }
.local-preview img, .local-preview video { width: 100%; max-height: 300px; display: block; object-fit: contain; }

textarea, .text-card input, .advanced select {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink); outline: none;
}
textarea { padding: 16px; resize: vertical; line-height: 1.7; }
textarea:focus, input:focus, select:focus { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(27,184,174,.1); }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.prompt-chips button { border: 1px solid var(--line); border-radius: 99px; padding: 7px 11px; background: transparent; color: var(--muted); font-size: 11px; }
.prompt-chips button:hover { border-color: var(--signal); color: var(--signal); }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-card, .text-card { min-height: 76px; padding: 14px; border: 1px solid var(--line); background: #f8f5ed; }
.check-card { display: flex; align-items: center; gap: 12px; }
.check-card input { width: 18px; height: 18px; accent-color: var(--signal); }
.check-card strong, .text-card span { display: block; font-size: 13px; }
.check-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.text-card input { margin-top: 7px; padding: 6px 8px; }
.advanced { margin: 18px 0; padding: 14px; border: 1px solid var(--line); }
.advanced summary { cursor: pointer; font-size: 12px; font-weight: 800; }
.advanced label { margin-top: 14px; }
.advanced select { padding: 10px; }
.submit-button {
  width: 100%; border: 0; padding: 18px 22px; display: flex; justify-content: space-between;
  color: #fff; background: var(--signal); font-weight: 900; letter-spacing: .05em;
  box-shadow: 8px 8px 0 var(--deep); transition: transform .2s, box-shadow .2s;
}
.submit-button:hover { transform: translate(3px, 3px); box-shadow: 5px 5px 0 var(--deep); }
.submit-button:disabled { opacity: .5; cursor: wait; }

.showcase-panel {
  padding: clamp(26px, 4vw, 44px);
  color: #f5f3eb;
  background:
    radial-gradient(circle at 88% 12%, rgba(27,184,174,.22), transparent 28rem),
    linear-gradient(125deg, #0a1921, #102b37);
  box-shadow: 20px 26px 70px rgba(16,37,48,.16);
}
.showcase-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
}
.showcase-heading .kicker { color: #7bd5cf; margin-bottom: 9px; }
.showcase-heading h2 { margin: 0; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; }
.showcase-heading > p { max-width: 540px; margin: 0; color: #a9bbc1; font-size: 12px; line-height: 1.7; }
.showcase-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.showcase-card { min-width: 0; margin: 0; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.15); }
.showcase-card video, .showcase-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  background: #061118;
}
.showcase-copy { padding: 16px; display: grid; gap: 5px; }
.showcase-copy span { color: #72d3cd; font: 800 9px/1.4 Consolas, monospace; letter-spacing: .15em; }
.showcase-copy strong { font-size: 15px; }
.showcase-copy small { color: #9db0b7; font-size: 10px; }

.result-panel { padding: clamp(24px, 4vw, 48px); }
.result-heading, .card-title, .progress-copy { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.result-heading h2 { margin: 0; font-size: 38px; letter-spacing: -.04em; }
.job-id { color: var(--muted); font: 11px/1.5 monospace; }
.progress-box { margin-top: 26px; padding: 18px; background: var(--deep); color: white; }
.progress-copy span { color: #88ddd7; font: 20px/1 Georgia, serif; }
.progress-track { height: 4px; margin-top: 14px; background: rgba(255,255,255,.14); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--signal); transition: width .3s ease; }
.error-box { margin-top: 20px; padding: 16px; color: #8f2414; background: #fff0ec; border: 1px solid #f1b2a5; white-space: pre-wrap; }
.output-grid { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 20px; }
.media-card, .report-card { min-width: 0; border: 1px solid var(--line); background: #fff; }
.card-title { padding: 13px 15px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 800; }
.card-title a { color: #24847d; font-weight: 500; }
.result-media { min-height: 320px; background: var(--deep); display: grid; place-items: center; }
.result-media img, .result-media video { width: 100%; max-height: 620px; object-fit: contain; }
.report-card pre { height: 560px; margin: 0; padding: 16px; overflow: auto; color: #d9ece8; background: #0d2028; font: 11px/1.65 Consolas, monospace; }
.keyframe-section { margin-top: 28px; }
.keyframe-section h3 { margin: 0 0 14px; }
.keyframe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.keyframe-grid a { display: block; border: 1px solid var(--line); background: #fff; }
.keyframe-grid img { width: 100%; display: block; }

footer { padding: 22px clamp(22px,5vw,76px); display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.hidden { display: none !important; }

@media (max-width: 920px) {
  .workspace { width: min(100% - 28px, 760px); }
  .intro-panel { grid-template-columns: 1fr; }
  .intro-panel .lede { margin-top: 24px; }
  .pipeline-list { grid-template-columns: repeat(2, 1fr); }
  .pipeline-list li:nth-child(3) { border-left: 0; padding-left: 0; }
  #jobForm { grid-template-columns: 1fr; }
  .option-grid, .advanced, .submit-button { grid-column: 1; }
  .showcase-grid { grid-template-columns: 1fr; }
  .output-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .masthead { height: 68px; padding: 0 15px; }
  .brand small { display: none; }
  .health-badge { max-width: 145px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .workspace { padding-top: 32px; }
  h1 { font-size: 45px; }
  .pipeline-list { grid-template-columns: 1fr; }
  .pipeline-list li + li { padding-left: 0; border-left: 0; }
  .option-grid { grid-template-columns: 1fr; }
  .showcase-heading { align-items: start; flex-direction: column; }
  footer { flex-direction: column; }
}
