/* 创作台右侧：结果舞台、最近任务；模型选择弹窗；高级参数表 */
.results {
  display: grid;
  min-width: 0;
  min-height: 0;
  gap: 14px;
  padding: 18px 24px 14px 22px;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 34px;
}

.results-status,
.results-tools {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.results-status h2 {
  margin: 0 4px 0 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.results-status i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--line-strong);
}

.results-status i[data-state="queued"],
.results-status i[data-state="running"],
.results-status i[data-state="output_checking"] {
  background: var(--warning);
  animation: pulse 1.4s ease-in-out infinite;
}

.results-status i[data-state="ready"],
.results-status i[data-state="delivered"] {
  background: var(--success);
}

.results-status i[data-state="failed"],
.results-status i[data-state="rejected_output"],
.results-status i[data-state="expired"],
.results-status i[data-state="cancelled"] {
  background: var(--danger);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.results-status strong {
  font-size: 12.5px;
  white-space: nowrap;
}

.results-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-action {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted-strong);
  background: var(--surface);
  place-items: center;
}

.icon-action svg {
  width: 15px;
  height: 15px;
}

.icon-action:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.view-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-sunken);
}

.view-toggle button {
  min-height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: none;
  font-size: 11.5px;
  font-weight: 600;
}

.view-toggle button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(27, 29, 34, 0.08);
}

/* ---------- 舞台 ---------- */
.stage {
  display: grid;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  place-items: center;
}

.stage-card {
  display: grid;
  width: min(100%, 860px);
  gap: 0;
}

.stage-frame {
  position: relative;
  display: grid;
  max-height: min(58vh, 640px);
  min-height: 220px;
  margin: 16px 16px 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--canvas-bg);
  aspect-ratio: 4 / 3;
  place-items: center;
}

.stage-frame[data-ratio="1:1"] {
  aspect-ratio: 1;
}

.stage-frame[data-ratio="16:9"] {
  aspect-ratio: 16 / 9;
}

.stage-frame[data-ratio="9:16"] {
  max-width: min(100%, 360px);
  margin-right: auto;
  margin-left: auto;
  aspect-ratio: 9 / 16;
}

.stage-frame[data-kind="audio"] {
  min-height: 170px;
  aspect-ratio: auto;
  background:
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(31, 58, 138, 0.1) 9px 11px),
    linear-gradient(var(--canvas-bg), var(--canvas-bg));
}

.stage-frame img,
.stage-frame video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(58vh, 640px);
  object-fit: contain;
}

.stage-frame audio {
  width: min(90%, 520px);
}

/* 3D 结果：舞台给正方形；网格缩略只自动旋转、不拦截滚动（<model-viewer> 通用样式在 base.css） */
.stage-frame[data-kind="model3d"] {
  min-height: 360px;
  aspect-ratio: 1;
}

.tile-frame[data-kind="model3d"] .model3d-viewer {
  pointer-events: none;
}

.frame-countdown {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 5px 9px;
  border-radius: 7px;
  color: white;
  background: rgba(27, 29, 34, 0.72);
  font-size: 10.5px;
  font-weight: 600;
}

.stage-frame:has(.frame-art) {
  align-content: center;
  gap: 8px;
  grid-template-rows: auto auto auto;
}

.frame-art {
  position: relative;
  display: block;
  width: 52px;
  height: 40px;
  border: 1.5px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
}

.frame-art[data-kind="video"]::after {
  position: absolute;
  top: 11px;
  left: 20px;
  border-color: transparent transparent transparent var(--muted-strong);
  border-style: solid;
  border-width: 8px 0 8px 13px;
  content: "";
}

.frame-art[data-kind="audio"]::after {
  position: absolute;
  inset: 12px 12px;
  background: repeating-linear-gradient(90deg, var(--muted-strong) 0 2px, transparent 2px 6px);
  content: "";
}

.frame-text {
  max-width: 80%;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.stage-frame > .primary {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.stage-frame > button {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
}

.stage-frame[data-busy="true"] {
  background:
    linear-gradient(100deg, var(--canvas-bg) 35%, rgba(255, 255, 255, 0.8) 50%, var(--canvas-bg) 65%) 0 0 /
    220% 100%;
  animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -120% 0;
  }
}

.stage-card[data-state="failed"] .stage-frame,
.stage-card[data-state="rejected_output"] .stage-frame {
  background: var(--danger-soft);
}

.stage-card[data-state="failed"] .frame-text,
.stage-card[data-state="rejected_output"] .frame-text {
  color: var(--danger);
}

.stage-card[data-state="delivered"] .stage-frame,
.stage-card[data-state="expired"] .stage-frame,
.stage-card[data-state="failed"] .stage-frame,
.stage-card[data-state="rejected_output"] .stage-frame,
.stage-card[data-state="cancelled"] .stage-frame {
  min-height: 180px;
  aspect-ratio: auto;
}

.stage-detail {
  width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  color: var(--text);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 空状态 */
.empty-result {
  max-width: 520px;
  padding: 40px 24px;
  text-align: center;
}

.empty-art {
  position: relative;
  width: 104px;
  height: 70px;
  margin: 0 auto 24px;
}

.empty-art i {
  position: absolute;
  width: 70px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.empty-art i:nth-child(1) {
  left: 0;
  transform: rotate(-8deg);
}

.empty-art i:nth-child(2) {
  left: 17px;
}

.empty-art i:nth-child(3) {
  left: 34px;
  transform: rotate(8deg);
}

.empty-art i:nth-child(3)::after {
  position: absolute;
  top: 17px;
  left: 27px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.empty-result h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.empty-result p {
  margin: 10px auto 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.empty-samples {
  display: grid;
  gap: 8px;
}

.empty-samples button {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted-strong);
  background: var(--surface-raised);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
}

.empty-samples button:hover {
  border-color: var(--accent-line);
  color: var(--text);
  background: var(--accent-soft);
}

/* ---------- 最近任务 ---------- */
.recent {
  display: grid;
  gap: 8px;
}

.recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.recent-head h3 {
  margin: 0;
  font-size: 13px;
}

.recent-head small {
  color: var(--muted);
  font-size: 11px;
}

.recent-grid {
  display: flex;
  min-height: 96px;
  gap: 10px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.recent-grid:empty::before {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  content: "还没有任务";
}

.recent-card {
  display: grid;
  width: 156px;
  flex: none;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
}

.recent-card:hover {
  border-color: var(--line-strong);
}

.recent-card[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.recent-frame {
  position: relative;
  display: grid;
  height: 60px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--canvas-bg);
  place-items: center;
}

.recent-frame img,
.recent-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-frame .status-pill {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(255, 255, 255, 0.92);
}

.recent-frame[data-busy="true"] {
  background: linear-gradient(110deg, var(--canvas-bg) 30%, var(--surface-hover) 50%, var(--canvas-bg) 70%) 0 0 / 200% 100%;
  animation: strip-shimmer 1.4s linear infinite;
}

@keyframes strip-shimmer {
  to {
    background-position: -200% 0;
  }
}

.recent-text {
  display: grid;
  gap: 1px;
  padding: 0 2px 2px;
}

.recent-text strong {
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-text small {
  color: var(--muted);
  font-size: 10.5px;
}

.risk-note {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.risk-note strong {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text);
  font-size: 9px;
  letter-spacing: 0.08em;
}
