﻿:root {
  --bg: #f3f7ff;
  --bg-soft: #eef4ff;
  --ink: #17223b;
  --muted: #60708f;
  --line: #cfdbf2;
  --line-strong: #afc3e8;
  --white: #ffffff;
  --primary: #1e66ff;
  --primary-2: #0052e5;
  --ok: #0d8750;
  --err: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 50% -200px, #d5e6ff, transparent), var(--bg);
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 80% 10%, rgba(30, 102, 255, 0.1), transparent 25%),
    radial-gradient(circle at 20% 90%, rgba(0, 180, 180, 0.08), transparent 28%);
}

.page {
  width: min(1240px, calc(100% - 28px));
  margin: 14px auto 18px;
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.card-3d {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(255,255,255,0.98), rgba(246,250,255,0.96));
  box-shadow: 0 2px 4px rgba(52, 88, 150, 0.08), 0 18px 38px rgba(50, 80, 140, 0.12);
}

.stage { padding: 14px; }

.stage-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.brand {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #3560a6;
  font-weight: 700;
}

h1 { margin: 4px 0 2px; font-size: 30px; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }

.status-wrap { display: flex; gap: 8px; align-items: center; }

.runtime-status {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #b6c9ec;
  background: #edf4ff;
  color: #355a95;
  font-size: 12px;
  font-weight: 700;
}
.runtime-status.ok { color: var(--ok); border-color: #98d7b5; background: #ecfaf3; }
.runtime-status.err { color: var(--err); border-color: #e4b9b5; background: #fff3f2; }

.result-stage {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid #d7e3f8;
  background: #f8fbff;
  min-height: 380px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 10px 12px;
}

.timeline-stage {
  position: relative;
}

.timeline-stage::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(#c4d8ff, #8bb8ff);
  border-radius: 999px;
}

.stage-empty {
  border: 1px dashed #bfd1f3;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: #fff;
}

.task-wrap {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
}

.task-wrap::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3b86ff;
  box-shadow: 0 0 0 4px #e7f1ff;
}

.task-card {
  border: 1px solid #d5e2fa;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(73, 104, 166, 0.08);
  padding: 10px;
}

.task-card.generating .task-meta::after {
  content: " 生成中";
  color: #2e6fe3;
  animation: blink 1.2s ease-in-out infinite;
}

.task-card.failed { border-color: #efc1bd; }

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.task-meta { color: #3e5f99; font-size: 12px; font-weight: 700; }
.task-time { color: var(--muted); font-size: 12px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 10px;
}

.image-card {
  border: 1px solid #dce7fa;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.image-card img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.image-card video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16 / 9;
}

.image-actions { display: flex; gap: 8px; padding: 8px; }

.action-link {
  flex: 1;
  text-decoration: none;
  text-align: center;
  padding: 7px 8px;
  border-radius: 9px;
  border: 1px solid #c6d8fa;
  color: #2559bd;
  background: #f3f8ff;
  font-size: 12px;
  font-weight: 700;
}
.action-link:hover { background: #e5efff; }

.skeleton-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 8px;
}

.skeleton-box {
  border-radius: 10px;
  height: 150px;
  background: linear-gradient(110deg, #eff4ff 8%, #dfe9fb 18%, #eff4ff 33%);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
  border: 1px solid #d8e4fa;
}

.task-error {
  color: var(--err);
  font-size: 13px;
  border: 1px solid #f2c7c4;
  border-radius: 10px;
  background: #fff6f5;
  padding: 8px;
}

.retry-row {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.dock-shell { position: sticky; bottom: 10px; z-index: 2; }

.agent-dock {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  padding: 10px;
  border-color: #d4e2fb;
}

.agent-dock::before {
  content: none;
  z-index: 0;
}

.agent-dock::after {
  content: "";
  position: static;
  inset: auto;
  border-radius: 0;
  background: transparent;
  z-index: 0;
}

.agent-dock > * { position: relative; z-index: 1; }

.dock-error { min-height: 18px; color: var(--err); font-size: 12px; margin-bottom: 6px; }

.upload-preview-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  margin-bottom: 4px;
}

.upload-thumb {
  position: relative;
  min-width: 76px;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  border: 1px solid #cedcf6;
  background: #fff;
  box-shadow: 0 4px 10px rgba(65, 100, 170, 0.12);
  overflow: hidden;
}

.upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: rgba(20, 35, 63, 0.76);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.dock-panels {
  display: grid;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 220ms ease;
}
.dock-panels.open { max-height: 460px; }

.dock-panel {
  border: 1px solid #d8e4fa;
  border-radius: 12px;
  background: #f7fbff;
  overflow: hidden;
}
.panel-title {
  padding: 8px 10px;
  border-bottom: 1px solid #dbe7fb;
  font-size: 13px;
  font-weight: 700;
  color: #345a98;
}
.panel-body { padding: 10px; }

.field { display: grid; gap: 6px; margin-bottom: 8px; }
.field > span { font-size: 12px; color: #405a86; font-weight: 700; }

textarea, select, input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #cad9f4;
  background: #fff;
  padding: 9px 10px;
  color: var(--ink);
  font-size: 14px;
}

textarea:focus, select:focus, input:focus, .tool-btn:focus, .btn:focus { outline: 2px solid rgba(30,102,255,0.2); outline-offset: 1px; }

.prompt-box { min-height: 92px; resize: vertical; }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.hidden { display: none; }

.params-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.params-grid .field { margin: 0; }
.params-grid .field.wide { grid-column: 1 / -1; }

.toolbar { display: flex; align-items: center; gap: 8px; }
.model-inline {
  width: min(320px, 38vw);
  border-radius: 10px;
  border: 1px solid #c6d8fa;
  background: #f7fbff;
  font-weight: 700;
}

.tool-btn, .btn {
  border-radius: 10px;
  border: 1px solid #c6d8fa;
  background: #f2f8ff;
  color: #264f96;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 140ms ease;
}
.tool-btn:hover, .btn:hover { transform: translateY(-1px); background: #e7f1ff; }
.tool-btn:active, .btn:active, .action-link:active { transform: translateY(1px); filter: saturate(1.12); }
.tool-btn.active { color: #fff; border-color: #2969e8; background: linear-gradient(135deg, #2f76ff, #0a58df); }
.toolbar-spacer { flex: 1; }
.toolbar-hint { white-space: nowrap; }
.btn-primary { color: #fff; border-color: #2363e4; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.hidden-upload { display: none; }

.preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 23, 41, 0.66);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.preview-modal.hidden {
  display: none !important;
}

.preview-body {
  max-width: min(1080px, 94vw);
  max-height: 86vh;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #dbe6fc;
  background: #fff;
  box-shadow: 0 22px 50px rgba(16, 32, 65, 0.32);
}

.preview-body img {
  display: block;
  max-width: min(1080px, 94vw);
  max-height: 86vh;
  width: auto;
  height: auto;
}

.preview-close {
  position: fixed;
  top: 20px;
  right: 22px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #27395f;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.raw-box { margin-top: 8px; }
.raw-box summary { cursor: pointer; color: #2b4f8d; font-size: 12px; font-weight: 700; }
pre {
  margin: 6px 0 0;
  max-height: 180px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #d4e2fb;
  background: #f7fbff;
  padding: 8px;
  font-size: 12px;
}

@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes blink { 0%,100% {opacity: 1;} 50% {opacity: .55;} }

@media (max-width: 920px) {
  .status-wrap { flex-direction: column; align-items: flex-end; }
  .params-grid { grid-template-columns: 1fr; }
}
